ip = lA.pub_ip(iid)
    acount = acount + 1

if osval == "Centos6":
    remoteuser = '******'
else:
    remoteuser = ''.join([i for i in osval if not i.isdigit()]).lower()

if os.path.exists(os.path.realpath(os.path.expanduser(keyloc))):
    print "waiting until contactable, ctrl-C to quit"
    try:
        remote = lD.remoteHost(remoteuser, ip, keyloc)
        lD.wait_until_up(remote, 20)
        if "Tags" in security_config:
            resources = lA.find_all_child_resources(iid)
            lA.tag_resources(resources, security_config["Tags"])
        remote.register()
        remote = lD.remote_cp_authkeys(remote, 'root')
        lD.rename_remote_host(remote, machinename, 'kave.io')
        lD.confallssh(remote)
        if osval.startswith("Centos"):
            remote.run("yum clean all")
        remote.describe()
    except KeyboardInterrupt:
        pass
else:
    print "Warning: not contactable since keyfile supplied does not exist locally,",
    print "also means I could not rename the host", keyloc

print "OK, iid " + iid + " now lives at IP " + ip
Beispiel #2
0
        lD.debug = False
    if "--no-cascade" in sys.argv:
        cascade = False
        sys.argv = [s for s in sys.argv if s != "--no-cascade"]
    if len(sys.argv) < 3:
        help()
        raise AttributeError("You did not supply enough parameters")
    if len(sys.argv) > 3:
        help()
        raise AttributeError("You supplied too many parameters")


check_opts()

import kaveaws as lA
import json

lA.testaws()

resources = [sys.argv[1]]
tag_dict = json.loads(sys.argv[2])

# Find all associated resources
if cascade:
    print "Collecting cascade resources"
    resources = lA.find_all_child_resources(resources[0])

# Tag everything
print "Tagging"
lA.tag_resources(resources, tag_dict)
Beispiel #3
0
ip = lA.pub_ip(iid)
acount = 0
while (ip is None and acount < 20):
    print "waiting for IP"
    lD.mysleep(1)
    ip = lA.pub_ip(iid)
    acount = acount + 1

remoteuser = lA.default_usernamedict[lA.default_os]
remote = lD.remoteHost(remoteuser, ip, keyloc)
print "waiting until contactable"
lD.wait_until_up(remote, 20)
remote = lD.remote_cp_authkeys(remote, 'root')
if "Tags" in security_config:
    resources = lA.find_all_child_resources(iid)
    lA.tag_resources(resources, security_config["Tags"])
remote.register()

##################################################
# Renaming, configuring firewall and adding more disk space
##################################################
print "Renaming, configuring firewall and adding more disk space"
lD.rename_remote_host(remote, username + "_dev_box", 'kave.io')
remote.run("mkdir -p /etc/kave/")
remote.run(
    "/bin/echo http://repos:[email protected]/ >> /etc/kave/mirror"
)
lD.add_as_host(edit_remote=remote,
               add_remote=remote,
               dest_internal_ip=lA.priv_ip(iid))
lD.configure_keyless(remote,
        print __doc__
        raise IOError("please specify keyfile or set AWSSECCONF environment variable!")
    security_config = os.path.expanduser(os.environ["AWSSECCONF"])
try:
    jsondat = open(security_config)
    security_config_json = json.loads(jsondat.read())
    jsondat.close()
    ssh_keyfile = security_config_json["AccessKeys"]["SSH"]["KeyFile"]
except KeyError:
    raise KeyError('Your security config file must contain ["AccessKeys"]["SSH"]["KeyFile"] ' + security_config)

instancegroups = {}

installfrom = os.path.realpath(os.path.dirname(__file__))
liblocation = os.path.realpath(installfrom + '/../lib')
sys.path.append(liblocation)

import kaveaws as lA
import kavedeploy as lD
lD.debug = verbose
lD.strict_host_key_checking = strict

lA.testaws()
lA.lD.testproxy()

print "Initial tests OK, now adding volume (may take considerable time depending on volume size)"
volID = lA.add_new_ebs_vol(iid, mount_conf, ssh_keyfile)

if "Tags" in security_config_json:
    lA.tag_resources([volID], security_config_json["Tags"])
Beispiel #5
0
    security_config = os.path.expanduser(os.environ["AWSSECCONF"])
try:
    jsondat = open(security_config)
    security_config_json = json.loads(jsondat.read())
    jsondat.close()
    ssh_keyfile = security_config_json["AccessKeys"]["SSH"]["KeyFile"]
except KeyError:
    raise KeyError(
        'Your security config file must contain ["AccessKeys"]["SSH"]["KeyFile"] '
        + security_config)

instancegroups = {}

installfrom = os.path.realpath(os.path.dirname(__file__))
liblocation = os.path.realpath(installfrom + '/../lib')
sys.path.append(liblocation)

import kaveaws as lA
import kavedeploy as lD
lD.debug = verbose
lD.strict_host_key_checking = strict

lA.testaws()
lA.lD.testproxy()

print "Initial tests OK, now adding volume (may take considerable time depending on volume size)"
vol_id = lA.add_new_ebs_vol(iid, mount_conf, ssh_keyfile)

if "Tags" in security_config_json:
    lA.tag_resources([vol_id], security_config_json["Tags"])
Beispiel #6
0
        lD.debug = False
    if "--no-cascade" in sys.argv:
        cascade = False
        sys.argv = [s for s in sys.argv if s != "--no-cascade"]
    if len(sys.argv) < 3:
        help()
        raise AttributeError("You did not supply enough parameters")
    if len(sys.argv) > 3:
        help()
        raise AttributeError("You supplied too many parameters")


check_opts()

import kaveaws as lA
import json

lA.testaws()

resources = [sys.argv[1]]
tag_dict = json.loads(sys.argv[2])

# Find all associated resources
if cascade:
    print "Collecting cascade resources"
    resources = lA.find_all_child_resources(resources[0])

# Tag everything
print "Tagging"
lA.tag_resources(resources, tag_dict)