From 1d455b3eb763dbf48c0346012438d3272ac74572 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 10 May 2012 19:47:15 -0700 Subject: [PATCH] Fix image uploader tool --- docs/source/topics/gettingstarted.rst | 4 ++-- tools/upload-img.py | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/docs/source/topics/gettingstarted.rst b/docs/source/topics/gettingstarted.rst index 2366468f..6300a67d 100644 --- a/docs/source/topics/gettingstarted.rst +++ b/docs/source/topics/gettingstarted.rst @@ -285,7 +285,7 @@ system auto-generate one for you you will need to check the final output of the above install and pick up the password that was generated which should be displayed at key ``passwords/horizon_keystone_admin``. You can also later find this authentication information in the generated -``os-core.rc`` file. +``core.rc`` file. If you see a login page and can access horizon then: @@ -298,7 +298,7 @@ In your ANVIL directory: :: - source os-core.rc + source core.rc This should set up the environment variables you need to run OpenStack CLI tools: diff --git a/tools/upload-img.py b/tools/upload-img.py index 02ac1e77..02a6c1e1 100755 --- a/tools/upload-img.py +++ b/tools/upload-img.py @@ -27,22 +27,17 @@ from anvil.components import glance from anvil.helpers import uploader -class CfgProxy: - def __init__(self, cfg, pw_gen): - self.cfg = cfg - self.pw_gen = pw_gen - - def get_config(): - base_config = cfg.IgnoreMissingConfigParser() - config_location = cfg_helpers.find_config() - if config_location: - base_config.read([config_location]) + config = cfg.ProxyConfig() config.add_read_resolver(cfg.EnvResolver()) - config.add_read_resolver(cfg.ConfigResolver(base_config)) - pw_gen = passwords.PasswordGenerator(config) - return (config, pw_gen) + config.add_read_resolver(cfg.ConfigResolver(cfg.IgnoreMissingConfigParser(fns=cfg_helpers.find_config()))) + + config.add_password_resolver(passwords.ConfigPassword(config)) + config.add_password_resolver(passwords.InputPassword(config)) + config.add_password_resolver(passwords.RandomPassword(config)) + + return config def setup_logging(level): @@ -74,5 +69,6 @@ if __name__ == "__main__": cleaned_uris.append(uri) setup_logging(len(options.verbosity)) - cfg, pw_gen = get_config() - uploader.Service(cfg, pw_gen).install(uris) + utils.welcome(prog_name="Image uploader tool") + cfg = get_config() + uploader.Service(cfg).install(uris)