Merge lp:~nuclearbob/utah/fix-recent-issues into lp:utah

Proposed by Max Brustkern
Status: Merged
Merged at revision: 841
Proposed branch: lp:~nuclearbob/utah/fix-recent-issues
Merge into: lp:utah
Diff against target: 190 lines (+24/-29)
9 files modified
utah/client/common.py (+0/-1)
utah/client/runner.py (+2/-2)
utah/client/tests/common.py (+2/-3)
utah/client/tests/test_phoenix.py (+2/-1)
utah/client/tests/test_result.py (+4/-4)
utah/client/tests/test_runner.py (+2/-3)
utah/client/tests/test_state_agent.py (+8/-12)
utah/iso.py (+2/-2)
utah/provisioning/baremetal/cobbler.py (+2/-1)
To merge this branch: bzr merge lp:~nuclearbob/utah/fix-recent-issues
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Joe Talbott (community) Approve
Review via email: mp+154805@code.launchpad.net

Description of the change

This branch contains fixes for issues I found testing the current dev branch, which includes rsyslog and reboot support, among other things. Not all of the fixes are mine, but they've all resulted in improved testing.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

LGTM.

review: Approve
Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utah/client/common.py'
2--- utah/client/common.py 2013-03-15 13:12:32 +0000
3+++ utah/client/common.py 2013-03-21 20:14:21 +0000
4@@ -176,7 +176,6 @@
5 # so wrap to avoid OSError: no such process
6 try:
7 os.kill(pid, signal.SIGKILL)
8- p.communicate()
9 except OSError:
10 pass
11
12
13=== modified file 'utah/client/runner.py'
14--- utah/client/runner.py 2013-03-15 14:59:35 +0000
15+++ utah/client/runner.py 2013-03-21 20:14:21 +0000
16@@ -258,8 +258,8 @@
17 try:
18 with open(rc_local, 'w') as fp:
19 fp.write(self.rc_local_content.format(runlist=runlist))
20- fp.close()
21- os.fchmod(fp, stat.S_IRWXU | stat.S_IROTH | stat.S_IRGRP)
22+ os.fchmod(fp.fileno(),
23+ stat.S_IRWXU | stat.S_IROTH | stat.S_IRGRP)
24 except (IOError, OSError) as err:
25 raise exceptions.UTAHClientError(
26 'Error setting up rc.local: {}'.format(err))
27
28=== modified file 'utah/client/tests/common.py'
29--- utah/client/tests/common.py 2012-12-08 02:10:12 +0000
30+++ utah/client/tests/common.py 2013-03-21 20:14:21 +0000
31@@ -82,9 +82,8 @@
32 if not os.path.exists(examples_dir):
33 shutil.copytree(examples_source, examples_dir)
34
35- fp = open(master_runlist, 'w')
36- fp.write(master_runlist_content)
37- fp.close()
38+ with open(master_runlist, 'w') as fp:
39+ fp.write(master_runlist_content)
40
41
42 def tearDown():
43
44=== modified file 'utah/client/tests/test_phoenix.py'
45--- utah/client/tests/test_phoenix.py 2012-12-08 02:10:12 +0000
46+++ utah/client/tests/test_phoenix.py 2013-03-21 20:14:21 +0000
47@@ -131,7 +131,8 @@
48
49 self.assertTrue(os.path.exists(fn))
50
51- fc_read = open(fn, 'r').read()
52+ with open(fn, 'r') as fp:
53+ fc_read = fp.read()
54 self.assertEqual(fc, fc_read)
55
56 os.remove(fn)
57
58=== modified file 'utah/client/tests/test_result.py'
59--- utah/client/tests/test_result.py 2012-12-08 02:10:12 +0000
60+++ utah/client/tests/test_result.py 2013-03-21 20:14:21 +0000
61@@ -77,14 +77,14 @@
62 """
63 self.result_yaml.add_result(self.result_fail)
64
65- self.assertEqual(self.result_yaml.status, 'ERROR')
66+ self.assertEqual(self.result_yaml.status, 'FAIL')
67
68 def test_result_clear_result(self):
69 """
70 Test that the result is actually cleared.
71 """
72 self.result_yaml.add_result(self.result_fail)
73- self.assertEqual(self.result_yaml.status, 'ERROR')
74+ self.assertEqual(self.result_yaml.status, 'FAIL')
75
76 self.result_yaml.clear_results()
77
78@@ -98,11 +98,11 @@
79 """
80 self.result_yaml.add_result(self.result_fail)
81
82- self.assertEqual(self.result_yaml.status, 'ERROR')
83+ self.assertEqual(self.result_yaml.status, 'FAIL')
84
85 self.result_yaml.add_result(self.result)
86
87- self.assertEqual(self.result_yaml.status, 'ERROR')
88+ self.assertEqual(self.result_yaml.status, 'FAIL')
89
90 def test_result_yaml(self):
91 self.result_yaml.add_result(self.result)
92
93=== modified file 'utah/client/tests/test_runner.py'
94--- utah/client/tests/test_runner.py 2013-03-11 09:17:54 +0000
95+++ utah/client/tests/test_runner.py 2013-03-21 20:14:21 +0000
96@@ -68,9 +68,8 @@
97
98 self.assertFalse(os.path.exists(runlist), runlist)
99
100- fp = open(runlist, 'w')
101- fp.write(bad_runlist_content)
102- fp.close()
103+ with open(runlist, 'w') as fp:
104+ fp.write(bad_runlist_content)
105
106 runner = Runner(install_type='desktop', result_class=self.result_class,
107 state_agent=self.state_agent, runlist=runlist)
108
109=== modified file 'utah/client/tests/test_state_agent.py'
110--- utah/client/tests/test_state_agent.py 2012-12-11 17:03:16 +0000
111+++ utah/client/tests/test_state_agent.py 2013-03-21 20:14:21 +0000
112@@ -99,9 +99,8 @@
113 self.assertEqual(self.runner.count_suites(), suite_count)
114 self.assertEqual(self.runner.count_tests(), test_count)
115
116- fp = open(self.state_file, 'r')
117- state_data = yaml.load(fp)
118- fp.close()
119+ with open(self.state_file, 'r') as fp:
120+ state_data = yaml.load(fp)
121
122 self.assertEqual(state_data['status'], 'DONE')
123
124@@ -109,9 +108,8 @@
125 """
126 Test that a partially run state file can be resumed.
127 """
128- fp = open(self.state_file, 'w')
129- fp.write(self.partial_state_file_content)
130- fp.close()
131+ with open(self.state_file, 'w') as fp:
132+ fp.write(self.partial_state_file_content)
133
134 # Need to set up utah_tests since we're simulating a restart
135 test_src = os.path.join(get_module_path(), 'client',
136@@ -155,9 +153,8 @@
137 """
138 Test partially run state file - run all jobs.
139 """
140- fp = open(self.state_file, 'w')
141- fp.write(self.partial_state_file_content_run_all)
142- fp.close()
143+ with open(self.state_file, 'w') as fp:
144+ fp.write(self.partial_state_file_content_run_all)
145
146 # Need to set up utah_tests since we're simulating a restart
147 test_src = os.path.join(get_module_path(), 'client',
148@@ -200,9 +197,8 @@
149 """
150 Test partially run state file - all jobs failed.
151 """
152- fp = open(self.state_file, 'w')
153- fp.write(self.partial_state_file_content_done_all_failed)
154- fp.close()
155+ with open(self.state_file, 'w') as fp:
156+ fp.write(self.partial_state_file_content_done_all_failed)
157
158 # Need to set up utah_tests since we're simulating a restart
159 test_src = os.path.join(get_module_path(), 'client',
160
161=== modified file 'utah/iso.py'
162--- utah/iso.py 2013-03-15 14:28:21 +0000
163+++ utah/iso.py 2013-03-21 20:14:21 +0000
164@@ -399,8 +399,8 @@
165 isopath = os.path.join(remotepath, isofile)
166 self.percent = 0
167 self.logger.info('Attempting to download ' + isopath)
168- temppath = get_resource(urllib.urlretrieve(isopath,
169- reporthook=self.dldisplay))[0]
170+ temppath = get_resource(urllib.urlretrieve, isopath,
171+ reporthook=self.dldisplay)[0]
172
173 # Try to copy it into our cache
174 self.logger.debug('Copying ' + temppath + ' to ' + path)
175
176=== modified file 'utah/provisioning/baremetal/cobbler.py'
177--- utah/provisioning/baremetal/cobbler.py 2013-03-18 14:43:57 +0000
178+++ utah/provisioning/baremetal/cobbler.py 2013-03-21 20:14:21 +0000
179@@ -195,9 +195,10 @@
180 self.restart()
181 self.rsyslog.wait_for_install(config.install_steps,
182 self._disable_netboot)
183- self.rsyslog.wait_for_booted(config.boot_steps)
184
185 if self.installtype == 'desktop':
186+ # TODO: look into getting this working for d-i installs
187+ self.rsyslog.wait_for_booted(config.boot_steps)
188 self._removenfs()
189
190 retry(self.sshcheck, logmethod=self.logger.info,

Subscribers

People subscribed via source and target branches