本文整理汇总了Python中clearstack.controller.Controller.get方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.get方法的具体用法?Python Controller.get怎么用?Python Controller.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clearstack.controller.Controller
的用法示例。
在下文中一共展示了Controller.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_config
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_config():
conf = {
"KEYSTONE": [
Argument("keystone-db-pw",
"Password for keystone to access DB",
"CONFIG_KEYSTONE_DB_PW",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("keystone-admin-token",
"The token to use for the Keystone service api",
"CONFIG_KEYSTONE_ADMIN_TOKEN",
uuid.uuid4().hex,
validators=[validators.not_empty]),
Argument("keystone-admin-pw",
"The password to use for the Keystone admin user",
"CONFIG_KEYSTONE_ADMIN_PW",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("keystone-demo-pw",
"The password to use for the Keystone demo user",
"CONFIG_KEYSTONE_DEMO_PW",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("keystone-region",
"Region name",
"CONFIG_KEYSTONE_REGION",
"RegionOne",
validators=[validators.not_empty])
]
}
for group in conf:
Controller.get().add_group(group, conf[group])
示例2: read
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def read(self, file, variables_cmd):
conf = Controller.get().CONF
config = configparser.RawConfigParser()
config.optionxform = str
if not os.path.isfile(file):
raise IOError("file {0} not found".format(file))
""" Validate option in answer file"""
config.read(file)
if not config.has_section('general'):
raise KeyError("answer file {0} doesn't have general"
" section".format(file))
conf_file = dict(config['general'])
conf_file.update(variables_cmd) # override variables
conf.update(conf_file)
try:
Controller.get().validate_groups(conf_file)
except Exception as e:
raise e
all_args = Controller.get().get_all_arguments()
for non_supported in (set(conf_file) - set(all_args)):
LOG.warn("clearstack: variable {0} is not"
" supported yet".format(non_supported))
示例3: init_config
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_config():
conf = {
"MONGODB": [
Argument("mongodb-host",
"The IP address or hostname of the MongoDB server",
"CONFIG_MONGODB_HOST",
util.get_ip(),
validators=[validators.ip_or_hostname])
]
}
for group in conf:
Controller.get().add_group(group, conf[group])
示例4: run_all_sequences
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def run_all_sequences():
load_sequences()
try:
utils.copy_resources()
except Exception as e:
raise e
try:
Controller.get().run_all_sequences()
except Exception as e:
raise e
finally:
utils.get_logs()
示例5: init_config
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_config():
conf = {
"SWIFT": [
Argument("swift-ks-pw",
"Password to use for the Object Storage service to "
" authenticate with with the Identity service",
"CONFIG_SWIFT_KS_PW",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("swift-storages",
"Comma-separated list of devices to use as storage device"
" for Object Storage. e.g. /path/to/dev1,/path/to/dev2."
" Clearstack DOES NOT creare the file system, you must "
"format it with xfs. Leave blank to use a loop device",
"CONFIG_SWIFT_STORAGES",
'',
validators=[validate_storage]),
Argument("swift-storage-zones",
"Number of Object Storage storage zones; this number "
"MUST be no larger than the number of configured "
"storage devices.",
"CONFIG_SWIFT_STORAGE_ZONES",
'1',
validators=[validators.digit]),
Argument("swift-storage-replicas",
"Number of Object Storage storage replicas; this number "
"MUST be no larger than the number of configured "
"storage zones.",
"CONFIG_SWIFT_STORAGE_REPLICAS",
'1',
validators=[validators.digit]),
Argument("swift-hash",
"Custom seed number to use for swift_hash_path_suffix in"
" /etc/swift/swift.conf. If you do not provide a value, "
"a seed number is automatically generated.",
"CONFIG_SWIFT_HASH",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("swift-storage-size",
"Size of the Object Storage loopback file storage "
"device in GB",
"CONFIG_SWIFT_STORAGE_SIZE",
"2",
validators=[validators.digit]),
]
}
for group in conf:
Controller.get().add_group(group, conf[group])
示例6: __init__
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def __init__(self):
conf = Controller.get().CONF
path = os.path.expanduser(
conf['CONFIG_PRIVATE_SSH_KEY'])
path = os.path.realpath(path)
self.ssh_private_key = path
self.ssh_user = "root"
示例7: load_sequences
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def load_sequences():
load_plugins()
for plugin in Controller.get().get_all_plugins():
try:
getattr(plugin, "init_sequences")()
except AttributeError:
LOG.debug("missing attribute: init_sequences in %s",
plugin.__file__)
示例8: init_sequences
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_sequences():
controller = Controller.get()
conf = controller.CONF
if util.str2bool(conf['CONFIG_NOVA_INSTALL']):
controller.add_sequence("Setting up nova controller",
setup_controller)
controller.add_sequence("Setting up nova computes",
setup_computes)
示例9: add_arguments
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def add_arguments(parser):
load_plugins()
for group in Controller.get().get_all_groups():
for argument in group.get_all_arguments():
parser.add_argument("--{0}".format(argument.cmd_option),
action="store",
dest=argument.conf_name,
help=argument.description,
choices=argument.option_list)
示例10: get_all_hosts
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def get_all_hosts():
conf = Controller.get().CONF
hosts = set()
hosts.update(set(conf["CONFIG_COMPUTE_HOSTS"].split(",")))
hosts.add(conf["CONFIG_CONTROLLER_HOST"])
hosts.add(conf["CONFIG_AMQP_HOST"])
hosts.add(conf["CONFIG_MARIADB_HOST"])
hosts.add(conf["CONFIG_MONGODB_HOST"])
return hosts
示例11: generate
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def generate(self, file, variables_cmd):
with open(file, "w") as f:
f.write("[general]\n\n")
for group in Controller.get().get_all_groups():
for argument in group.get_all_arguments():
f.write("# {0}\n".format(argument.description))
value = variables_cmd.get(argument.conf_name,
argument.default_value)
f.write("{0}={1}\n\n".format(argument.conf_name, value))
示例12: setup_controller
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def setup_controller():
conf = Controller.get().CONF
templates = ['provision']
recipe = ""
for template in templates:
recipe += utils.get_template(template)
return utils.run_recipe("provision.py", recipe,
[conf["CONFIG_CONTROLLER_HOST"]])
示例13: init_config
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_config():
conf = {
"NOVA": [
Argument("nova-db-pw",
"Password for nova to access DB",
"CONFIG_NOVA_DB_PW",
utils.generate_random_pw(),
validators=[validators.not_empty]),
Argument("nova-ks-pw",
"Password to use for the Nova to"
" authenticate with Keystone",
"CONFIG_NOVA_KS_PW",
utils.generate_random_pw(),
validators=[validators.not_empty])
]
}
for group in conf:
Controller.get().add_group(group, conf[group])
示例14: load_plugins
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def load_plugins():
""" return if plugins already are loaded """
if Controller.get().get_all_plugins():
return
path = "plugins"
base_module = "clearstack.{0}".format(path)
directory = "{0}/{1}".format(os.path.dirname(
os.path.realpath(__file__)), path)
rx_val = r'^[a-zA-Z]+_[0-9]{3}\.py$'
files = [fd for fd in os.listdir(directory) if re.match(rx_val, fd)]
for fd in sorted(files, key=_get_weight):
plugin = import_module("{0}.{1}".format(base_module, fd.split(".")[0]))
Controller.get().add_plugin(plugin)
try:
getattr(plugin, "init_config")()
except AttributeError:
LOG.debug("missing attribute: init_config in %s",
plugin.__file__)
示例15: init_config
# 需要导入模块: from clearstack.controller import Controller [as 别名]
# 或者: from clearstack.controller.Controller import get [as 别名]
def init_config():
conf = {
"PROVISION_INIT": [
Argument("provision-demo",
"Specify 'y' to provision for demo usage and testing."
" ['y', 'n']",
"CONFIG_PROVISION_DEMO",
"n",
options=['y', 'n'],
validators=[validators.y_or_n])
],
"PROVISION_DEMO": [
Argument("provision-demo-floatrange",
"CIDR network address for the floating IP subnet.",
"CONFIG_PROVISION_DEMO_FLOATRANGE",
"172.24.4.224/28",
validators=[validators.cidr]),
Argument("privision-image-format",
'Format for the demo image (default "qcow2").',
"CONFIG_PROVISION_IMAGE_FORMAT",
"qcow2",
validators=[validators.not_empty]),
Argument("provision-image-name",
'The name to be assigned to the demo image in Glance '
'(default "cirros")',
"CONFIG_PROVISION_IMAGE_NAME",
"cirros",
validators=[validators.not_empty]),
Argument("provision-image-url",
'A URL or local file location for an image to download'
'and provision in Glance (defaults to a URL for a '
'recent "cirros" image).',
"CONFIG_PROVISION_IMAGE_URL",
'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-'
'x86_64-disk.img',
validators=[validators.not_empty])
]
}
for group in conf:
Controller.get().add_group(group, conf[group])