projects
/
awsible
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rotate vpn logs
[awsible]
/
sqs-action.py
diff --git
a/sqs-action.py
b/sqs-action.py
index 54f2eb7969cd48b4a879eeac8829dc4315d85b84..e2b8c6431eb7a574e79bb342ef04d17cb70aa7d9 100755
(executable)
--- a/
sqs-action.py
+++ b/
sqs-action.py
@@
-43,6
+43,7
@@
def handleEvent(message, event, ASGName, InstanceId):
message.delete()
else:
notice += ['no action taken: no playbook for this ASG']
message.delete()
else:
notice += ['no action taken: no playbook for this ASG']
+ message.delete()
notify(notice[0], '\n'.join(notice))
notify(notice[0], '\n'.join(notice))
@@
-54,22
+55,23
@@
def processMessage(message):
ASGName = data['AutoScalingGroupName']
InstanceId = data['EC2InstanceId']
except:
ASGName = data['AutoScalingGroupName']
InstanceId = data['EC2InstanceId']
except:
- logging.
debu
g('unparsable message %r', message.body)
+ logging.
warnin
g('unparsable message %r', message.body)
message.delete()
else:
if event == 'autoscaling:EC2_INSTANCE_LAUNCH':
try:
instanceState = ec2r.Instance(InstanceId).state['Name']
except:
message.delete()
else:
if event == 'autoscaling:EC2_INSTANCE_LAUNCH':
try:
instanceState = ec2r.Instance(InstanceId).state['Name']
except:
- logging.
debu
g('instance %s does not exist', InstanceId)
- message.
delete(
)
+ logging.
warnin
g('instance %s does not exist', InstanceId)
+ message.
change_visibility(VisibilityTimeout=60 * 2
)
else:
if instanceState == 'running':
handleEvent(message, event, ASGName, InstanceId)
else:
else:
if instanceState == 'running':
handleEvent(message, event, ASGName, InstanceId)
else:
- logging.debug('instance %s is in state %s, will try again', InstanceId, instanceState)
+ logging.warning('instance %s is in state %s, will try again', InstanceId, instanceState)
+ message.change_visibility(VisibilityTimeout=60 * 2)
else:
else:
- logging.
debu
g('nothing to do for event %r', data)
+ logging.
warnin
g('nothing to do for event %r', data)
message.delete()
message.delete()