Skip to content
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

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 #55366

Open
muddman opened this issue Nov 19, 2019 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Windows
Milestone

Comments

@muddman
Copy link

muddman commented Nov 19, 2019

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

  1. Remove existing known_host file: C:\Users\vagrant\.ssh\known_hosts
  2. Run highstate: vagrant provision or C:\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
@muddman muddman changed the title windows: "Reason: 'ssh_known_hosts.present' is not available" but ssh.check_known_host succeed and ssh.set_known_host succeed 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 Nov 19, 2019
@Akm0d Akm0d added v2019.2.2 unsupported version Bug broken, incorrect, or confusing behavior labels Nov 20, 2019
@Akm0d Akm0d added this to Backlog in Neon Nov 20, 2019
@Akm0d Akm0d added this to the Approved milestone Nov 20, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 7, 2020
@waynew waynew added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 8, 2020
@stale
Copy link

stale bot commented Jan 8, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 8, 2020
@sagetherage sagetherage removed the v2019.2.2 unsupported version label Jan 24, 2020
@sagetherage sagetherage removed this from Backlog in Neon Jan 24, 2020
@sagetherage sagetherage added this to Considering in Sodium Jan 24, 2020
@sagetherage sagetherage removed this from Considering in Sodium Apr 24, 2020
@xeacott xeacott added this to To do in Windows Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Windows
Projects
Windows
  
To do
Magnesium
  
Awaiting triage
Development

No branches or pull requests

4 participants