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
=== modified file 'src/provisioningserver/pxe/install_image.py'
--- src/provisioningserver/pxe/install_image.py 2012-07-23 10:24:39 +0000
+++ src/provisioningserver/pxe/install_image.py 2012-08-29 18:49:18 +0000
@@ -108,6 +108,7 @@
108 if os.path.isdir(old):108 if os.path.isdir(old):
109 os.rename(old, '%s.old' % old)109 os.rename(old, '%s.old' % old)
110 os.rename('%s.new' % old, old)110 os.rename('%s.new' % old, old)
111 os.chmod(old, 0755)
111 # End of critical window.112 # End of critical window.
112113
113 # Now delete the old image directory at leisure.114 # Now delete the old image directory at leisure.
114115
=== modified file 'src/provisioningserver/pxe/tests/test_install_image.py'
--- src/provisioningserver/pxe/tests/test_install_image.py 2012-07-23 13:25:15 +0000
+++ src/provisioningserver/pxe/tests/test_install_image.py 2012-08-29 18:49:18 +0000
@@ -85,7 +85,7 @@
85 tftproot = self.make_dir()85 tftproot = self.make_dir()
86 arch, subarch, release, purpose = make_arch_subarch_release_purpose()86 arch, subarch, release, purpose = make_arch_subarch_release_purpose()
87 self.assertEqual(87 self.assertEqual(
88 os.path.join(tftproot, 'maas', arch, subarch, release, purpose),88 os.path.join(tftproot, arch, subarch, release, purpose),
89 make_destination(tftproot, arch, subarch, release, purpose))89 make_destination(tftproot, arch, subarch, release, purpose))
9090
91 def test_make_destination_creates_directory_if_not_present(self):91 def test_make_destination_creates_directory_if_not_present(self):
9292
=== modified file 'src/provisioningserver/pxe/tests/test_tftppath.py'
--- src/provisioningserver/pxe/tests/test_tftppath.py 2012-08-17 14:11:20 +0000
+++ src/provisioningserver/pxe/tests/test_tftppath.py 2012-08-29 18:49:18 +0000
@@ -41,7 +41,7 @@
41 def test_compose_config_path_follows_maas_pxe_directory_layout(self):41 def test_compose_config_path_follows_maas_pxe_directory_layout(self):
42 name = factory.make_name('config')42 name = factory.make_name('config')
43 self.assertEqual(43 self.assertEqual(
44 'maas/pxelinux.cfg/%02x-%s' % (ARP_HTYPE.ETHERNET, name),44 'pxelinux.cfg/%02x-%s' % (ARP_HTYPE.ETHERNET, name),
45 compose_config_path(name))45 compose_config_path(name))
4646
47 def test_compose_config_path_does_not_include_tftp_root(self):47 def test_compose_config_path_does_not_include_tftp_root(self):
@@ -56,7 +56,7 @@
56 release = factory.make_name('release')56 release = factory.make_name('release')
57 purpose = factory.make_name('purpose')57 purpose = factory.make_name('purpose')
58 self.assertEqual(58 self.assertEqual(
59 'maas/%s/%s/%s/%s' % (arch, subarch, release, purpose),59 '%s/%s/%s/%s' % (arch, subarch, release, purpose),
60 compose_image_path(arch, subarch, release, purpose))60 compose_image_path(arch, subarch, release, purpose))
6161
62 def test_compose_image_path_does_not_include_tftp_root(self):62 def test_compose_image_path_does_not_include_tftp_root(self):
@@ -69,7 +69,7 @@
69 Not(StartsWith(self.tftproot)))69 Not(StartsWith(self.tftproot)))
7070
71 def test_compose_bootloader_path_follows_maas_pxe_directory_layout(self):71 def test_compose_bootloader_path_follows_maas_pxe_directory_layout(self):
72 self.assertEqual('maas/pxelinux.0', compose_bootloader_path())72 self.assertEqual('pxelinux.0', compose_bootloader_path())
7373
74 def test_compose_bootloader_path_does_not_include_tftp_root(self):74 def test_compose_bootloader_path_does_not_include_tftp_root(self):
75 self.assertThat(75 self.assertThat(
7676
=== modified file 'src/provisioningserver/tests/test_tftp.py'
--- src/provisioningserver/tests/test_tftp.py 2012-08-27 12:00:44 +0000
+++ src/provisioningserver/tests/test_tftp.py 2012-08-29 18:49:18 +0000
@@ -71,7 +71,7 @@
71 the expected groups from a match.71 the expected groups from a match.
72 """72 """
73 components = {73 components = {
74 "bootpath": b"maas", # Static.74 "bootpath": None, # Static.
75 "mac": factory.getRandomMACAddress(b"-"),75 "mac": factory.getRandomMACAddress(b"-"),
76 }76 }
77 config_path = compose_config_path(components["mac"])77 config_path = compose_config_path(components["mac"])
@@ -125,7 +125,7 @@
125125
126 def test_re_config_file_does_not_match_non_config_file(self):126 def test_re_config_file_does_not_match_non_config_file(self):
127 self.assertIsNone(127 self.assertIsNone(
128 TFTPBackend.re_config_file.match('maas/pxelinux.cfg/kernel'))128 TFTPBackend.re_config_file.match('pxelinux.cfg/kernel'))
129129
130 def test_re_config_file_does_not_match_file_in_root(self):130 def test_re_config_file_does_not_match_file_in_root(self):
131 self.assertIsNone(131 self.assertIsNone(
@@ -202,7 +202,7 @@
202 output = reader.read(10000)202 output = reader.read(10000)
203 # The expected parameters include bootpath; this is extracted from the203 # The expected parameters include bootpath; this is extracted from the
204 # file path by re_config_file.204 # file path by re_config_file.
205 expected_params = dict(mac=mac, bootpath="maas")205 expected_params = dict(mac=mac, bootpath=None)
206 observed_params = json.loads(output)206 observed_params = json.loads(output)
207 self.assertEqual(expected_params, observed_params)207 self.assertEqual(expected_params, observed_params)
208208
@@ -213,7 +213,7 @@
213 backend = TFTPBackend(self.make_dir(), b"http://example.com/")213 backend = TFTPBackend(self.make_dir(), b"http://example.com/")
214 # Fake configuration parameters, as discovered from the file path.214 # Fake configuration parameters, as discovered from the file path.
215 fake_params = {215 fake_params = {
216 "bootpath": "maas",216 "bootpath": None,
217 "mac": factory.getRandomMACAddress(b"-"),217 "mac": factory.getRandomMACAddress(b"-"),
218 }218 }
219 # Fake kernel configuration parameters, as returned from the API call.219 # Fake kernel configuration parameters, as returned from the API call.
220220
=== modified file 'src/provisioningserver/utils.py'
--- src/provisioningserver/utils.py 2012-08-24 09:21:34 +0000
+++ src/provisioningserver/utils.py 2012-08-29 18:49:18 +0000
@@ -75,6 +75,9 @@
75 if not os.path.isfile(filename):75 if not os.path.isfile(filename):
76 temp_file = _write_temp_file(content, filename)76 temp_file = _write_temp_file(content, filename)
77 os.rename(temp_file, filename)77 os.rename(temp_file, filename)
78 # Setting 0755 as we assume `filename` is not a file
79 # but rather it is a directory.
80 os.chmod(filename, 0755)
78 finally:81 finally:
79 # Release the lock.82 # Release the lock.
80 lock.release()83 lock.release()
@@ -83,6 +86,7 @@
83 # POSIX systems.86 # POSIX systems.
84 temp_file = _write_temp_file(content, filename)87 temp_file = _write_temp_file(content, filename)
85 os.rename(temp_file, filename)88 os.rename(temp_file, filename)
89 os.chmod(filename, 0644)
8690
8791
88def incremental_write(content, filename):92def incremental_write(content, filename):