launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14821
[Merge] lp:~allenap/maas/ucs-execute-bit-bug-1091215 into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/ucs-execute-bit-bug-1091215 into lp:maas.
Commit message:
Ensure that files in the commissioning script archive have the execute bit set.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1091215 in MAAS: "User commissioning scripts not executable"
https://bugs.launchpad.net/maas/+bug/1091215
For more details, see:
https://code.launchpad.net/~allenap/maas/ucs-execute-bit-bug-1091215/+merge/140230
--
https://code.launchpad.net/~allenap/maas/ucs-execute-bit-bug-1091215/+merge/140230
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/ucs-execute-bit-bug-1091215 into lp:maas.
=== modified file 'src/metadataserver/models/commissioningscript.py'
--- src/metadataserver/models/commissioningscript.py 2012-12-13 09:04:28 +0000
+++ src/metadataserver/models/commissioningscript.py 2012-12-17 15:33:22 +0000
@@ -52,6 +52,7 @@
assert isinstance(content, bytes), "Script content must be binary."
tarinfo = tarfile.TarInfo(name=os.path.join(ARCHIVE_PREFIX, name))
tarinfo.size = len(content)
+ tarinfo.mode = 0755 # u=rwx,go=rx
tarball.addfile(tarinfo, BytesIO(content))
=== modified file 'src/metadataserver/tests/test_commissioningscript.py'
--- src/metadataserver/tests/test_commissioningscript.py 2012-12-13 09:17:14 +0000
+++ src/metadataserver/tests/test_commissioningscript.py 2012-12-17 15:33:22 +0000
@@ -78,6 +78,12 @@
self.assertIn(path, archive.getnames())
self.assertEqual(content, archive.extractfile(path).read())
+ def test_get_archive_sets_sensible_mode(self):
+ for counter in range(3):
+ factory.make_commissioning_script()
+ archive = open_tarfile(CommissioningScript.objects.get_archive())
+ self.assertEqual({info.mode for info in archive.getmembers()}, {0755})
+
class TestCommissioningScript(TestCase):