Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

resolve crash and make more pythonic #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mchugh19
Copy link

Experienced scenario

[CRITICAL] Failed to load grains defined in grain file ec2_info.ec2_info in function <function ec2_info at 0x7f8cdfc8bde8>, error:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 757, in grains
    ret = funcs[key]()
  File "/var/cache/salt/minion/extmods/grains/ec2_info.py", line 153, in ec2_info
    grains.update(_get_ec2_hostinfo())
  File "/var/cache/salt/minion/extmods/grains/ec2_info.py", line 69, in _get_ec2_hostinfo
    d[_dash_to_snake_case(line[:-1])] = _get_ec2_hostinfo(path + line)
  File "/var/cache/salt/minion/extmods/grains/ec2_info.py", line 69, in _get_ec2_hostinfo
    d[_dash_to_snake_case(line[:-1])] = _get_ec2_hostinfo(path + line)
  File "/var/cache/salt/minion/extmods/grains/ec2_info.py", line 46, in _get_ec2_hostinfo
    if line[-1] != "/":
IndexError: string index out of range

This corrects for that case

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant