Merge lp:~javier.collado/utah/static_analysis_8 into lp:utah

Proposed by Javier Collado
Status: Merged
Approved by: Javier Collado
Approved revision: 788
Merged at revision: 783
Proposed branch: lp:~javier.collado/utah/static_analysis_8
Merge into: lp:utah
Diff against target: 259 lines (+27/-41)
13 files modified
tests/test_parser.py (+2/-3)
utah/client/phoenix.py (+3/-5)
utah/client/tests/test_jsonschema.py (+0/-1)
utah/client/tests/test_runner.py (+1/-2)
utah/client/tests/test_state_agent.py (+1/-2)
utah/client/tests/test_testcase.py (+1/-2)
utah/client/tests/test_testsuite.py (+1/-2)
utah/provisioning/baremetal/bamboofeeder.py (+2/-1)
utah/provisioning/baremetal/cobbler.py (+4/-3)
utah/provisioning/baremetal/power.py (+3/-2)
utah/provisioning/inventory/sqlite.py (+2/-2)
utah/provisioning/provisioning.py (+7/-11)
utah/publish.py (+0/-5)
To merge this branch: bzr merge lp:~javier.collado/utah/static_analysis_8
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+139158@code.launchpad.net

Description of the change

This branch contains a few more pep8 related fixes.

To post a comment you must log in.
Revision history for this message
Javier Collado (javier.collado) wrote :

One warning I haven't fixed is the following one:
./utah/client/phoenix.py:89: W806 local variable 'fc' is assigned to but never used

Looking the code, it seems that `Phoenix.debug` method isn't used anymore. Joe,
could you confirm so that I can remove it?

Revision history for this message
Max Brustkern (nuclearbob) wrote :

Looks good to me. Once Joe comments regarding the Phoenix.debug method I think we should be good to go.

review: Approve
Revision history for this message
Joe Talbott (joetalbott) wrote :

On Tue, Dec 11, 2012 at 09:57:20AM -0000, Javier Collado wrote:
> One warning I haven't fixed is the following one:
> ./utah/client/phoenix.py:89: W806 local variable 'fc' is assigned to but never used
>
> Looking the code, it seems that `Phoenix.debug` method isn't used anymore. Joe,
> could you confirm so that I can remove it?

It's no longer needed feel free to remove it.

Thanks,
Joe
>
> --
> https://code.launchpad.net/~javier.collado/utah/static_analysis_8/+merge/139158
> Your team UTAH Dev is requested to review the proposed merge of lp:~javier.collado/utah/static_analysis_8 into lp:utah.

788. By Javier Collado

Removed unused `debug` method

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_parser.py'
2--- tests/test_parser.py 2012-12-08 02:10:12 +0000
3+++ tests/test_parser.py 2012-12-11 15:19:23 +0000
4@@ -13,7 +13,6 @@
5 # You should have received a copy of the GNU General Public License along
6 # with this program. If not, see <http://www.gnu.org/licenses/>.
7
8-import jsonschema
9 import os
10 import tempfile
11 import unittest
12@@ -46,11 +45,11 @@
13
14 def test_missing_file(self):
15 with self.assertRaises(IOError):
16- data = self.parser.parse(self.fakelog)
17+ self.parser.parse(self.fakelog)
18
19 def test_malformed_file(self):
20 with self.assertRaises(ParserError):
21- data = self.parser.parse(self.tmpfile)
22+ self.parser.parse(self.tmpfile)
23
24 def test_parser(self):
25 data = self.parser.parse(self.logfile)
26
27=== modified file 'utah/client/phoenix.py'
28--- utah/client/phoenix.py 2012-12-08 02:10:12 +0000
29+++ utah/client/phoenix.py 2012-12-11 15:19:23 +0000
30@@ -78,14 +78,12 @@
31
32 self.FILE_CONTENT[MASTER_NAME] += " - name: {}\n".format(testsuite)
33 self.FILE_CONTENT[MASTER_NAME] += \
34- " fetch_method: {} # one of 'bzr', 'bzr-export', 'dev', 'git'\n".format(CHANGEME)
35+ (" fetch_method: {} "
36+ "# one of 'bzr', 'bzr-export', 'dev', 'git'\n"
37+ .format(CHANGEME))
38 self.FILE_CONTENT[MASTER_NAME] += \
39 " fetch_location: {}\n".format(CHANGEME)
40
41- def debug(self):
42- for f in self.FILE_CONTENT.keys():
43- fc = self.FILE_CONTENT[f]
44-
45 def create_file(self, path, content, append_if_exists=False):
46 write_method = 'a' if append_if_exists else 'w'
47 if not os.path.exists(path) or append_if_exists:
48
49=== modified file 'utah/client/tests/test_jsonschema.py'
50--- utah/client/tests/test_jsonschema.py 2012-12-08 02:10:12 +0000
51+++ utah/client/tests/test_jsonschema.py 2012-12-11 15:19:23 +0000
52@@ -15,7 +15,6 @@
53
54 import jsonschema
55 import os
56-import re
57 import unittest
58 import yaml
59
60
61=== modified file 'utah/client/tests/test_runner.py'
62--- utah/client/tests/test_runner.py 2012-12-08 02:10:12 +0000
63+++ utah/client/tests/test_runner.py 2012-12-11 15:19:23 +0000
64@@ -24,8 +24,7 @@
65 from utah.client.common import RETURN_CODES
66 from utah.client import exceptions
67
68-from .common import (
69- # NOQA
70+from .common import ( # NOQA
71 setUp, # Used by nosetests
72 tearDown, # Used by nosetests
73 master_runlist_content,
74
75=== modified file 'utah/client/tests/test_state_agent.py'
76--- utah/client/tests/test_state_agent.py 2012-12-08 02:10:12 +0000
77+++ utah/client/tests/test_state_agent.py 2012-12-11 15:19:23 +0000
78@@ -23,8 +23,7 @@
79 from utah.client.result import ResultYAML
80 from utah.client.common import UTAH_DIR
81
82-from .common import (
83- # NOQA
84+from .common import ( # NOQA
85 setUp, # Used by nosetests
86 tearDown, # Used by nosetests
87 get_module_path,
88
89=== modified file 'utah/client/tests/test_testcase.py'
90--- utah/client/tests/test_testcase.py 2012-12-08 02:10:12 +0000
91+++ utah/client/tests/test_testcase.py 2012-12-11 15:19:23 +0000
92@@ -23,8 +23,7 @@
93 )
94 from utah.client import testcase
95
96-from .common import (
97- # NOQA
98+from .common import ( # NOQA
99 setUp, # Used by nosetests
100 tearDown, # Used by nosetests
101 )
102
103=== modified file 'utah/client/tests/test_testsuite.py'
104--- utah/client/tests/test_testsuite.py 2012-12-08 02:10:12 +0000
105+++ utah/client/tests/test_testsuite.py 2012-12-11 15:19:23 +0000
106@@ -22,8 +22,7 @@
107 from utah.client.result import ResultYAML
108 from utah.client import testsuite
109
110-from .common import (
111- # NOQA
112+from .common import ( # NOQA
113 setUp, # Used by nosetests
114 tearDown, # Used by nosetests
115 )
116
117=== modified file 'utah/provisioning/baremetal/bamboofeeder.py'
118--- utah/provisioning/baremetal/bamboofeeder.py 2012-12-10 20:07:30 +0000
119+++ utah/provisioning/baremetal/bamboofeeder.py 2012-12-11 15:19:23 +0000
120@@ -52,7 +52,8 @@
121 raise UTAHBMProvisioningException('No MAC address specified')
122 self.inventory = inventory
123 super(BambooFeederMachine, self).__init__(*args,
124- machineinfo=machineinfo, name=name, **kw)
125+ machineinfo=machineinfo,
126+ name=name, **kw)
127 if self.inventory is not None:
128 self.cleanfunction(self.inventory.release, machine=self)
129 self._depcheck()
130
131=== modified file 'utah/provisioning/baremetal/cobbler.py'
132--- utah/provisioning/baremetal/cobbler.py 2012-12-11 08:41:24 +0000
133+++ utah/provisioning/baremetal/cobbler.py 2012-12-11 15:19:23 +0000
134@@ -92,7 +92,7 @@
135 return True
136
137 def _create(self, checktimeout=config.checktimeout,
138- installtimeout=config.installtimeout):
139+ installtimeout=config.installtimeout):
140 """
141 Install a machine.
142 """
143@@ -272,8 +272,9 @@
144 raise UTAHBMProvisioningException('NFS needed for desktop'
145 ' install')
146 if not os.path.isfile(config.nfsconfigfile):
147- raise UTAHBMProvisioningException('NFS config file: ' +
148- config.nfsconfigfile + ' not available')
149+ raise UTAHBMProvisioningException(
150+ 'NFS config file: {nfsconfigfile} not available'
151+ .format(nfsconfigfile=config.nfsconfigfile))
152
153 def _cleanupcobbler(self):
154 """
155
156=== modified file 'utah/provisioning/baremetal/power.py'
157--- utah/provisioning/baremetal/power.py 2012-12-10 20:01:25 +0000
158+++ utah/provisioning/baremetal/power.py 2012-12-11 15:19:23 +0000
159@@ -57,8 +57,9 @@
160 '-p', self.power['power-pass'],
161 '-o']
162 else:
163- raise UTAHBMProvisioningException('Power type ' +
164- self.power['power-type'] + ' not supported')
165+ raise UTAHBMProvisioningException(
166+ 'Power type {power_type!r} not supported'
167+ .format(power_type=self.power['power-type']))
168 except AttributeError:
169 raise UTAHBMProvisioningException('Power commands not defined'
170 ' for this machine')
171
172=== modified file 'utah/provisioning/inventory/sqlite.py'
173--- utah/provisioning/inventory/sqlite.py 2012-12-10 20:36:03 +0000
174+++ utah/provisioning/inventory/sqlite.py 2012-12-11 15:19:23 +0000
175@@ -108,8 +108,8 @@
176 raise UTAHProvisioningInventoryException(
177 'No machine database found at ' + db)
178 super(ManualBaremetalSQLiteInventory, self).__init__(*args, db=db,
179- lockfile=lockfile,
180- **kw)
181+ lockfile=lockfile,
182+ **kw)
183 machines_count = (self.connection
184 .execute('SELECT COUNT(*) FROM machines')
185 .fetchall()[0][0])
186
187=== modified file 'utah/provisioning/provisioning.py'
188--- utah/provisioning/provisioning.py 2012-12-11 09:03:17 +0000
189+++ utah/provisioning/provisioning.py 2012-12-11 15:19:23 +0000
190@@ -674,9 +674,9 @@
191 if self.run(uuid_check_command)[0] != 0:
192 self.provisioned = False
193 raise UTAHProvisioningException(
194- 'Installed UUID differs from Machine UUID; '
195- 'installation probably failed. '
196- 'Try rerunning install.')
197+ 'Installed UUID differs from Machine UUID; '
198+ 'installation probably failed. '
199+ 'Try rerunning install.')
200
201
202 class SSHMixin(object):
203@@ -1004,8 +1004,7 @@
204 self.logger.info('Creating latecommand script')
205 filename = os.path.join(tmpdir, 'initrd.d', 'utah-latecommand')
206 latecommand = open(filename, 'w')
207- latecommand.write(
208-"""#!/bin/sh
209+ latecommand.write("""#!/bin/sh
210
211 ROOTDIR=/target/root/.ssh
212 USERDIR=/target/home/{user}/.ssh
213@@ -1144,8 +1143,7 @@
214 tmpdir = self.tmpdir
215 preseedscript = os.path.join(tmpdir, 'initrd.d', 'scripts',
216 'casper-bottom', 'utah')
217- open(preseedscript, 'w').write(
218-"""#!/bin/sh
219+ open(preseedscript, 'w').write("""#!/bin/sh
220
221 cp preseed.cfg utah-ssh-key utah-latecommand /root
222 cp 50-utahdefault.conf /root/etc/rsyslog.d
223@@ -1157,8 +1155,7 @@
224 tmpfile = open(tmpfilename, 'w')
225 orderfilename = os.path.join(casper_dir, 'ORDER')
226 orderfile = open(orderfilename, 'r')
227- tmpfile.write(
228-"""/scripts/casper-bottom/utah
229+ tmpfile.write("""/scripts/casper-bottom/utah
230 [ -e /conf/param.conf ] && . /conf/param.conf
231 """)
232 tmpfile.flush()
233@@ -1188,8 +1185,7 @@
234 self.logger.info('No inittab found, creating rsyslog config file')
235 conffilename = os.path.join(tmpdir, 'initrd.d',
236 '50-utahdefault.conf')
237- open(conffilename, 'w').write(
238-"""
239+ open(conffilename, 'w').write("""
240 # Default rules for rsyslog.
241 # Minimal file provided for utah installation logging
242 # For more information see rsyslog.conf(5) and /etc/rsyslog.conf
243
244=== modified file 'utah/publish.py'
245--- utah/publish.py 2012-12-08 02:10:12 +0000
246+++ utah/publish.py 2012-12-11 15:19:23 +0000
247@@ -14,14 +14,9 @@
248 # with this program. If not, see <http://www.gnu.org/licenses/>.
249
250 import argparse
251-import datetime
252-import jsonschema
253-import os
254 import urllib
255 import urllib2
256-import yaml
257
258-from utah.client import exceptions
259 from utah.parser import UTAHParser
260
261

Subscribers

People subscribed via source and target branches