Exemple #1
0
def spin_up():
    valid_input = False
    num_tries = 10
    while not valid_input and num_tries > 0:
        user_inp = input("How many VMs?")
        num_tries -= 1
        if user_inp.isdigit():
            valid_input = True
            num_vm = int(user_inp)

            if num_vm == 0:
                print("Must be at least 1 vm, try again")
                valid_input = False

    cur_dt = datetime.datetime.now()
    time_stamp = '{0}{1}{2}_{3}{4}{5}'.\
        format(cur_dt.year, cur_dt.month, cur_dt.day, cur_dt.hour, cur_dt.minute, cur_dt.second)

    writeout_file = 'logs/build-{time_stamp}.json'.format(
        time_stamp=time_stamp)
    os.system('{unix_command} > {writeout_file}'.format(
        unix_command=digitalocean.builder(num_vm),
        writeout_file=writeout_file))
    time.sleep(60)
    return harden(writeout_file)
Exemple #2
0
def spin_up():
    timestamp_utc = time.time()
    writeout_file = 'logs/build-{timestamp_utc}.json'.format(
        timestamp_utc=timestamp_utc)
    aws_lightsail = ['awsl', 'aws lightsail']
    digital_ocean = ['do', 'digital ocean']
    iaas_platform = aws_lightsail + digital_ocean
    # vendor_choice = input('vendor_choice: ') # FIXME Parameter hard-coded to expedite testing.
    vendor_choice = 'do'  # FIXME Parameter hard-coded to expedite testing.
    if vendor_choice in iaas_platform:
        if vendor_choice in aws_lightsail:
            pass  # TODO 1
        elif vendor_choice in digital_ocean:
            os.system('{unix_command} > {writeout_file}'             \
                        .format(unix_command=digitalocean.builder(), \
                                writeout_file=writeout_file))
            time.sleep(60)
            return harden(writeout_file)
    else:
        pass  # TODO 2
Exemple #3
0
def spinup(cluster_name, defined_ssh_port, email_address, remote_username,
           remote_password, user_home, vm_count):
    timestamp_utc = time.time()
    writeout_file = 'logs/build-{timestamp_utc}.json'.format(
        timestamp_utc=timestamp_utc)
    aws_lightsail = ['awsl', 'aws lightsail']
    digital_ocean = ['do', 'digital ocean']
    iaas_platform = aws_lightsail + digital_ocean
    # vendor_choice = input('vendor_choice: ') # FIXME Parameter hard-coded to expedite testing.
    vendor_choice = 'do'  # FIXME Parameter hard-coded to expedite testing.
    if vendor_choice in iaas_platform:
        if vendor_choice in aws_lightsail:
            pass  # TODO 1
        elif vendor_choice in digital_ocean:
            os.system('{unix_command} > {writeout_file}'                                              \
                        .format(unix_command=digitalocean.builder(cluster_name, user_home, vm_count), \
                                writeout_file=writeout_file))
            time.sleep(60)
            return harden(cluster_name, defined_ssh_port, email_address,
                          remote_username, remote_password, user_home,
                          writeout_file)
    else:
        pass  # TODO 2
Exemple #4
0
def spin_up(params):
    # timestamp_utc = time.time()

    now = datetime.datetime.now()
    timestamp_local = '{0}{1}{2}_{3}{4}{5}'.\
        format(now.year, now.month, now.day, now.hour, now.minute, now.second)

    writeout_file = '{working_dir}/build-{timestamp_local}.json'.\
        format(working_dir=params['working_dir'], timestamp_local=timestamp_local)
    aws_lightsail = ['awsl', 'aws lightsail']
    digital_ocean = ['do', 'digital ocean']

    for vendor_choice in params['platforms']:
        if vendor_choice in aws_lightsail:
            pass  # TODO 1
        elif vendor_choice in digital_ocean:
            os.system('{unix_command} > {writeout_file}'.format(
                unix_command=digitalocean.builder(params),
                writeout_file=writeout_file))
            time.sleep(60)
            return harden(writeout_file, params)
    else:
        pass  # TODO 2