1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env python
from argparse import ArgumentParser
from jujuconfig import get_juju_home
from jujupy import (
bootstrap_from_env,
EnvJujuClient,
SimpleEnvironment,
)
def main():
parser = ArgumentParser(description="""
Bootstrap a customized environment. The first argument is the configured
environment to use as the starting point. Subsequent arguments are
options to override, e.g. "region=lcy03".
""")
parser.add_argument('env', help='The environment to base deployment on.')
parser.add_argument('option', nargs='*',
help='Override an environment option with value.')
parser.add_argument('--name', help='A name for the new environment.')
args = parser.parse_args()
env = SimpleEnvironment.from_config(args.env)
if args.name is not None:
env.environment = args.name
for option in args.option:
key, value = option.split('=', 1)
env.config[key] = value
bootstrap_from_env(get_juju_home(), EnvJujuClient.by_version(env))
if __name__ == '__main__':
main()
|