← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/ephemerals-tftp-access into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/ephemerals-tftp-access into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/ephemerals-tftp-access/+merge/119080

Discussed this with Scott.  If you run maas-import-ephemerals with a non-world-readable umask, as might happen when the obsolescent maas-import-isos runs, you'll get non-world-readable commissioning images installed in the TFTP tree.  And those won't be readable to the TFTP server, which kind of defeats the purpose.

Here I add a umask to maas-import-ephemerals, just like the one that's already in maas-import-pxe-files, to ensure that that doesn't happen.  If you've already got non-readable images, they will be fixed with the next image upgrade.  I also threw in a transitional hack for those who have been hit by this problem while running development versions (at least, without changing the TFTP location).  It's a bit of a trade-off putting this in maas-import-isos: on the one hand it won't cover all possible upgrade paths so some people will still have to chmod manually.  On the other hand it's code that will go away as we ditch Cobbler, which makes it a good place for transitory kludges.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/ephemerals-tftp-access/+merge/119080
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/ephemerals-tftp-access into lp:maas.
=== modified file 'scripts/maas-import-ephemerals'
--- scripts/maas-import-ephemerals	2012-08-08 20:40:42 +0000
+++ scripts/maas-import-ephemerals	2012-08-10 03:54:25 +0000
@@ -380,6 +380,10 @@
         cp -- "$src/$filename" "$tmpdir/"
     done
 
+    # All files we create here are public.  The TFTP user will need to be
+    # able to read them.
+    umask a+r
+
     debug 1 "maas-provision install-pxe-image --arch=$arch --subarch=$subarch --release=$release --purpose=commissioning --image=$tmpdir"
     maas-provision install-pxe-image \
         --arch=$arch --subarch=$subarch --release=$release \

=== modified file 'scripts/maas-import-isos'
--- scripts/maas-import-isos	2012-08-03 19:20:48 +0000
+++ scripts/maas-import-isos	2012-08-10 03:54:25 +0000
@@ -177,6 +177,16 @@
 ## check arguments here
 [ $# -ne 0 ] && bad_Usage
 
+# Older versions of maas-import-isos may have created PXE images in the
+# TFTP directory tree that are not world-readable as they should be.
+# This script doesn't know where they are, but if they are in the
+# default location, it can ease the pain by fixing up their access mode
+# now.
+if [ -d /var/lib/tftpboot/maas ]
+then
+    chmod -R a+r /var/lib/tftpboot/maas
+fi
+
 # if no action specified, import by default
 ( ! $do_import_isos && ! $do_update_settings  ) && do_import_isos=true
 # do not allow import + update