From 84fa24c2ac43d0824782fd0de7b5400bb24538cf Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Mon, 11 Jan 2016 10:46:02 -0500 Subject: [PATCH] update for lint --- hooks/ceph.py | 14 +++++++------- hooks/ceph_hooks.py | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hooks/ceph.py b/hooks/ceph.py index b7a9cc8..b3e6fea 100644 --- a/hooks/ceph.py +++ b/hooks/ceph.py @@ -12,6 +12,7 @@ import subprocess import time import os import re +import sys from charmhelpers.core.host import ( mkdir, chownr, @@ -44,6 +45,7 @@ QUORUM = [LEADER, PEON] PACKAGES = ['ceph', 'gdisk', 'ntp', 'btrfs-tools', 'python-ceph', 'xfsprogs'] + def ceph_user(): if get_version() > 1: return 'ceph' @@ -60,16 +62,12 @@ def get_version(): try: pkg = cache[package] except: - if not fatal: - return None # the package is unknown to the current apt cache. e = 'Could not determine version of package with no installation '\ 'candidate: %s' % package error_out(e) if not pkg.current_ver: - if not fatal: - return None # package is known, but no version is currently installed. e = 'Could not determine version of uninstalled package: %s' % package error_out(e) @@ -86,7 +84,8 @@ def get_version(): def error_out(msg): - juju_log("FATAL ERROR: %s" % msg, level='ERROR') + log("FATAL ERROR: %s" % msg, + level=ERROR) sys.exit(1) @@ -338,7 +337,7 @@ def upgrade_key_caps(key, caps): # Not the MON leader OR not clustered return cmd = [ - "sudo", "-u", ceph_user(),'ceph', 'auth', 'caps', key + "sudo", "-u", ceph_user(), 'ceph', 'auth', 'caps', key ] for subsystem, subcaps in caps.iteritems(): cmd.extend([subsystem, '; '.join(subcaps)]) @@ -365,7 +364,8 @@ def bootstrap_monitor_cluster(secret): log('bootstrap_monitor_cluster: mon already initialized.') else: # Ceph >= 0.61.3 needs this for ceph-mon fs creation - mkdir('/var/run/ceph', owner=ceph_user(), group=ceph_user(), perms=0o755) + mkdir('/var/run/ceph', owner=ceph_user(), + group=ceph_user(), perms=0o755) mkdir(path, owner=ceph_user(), group=ceph_user()) # end changes for Ceph >= 0.61.3 try: diff --git a/hooks/ceph_hooks.py b/hooks/ceph_hooks.py index 387191e..3a38393 100755 --- a/hooks/ceph_hooks.py +++ b/hooks/ceph_hooks.py @@ -111,7 +111,8 @@ def emit_cephconf(): # Install ceph.conf as an alternative to support # co-existence with other charms that write this file charm_ceph_conf = "/var/lib/charm/{}/ceph.conf".format(service_name()) - mkdir(os.path.dirname(charm_ceph_conf), owner=ceph.ceph_user(), group=ceph.ceph_user()) + mkdir(os.path.dirname(charm_ceph_conf), owner=ceph.ceph_user(), + group=ceph.ceph_user()) render('ceph.conf', charm_ceph_conf, cephcontext, perms=0o644) install_alternative('ceph.conf', '/etc/ceph/ceph.conf', charm_ceph_conf, 100)