fixing pep8
This commit is contained in:
@@ -4,7 +4,8 @@ import uuid
|
|||||||
NOVA_CONF = "/etc/nova/nova.conf"
|
NOVA_CONF = "/etc/nova/nova.conf"
|
||||||
CEILOMETER_CONF = "/etc/ceilometer/ceilometer.conf"
|
CEILOMETER_CONF = "/etc/ceilometer/ceilometer.conf"
|
||||||
CEILOMETER_COMPUTE_SERVICES = ['ceilometer-agent-compute']
|
CEILOMETER_COMPUTE_SERVICES = ['ceilometer-agent-compute']
|
||||||
CEILOMETER_PACKAGES = ['python-ceilometer', 'ceilometer-common', 'ceilometer-agent-compute']
|
CEILOMETER_PACKAGES = ['python-ceilometer', 'ceilometer-common',
|
||||||
|
'ceilometer-agent-compute']
|
||||||
NOVA_SETTINGS = [
|
NOVA_SETTINGS = [
|
||||||
('DEFAULT', 'instance_usage_audit', 'True'),
|
('DEFAULT', 'instance_usage_audit', 'True'),
|
||||||
('DEFAULT', 'instance_usage_audit_period', 'hour'),
|
('DEFAULT', 'instance_usage_audit_period', 'hour'),
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ def install():
|
|||||||
|
|
||||||
# add line at the end, it's a dupe and configparser doesn't handle it
|
# add line at the end, it's a dupe and configparser doesn't handle it
|
||||||
with open(ceilometer_utils.NOVA_CONF, "a") as f:
|
with open(ceilometer_utils.NOVA_CONF, "a") as f:
|
||||||
f.write("notification_driver=nova.openstack.common.notifier.rabbit_notifier\n")
|
f.write("notification_driver="\
|
||||||
|
"nova.openstack.common.notifier.rabbit_notifier\n")
|
||||||
|
|
||||||
utils.restart(*ceilometer_utils.CEILOMETER_COMPUTE_SERVICES)
|
utils.restart(*ceilometer_utils.CEILOMETER_COMPUTE_SERVICES)
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import re
|
|||||||
import ceilometer_utils
|
import ceilometer_utils
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
|
||||||
def do_hooks(hooks):
|
def do_hooks(hooks):
|
||||||
hook = os.path.basename(sys.argv[0])
|
hook = os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ CLOUD_ARCHIVE_POCKETS = {
|
|||||||
'precise-grizzly/proposed': 'precise-proposed/grizzly'
|
'precise-grizzly/proposed': 'precise-proposed/grizzly'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def configure_source():
|
def configure_source():
|
||||||
source = str(config_get('openstack-origin'))
|
source = str(config_get('openstack-origin'))
|
||||||
if not source:
|
if not source:
|
||||||
@@ -87,6 +89,7 @@ def configure_source():
|
|||||||
]
|
]
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def juju_log(severity, message):
|
def juju_log(severity, message):
|
||||||
cmd = [
|
cmd = [
|
||||||
'juju-log',
|
'juju-log',
|
||||||
@@ -95,6 +98,7 @@ def juju_log(severity, message):
|
|||||||
]
|
]
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def config_get(attribute):
|
def config_get(attribute):
|
||||||
cmd = [
|
cmd = [
|
||||||
'config-get',
|
'config-get',
|
||||||
@@ -106,6 +110,7 @@ def config_get(attribute):
|
|||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def _service_ctl(service, action):
|
def _service_ctl(service, action):
|
||||||
subprocess.check_call(['service', service, action])
|
subprocess.check_call(['service', service, action])
|
||||||
|
|
||||||
@@ -134,6 +139,7 @@ def get_os_version(package=None):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def modify_config_file(nova_conf, values):
|
def modify_config_file(nova_conf, values):
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
@@ -150,6 +156,7 @@ def modify_config_file(nova_conf, values):
|
|||||||
juju_log('ERROR', 'nova config file must exist at this point')
|
juju_log('ERROR', 'nova config file must exist at this point')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def relation_ids(relation):
|
def relation_ids(relation):
|
||||||
cmd = [
|
cmd = [
|
||||||
'relation-ids',
|
'relation-ids',
|
||||||
@@ -157,6 +164,7 @@ def relation_ids(relation):
|
|||||||
]
|
]
|
||||||
return subprocess.check_output(cmd).split() # IGNORE:E1103
|
return subprocess.check_output(cmd).split() # IGNORE:E1103
|
||||||
|
|
||||||
|
|
||||||
def relation_list(rid):
|
def relation_list(rid):
|
||||||
cmd = [
|
cmd = [
|
||||||
'relation-list',
|
'relation-list',
|
||||||
@@ -164,6 +172,7 @@ def relation_list(rid):
|
|||||||
]
|
]
|
||||||
return subprocess.check_output(cmd).split() # IGNORE:E1103
|
return subprocess.check_output(cmd).split() # IGNORE:E1103
|
||||||
|
|
||||||
|
|
||||||
def relation_get(attribute, unit=None, rid=None):
|
def relation_get(attribute, unit=None, rid=None):
|
||||||
cmd = [
|
cmd = [
|
||||||
'relation-get',
|
'relation-get',
|
||||||
@@ -180,6 +189,7 @@ def relation_get(attribute, unit=None, rid=None):
|
|||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
def relation_set(**kwargs):
|
def relation_set(**kwargs):
|
||||||
cmd = [
|
cmd = [
|
||||||
'relation-set'
|
'relation-set'
|
||||||
@@ -194,6 +204,7 @@ def relation_set(**kwargs):
|
|||||||
cmd += args
|
cmd += args
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def unit_get(attribute):
|
def unit_get(attribute):
|
||||||
cmd = [
|
cmd = [
|
||||||
'unit-get',
|
'unit-get',
|
||||||
@@ -213,6 +224,7 @@ except ImportError:
|
|||||||
install('python-jinja2')
|
install('python-jinja2')
|
||||||
import jinja2
|
import jinja2
|
||||||
|
|
||||||
|
|
||||||
def render_template(template_name, context, template_dir=TEMPLATES_DIR):
|
def render_template(template_name, context, template_dir=TEMPLATES_DIR):
|
||||||
templates = jinja2.Environment(
|
templates = jinja2.Environment(
|
||||||
loader=jinja2.FileSystemLoader(template_dir)
|
loader=jinja2.FileSystemLoader(template_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user