Merge lp:~andreserl/maas/maas_set_correct_file_permissions into lp:~maas-committers/maas/trunk

Proposed by Andres Rodriguez
Status: Superseded
Proposed branch: lp:~andreserl/maas/maas_set_correct_file_permissions
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 117 lines (+13/-8)
5 files modified
src/provisioningserver/pxe/install_image.py (+1/-0)
src/provisioningserver/pxe/tests/test_install_image.py (+1/-1)
src/provisioningserver/pxe/tests/test_tftppath.py (+3/-3)
src/provisioningserver/tests/test_tftp.py (+4/-4)
src/provisioningserver/utils.py (+4/-0)
To merge this branch: bzr merge lp:~andreserl/maas/maas_set_correct_file_permissions
Reviewer Review Type Date Requested Status
MAAS Maintainers Pending
Review via email: mp+121923@code.launchpad.net

This proposal has been superseded by a proposal from 2012-08-30.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/pxe/install_image.py'
2--- src/provisioningserver/pxe/install_image.py 2012-07-23 10:24:39 +0000
3+++ src/provisioningserver/pxe/install_image.py 2012-08-29 18:49:18 +0000
4@@ -108,6 +108,7 @@
5 if os.path.isdir(old):
6 os.rename(old, '%s.old' % old)
7 os.rename('%s.new' % old, old)
8+ os.chmod(old, 0755)
9 # End of critical window.
10
11 # Now delete the old image directory at leisure.
12
13=== modified file 'src/provisioningserver/pxe/tests/test_install_image.py'
14--- src/provisioningserver/pxe/tests/test_install_image.py 2012-07-23 13:25:15 +0000
15+++ src/provisioningserver/pxe/tests/test_install_image.py 2012-08-29 18:49:18 +0000
16@@ -85,7 +85,7 @@
17 tftproot = self.make_dir()
18 arch, subarch, release, purpose = make_arch_subarch_release_purpose()
19 self.assertEqual(
20- os.path.join(tftproot, 'maas', arch, subarch, release, purpose),
21+ os.path.join(tftproot, arch, subarch, release, purpose),
22 make_destination(tftproot, arch, subarch, release, purpose))
23
24 def test_make_destination_creates_directory_if_not_present(self):
25
26=== modified file 'src/provisioningserver/pxe/tests/test_tftppath.py'
27--- src/provisioningserver/pxe/tests/test_tftppath.py 2012-08-17 14:11:20 +0000
28+++ src/provisioningserver/pxe/tests/test_tftppath.py 2012-08-29 18:49:18 +0000
29@@ -41,7 +41,7 @@
30 def test_compose_config_path_follows_maas_pxe_directory_layout(self):
31 name = factory.make_name('config')
32 self.assertEqual(
33- 'maas/pxelinux.cfg/%02x-%s' % (ARP_HTYPE.ETHERNET, name),
34+ 'pxelinux.cfg/%02x-%s' % (ARP_HTYPE.ETHERNET, name),
35 compose_config_path(name))
36
37 def test_compose_config_path_does_not_include_tftp_root(self):
38@@ -56,7 +56,7 @@
39 release = factory.make_name('release')
40 purpose = factory.make_name('purpose')
41 self.assertEqual(
42- 'maas/%s/%s/%s/%s' % (arch, subarch, release, purpose),
43+ '%s/%s/%s/%s' % (arch, subarch, release, purpose),
44 compose_image_path(arch, subarch, release, purpose))
45
46 def test_compose_image_path_does_not_include_tftp_root(self):
47@@ -69,7 +69,7 @@
48 Not(StartsWith(self.tftproot)))
49
50 def test_compose_bootloader_path_follows_maas_pxe_directory_layout(self):
51- self.assertEqual('maas/pxelinux.0', compose_bootloader_path())
52+ self.assertEqual('pxelinux.0', compose_bootloader_path())
53
54 def test_compose_bootloader_path_does_not_include_tftp_root(self):
55 self.assertThat(
56
57=== modified file 'src/provisioningserver/tests/test_tftp.py'
58--- src/provisioningserver/tests/test_tftp.py 2012-08-27 12:00:44 +0000
59+++ src/provisioningserver/tests/test_tftp.py 2012-08-29 18:49:18 +0000
60@@ -71,7 +71,7 @@
61 the expected groups from a match.
62 """
63 components = {
64- "bootpath": b"maas", # Static.
65+ "bootpath": None, # Static.
66 "mac": factory.getRandomMACAddress(b"-"),
67 }
68 config_path = compose_config_path(components["mac"])
69@@ -125,7 +125,7 @@
70
71 def test_re_config_file_does_not_match_non_config_file(self):
72 self.assertIsNone(
73- TFTPBackend.re_config_file.match('maas/pxelinux.cfg/kernel'))
74+ TFTPBackend.re_config_file.match('pxelinux.cfg/kernel'))
75
76 def test_re_config_file_does_not_match_file_in_root(self):
77 self.assertIsNone(
78@@ -202,7 +202,7 @@
79 output = reader.read(10000)
80 # The expected parameters include bootpath; this is extracted from the
81 # file path by re_config_file.
82- expected_params = dict(mac=mac, bootpath="maas")
83+ expected_params = dict(mac=mac, bootpath=None)
84 observed_params = json.loads(output)
85 self.assertEqual(expected_params, observed_params)
86
87@@ -213,7 +213,7 @@
88 backend = TFTPBackend(self.make_dir(), b"http://example.com/")
89 # Fake configuration parameters, as discovered from the file path.
90 fake_params = {
91- "bootpath": "maas",
92+ "bootpath": None,
93 "mac": factory.getRandomMACAddress(b"-"),
94 }
95 # Fake kernel configuration parameters, as returned from the API call.
96
97=== modified file 'src/provisioningserver/utils.py'
98--- src/provisioningserver/utils.py 2012-08-24 09:21:34 +0000
99+++ src/provisioningserver/utils.py 2012-08-29 18:49:18 +0000
100@@ -75,6 +75,9 @@
101 if not os.path.isfile(filename):
102 temp_file = _write_temp_file(content, filename)
103 os.rename(temp_file, filename)
104+ # Setting 0755 as we assume `filename` is not a file
105+ # but rather it is a directory.
106+ os.chmod(filename, 0755)
107 finally:
108 # Release the lock.
109 lock.release()
110@@ -83,6 +86,7 @@
111 # POSIX systems.
112 temp_file = _write_temp_file(content, filename)
113 os.rename(temp_file, filename)
114+ os.chmod(filename, 0644)
115
116
117 def incremental_write(content, filename):