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
1=== modified file 'src/metadataserver/models/commissioningscript.py'
2--- src/metadataserver/models/commissioningscript.py 2012-12-13 09:04:28 +0000
3+++ src/metadataserver/models/commissioningscript.py 2012-12-18 12:23:20 +0000
4@@ -52,6 +52,7 @@
5 assert isinstance(content, bytes), "Script content must be binary."
6 tarinfo = tarfile.TarInfo(name=os.path.join(ARCHIVE_PREFIX, name))
7 tarinfo.size = len(content)
8+ tarinfo.mode = 0755 # u=rwx,go=rx
9 tarball.addfile(tarinfo, BytesIO(content))
10
11
12
13=== modified file 'src/metadataserver/tests/test_commissioningscript.py'
14--- src/metadataserver/tests/test_commissioningscript.py 2012-12-13 09:17:14 +0000
15+++ src/metadataserver/tests/test_commissioningscript.py 2012-12-18 12:23:20 +0000
16@@ -78,6 +78,12 @@
17 self.assertIn(path, archive.getnames())
18 self.assertEqual(content, archive.extractfile(path).read())
19
20+ def test_get_archive_sets_sensible_mode(self):
21+ for counter in range(3):
22+ factory.make_commissioning_script()
23+ archive = open_tarfile(CommissioningScript.objects.get_archive())
24+ self.assertEqual({0755}, {info.mode for info in archive.getmembers()})
25+
26
27 class TestCommissioningScript(TestCase):
28