-
Notifications
You must be signed in to change notification settings - Fork 171
ec2_info breaks on empty endpoint #195
base: master
Are you sure you want to change the base?
Conversation
Noticed the same here with the recent
I came up with quite about the same resolution:
|
I was in the process of adding this as a PR: It looks like they're not done with these changes though. Maintenance events aren't actually getting into the metadata service yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like. len(line) ==0 is the best approach. We can always test for a variable being missing. This covers the current problem well and potentially avoids other issues with metadata drift.
Please consider merging this already as-is (without waiting for feedback from AWS etc), given the impact of this. |
There is no line. It isn’t that there is a blank line which I think would break the protocol since each line means something. When you split nothing you get an array with a single empty string. My solution was to wrap everything so that an empty response returns {} |
Yeah, changing lines = resp_data.split("\n")
if lines:
for line in lines: |
Just noticed this and submitted a PR before seeing this one. I think the fix in #201 is a little bit more direct and clean. It also matches the now upstream behavior from https://github.com/saltstack/salt/blob/develop/salt/grains/metadata.py#L61 |
@mchugh19 |
It seems that if implemented that way it would try to get a value for a non existent key. Surely the right way is to return an empty set if the result is empty? |
Here is AWS's response on the ticket that @kdecoteauCS mentioned:
|
Thanks. TLDR:
|
By default
events/maintenance/
is empty which makes_get_ec2_hostinfo
to fail with the following error: