Exemple #1
0
def deploy(bootstrap_node_name, bundle_charm):
    if not bootstrapped():
        juju('bootstrap --upload-tools --to "{}"'.format(
              bootstrap_node_name))
    wait()
    juju('deploy ' + bundle_charm)
    wait()
Exemple #2
0
def main(controller):
    clean(controller)
    bootstrap(controller, params={
        'to': 'zoe.maas',
        'keep-broken': '',
        #'config': 'bootstrap-timeout=2000',
    })
    juju('deploy mysql')
Exemple #3
0
def main(controller, series):
    clean(controller)
    bootstrap(controller, params={
        'bootstrap-series': series
    })

    #juju('deploy /home/dooferlad/charms/builds/resource-get-test')
    juju('deploy /home/dooferlad/charms/builds/resource-get-test --resource '
         'aresource=/home/dooferlad/a-file.bin')
    wait()
def main(controller, cloud, series):
    clean(controller)
    bootstrap(controller, cloud, params={
        'bootstrap-series': series,
        'to': 'wash.maas',
    })
    wait()

    # Since this is Juju 2.0 and we can't co-host (well, it isn't preferable)
    # add a machine (i.e. machine 0 in the default model).
    juju('add-machine mal.maas')
    wait()
    juju('add-machine lxd:0')
    wait()
Exemple #5
0
def main(stop, controller, hosts, guests, wait_between_guests, deploy):
    clean(controller)
    bootstrap(controller)

    wait()
    for i in range(hosts):
        juju('add-machine')
    wait()

    first = True
    for j in range(guests):
        for i in range(hosts):
            if not deploy:
                juju('add-machine lxd:{}'.format(i))

            else:
                # Deploy the Ubuntu charm instead of just adding a machine
                if first:
                    juju('deploy ubuntu --to lxd:{}'.format(i))
                    first = False
                else:
                    juju('add-unit ubuntu --to lxd:{}'.format(i))

        if wait_between_guests:
            wait()

    wait()

    if stop:
        clean(controller)
Exemple #6
0
def service_address(unit, relation):
    out = juju('run --unit {unit} "relation-ids {relation}"'.format(
                 unit=unit, relation=relation),
               silent=True).splitlines()
    rid = None
    for line in out:
        if line.startswith(relation):
            rid = line
    if rid is None:
        exit('Failed to find relation ID for {} {}'.format(unit, relation))
    address = juju(
        'run --unit {unit} "network-get -r {rid} --primary-address"'.format(
            unit=unit, rid=rid),
        silent=True).rstrip()
    return address
def main():
    controllers = ['maas-trusty', 'maas-xenial', 'maas-precise']

    # first kill everything
    for controller in controllers + ['maas']:
        clean(controller)

    # now boot on everything
    for controller in controllers:
        bootstrap(controller, params={'to': 'zoe.maas'})
        # bootstrap(controller, params={'to': 'mal.maas'})
        juju('add-machine')
        wait()
        pprint(status())
        clean(controller)
Exemple #8
0
def main():
    controller = 'maas-xenial'  # bundle specifies series, so leave it unset.
    clean(controller)
    bootstrap(controller, params={'to': 'mal.maas'})

    wait()

    machines = 1
    containers = 2

    if machines > 1:
        juju('add-machine -n {}'.format(machines-1))
    for i in range(machines):
        for j in range(containers):
            juju('add-machine lxc:{}'.format(i))

    wait()
Exemple #9
0
def main():
    _, rc = juju("status -m lxd:default", fail_ok=True)
    if rc == 0:
        juju("kill-controller lxd -y")
    bootstrap('lxd')
    juju("upgrade-gui ~/Downloads/jujugui-2.1.1.tar.bz2")
    juju("gui")
Exemple #10
0
def service_address(unit, relation):
    network_get_output = juju(
        'run --unit {unit} "network-get {relation} --primary-address"'.format(
            unit=unit, relation=relation),
        silent=True).rstrip()
    for line in network_get_output.split('\n'):
        try:
            return ipaddress.IPv4Address(line)
        except:
            continue
    return None
def main(controller, series):
    clean(controller)
    bootstrap(controller, params={
        'bootstrap-series': series
    })

    juju('switch {}:controller'.format(controller))
    juju('enable-ha')

    return

    juju_bin = run('which juju', quiet=True).rstrip()
    run('cp {} /tmp'.format(juju_bin), quiet=True)
    run('cp {}d /tmp'.format(juju_bin), quiet=True)

    out = juju('add-user testuser', quiet=True)
    for line in out.splitlines():
        if re.search('juju register', line):
            cmd = line
            break

    sudo('/tmp/juju {}'.format(cmd), user='******')
    sudo('/tmp/juju ensure-availability', user='******')
Exemple #12
0
def main():
    controller = 'maas-proxied'
    #juju destroy-environment -y maas-proxied ; juju bootstrap --upload-tools && juju deploy mysql
    if bootstrapped(controller):
        juju("kill-controller -y {}".format(controller))
        time.sleep(3)
    bootstrap(controller)
    juju('set-model-config http-proxy=192.168.0.22')
    juju('deploy mysql')
Exemple #13
0
def deploy(controller_name, cloud, bootstrap_node_name, bundle_charm):
    bootstrap(controller_name, cloud, bootstrap_node_name)
    
    juju('deploy ' + bundle_charm)
    wait()
Exemple #14
0
#!/usr/bin/python

import wand

wand.juju('ensure-availability -n 3')
Exemple #15
0
def main(stop):
    controller = 'lxd'
    clean(controller)
    bootstrap(controller)

    wait()

    juju('add-model foo')
    juju('add-model bar')

    machines = 1
    containers = 2

    for i in range(machines):
        juju('add-machine -m foo')
        juju('add-machine -m bar')
        for j in range(containers):
            juju('add-machine -m foo lxd:{}'.format(i))
            juju('add-machine -m bar lxd:{}'.format(i))

    wait()
    if stop:
        juju('destroy-controller {} --destroy-all-models -y'.format(controller))
        clean(controller)