From 6665c3b78fff37b5565a5ae55e9aa8dd666f4433 Mon Sep 17 00:00:00 2001 From: James Page Date: Fri, 7 Nov 2014 17:46:25 +0100 Subject: [PATCH] Tidy lint --- Makefile | 2 +- config.yaml | 56 +++++------------------------------ hooks/fabfile.py | 2 +- hooks/nova_compute_context.py | 40 ++++++++++++------------- hooks/nova_compute_proxy.py | 6 ++-- hooks/nova_compute_utils.py | 3 +- metadata.yaml | 2 +- 7 files changed, 36 insertions(+), 75 deletions(-) diff --git a/Makefile b/Makefile index 2fc0c8a..52caa19 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PYTHON := /usr/bin/env python lint: - @flake8 --exclude hooks/charmhelpers hooks unit_tests + @flake8 --exclude hooks/charmhelpers hooks @charm proof sync: diff --git a/config.yaml b/config.yaml index 683cd63..39bc287 100644 --- a/config.yaml +++ b/config.yaml @@ -5,18 +5,23 @@ options: description: OpenStack release to use for configuration of POWER hypervisor. power-user: type: string + default: description: Username used to access POWER hypervisors. power-key: type: string + default: description: SSH key to use to accesss POWER hypervisors. power-repo: type: string + default: description: RPM repository of OpenStack packages to deploy to POWER hypervisors. power-hosts: type: string + default: description: POWER hosts to manager; space delimited. power-password: type: string + default: description: sudo password on POWER hypervisor rabbit-user: default: nova @@ -25,7 +30,7 @@ options: rabbit-vhost: default: openstack type: string - decsription: Rabbitmq vhost + description: Rabbitmq vhost use-syslog: type: boolean default: False @@ -40,56 +45,11 @@ options: default: nova type: string description: Database name - multi-host: - default: "yes" - type: string - description: Whether to run nova-api and nova-network on the compute nodes. - enable-resize: - default: False - type: boolean - description: Enable instance resizing, which requires that passwordless SSH - access be setup between compute hosts. - enable-live-migration: - default: False - type: boolean - description: Configure libvirt for live migration. - migration-auth-type: - default: sasl - type: string - description: | - TCP authentication scheme for libvirt live migration. Available options - include sasl or none. - # needed if using flatmanager - bridge-interface: - default: br100 - type: string - description: Bridge interface to be configured - bridge-ip: - default: 11.0.0.1 - type: string - description: IP to be assigned to bridge interface - bridge-netmask: - default: 255.255.255.0 - type: string - description: Netmask to be assigned to bridge interface - # needed if using flatdhcpmanager - flat-interface: - default: eth1 - type: string - description: Network interface on which to build bridge instances-path: type: string + default: description: Instance path to use - empty means default of /var/lib/nova/instances config-flags: type: string + default: description: Comma separated list of key=value config flags to be set in nova.conf. - nagios_context: - default: "juju" - type: string - description: | - Used by the nrpe-external-master subordinate charm. - A string that will be prepended to instance name to set the host name - in nagios. So for instance the hostname would be something like: - juju-myservice-0 - If you're running multiple environments with the same services in them - this allows you to differentiate between them. diff --git a/hooks/fabfile.py b/hooks/fabfile.py index 0a3dc38..f9fa5bc 100644 --- a/hooks/fabfile.py +++ b/hooks/fabfile.py @@ -30,7 +30,7 @@ def yum_install(packages): def restart_service(service): - sudo('service openstack-nova-%s restart' %service) + sudo('service openstack-nova-%s restart' % service) def add_bridge(): diff --git a/hooks/nova_compute_context.py b/hooks/nova_compute_context.py index bda058a..822e2a2 100644 --- a/hooks/nova_compute_context.py +++ b/hooks/nova_compute_context.py @@ -44,32 +44,32 @@ def _network_manager(): def _neutron_security_groups(): - ''' - Inspects current cloud-compute relation and determine if nova-c-c has - instructed us to use neutron security groups. - ''' - for rid in relation_ids('cloud-compute'): - for unit in related_units(rid): - groups = [ - relation_get('neutron_security_groups', - rid=rid, unit=unit), - relation_get('quantum_security_groups', - rid=rid, unit=unit) - ] - if ('yes' in groups or 'Yes' in groups): - return True - return False + ''' + Inspects current cloud-compute relation and determine if nova-c-c has + instructed us to use neutron security groups. + ''' + for rid in relation_ids('cloud-compute'): + for unit in related_units(rid): + groups = [ + relation_get('neutron_security_groups', + rid=rid, unit=unit), + relation_get('quantum_security_groups', + rid=rid, unit=unit) + ] + if ('yes' in groups or 'Yes' in groups): + return True + return False def _neutron_plugin(): - from nova_compute_utils import neutron_plugin - return neutron_plugin() + from nova_compute_utils import neutron_plugin + return neutron_plugin() def _neutron_url(rid, unit): - # supports legacy relation settings. - return (relation_get('neutron_url', rid=rid, unit=unit) or - relation_get('quantum_url', rid=rid, unit=unit)) + # supports legacy relation settings. + return (relation_get('neutron_url', rid=rid, unit=unit) or + relation_get('quantum_url', rid=rid, unit=unit)) class NovaComputeLibvirtContext(context.OSContextGenerator): diff --git a/hooks/nova_compute_proxy.py b/hooks/nova_compute_proxy.py index d6a57f1..ad80c19 100644 --- a/hooks/nova_compute_proxy.py +++ b/hooks/nova_compute_proxy.py @@ -79,7 +79,7 @@ class POWERProxy(): env.connection_attempts = 10 env.timeout = 10 env.user = self.user - env.key_filename= self.key_filename + env.key_filename = self.key_filename env.hosts = self.hosts env.password = self.password @@ -150,7 +150,7 @@ def restart_on_change(restart_map, func): if checksums[path] != file_hash(path): restarts += restart_map[path] services_list = list(OrderedDict.fromkeys(restarts)) - for service_name in services_list: - func(service_name) + for s_name in services_list: + func(s_name) return wrapped_f return wrap diff --git a/hooks/nova_compute_utils.py b/hooks/nova_compute_utils.py index b6f8925..d905d8c 100644 --- a/hooks/nova_compute_utils.py +++ b/hooks/nova_compute_utils.py @@ -99,7 +99,8 @@ def resource_map(): resource_map.update(nm_rsc) conf = os.path.join(conf_path, - neutron_plugin_attribute(plugin, 'config', net_manager)) + neutron_plugin_attribute(plugin, 'config', + net_manager)) ctxts = (neutron_plugin_attribute(plugin, 'contexts', net_manager) or []) resource_map[conf] = {} diff --git a/metadata.yaml b/metadata.yaml index 5c2ca6b..cb6041b 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -5,7 +5,7 @@ description: | OpenStack Compute, codenamed Nova, is a cloud computing fabric controller. In addition to its "native" API (the OpenStack API), it also supports the Amazon EC2 API. -categories: +tags: - openstack provides: cloud-compute: