vpcaccess-dev gets openvpn roles
[awsible] / sqs-action.py
index 54f2eb7969cd48b4a879eeac8829dc4315d85b84..a71d01d003620f8817793737bf6372d61758728c 100755 (executable)
@@ -43,6 +43,7 @@ def handleEvent(message, event, ASGName, InstanceId):
             message.delete()
     else:
         notice += ['no action taken: no playbook for this ASG']
+        message.delete()
     notify(notice[0], '\n'.join(notice))
 
 
@@ -62,12 +63,13 @@ def processMessage(message):
                 instanceState = ec2r.Instance(InstanceId).state['Name']
             except:
                 logging.debug('instance %s does not exist', InstanceId)
-                message.delete()
+                message.change_visibility(VisibilityTimeout=60 * 2)
             else:
                 if instanceState == 'running':
                     handleEvent(message, event, ASGName, InstanceId)
                 else:
                     logging.debug('instance %s is in state %s, will try again', InstanceId, instanceState)
+                    message.change_visibility(VisibilityTimeout=60 * 2)
         else:
             logging.debug('nothing to do for event %r', data)
             message.delete()