pylint cleanups

This commit is contained in:
Joshua Harlow 2012-08-20 23:15:53 -07:00
parent 245f36bc64
commit a7acb03e4e
6 changed files with 29 additions and 17 deletions

View File

@ -94,7 +94,7 @@ class PkgInstallComponent(component.Component):
uri = self.get_option(key, '').strip()
if not uri:
raise ValueError(("Could not find uri in config to download "
"from at section %s for option %s") % (section, key))
"from option %s") % (key))
return (uri, self.get_option('app_dir'))
def download(self):
@ -493,7 +493,7 @@ class PythonRuntime(ProgramRuntime):
starter_cls = importer.import_entry_point(run_type)
starter = starter_cls(self)
for i, app_info in enumerate(self.apps_to_start):
self._start_app(app_info, start)
self._start_app(app_info, run_type, starter)
am_started = i + 1
self._post_app_start(app_info)
return am_started
@ -511,7 +511,8 @@ class PythonRuntime(ProgramRuntime):
def _post_app_start(self, app_info):
if 'sleep_time' in app_info:
LOG.info("%s requested a %s second sleep time, please wait...", colorizer.quote(app_name), app_info.get('sleep_time'))
LOG.info("%s requested a %s second sleep time, please wait...",
colorizer.quote(app_info.get('name')), app_info.get('sleep_time'))
sh.sleep(float(app_info.get('sleep_time')))
def _locate_investigators(self, apps_started):
@ -523,7 +524,7 @@ class PythonRuntime(ProgramRuntime):
inv_cls = importer.import_entry_point(run_type)
except RuntimeError as e:
LOG.warn("Could not load class %s which should be used to investigate %s: %s",
colorizer.quote(how), colorizer.quote(app_name), e)
colorizer.quote(run_type), colorizer.quote(app_name), e)
continue
investigator = None
if inv_cls in investigator_created:

View File

@ -20,6 +20,7 @@ from anvil import cfg
from anvil import components as comp
from anvil import log as logging
from anvil import shell as sh
from anvil import utils
from anvil.components.helpers import db as dbhelper
from anvil.components.helpers import glance as ghelper
@ -40,7 +41,6 @@ CONFIGS = [API_CONF, REG_CONF, API_PASTE_CONF,
# Reg, api, scrub are here as possible subsystems
GAPI = "api"
GREG = "reg"
GSCR = 'scrub'
# This db will be dropped and created
DB_NAME = "glance"
@ -49,14 +49,12 @@ DB_NAME = "glance"
APP_OPTIONS = {
'glance-api': ['--config-file', sh.joinpths('%CONFIG_DIR%', API_CONF)],
'glance-registry': ['--config-file', sh.joinpths('%CONFIG_DIR%', REG_CONF)],
'glance-scrubber': ['--config-file', sh.joinpths('%CONFIG_DIR%', REG_CONF)],
}
# How the subcompoent small name translates to an actual app
SUB_TO_APP = {
GAPI: 'glance-api',
GREG: 'glance-registry',
GSCR: 'glance-scrubber',
}
@ -106,9 +104,10 @@ class GlanceInstaller(GlanceMixin, comp.PythonInstallComponent):
dbhelper.get_shared_passwords(self)))
def source_config(self, config_fn):
real_fn = config_fn
if config_fn == LOGGING_CONF:
real_fn = 'logging.cnf.sample'
else:
real_fn = config_fn
fn = sh.joinpths(self.get_option('app_dir'), 'etc', real_fn)
return (fn, sh.load_file(fn))
@ -117,8 +116,8 @@ class GlanceInstaller(GlanceMixin, comp.PythonInstallComponent):
with io.BytesIO(contents) as stream:
config = cfg.RewritableConfigParser()
config.readfp(stream)
config.set('DEFAULT', 'debug', True)
config.set('DEFAULT', 'verbose', True)
config.set('DEFAULT', 'debug', self.get_option('verbose', False))
config.set('DEFAULT', 'verbose', self.get_option('verbose', False))
config.set('DEFAULT', 'bind_port', params['endpoints']['registry']['port'])
config.set('DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME,
utf8=True,
@ -158,8 +157,8 @@ class GlanceInstaller(GlanceMixin, comp.PythonInstallComponent):
config = cfg.RewritableConfigParser()
config.readfp(stream)
img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images')
config.set('DEFAULT', 'debug', True)
config.set('DEFAULT', 'verbose', True)
config.set('DEFAULT', 'debug', self.get_option('verbose', False))
config.set('DEFAULT', 'verbose', self.get_option('verbose', False))
config.set('DEFAULT', 'default_store', 'file')
config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir)
config.set('DEFAULT', 'bind_port', params['endpoints']['public']['port'])

View File

@ -26,6 +26,8 @@ from anvil import shell as sh
from anvil import utils
from anvil.components.helpers import db as dbhelper
from anvil.components.helpers import rabbit as rbhelper
LOG = logging.getLogger(__name__)
@ -228,9 +230,9 @@ class ConfConfigurator(object):
# How is your message queue setup?
mq_type = canon_mq_type(self._getstr('mq'))
if mq_type == 'rabbit':
nova_conf.add('rabbit_host', self.cfg.getdefaulted('rabbit', 'rabbit_host', hostip))
nova_conf.add('rabbit_password', self.cfg.get("passwords", "rabbit"))
nova_conf.add('rabbit_userid', self.cfg.get('rabbit', 'rabbit_userid'))
nova_conf.add('rabbit_host', self._getstr('rabbit.host', hostip))
nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw'])
nova_conf.add('rabbit_userid', self._getstr('rabbit.user_id'))
nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu')
# Where instances will be stored

View File

@ -26,7 +26,7 @@ from anvil import colorizer
from anvil import log as logging
from anvil import shell as sh
from anvil import utils
from anvil.components import db
from anvil.components import horizon
from anvil.components import nova
@ -147,7 +147,7 @@ class NovaInstaller(nova.NovaInstaller):
def configure(self):
configs_made = nova.NovaInstaller.configure(self)
driver_canon = nhelper.canon_virt_driver(self.cfg.get('nova', 'virt_driver'))
driver_canon = nhelper.canon_virt_driver(self.get_option('virt_driver'))
if driver_canon == 'libvirt':
# Create a libvirtd user group
if not sh.group_exists('libvirtd'):

View File

@ -2,20 +2,25 @@
---
# Where we download this from...
get_from: "git://github.com/openstack/glance.git?branch=master"
host: "$(auto:ip)"
api_port: 9292
reg_port: 9191
protocol: http
verbose: True
# List of images to download and install into glance.
image_urls:
- http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz
- http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz
# Needed for setting up your database
db:
type: "$(db:type)"
user: "$(db:user)"
host: "$(db:host)"
port: "$(db:port)"
# Interactions with keystone are via the following settings
paste_flavor: 'keystone'
keystone:

View File

@ -136,4 +136,9 @@ keystone:
service_port: "$(keystone:service_port)"
service_proto: "$(keystone:service_proto)"
# Rabbit mq hookins
rabbit:
user_id: "$(rabbit-mq:user_id)"
host: "$(rabbit-mq:host)"
...