Merge lp:~barryprice/juju-deployer/resolve-pep8-failures into lp:juju-deployer

Proposed by Barry Price
Status: Merged
Approved by: Barry Price
Approved revision: 221
Merged at revision: 221
Proposed branch: lp:~barryprice/juju-deployer/resolve-pep8-failures
Merge into: lp:juju-deployer
Prerequisite: lp:~barryprice/juju-deployer/resolve-OpenStack-1501-option-errors
Diff against target: 174 lines (+21/-32)
9 files modified
deployer/action/diff.py (+3/-2)
deployer/config.py (+1/-2)
deployer/deployment.py (+1/-2)
deployer/env/base.py (+3/-3)
deployer/env/go.py (+1/-4)
deployer/relation.py (+2/-6)
deployer/service.py (+4/-5)
deployer/tests/test_diff.py (+3/-2)
deployer/utils.py (+3/-6)
To merge this branch: bzr merge lp:~barryprice/juju-deployer/resolve-pep8-failures
Reviewer Review Type Date Requested Status
Benjamin Allot Approve
Canonical IS Reviewers Pending
Review via email: mp+392359@code.launchpad.net

Commit message

Fix PEP8/Flake8 errors

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Benjamin Allot (ballot) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 221

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'deployer/action/diff.py'
--- deployer/action/diff.py 2016-12-16 11:17:35 +0000
+++ deployer/action/diff.py 2020-10-16 07:31:11 +0000
@@ -143,8 +143,9 @@
143 mod['cfg-constraints'] = dep_constraints143 mod['cfg-constraints'] = dep_constraints
144144
145 # Now collect all the options from both services and diff them.145 # Now collect all the options from both services and diff them.
146 all_options = (set(dep_service.get('options', {}).keys()) |146 all_options = (
147 set(env_service.get('options', {}).keys()))147 set(dep_service.get('options', {}).keys()) | set(env_service.get('options', {}).keys())
148 )
148 for key in all_options:149 for key in all_options:
149 dep_value = dep_service.get('options', {}).get(key)150 dep_value = dep_service.get('options', {}).get(key)
150 # Assume the charm default if the deployment specifies no value.151 # Assume the charm default if the deployment specifies no value.
151152
=== modified file 'deployer/config.py'
--- deployer/config.py 2016-07-12 02:29:52 +0000
+++ deployer/config.py 2020-10-16 07:31:11 +0000
@@ -59,8 +59,7 @@
5959
60 # Check if this is a v4 bundle.60 # Check if this is a v4 bundle.
61 services = yaml_result.get('services')61 services = yaml_result.get('services')
62 if (isinstance(services, dict) and62 if (isinstance(services, dict) and 'services' not in services):
63 'services' not in services):
64 self.version = 463 self.version = 4
65 yaml_result = {config_file: yaml_result}64 yaml_result = {config_file: yaml_result}
6665
6766
=== modified file 'deployer/deployment.py'
--- deployer/deployment.py 2020-10-07 02:09:02 +0000
+++ deployer/deployment.py 2020-10-16 07:31:11 +0000
@@ -256,8 +256,7 @@
256 def _resolve_include(self, svc_name, k, v):256 def _resolve_include(self, svc_name, k, v):
257 feedback = Feedback()257 feedback = Feedback()
258 for include_type in ["file", "base64"]:258 for include_type in ["file", "base64"]:
259 if (not isinstance(v, six.string_types) or259 if (not isinstance(v, six.string_types) or not v.startswith("include-%s://" % include_type)):
260 not v.startswith("include-%s://" % include_type)):
261 continue260 continue
262 include, fname = v.split("://", 1)261 include, fname = v.split("://", 1)
263 ip = resolve_include(fname, self.include_dirs)262 ip = resolve_include(fname, self.include_dirs)
264263
=== modified file 'deployer/env/base.py'
--- deployer/env/base.py 2020-02-26 12:08:57 +0000
+++ deployer/env/base.py 2020-10-16 07:31:11 +0000
@@ -145,9 +145,9 @@
145 units have finished executing stop hooks and are removed).145 units have finished executing stop hooks and are removed).
146146
147 """147 """
148 if (self.juju_version == 1 and148 if (
149 ((isinstance(mid, int) and mid == 0) or149 self.juju_version == 1 and ((isinstance(mid, int) and mid == 0) or (mid.isdigit() and int(mid) == 0))
150 (mid.isdigit() and int(mid) == 0))):150 ):
151 # Don't kill state server151 # Don't kill state server
152 raise RuntimeError("Can't terminate machine 0")152 raise RuntimeError("Can't terminate machine 0")
153 if get_juju_major_version() == 1:153 if get_juju_major_version() == 1:
154154
=== modified file 'deployer/env/go.py'
--- deployer/env/go.py 2017-08-30 09:01:00 +0000
+++ deployer/env/go.py 2020-10-16 07:31:11 +0000
@@ -283,10 +283,7 @@
283 d = NormalizedDelta(d)283 d = NormalizedDelta(d)
284 name = d.get('Name', d.get('Id', 'unknown'))284 name = d.get('Name', d.get('Id', 'unknown'))
285 state = (285 state = (
286 d.get('workload-status') or286 d.get('workload-status') or d.get('Status') or d.get('Life') or 'unknown'
287 d.get('Status') or
288 d.get('Life') or
289 'unknown'
290 )287 )
291 if et == "relation":288 if et == "relation":
292 name = self._format_endpoints(d['Endpoints'])289 name = self._format_endpoints(d['Endpoints'])
293290
=== modified file 'deployer/relation.py'
--- deployer/relation.py 2016-12-20 15:10:01 +0000
+++ deployer/relation.py 2020-10-16 07:31:11 +0000
@@ -17,10 +17,7 @@
17 # equal only by service if name is "*" or unset17 # equal only by service if name is "*" or unset
18 return (18 return (
19 (self.ep == ep.ep) or (19 (self.ep == ep.ep) or (
20 (not self.name or self.name == "*" or20 (not self.name or self.name == "*" or not ep.name or ep.name == "*") and self.service == ep.service)
21 not ep.name or ep.name == "*") and
22 self.service == ep.service
23 )
24 )21 )
2522
2623
@@ -35,8 +32,7 @@
35 def __eq__(self, ep_pair):32 def __eq__(self, ep_pair):
36 if not isinstance(ep_pair, EndpointPair):33 if not isinstance(ep_pair, EndpointPair):
37 return False34 return False
38 return (ep_pair.ep_x in self and35 return (ep_pair.ep_x in self and ep_pair.ep_y in self)
39 ep_pair.ep_y in self)
4036
41 def __contains__(self, ep):37 def __contains__(self, ep):
42 return (self.ep_x == ep or self.ep_y == ep)38 return (self.ep_x == ep or self.ep_y == ep)
4339
=== modified file 'deployer/service.py'
--- deployer/service.py 2017-03-16 04:23:06 +0000
+++ deployer/service.py 2020-10-16 07:31:11 +0000
@@ -128,8 +128,7 @@
128 unit_names = list(svc_units.keys())128 unit_names = list(svc_units.keys())
129 unit_names.sort(key=lambda unit: int(unit.split('/')[1]))129 unit_names.sort(key=lambda unit: int(unit.split('/')[1]))
130 machine = (130 machine = (
131 svc_units[unit_names[int(u_idx)]].get('Machine') or131 svc_units[unit_names[int(u_idx)]].get('Machine') or svc_units[unit_names[int(u_idx)]].get('machine')
132 svc_units[unit_names[int(u_idx)]].get('machine')
133 )132 )
134 if not machine:133 if not machine:
135 self.deployment.log.warning(134 self.deployment.log.warning(
@@ -273,9 +272,9 @@
273 return272 return
274273
275 self.service.svc_data['to'] = (274 self.service.svc_data['to'] = (
276 unit_mapping +275 unit_mapping + list(itertools.repeat(
277 list(itertools.repeat(276 unit_mapping[-1], unit_count - len(unit_mapping))
278 unit_mapping[-1], unit_count - len(unit_mapping)))277 )
279 )278 )
280 unit_mapping = self.service.unit_placement279 unit_mapping = self.service.unit_placement
281280
282281
=== modified file 'deployer/tests/test_diff.py'
--- deployer/tests/test_diff.py 2020-10-16 07:31:11 +0000
+++ deployer/tests/test_diff.py 2020-10-16 07:31:11 +0000
@@ -191,8 +191,9 @@
191 env = MemoryEnvironment(dpl.name, dpl)191 env = MemoryEnvironment(dpl.name, dpl)
192 diff = Diff(env, edited_dpl, {}).do_diff()192 diff = Diff(env, edited_dpl, {}).do_diff()
193 # verify ceilometer<->keystone present in unknown relations193 # verify ceilometer<->keystone present in unknown relations
194 self.assertTrue('ceilometer' in str(diff['relations']['unknown']) and194 self.assertTrue(
195 'keystone' in str(diff['relations']['unknown']))195 'ceilometer' in str(diff['relations']['unknown']) and 'keystone' in str(diff['relations']['unknown'])
196 )
196197
197 def test_diff_cfg_replace_with_unnamed_relations(self):198 def test_diff_cfg_replace_with_unnamed_relations(self):
198 dpl = self.get_deployment()199 dpl = self.get_deployment()
199200
=== modified file 'deployer/utils.py'
--- deployer/utils.py 2017-03-16 04:23:06 +0000
+++ deployer/utils.py 2020-10-16 07:31:11 +0000
@@ -245,12 +245,10 @@
245def _get_juju_home():245def _get_juju_home():
246 if get_juju_major_version() == 1:246 if get_juju_major_version() == 1:
247 return (247 return (
248 os.environ.get("JUJU_HOME") or248 os.environ.get("JUJU_HOME") or path_join(os.environ.get('HOME'), '.juju')
249 path_join(os.environ.get('HOME'), '.juju')
250 )249 )
251 return (250 return (
252 os.environ.get("JUJU_DATA") or251 os.environ.get("JUJU_DATA") or path_join(os.environ.get('HOME'), '.local', 'share', 'juju')
253 path_join(os.environ.get('HOME'), '.local', 'share', 'juju')
254 )252 )
255253
256254
@@ -325,8 +323,7 @@
325 for (key, value) in source.items():323 for (key, value) in source.items():
326 if key == 'relations' and key in target:324 if key == 'relations' and key in target:
327 target[key] = relations_combine(target[key], value)325 target[key] = relations_combine(target[key], value)
328 elif (key in target and isinstance(target[key], dict) and326 elif (key in target and isinstance(target[key], dict) and isinstance(value, dict)):
329 isinstance(value, dict)):
330 target[key] = dict_merge(target[key], value)327 target[key] = dict_merge(target[key], value)
331 else:328 else:
332 target[key] = value329 target[key] = value

Subscribers

People subscribed via source and target branches