Fixed bug in setting sections that aren't there, and added a little upload image tool/util
This commit is contained in:
parent
44f1ed062f
commit
ed32f9ef60
@ -117,6 +117,8 @@ class StackConfigParser(IgnoreMissingConfigParser):
|
||||
key = cfg_helpers.make_id(section, option)
|
||||
LOG.audit("Setting config value '%s' for param %r" % (value, key))
|
||||
self.configs_fetched[key] = value
|
||||
if not self.has_section(section):
|
||||
self.add_section(section)
|
||||
IgnoreMissingConfigParser.set(self, section, option, value)
|
||||
|
||||
def _resolve_replacements(self, value):
|
||||
|
40
tools/upload-img.py
Normal file
40
tools/upload-img.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
os.pardir))
|
||||
if os.path.exists(os.path.join(possible_topdir,
|
||||
'devstack',
|
||||
'__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from devstack import log as logging
|
||||
from devstack import utils
|
||||
from devstack import cfg
|
||||
from devstack import passwords
|
||||
from devstack.image import uploader
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-u", "--uri",
|
||||
action="append",
|
||||
dest="uris",
|
||||
metavar="URI",
|
||||
help=("uri to attempt to upload to glance"))
|
||||
(options, args) = parser.parse_args()
|
||||
uris = options.uris or list()
|
||||
uri_sep = ",".join(uris)
|
||||
utils.configure_logging(3)
|
||||
config = cfg.StackConfigParser()
|
||||
config.add_section('img')
|
||||
config.set('img', 'image_urls', uri_sep)
|
||||
pw_gen = passwords.PasswordGenerator(config)
|
||||
uploader = uploader.Service(config, pw_gen)
|
||||
uploader.install()
|
Loading…
Reference in New Issue
Block a user