Answers4AWS/distami — pull request #7 by dsumsky (2014-04-14 11:07:54+00:00)
Title: - corrected a bug when an AMI image or a snapshot has empty tags which l...

Description:
============
I found out that the routine copy_to_region of Distami class throws an exception when AMI image or snapshot has empty tags. The pull requests contain simple "tags dict is empty" check to get rid of this misbehavior.

Tested on:
==============
boto (2.27.0)

Exception details:
===============
2014-04-11 16:34:02 [INFO] Looking for AMI ami-46ff1f31 in region eu-west-1
2014-04-11 16:34:03 [INFO] Found AMI ami-46ff1f31 with snapshot snap-2d46d133
2014-04-11 16:34:03 [INFO] Copying AMI to us-east-1
2014-04-11 16:34:05 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:34:36 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:35:07 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:35:38 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:36:09 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:36:41 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:37:12 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:37:43 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:38:14 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:38:45 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:39:16 [INFO] ami-996e71f0 in us-east-1 not available, waiting...
2014-04-11 16:39:47 [INFO] Copying tags to ami-996e71f0 in us-east-1
Traceback (most recent call last):
File "/home/ec2-user/python_virt/bin/distami", line 8, in
load_entry_point('distami==1.0.5', 'console_scripts', 'distami')()
File "/home/ec2-user/python_virt/lib/python2.7/site-packages/distami/cli.py", line 132, in run
copy([distami, region, args])
File "/home/ec2-user/python_virt/lib/python2.7/site-packages/distami/cli.py", line 43, in copy
copied_ami_id = distami.copy_to_region(to_region)
File "/home/ec2-user/python_virt/lib/python2.7/site-packages/distami/core.py", line 133, in copy_to_region
dest_conn.create_tags(copied_ami_id, self._image.tags)
File "/home/ec2-user/python_virt/lib/python2.7/site-packages/boto/ec2/connection.py", line 4154, in create_tags
return self.get_status('CreateTags', params, verb='POST')
File "/home/ec2-user/python_virt/lib/python2.7/site-packages/boto/connection.py", line 1196, in get_status
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 400 Bad Request

InvalidParameterValueYou must specify one or more tags to create285af204-43c8-4270-adf6-9f9218b639b4