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

Prevent backtrace (KeyError) in `ssh_known_hosts.present` state #29112

Merged
merged 1 commit into from Nov 25, 2015

Conversation

Projects
None yet
3 participants
@eliasp
Member

eliasp commented Nov 22, 2015

When using test=true, the ssh_known_hosts.present state will run
into a backtrace because of an KeyError. Prevent that.

An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/state.py", line 1591, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/site-packages/salt/states/ssh_known_hosts.py", line 122, in present
    config=config)
  File "/usr/lib/python2.7/site-packages/salt/modules/ssh.py", line 827, in check_known_host
    return ('exists' if fingerprint == known_host['fingerprint']
KeyError: 'fingerprint'
@cachedout

This comment has been minimized.

Show comment
Hide comment
@cachedout

cachedout Nov 23, 2015

Contributor

@eliasp Thanks for catching this. The linter requires a small change to be satisified here. Could you please take a look? Thanks!

Contributor

cachedout commented Nov 23, 2015

@eliasp Thanks for catching this. The linter requires a small change to be satisified here. Could you please take a look? Thanks!

Prevent backtrace (KeyError) in `ssh_known_hosts.present` state
When using `test=true`, the `ssh_known_hosts.present` state will run
into a backtrace because of an KeyError. Prevent that.
```
An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/state.py", line 1591, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/site-packages/salt/states/ssh_known_hosts.py", line 122, in present
    config=config)
  File "/usr/lib/python2.7/site-packages/salt/modules/ssh.py", line 827, in check_known_host
    return ('exists' if fingerprint == known_host['fingerprint']
KeyError: 'fingerprint'
```
@eliasp

This comment has been minimized.

Show comment
Hide comment
@eliasp

eliasp Nov 23, 2015

Member

@cachedout oups, sorry… fixed that.

Member

eliasp commented Nov 23, 2015

@cachedout oups, sorry… fixed that.

@jfindlay

This comment has been minimized.

Show comment
Hide comment
@jfindlay

jfindlay Nov 24, 2015

Contributor

Go Go Jenkins!

Contributor

jfindlay commented Nov 24, 2015

Go Go Jenkins!

cachedout added a commit that referenced this pull request Nov 25, 2015

Merge pull request #29112 from eliasp/ssh_known_hosts.present-backtra…
…ce-test

Prevent backtrace (KeyError) in `ssh_known_hosts.present` state

@cachedout cachedout merged commit cc69c87 into saltstack:2015.8 Nov 25, 2015

4 of 6 checks passed

default Merged build finished.
Details
jenkins/salt-pr-rs-cent6-n Salt PR - RS CentOS 6 #199 — FAILURE
Details
jenkins/salt-pr-clone Salt PR - Clone Repository #11487 — SUCCESS
Details
jenkins/salt-pr-linode-ubuntu14.04-n Salt PR - Linode Ubuntu 14.04 #2554 — SUCCESS
Details
jenkins/salt-pr-lint-n Salt PR - Code Lint #11195 — SUCCESS
Details
jenkins/salt-pr-rs-cent7-n Salt PR - RS CentOS 7 #10024 — SUCCESS
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment