Converted all these files from python 2 to python 3 syntax usong 2to3 library (demo3-microservices.py,demo4-scale-out-add-worker.py,demo4-scale-out.py,demo5-1-durable-storage.py,demo5-2-backup-fractals.py,destroy-all-demo-instances.py)
This commit is contained in:
@ -113,7 +113,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)
|
||||
@ -131,7 +131,7 @@ def main():
|
||||
for instance in conn.list_nodes():
|
||||
if instance.name in ['all-in-one', 'app-worker-1', 'app-worker-2', 'app-worker-3', 'app-controller',
|
||||
'app-services', 'app-api-1', 'app-api-2']:
|
||||
print('Destroying Instance: %s' % instance.name)
|
||||
print(('Destroying Instance: %s' % instance.name))
|
||||
conn.destroy_node(instance)
|
||||
|
||||
# wait until all nodes are destroyed to be able to remove depended security groups
|
||||
@ -149,7 +149,7 @@ def main():
|
||||
# delete security groups
|
||||
for group in conn.ex_list_security_groups():
|
||||
if group.name in ['control', 'worker', 'api', 'services']:
|
||||
print('Deleting security group: %s' % group.name)
|
||||
print(('Deleting security group: %s' % group.name))
|
||||
conn.ex_delete_security_group(group)
|
||||
|
||||
###########################################################################
|
||||
@ -160,10 +160,10 @@ def main():
|
||||
|
||||
def get_security_group(connection, security_group_name):
|
||||
"""A helper function to check if security group already exists"""
|
||||
print('Checking for existing ' + security_group_name + ' security group...')
|
||||
print(('Checking for existing ' + security_group_name + ' security group...'))
|
||||
for security_grp in connection.ex_list_security_groups():
|
||||
if security_grp.name == security_group_name:
|
||||
print('Security Group ' + security_group_name + ' already exists. Skipping creation.')
|
||||
print(('Security Group ' + security_group_name + ' already exists. Skipping creation.'))
|
||||
return worker_security_group
|
||||
return False
|
||||
|
||||
@ -292,7 +292,7 @@ def main():
|
||||
for instance in [instance_api_1, instance_api_2]:
|
||||
floating_ip = get_floating_ip(conn)
|
||||
conn.ex_attach_floating_ip_to_node(instance, floating_ip)
|
||||
print('allocated %(ip)s to %(host)s' % {'ip': floating_ip.ip_address, 'host': instance.name})
|
||||
print(('allocated %(ip)s to %(host)s' % {'ip': floating_ip.ip_address, 'host': instance.name}))
|
||||
|
||||
###########################################################################
|
||||
#
|
||||
|
Reference in New Issue
Block a user