windows: "Reason: 'ssh_known_hosts.present' is not available" but execution modules used by the state (ssh.check_known_host & ssh.set_known_host) succeed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue
salt.states.ssh_known_hosts.present is not available on Windows 10 and Windows Server 2019, however, ssh.check_known_host and ssh.set_known_host, which are used by the state on lines 139 and 163, both work in windows.
C:\salt\salt-call.bat state.highstate --retcode-passthrough --local --log-level=info
Stdout from the command:
local:
----------
ID: github.com
Function: ssh_known_hosts.present
Result: False
Comment: State 'ssh_known_hosts.present' was not found in SLS 'known_host'
Reason: 'ssh_known_hosts.present' is not available.
Changes:
----------
ID: ssh.check_known_host.github.com
Function: module.run
Result: True
Comment: ssh.check_known_host: add
Started: 13:18:09.370000
Duration: 32.0 ms
Changes:
----------
ssh.check_known_host:
add
----------
ID: ssh.set_known_host.github.com
Function: module.run
Result: True
Comment: ssh.set_known_host: Success
Started: 13:18:09.402000
Duration: 5233.0 ms
Changes:
----------
ssh.set_known_host:
----------
new:
|_
----------
enc:
ssh-rsa
fingerprint:
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
hostname:
github.com
key:
AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
old:
None
status:
updated
----------
ID: ssh.recheck_known_host.github.com
Function: module.run
Result: True
Comment: ssh.check_known_host: exists
Started: 13:18:14.635000
Duration: 31.0 ms
Changes:
----------
ssh.check_known_host:
exists
----------
ID: ssh.reset_known_host.github.com
Function: module.run
Result: True
Comment: ssh.set_known_host: Success
Started: 13:18:14.666000
Duration: 16.0 ms
Changes:
----------
ssh.set_known_host:
----------
keys:
- AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
status:
exists
Summary for local
------------
Succeeded: 4 (changed=4)
Failed: 1
------------
Total states run: 5
Total run time: 5.312 s
Setup
known_hosts.sls:
# STATE MODULE FAILS IN WINDOWS AND WORKS IN LINUX
github.com:
ssh_known_hosts:
- present
- user: vagrant
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- fingerprint_hash_type: md5
- hash_known_hosts: False
# EXECUTION MODULES WORK IN BOTH WINDOWS and LINUX
ssh.check_known_host.github.com:
module.run:
- ssh.check_known_host:
- user: vagrant
- hostname: github.com
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- fingerprint_hash_type: md5
ssh.set_known_host.github.com:
module.run:
- ssh.set_known_host:
- user: vagrant
- hostname: github.com
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- fingerprint_hash_type: md5
- hash_known_hosts: False
ssh.recheck_known_host.github.com:
module.run:
- ssh.check_known_host:
- user: vagrant
- hostname: github.com
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- fingerprint_hash_type: md5
ssh.reset_known_host.github.com:
module.run:
- ssh.set_known_host:
- user: vagrant
- hostname: github.com
- fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- fingerprint_hash_type: md5
- hash_known_hosts: False
Steps to Reproduce Issue
- Remove existing known_host file:
C:\Users\vagrant\.ssh\known_hosts - Run highstate:
vagrant provisionorC:\salt\salt-call.bat state.highstate --retcode-passthrough --local --log-level=trace
The full trace level logs only show the following:
[DEBUG ] Could not LazyLoad ssh_known_hosts.present: 'ssh_known_hosts.present' is not available.
[INFO ] Running state [github.com] at time 14:57:26.369000
[DEBUG ] Could not LazyLoad ssh_known_hosts.present: 'ssh_known_hosts.present' is not available.
[ERROR ] State 'ssh_known_hosts.present' was not found in SLS 'known_host'
Reason: 'ssh_known_hosts.present' is not available.
Versions Report
Salt Version:
Salt: 2019.2.2
Dependency Versions:
cffi: 1.12.2
cherrypy: 17.4.1
dateutil: 2.8.0
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 2.1.10
ioflo: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
libnacl: 1.6.1
M2Crypto: Not Installed
Mako: 1.0.7
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.19
pycrypto: Not Installed
pycryptodome: 3.8.1
pygit2: Not Installed
Python: 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
python-gnupg: 0.4.4
PyYAML: 3.13
PyZMQ: 18.0.1
RAET: Not Installed
smmap: 2.0.5
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist:
locale: cp1252
machine: AMD64
release: 10
system: Windows
version: 10 10.0.18362 Multiprocessor Free
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with salt/states/ssh_known_hosts.py and the ssh.check_known_host and ssh.set_known_host execution modules referenced in the issue. Reproduce the Windows failure with state.highstate using the supplied known_hosts.sls, then compare the state’s availability with the working execution modules. Done means ssh_known_hosts.present works on Windows without the reported missing-state error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100