예제 #1
0
def checkEnvState(thisDict):
    for i in thisDict.keys():
        instance = thisDict[i].__dict__
        hostname = instance['public_dns_name'].encode('ascii')
        #quick check to make sure everything is up and running
        x = execute(i, hostname, 'root', cfg.EC2.east_key,
                    cfg.EC2.east_keyName)
        if not x.connectionSuccessful:
            exit(-1)
        print(x.rc('hostname'))
예제 #2
0
if __name__ == '__main__':
    if cfg.MAIN.environment == 'ec2':
        thisEnv = list(myenv)
        dict = startInstances(thisEnv)
        ## wait for instance and check ssh
        print('wait for instances to boot for 130 seconds')
        time.sleep(float(cfg.EC2.sleepForInstance))
        print('done waiting for instances to boot')
        checkEnvState(dict)

        rhuiEnv = {}
        clientEnv = {}

        if 'RHUA' in thisEnv:
            rhua = dict['RHUA'].__dict__
            rhuaCMD = execute('RHUA', rhua['public_dns_name'].encode('ascii'),
                              'root', cfg.EC2.east_key, cfg.EC2.east_keyName)
            rhuiEnv['rhua'] = rhua
            rhuiEnv['rhuaCMD'] = rhuaCMD
            rhua['ent_cert'] = cfg.ENT_CERTS.cert

        if 'CDS1' in thisEnv:
            cds1 = dict['CDS1'].__dict__
            cds1CMD = execute('CDS1', cds1['public_dns_name'].encode('ascii'),
                              'root', cfg.EC2.east_key, cfg.EC2.east_keyName)
            rhuiEnv['cds1'] = cds1
            rhuiEnv['cds1CMD'] = cds1CMD

        if 'CDS2' in thisEnv:
            cds2 = dict['CDS2'].__dict__
            cds2CMD = execute('CDS2', cds2['public_dns_name'].encode('ascii'),
                              'root', cfg.EC2.east_key, cfg.EC2.east_keyName)