Merge lp:~ajkavanagh/charm-helpers/fix-lint-and-errors into lp:charm-helpers

Proposed by Alex Kavanagh
Status: Merged
Merged at revision: 764
Proposed branch: lp:~ajkavanagh/charm-helpers/fix-lint-and-errors
Merge into: lp:charm-helpers
Diff against target: 71 lines (+13/-9)
3 files modified
charmhelpers/contrib/storage/linux/ceph.py (+1/-1)
charmhelpers/fetch/snap.py (+11/-5)
tests/contrib/openstack/test_openstack_utils.py (+1/-3)
To merge this branch: bzr merge lp:~ajkavanagh/charm-helpers/fix-lint-and-errors
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+327788@code.launchpad.net

Description of the change

Fix lint and other errors introduced in last few merges

It seems likely that the last couple of merges have been performed
without running a 'make test' before pushing it back to tip.
Essentially, the tip of charm-helpers won't pass make-test, and the
ceph changes unbreaks a breaking change introduced to charm-helpers
recently. Please can we ensure that we run 'make test', and fix
ALL the errors, before merging back into devel's tip.

To post a comment you must log in.
Revision history for this message
James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/storage/linux/ceph.py'
2--- charmhelpers/contrib/storage/linux/ceph.py 2017-06-09 15:06:01 +0000
3+++ charmhelpers/contrib/storage/linux/ceph.py 2017-07-20 13:36:29 +0000
4@@ -1372,7 +1372,7 @@
5 return {}
6
7 conf = config_flags_parser(conf)
8- if type(conf) != dict:
9+ if not isinstance(conf, dict):
10 log("Provided config-flags is not a dictionary - ignoring",
11 level=WARNING)
12 return {}
13
14=== modified file 'charmhelpers/fetch/snap.py'
15--- charmhelpers/fetch/snap.py 2017-06-16 23:07:35 +0000
16+++ charmhelpers/fetch/snap.py 2017-07-20 13:36:29 +0000
17@@ -18,13 +18,15 @@
18 https://lists.ubuntu.com/archives/snapcraft/2016-September/001114.html
19 """
20 import subprocess
21-from os import environ
22+import os
23 from time import sleep
24 from charmhelpers.core.hookenv import log
25
26 __author__ = 'Joseph Borg <joseph.borg@canonical.com>'
27
28-SNAP_NO_LOCK = 1 # The return code for "couldn't acquire lock" in Snap (hopefully this will be improved).
29+# The return code for "couldn't acquire lock" in Snap
30+# (hopefully this will be improved).
31+SNAP_NO_LOCK = 1
32 SNAP_NO_LOCK_RETRY_DELAY = 10 # Wait X seconds between Snap lock checks.
33 SNAP_NO_LOCK_RETRY_COUNT = 30 # Retry to acquire the lock X times.
34 SNAP_CHANNELS = [
35@@ -53,13 +55,17 @@
36
37 while return_code is None or return_code == SNAP_NO_LOCK:
38 try:
39- return_code = subprocess.check_call(['snap'] + commands, env=environ)
40+ return_code = subprocess.check_call(['snap'] + commands,
41+ env=os.environ)
42 except subprocess.CalledProcessError as e:
43 retry_count += + 1
44 if retry_count > SNAP_NO_LOCK_RETRY_COUNT:
45- raise CouldNotAcquireLockException('Could not aquire lock after %s attempts' % SNAP_NO_LOCK_RETRY_COUNT)
46+ raise CouldNotAcquireLockException(
47+ 'Could not aquire lock after {} attempts'
48+ .format(SNAP_NO_LOCK_RETRY_COUNT))
49 return_code = e.returncode
50- log('Snap failed to acquire lock, trying again in %s seconds.' % SNAP_NO_LOCK_RETRY_DELAY, level='WARN')
51+ log('Snap failed to acquire lock, trying again in {} seconds.'
52+ .format(SNAP_NO_LOCK_RETRY_DELAY, level='WARN'))
53 sleep(SNAP_NO_LOCK_RETRY_DELAY)
54
55 return return_code
56
57=== modified file 'tests/contrib/openstack/test_openstack_utils.py'
58--- tests/contrib/openstack/test_openstack_utils.py 2017-06-16 23:07:35 +0000
59+++ tests/contrib/openstack/test_openstack_utils.py 2017-07-20 13:36:29 +0000
60@@ -1946,11 +1946,9 @@
61 snaps = ['os_project']
62 mode = 'jailmode'
63 src = 'snap:beta-xenial-ocata'
64- post_install = MagicMock()
65-
66 openstack.install_os_snaps(
67 openstack.get_snaps_install_info_from_origin(
68- snaps, src, mode=mode))
69+ snaps, src, mode=mode))
70 mock_snap_install.assert_called_with(
71 'os_project', '--beta', '--jailmode')
72

Subscribers

People subscribed via source and target branches