Merge lp:~allenap/maas/ucs-execute-bit-bug-1091215 into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 1402
Merged at revision: 1403
Proposed branch: lp:~allenap/maas/ucs-execute-bit-bug-1091215
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 27 lines (+7/-0)
2 files modified
src/metadataserver/models/commissioningscript.py (+1/-0)
src/metadataserver/tests/test_commissioningscript.py (+6/-0)
To merge this branch: bzr merge lp:~allenap/maas/ucs-execute-bit-bug-1091215
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+140230@code.launchpad.net

Commit message

Ensure that files in the commissioning script archive have the execute bit set.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) :
review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/maas-merger-trunk/150/console reported an error when processing this lp:~allenap/maas/ucs-execute-bit-bug-1091215 branch.
Not merging it.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Remember, in equality tests, we write the expected value first and the actual value second!

1402. By Gavin Panella

Expected, observed.

Revision history for this message
Gavin Panella (allenap) wrote :

> Remember, in equality tests, we write the expected value first and the actual
> value second!

Oops, well spotted.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-18 12:23:20 +0000
@@ -52,6 +52,7 @@
52 assert isinstance(content, bytes), "Script content must be binary."52 assert isinstance(content, bytes), "Script content must be binary."
53 tarinfo = tarfile.TarInfo(name=os.path.join(ARCHIVE_PREFIX, name))53 tarinfo = tarfile.TarInfo(name=os.path.join(ARCHIVE_PREFIX, name))
54 tarinfo.size = len(content)54 tarinfo.size = len(content)
55 tarinfo.mode = 0755 # u=rwx,go=rx
55 tarball.addfile(tarinfo, BytesIO(content))56 tarball.addfile(tarinfo, BytesIO(content))
5657
5758
5859
=== 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-18 12:23:20 +0000
@@ -78,6 +78,12 @@
78 self.assertIn(path, archive.getnames())78 self.assertIn(path, archive.getnames())
79 self.assertEqual(content, archive.extractfile(path).read())79 self.assertEqual(content, archive.extractfile(path).read())
8080
81 def test_get_archive_sets_sensible_mode(self):
82 for counter in range(3):
83 factory.make_commissioning_script()
84 archive = open_tarfile(CommissioningScript.objects.get_archive())
85 self.assertEqual({0755}, {info.mode for info in archive.getmembers()})
86
8187
82class TestCommissioningScript(TestCase):88class TestCommissioningScript(TestCase):
8389