-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CommandComplete waiter to ssm GetCommandInvocation operation #90
Comments
P48336721 |
@stobrien89 , thanks for creating this. Would it be a new waiter to accompany or replace the existing command-executed waiter? I'd really like a waiter that doesn't fail because "doesn't exist yet" and doesn't fail because the command failed. I just need to know when I can retrive the result of the invocation. I find that command-executed behaves very strangely in boto3 1.17.102. I created the following function to learn how SSM works: def test_ec2():
ssm = boto3.client("ssm")
instance_id = "i-1111111111111111"
response = ssm.send_command(
InstanceIds=[instance_id],
DocumentName="AWS-RunShellScript",
Parameters={"commands": ["missing"]}
)
command_id = response["Command"]["CommandId"]
waiter = ssm.get_waiter("command_executed")
while True:
try:
waiter.wait(
CommandId=command_id,
InstanceId=instance_id
)
except WaiterError as ex:
print("!" * 40)
print(ex.last_response)
error = ex.last_response.get("Error")
if error:
if error["Code"] == "InvocationDoesNotExist":
time.sleep(0.1)
continue
if ex.last_response["Status"] == "Failed":
break
raise ex
output = ssm.get_command_invocation(
CommandId=command_id,
InstanceId=instance_id
)
print(output) The function just tries to run a command that shouldn't exist on an EC2 instance and gets the result. It needs to run the waiter in a loop with a complex try-catch inside to get the behavior I want. You can see the waiter first raises an exception because of an InvocationDoesNotExist error, and then raises another exception because the comand failed. Apart from the request ID, the content of the exception from command failure seems identical to the invocation result.
|
Hi @iainelder, This waiter would accompany the existing |
Heard back from the ssm team today— They've added this request to their backlog, which is a good sign, but we don't have an estimated date of completion. I'll provide any additional updates I receive from them. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Any updates? |
Originated from: boto/botocore#1744
Linked PR: boto/botocore#1753
The text was updated successfully, but these errors were encountered: