示例#1
0
def main():
    # for n in range(40, 45):
    #     sudo('ip addr add 192.168.1.{} dev eth1'.format(n))
    #
    # run('ip addr')

    sudo('lxd init')
    run('lxc launch ubuntu:14.04 my-ubuntu')
    sudo('ip route add 192.168.1.42 dev lxdbr0  scope link metric 1')
    sudo('sudo ip route add 192.168.1.0/24 dev eth1 metric 99')
    sudo('ip route del 192.168.1.42 dev lxdbr0  scope link')
示例#2
0
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='******')
示例#3
0
 def sudo(self, cmd, fail_ok=False):
     return shelly.sudo(cmd.format(**self.settings), fail_ok=fail_ok)