demo2-instance-with-init-script.py converted to python 3 using 2to3
This commit is contained in:
parent
c9d8e9b0af
commit
7c2a5341af
@ -104,7 +104,7 @@ def main():
|
||||
keypair_exists = True
|
||||
|
||||
if keypair_exists:
|
||||
print('Keypair ' + keypair_name + ' already exists. Skipping import.')
|
||||
print(('Keypair ' + keypair_name + ' already exists. Skipping import.'))
|
||||
else:
|
||||
print('adding keypair...')
|
||||
conn.import_key_pair_from_file(keypair_name, pub_key_file)
|
||||
@ -128,7 +128,7 @@ def main():
|
||||
security_group_exists = True
|
||||
|
||||
if security_group_exists:
|
||||
print('Security Group ' + all_in_one_security_group.name + ' already exists. Skipping creation.')
|
||||
print(('Security Group ' + all_in_one_security_group.name + ' already exists. Skipping creation.'))
|
||||
else:
|
||||
all_in_one_security_group = conn.ex_create_security_group(security_group_name,
|
||||
'network access for all-in-one application.')
|
||||
@ -159,7 +159,7 @@ def main():
|
||||
instance_exists = True
|
||||
|
||||
if instance_exists:
|
||||
print('Instance ' + testing_instance.name + ' already exists. Skipping creation.')
|
||||
print(('Instance ' + testing_instance.name + ' already exists. Skipping creation.'))
|
||||
exit()
|
||||
else:
|
||||
print('Starting new all-in-one instance and wait until it is running...')
|
||||
@ -181,12 +181,12 @@ def main():
|
||||
private_ip = None
|
||||
if len(testing_instance.private_ips):
|
||||
private_ip = testing_instance.private_ips[0]
|
||||
print('Private IP found: {}'.format(private_ip))
|
||||
print(('Private IP found: {}'.format(private_ip)))
|
||||
|
||||
public_ip = None
|
||||
if len(testing_instance.public_ips):
|
||||
public_ip = testing_instance.public_ips[0]
|
||||
print('Public IP found: {}'.format(public_ip))
|
||||
print(('Public IP found: {}'.format(public_ip)))
|
||||
|
||||
print('Checking for unused Floating IP...')
|
||||
unused_floating_ip = None
|
||||
@ -197,11 +197,11 @@ def main():
|
||||
|
||||
if not unused_floating_ip and len(conn.ex_list_floating_ip_pools()):
|
||||
pool = conn.ex_list_floating_ip_pools()[0]
|
||||
print('Allocating new Floating IP from pool: {}'.format(pool))
|
||||
print(('Allocating new Floating IP from pool: {}'.format(pool)))
|
||||
unused_floating_ip = pool.create_floating_ip()
|
||||
|
||||
if public_ip:
|
||||
print('Instance ' + testing_instance.name + ' already has a public ip. Skipping attachment.')
|
||||
print(('Instance ' + testing_instance.name + ' already has a public ip. Skipping attachment.'))
|
||||
elif unused_floating_ip:
|
||||
conn.ex_attach_floating_ip_to_node(testing_instance, unused_floating_ip)
|
||||
|
||||
@ -214,7 +214,7 @@ def main():
|
||||
actual_ip_address = private_ip
|
||||
|
||||
print('\n')
|
||||
print('The Fractals app will be deployed to http://{}\n'.format(actual_ip_address))
|
||||
print(('The Fractals app will be deployed to http://{}\n'.format(actual_ip_address)))
|
||||
|
||||
print('You can use ssh to login to the instance using your private key. Default user name for official Ubuntu\n'
|
||||
'Cloud Images is: ubuntu, so you can use, e.g.: "ssh -i ~/.ssh/id_rsa ubuntu@<floating-ip>" if your private\n'
|
||||
|
Loading…
x
Reference in New Issue
Block a user