Merge lp:~chris.macnaughton/mojo/py3001 into lp:~ost-maintainers/mojo/py3

Proposed by Chris MacNaughton
Status: Merged
Merged at revision: 464
Proposed branch: lp:~chris.macnaughton/mojo/py3001
Merge into: lp:~ost-maintainers/mojo/py3
Diff against target: 543 lines (+66/-66)
19 files modified
contrib/test/utils.py (+1/-1)
mojo/cli.py (+3/-3)
mojo/contain.py (+1/-1)
mojo/info.py (+2/-2)
mojo/juju/__init__.py (+5/-5)
mojo/juju/check.py (+3/-3)
mojo/juju/parse_status.py (+4/-4)
mojo/juju/status.py (+11/-11)
mojo/phase.py (+10/-10)
mojo/project.py (+15/-15)
mojo/project_destroy.py (+1/-1)
mojo/project_new.py (+1/-1)
mojo/tests/test_debuglogs.py (+1/-1)
mojo/tests/test_juju2.py (+1/-1)
mojo/tests/test_mojo.py (+2/-2)
mojo/tests/utils.py (+1/-1)
mojo/volattach.py (+2/-2)
mojo/workspace.py (+1/-1)
tox.ini (+1/-1)
To merge this branch: bzr merge lp:~chris.macnaughton/mojo/py3001
Reviewer Review Type Date Requested Status
Ryan Beisner Approve
Review via email: mp+336288@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ryan Beisner (1chb1n) wrote :

There are a number of print(( changes which I think can just be print(. Happy to be proven incorrect, however.

review: Needs Fixing
lp:~chris.macnaughton/mojo/py3001 updated
466. By Chris MacNaughton

Remove print((

Revision history for this message
Ryan Beisner (1chb1n) wrote :

Ignoring existing lint issues at lp:mojo trunk, let's land this and continue to iterate/fix stuff. Thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'contrib/test/utils.py'
--- contrib/test/utils.py 2017-04-26 04:00:14 +0000
+++ contrib/test/utils.py 2018-01-18 11:04:49 +0000
@@ -44,6 +44,6 @@
44 """44 """
45 try:45 try:
46 subprocess.check_output(['juju', 'switch'])46 subprocess.check_output(['juju', 'switch'])
47 except subprocess.CalledProcessError, OSError:47 except subprocess.CalledProcessError as OSError:
48 print('Error checking active Juju controller')48 print('Error checking active Juju controller')
49 sys.exit(1)49 sys.exit(1)
5050
=== modified file 'mojo/cli.py'
--- mojo/cli.py 2017-11-08 14:58:22 +0000
+++ mojo/cli.py 2018-01-18 11:04:49 +0000
@@ -1,6 +1,6 @@
1# Copyright 2014, 2015 Canonical Ltd. This software is licensed under the1# Copyright 2014, 2015 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3from __future__ import print_function3
4import argparse4import argparse
5import errno5import errno
6import logging6import logging
@@ -256,7 +256,7 @@
256256
257257
258def list_projects(args):258def list_projects(args):
259 map(print, mojo.project.Project.list(args.mojo_root, only_names=args.names))259 list(map(print, mojo.project.Project.list(args.mojo_root, only_names=args.names)))
260260
261261
262@warn_if_root262@warn_if_root
@@ -312,7 +312,7 @@
312312
313def list_workspaces(args):313def list_workspaces(args):
314 project = mojo.project.Project(get_project_name(args), args.series, args.mojo_root)314 project = mojo.project.Project(get_project_name(args), args.series, args.mojo_root)
315 map(print, project.workspace_list())315 list(map(print, project.workspace_list()))
316316
317317
318def new_spec(args):318def new_spec(args):
319319
=== modified file 'mojo/contain.py'
--- mojo/contain.py 2017-12-14 10:13:12 +0000
+++ mojo/contain.py 2018-01-18 11:04:49 +0000
@@ -173,7 +173,7 @@
173 self.timeout = 60173 self.timeout = 60
174174
175 def _check_mount(self):175 def _check_mount(self):
176 if self.device_name in self.container.devices.keys():176 if self.device_name in list(self.container.devices.keys()):
177 return True177 return True
178 return False178 return False
179179
180180
=== modified file 'mojo/info.py'
--- mojo/info.py 2016-05-25 11:59:42 +0000
+++ mojo/info.py 2018-01-18 11:04:49 +0000
@@ -1,6 +1,6 @@
1# Copyright 2014 Canonical Ltd. This software is licensed under the1# Copyright 2014 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3from __future__ import print_function3
4from mojo.cli import MojoArgumentParser4from mojo.cli import MojoArgumentParser
5from mojo.juju.status import Status5from mojo.juju.status import Status
6import argparse6import argparse
@@ -59,7 +59,7 @@
59 prop))59 prop))
60 else:60 else:
61 if isinstance(values, list):61 if isinstance(values, list):
62 map(print, values)62 list(map(print, values))
63 else:63 else:
64 print(values)64 print(values)
65 sys.exit(0)65 sys.exit(0)
6666
=== modified file 'mojo/juju/__init__.py'
--- mojo/juju/__init__.py 2016-10-05 16:58:34 +0000
+++ mojo/juju/__init__.py 2018-01-18 11:04:49 +0000
@@ -1,10 +1,10 @@
1import subprocess1import subprocess
22
3from debuglogs import DebugLogs3from .debuglogs import DebugLogs
4from status import JujuStatusError, version, major_version4from .status import JujuStatusError, version, major_version
5from wait import JujuWaitException5from .wait import JujuWaitException
66
7if major_version == 1:7if major_version == 1:
8 from status import Juju1Status as Status8 from .status import Juju1Status as Status
9elif major_version == 2:9elif major_version == 2:
10 from status import Juju2Status as Status10 from .status import Juju2Status as Status
1111
=== modified file 'mojo/juju/check.py'
--- mojo/juju/check.py 2016-10-25 06:49:00 +0000
+++ mojo/juju/check.py 2018-01-18 11:04:49 +0000
@@ -6,8 +6,8 @@
6import inspect6import inspect
7import sys7import sys
88
9import checks9from . import checks
10from status import Juju2Status, JujuStatusError10from .status import Juju2Status, JujuStatusError
1111
1212
13def main():13def main():
@@ -25,7 +25,7 @@
25 if issubclass(clsmember, checks.JujuCheck):25 if issubclass(clsmember, checks.JujuCheck):
26 available_checks[clsmember.cmd_name] = clsmember26 available_checks[clsmember.cmd_name] = clsmember
2727
28 for check in available_checks.values():28 for check in list(available_checks.values()):
29 sub = sp.add_parser(check.cmd_name, description=check.help)29 sub = sp.add_parser(check.cmd_name, description=check.help)
30 check.setup_argparse(sub)30 check.setup_argparse(sub)
3131
3232
=== modified file 'mojo/juju/parse_status.py'
--- mojo/juju/parse_status.py 2017-12-07 15:09:39 +0000
+++ mojo/juju/parse_status.py 2018-01-18 11:04:49 +0000
@@ -4,7 +4,7 @@
4import argparse4import argparse
5import sys5import sys
66
7from status import Juju2Status7from .status import Juju2Status
88
99
10class StatusInfo:10class StatusInfo:
@@ -39,11 +39,11 @@
39 def run(self, args):39 def run(self, args):
40 ips = []40 ips = []
41 if 'all' in args.applications:41 if 'all' in args.applications:
42 for machine in self.status.yaml_status()['machines'].values():42 for machine in list(self.status.yaml_status()['machines'].values()):
43 if 'dns-name' in machine:43 if 'dns-name' in machine:
44 ips.append(machine['dns-name'])44 ips.append(machine['dns-name'])
45 if 'containers' in machine:45 if 'containers' in machine:
46 for container in machine['containers'].values():46 for container in list(machine['containers'].values()):
47 if 'dns-name' in container:47 if 'dns-name' in container:
48 ips.append(container['dns-name'])48 ips.append(container['dns-name'])
49 else:49 else:
@@ -71,7 +71,7 @@
7171
72 # Setup all available StatusInfo classes as subparsers72 # Setup all available StatusInfo classes as subparsers
73 available_info = {'get_ips': GetIPs}73 available_info = {'get_ips': GetIPs}
74 for cmd in available_info.values():74 for cmd in list(available_info.values()):
75 sub = sp.add_parser(cmd.name, description=cmd.help)75 sub = sp.add_parser(cmd.name, description=cmd.help)
76 cmd.setup_argparse(sub)76 cmd.setup_argparse(sub)
7777
7878
=== modified file 'mojo/juju/status.py'
--- mojo/juju/status.py 2017-11-21 09:59:26 +0000
+++ mojo/juju/status.py 2018-01-18 11:04:49 +0000
@@ -7,7 +7,7 @@
77
8from collections import Counter8from collections import Counter
99
10from wait import wait10from .wait import wait
1111
12try:12try:
13 with open(os.devnull, 'w') as devnull:13 with open(os.devnull, 'w') as devnull:
@@ -208,7 +208,7 @@
208 ['juju', 'status', '--format=tabular']))208 ['juju', 'status', '--format=tabular']))
209 raise JujuStatusError("Timed out checking Juju status for stable state")209 raise JujuStatusError("Timed out checking Juju status for stable state")
210 stable_state = []210 stable_state = []
211 for juju_objtype, check_info in checks.iteritems():211 for juju_objtype, check_info in checks.items():
212 for check in check_info:212 for check in check_info:
213 check_function = check['check_func']213 check_function = check['check_func']
214 states = check_function()214 states = check_function()
@@ -229,7 +229,7 @@
229 break229 break
230 time.sleep(5)230 time.sleep(5)
231 self._get_status(force_update=True)231 self._get_status(force_update=True)
232 for juju_objtype, check_info in checks.iteritems():232 for juju_objtype, check_info in checks.items():
233 for check in check_info:233 for check in check_info:
234 check_function = check['check_func']234 check_function = check['check_func']
235 states = check_function()235 states = check_function()
@@ -266,7 +266,7 @@
266 def _service_info(self, svc):266 def _service_info(self, svc):
267 if svc == "ALL":267 if svc == "ALL":
268 units = {}268 units = {}
269 for service in self.yaml_status()['services'].values():269 for service in list(self.yaml_status()['services'].values()):
270 for unit, data in service.get('units', {}).items():270 for unit, data in service.get('units', {}).items():
271 units[unit] = data271 units[unit] = data
272 elif svc not in self.yaml_status()['services']:272 elif svc not in self.yaml_status()['services']:
@@ -304,20 +304,20 @@
304 def service_ips(self, service):304 def service_ips(self, service):
305 units = self._service_info(service)305 units = self._service_info(service)
306 if units:306 if units:
307 return [u.get('public-address') for u in units.values()307 return [u.get('public-address') for u in list(units.values())
308 if u.get('public-address')]308 if u.get('public-address')]
309 return units309 return units
310310
311 def service_units(self, service):311 def service_units(self, service):
312 units = self._service_info(service)312 units = self._service_info(service)
313 if units:313 if units:
314 return units.keys()314 return list(units.keys())
315 return units315 return units
316316
317 def service_machine_numbers(self, service):317 def service_machine_numbers(self, service):
318 units = self._service_info(service)318 units = self._service_info(service)
319 if units:319 if units:
320 return [u.get('machine') for u in units.values()320 return [u.get('machine') for u in list(units.values())
321 if u.get('machine')]321 if u.get('machine')]
322 return units322 return units
323323
@@ -408,18 +408,18 @@
408 if units is None:408 if units is None:
409 return []409 return []
410410
411 return [u.get('public-address') for u in units.values() if u.get('public-address')]411 return [u.get('public-address') for u in list(units.values()) if u.get('public-address')]
412412
413 def application_machine_numbers(self, application):413 def application_machine_numbers(self, application):
414 units = self._get_units(application)414 units = self._get_units(application)
415 if units is None:415 if units is None:
416 return None416 return None
417417
418 return [u.get('machine') for u in units.values() if u.get('machine')]418 return [u.get('machine') for u in list(units.values()) if u.get('machine')]
419419
420 def applications_list(self, exclude_subordinates=True):420 def applications_list(self, exclude_subordinates=True):
421 applications = []421 applications = []
422 for app in self.yaml_status()['applications'].keys():422 for app in list(self.yaml_status()['applications'].keys()):
423 if exclude_subordinates and 'subordinate-to' in self.yaml_status()['applications'][app]:423 if exclude_subordinates and 'subordinate-to' in self.yaml_status()['applications'][app]:
424 continue424 continue
425 applications.append(app)425 applications.append(app)
@@ -431,7 +431,7 @@
431 if units is None:431 if units is None:
432 return None432 return None
433433
434 return units.keys()434 return list(units.keys())
435435
436 def applications_ready(self):436 def applications_ready(self):
437 """ Check status of all applications, raise JujuStatusError for an error state.437 """ Check status of all applications, raise JujuStatusError for an error state.
438438
=== modified file 'mojo/phase.py'
--- mojo/phase.py 2017-12-21 11:27:44 +0000
+++ mojo/phase.py 2018-01-18 11:04:49 +0000
@@ -1,10 +1,10 @@
1# Copyright 2014 Canonical Ltd. This software is licensed under the1# Copyright 2014 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3import commands3import subprocess
4import os4import os
5import logging5import logging
6import subprocess6import subprocess
7import charm_repo7from . import charm_repo
8import re8import re
9import shutil9import shutil
10import tempfile10import tempfile
@@ -476,7 +476,7 @@
476 if not modified:476 if not modified:
477 return477 return
478478
479 for service, changes in modified.iteritems():479 for service, changes in modified.items():
480 deployer_config_items = changes.get('cfg-config')480 deployer_config_items = changes.get('cfg-config')
481 if not deployer_config_items:481 if not deployer_config_items:
482 # Something differs, e.g. constraints, but not the config.482 # Something differs, e.g. constraints, but not the config.
@@ -485,7 +485,7 @@
485 juju_set_command = ['juju', mojo.juju.utils.get_juju_command('set'), service]485 juju_set_command = ['juju', mojo.juju.utils.get_juju_command('set'), service]
486 config_changes = []486 config_changes = []
487487
488 for config_item, config_value in deployer_config_items.iteritems():488 for config_item, config_value in deployer_config_items.items():
489 # At some point, "juju set" started trimming newlines,489 # At some point, "juju set" started trimming newlines,
490 # which I endorse; but we may get a false positive here.490 # which I endorse; but we may get a false positive here.
491 if identical_but_wrapped_in_newlines(491 if identical_but_wrapped_in_newlines(
@@ -616,7 +616,7 @@
616 # Take in MOJO_* variables from the environment616 # Take in MOJO_* variables from the environment
617 tmpl_vars = {}617 tmpl_vars = {}
618 env = os.environ.copy()618 env = os.environ.copy()
619 for key in env.iterkeys():619 for key in env.keys():
620 if 'MOJO_' in key:620 if 'MOJO_' in key:
621 tmpl_vars[key] = env[key]621 tmpl_vars[key] = env[key]
622 # Process the deployment configs as a Jinja2 template622 # Process the deployment configs as a Jinja2 template
@@ -948,7 +948,7 @@
948948
949 _run = super(VerifyPhase, self).run949 _run = super(VerifyPhase, self).run
950950
951 for i in xrange(1, retry + 1):951 for i in range(1, retry + 1):
952 if i > 1:952 if i > 1:
953 logging.info(953 logging.info(
954 "Retrying (attempt {} of {})".format(954 "Retrying (attempt {} of {})".format(
@@ -1057,7 +1057,7 @@
1057 '[ -f ${CHARMDIR}/codetree-collect-info.yaml ] && '1057 '[ -f ${CHARMDIR}/codetree-collect-info.yaml ] && '
1058 'cat ${CHARMDIR}/codetree-collect-info.yaml| sed -e "s/^/ /" || true; done')1058 'cat ${CHARMDIR}/codetree-collect-info.yaml| sed -e "s/^/ /" || true; done')
1059 cmd = ['juju', 'ssh', machine_id, "'{}'".format(audit_cmd), "2>/dev/null"]1059 cmd = ['juju', 'ssh', machine_id, "'{}'".format(audit_cmd), "2>/dev/null"]
1060 status, output = commands.getstatusoutput(" ".join(cmd))1060 status, output = subprocess.getstatusoutput(" ".join(cmd))
1061 if status != 0:1061 if status != 0:
1062 raise CharmAuditPhaseException("Unknown error trying to run {}: {}".format(" ".join(cmd), output))1062 raise CharmAuditPhaseException("Unknown error trying to run {}: {}".format(" ".join(cmd), output))
1063 return output1063 return output
@@ -1065,7 +1065,7 @@
1065 def parse_charm_audit_output(self, audit_output):1065 def parse_charm_audit_output(self, audit_output):
1066 audit_info = yaml.safe_load(audit_output)1066 audit_info = yaml.safe_load(audit_output)
1067 parsed_audit_output = {}1067 parsed_audit_output = {}
1068 for unit in audit_info.keys():1068 for unit in list(audit_info.keys()):
1069 try:1069 try:
1070 collect_url = audit_info[unit]['collect_url']1070 collect_url = audit_info[unit]['collect_url']
1071 except KeyError:1071 except KeyError:
@@ -1074,7 +1074,7 @@
1074 application = audit_info[unit]['application']1074 application = audit_info[unit]['application']
10751075
1076 try:1076 try:
1077 collect_urls = parsed_audit_output[application].keys()1077 collect_urls = list(parsed_audit_output[application].keys())
1078 except KeyError:1078 except KeyError:
1079 collect_urls = []1079 collect_urls = []
1080 finally:1080 finally:
@@ -1119,7 +1119,7 @@
1119 "sed 's/.*/(set -x; & \&\& echo MOJO_NAGIOS_OK) || echo MOJO_NAGIOS_FAIL /'" \1119 "sed 's/.*/(set -x; & \&\& echo MOJO_NAGIOS_OK) || echo MOJO_NAGIOS_FAIL /'" \
1120 "|sudo -u nagios -s bash".format(skip_check_command)1120 "|sudo -u nagios -s bash".format(skip_check_command)
1121 cmd = ['juju', 'ssh', unit, '"{}"'.format(check_cmd), "2>/dev/null"]1121 cmd = ['juju', 'ssh', unit, '"{}"'.format(check_cmd), "2>/dev/null"]
1122 status, output = commands.getstatusoutput(" ".join(cmd))1122 status, output = subprocess.getstatusoutput(" ".join(cmd))
1123 error_output, ok_output = "", ""1123 error_output, ok_output = "", ""
1124 if status != 0:1124 if status != 0:
1125 if 'No such file or directory' in output or 'sudo: unknown user: nagios' in output:1125 if 'No such file or directory' in output or 'sudo: unknown user: nagios' in output:
11261126
=== modified file 'mojo/project.py'
--- mojo/project.py 2017-06-18 23:54:07 +0000
+++ mojo/project.py 2018-01-18 11:04:49 +0000
@@ -206,7 +206,7 @@
206 "project".format(self.name, self.root))206 "project".format(self.name, self.root))
207 else:207 else:
208 try:208 try:
209 mkdirs(self.root, self.owner, mode=0700)209 mkdirs(self.root, self.owner, mode=0o700)
210 except OSError as e:210 except OSError as e:
211 raise ProjectCreationError(211 raise ProjectCreationError(
212 "Could not create project root: {}".format(e.strerror))212 "Could not create project root: {}".format(e.strerror))
@@ -216,7 +216,7 @@
216 "using it.".format(self.name, self.project_series))216 "using it.".format(self.name, self.project_series))
217 else:217 else:
218 try:218 try:
219 mkdirs(self.project_series, self.owner, mode=0700)219 mkdirs(self.project_series, self.owner, mode=0o700)
220 except OSError as e:220 except OSError as e:
221 raise ProjectCreationError(221 raise ProjectCreationError(
222 "Could not create project project_series: "222 "Could not create project project_series: "
@@ -246,7 +246,7 @@
246 logging.info("Checking {} project dir {} ..."246 logging.info("Checking {} project dir {} ..."
247 "".format(self.name, self.container_project_series))247 "".format(self.name, self.container_project_series))
248 if not os.path.exists(self.container_project_series):248 if not os.path.exists(self.container_project_series):
249 mkdirs(self.container_project_series, self.owner, mode=0700)249 mkdirs(self.container_project_series, self.owner, mode=0o700)
250250
251 sudoers_file = os.path.join(self.project_container_root, "etc", "sudoers.d",251 sudoers_file = os.path.join(self.project_container_root, "etc", "sudoers.d",
252 "ubuntu-all")252 "ubuntu-all")
@@ -254,7 +254,7 @@
254 self.name, sudoers_file))254 self.name, sudoers_file))
255 with open(sudoers_file, "w") as f:255 with open(sudoers_file, "w") as f:
256 f.write("ubuntu ALL=(ALL) NOPASSWD: ALL\n")256 f.write("ubuntu ALL=(ALL) NOPASSWD: ALL\n")
257 os.chmod(sudoers_file, 0400)257 os.chmod(sudoers_file, 0o400)
258258
259 if not os.path.exists(os.path.join(self.project_series, '.project')):259 if not os.path.exists(os.path.join(self.project_series, '.project')):
260 self.write_project_info()260 self.write_project_info()
@@ -294,19 +294,19 @@
294294
295 # Validate the project exists295 # Validate the project exists
296 if self.name not in self.list(self.mojo_root, True):296 if self.name not in self.list(self.mojo_root, True):
297 print "Project, '{}', does not appear to exist.".format(self.name)297 print("Project, '{}', does not appear to exist.".format(self.name))
298 print "Please run 'mojo project-new --series {} {}' to " \298 print("Please run 'mojo project-new --series {} {}' to " \
299 "create the project.".format(self.series, self.name)299 "create the project.".format(self.series, self.name))
300 print "Or check the file permissions on {}".format(self.root)300 print("Or check the file permissions on {}".format(self.root))
301 sys.exit(1)301 sys.exit(1)
302 if not self.container.exists() or not self.container.is_setup():302 if not self.container.exists() or not self.container.is_setup():
303 print "The container project and series path for {} does not appear " \303 print("The container project and series path for {} does not appear " \
304 "to exist at {}.".format(self.name, self.container_project_series)304 "to exist at {}.".format(self.name, self.container_project_series))
305 print "Check to make sure the project and series exist and " \305 print("Check to make sure the project and series exist and " \
306 "permissions are set properly."306 "permissions are set properly.")
307 print "Please run 'mojo project-new --series {} {}' to " \307 print("Please run 'mojo project-new --series {} {}' to " \
308 "create the project if needed.".format(self.series, self.name)308 "create the project if needed.".format(self.series, self.name))
309 print "Or check the file permissions on {}".format(self.container_project_series)309 print("Or check the file permissions on {}".format(self.container_project_series))
310 sys.exit(1)310 sys.exit(1)
311311
312 # If we're using nested directories for specs, make sure our workspace312 # If we're using nested directories for specs, make sure our workspace
313313
=== modified file 'mojo/project_destroy.py'
--- mojo/project_destroy.py 2016-11-21 22:15:55 +0000
+++ mojo/project_destroy.py 2018-01-18 11:04:49 +0000
@@ -1,7 +1,7 @@
1# Copyright 2015 Canonical Ltd. This software is licensed under the1# Copyright 2015 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3import os3import os
4import cli4from . import cli
5from .utils import setup_logging5from .utils import setup_logging
66
77
88
=== modified file 'mojo/project_new.py'
--- mojo/project_new.py 2016-11-25 17:27:11 +0000
+++ mojo/project_new.py 2018-01-18 11:04:49 +0000
@@ -1,7 +1,7 @@
1# Copyright 2015 Canonical Ltd. This software is licensed under the1# Copyright 2015 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3import os3import os
4import cli4from . import cli
5from .utils import setup_logging5from .utils import setup_logging
66
77
88
=== modified file 'mojo/tests/test_debuglogs.py'
--- mojo/tests/test_debuglogs.py 2017-01-11 14:24:11 +0000
+++ mojo/tests/test_debuglogs.py 2018-01-18 11:04:49 +0000
@@ -19,7 +19,7 @@
19 @mock.patch('subprocess.check_output')19 @mock.patch('subprocess.check_output')
20 def test__resolve_remote_paths(self, _check_output):20 def test__resolve_remote_paths(self, _check_output):
21 """Test _resolve_remote_paths"""21 """Test _resolve_remote_paths"""
22 _check_output.return_value = u"['/etc/init.d/apache2']"22 _check_output.return_value = "['/etc/init.d/apache2']"
23 ws = None23 ws = None
24 debug_logs = DebugLogs(ws, "production", None, None)24 debug_logs = DebugLogs(ws, "production", None, None)
25 self.assertEqual(debug_logs._resolve_remote_paths('apache2/0', '/etc/init.d/apache2'),25 self.assertEqual(debug_logs._resolve_remote_paths('apache2/0', '/etc/init.d/apache2'),
2626
=== modified file 'mojo/tests/test_juju2.py'
--- mojo/tests/test_juju2.py 2017-12-08 10:58:48 +0000
+++ mojo/tests/test_juju2.py 2018-01-18 11:04:49 +0000
@@ -2,7 +2,7 @@
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3import mock3import mock
4import os4import os
5from StringIO import StringIO5from io import StringIO
6import sys6import sys
7from unittest import TestCase7from unittest import TestCase
88
99
=== modified file 'mojo/tests/test_mojo.py'
--- mojo/tests/test_mojo.py 2017-05-11 01:27:01 +0000
+++ mojo/tests/test_mojo.py 2018-01-18 11:04:49 +0000
@@ -5,7 +5,7 @@
5from tempfile import mkdtemp5from tempfile import mkdtemp
6from shutil import rmtree6from shutil import rmtree
7import subprocess7import subprocess
8import commands8import subprocess
9import os9import os
10import sys10import sys
11import time11import time
@@ -260,7 +260,7 @@
260 ]260 ]
261 for cmd in cmds:261 for cmd in cmds:
262 bc_status, bc_output = mojo.utils.bicommand(cmd)262 bc_status, bc_output = mojo.utils.bicommand(cmd)
263 c_status, c_output = commands.getstatusoutput(cmd)263 c_status, c_output = subprocess.getstatusoutput(cmd)
264264
265 # We don't care about return codes, we just want to confirm they're265 # We don't care about return codes, we just want to confirm they're
266 # both returning zero or non-zero266 # both returning zero or non-zero
267267
=== modified file 'mojo/tests/utils.py'
--- mojo/tests/utils.py 2017-04-19 02:09:34 +0000
+++ mojo/tests/utils.py 2018-01-18 11:04:49 +0000
@@ -43,7 +43,7 @@
43 with open(os.path.join(directory, manifest_path), 'w+') as fp:43 with open(os.path.join(directory, manifest_path), 'w+') as fp:
44 fp.write(content)44 fp.write(content)
4545
46 filenames = list(filenames) + manifests.keys()46 filenames = list(filenames) + list(manifests.keys())
4747
48 with mojo.utils.chdir(directory):48 with mojo.utils.chdir(directory):
49 for filename in filenames:49 for filename in filenames:
5050
=== modified file 'mojo/volattach.py'
--- mojo/volattach.py 2016-09-21 17:00:41 +0000
+++ mojo/volattach.py 2018-01-18 11:04:49 +0000
@@ -1,7 +1,7 @@
1# Copyright 2014 Canonical Ltd. This software is licensed under the1# Copyright 2014 Canonical Ltd. This software is licensed under the
2# GNU General Public License version 3 (see the file LICENSE).2# GNU General Public License version 3 (see the file LICENSE).
3"""A helper for attaching volumes to Juju instances"""3"""A helper for attaching volumes to Juju instances"""
4from __future__ import print_function4
5from subprocess import check_call5from subprocess import check_call
6import os6import os
7import sys7import sys
@@ -132,7 +132,7 @@
132 for volume_id in [v for (v, u) in unit_map.items() if u is None]:132 for volume_id in [v for (v, u) in unit_map.items() if u is None]:
133 if status.service_units(service):133 if status.service_units(service):
134 units = [u for u in status.service_units(service)134 units = [u for u in status.service_units(service)
135 if u not in unit_map.values()]135 if u not in list(unit_map.values())]
136 else:136 else:
137 raise VolumeConfigError("No service {} found".format(service))137 raise VolumeConfigError("No service {} found".format(service))
138 if units:138 if units:
139139
=== modified file 'mojo/workspace.py'
--- mojo/workspace.py 2016-02-05 23:40:05 +0000
+++ mojo/workspace.py 2018-01-18 11:04:49 +0000
@@ -61,7 +61,7 @@
6161
62 def clean(self):62 def clean(self):
63 "Reset the workspace"63 "Reset the workspace"
64 map(shutil.rmtree, (d for d in self.all_dirs if os.path.exists(d)))64 list(map(shutil.rmtree, (d for d in self.all_dirs if os.path.exists(d))))
65 return self.prepare()65 return self.prepare()
6666
67 def delete(self):67 def delete(self):
6868
=== modified file 'tox.ini'
--- tox.ini 2018-01-18 10:03:30 +0000
+++ tox.ini 2018-01-18 11:04:49 +0000
@@ -13,5 +13,5 @@
13[testenv:mojo_exec]13[testenv:mojo_exec]
14basepython = python314basepython = python3
15deps = -r{toxinidir}/requirements.txt15deps = -r{toxinidir}/requirements.txt
16commands = pip install .16commands = pip install --upgrade .
17 mojo --version17 mojo --version

Subscribers

People subscribed via source and target branches