Commit b84c7789 by Arbab Nazar

Added EBS Volumes Tagging

parent 8f897c94
...@@ -53,7 +53,7 @@ if __name__ == '__main__': ...@@ -53,7 +53,7 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Enable all services that are in the services tag of this ec2 instance.") description="Enable all services that are in the services tag of this ec2 instance.")
parser.add_argument("-a","--available", parser.add_argument("-a","--available",
help="The location of the available services.") help="The location of the available services.")
parser.add_argument("-e","--enabled", parser.add_argument("-e","--enabled",
help="The location of the enabled services.") help="The location of the enabled services.")
...@@ -114,7 +114,21 @@ if __name__ == '__main__': ...@@ -114,7 +114,21 @@ if __name__ == '__main__':
play=play, play=play,
instance_id=instance_id) instance_id=instance_id)
except: except:
print("Failed to get EDP for {}".format(instance_id)) print("Failed to get EDP for {}".format(instance=instance_id))
#get the hostname of the sandbox
hostname = socket.gethostname()
#get the list of the volumes, that are attached to the instance
volumes = ec2.get_all_volumes(filters={'attachment.instance-id': instance_id})
for volume in volumes:
volume.add_tags({"hostname": hostname,
"environment": environment,
"deployment": deployment,
"cluster": play,
"instance-id": instance_id,
"created": volume.create_time })
try: try:
for service in services_for_instance(instance_id): for service in services_for_instance(instance_id):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment