salt icon indicating copy to clipboard operation
salt copied to clipboard

ssh_auth.present fails to find public key in salt:// path with "Source file ... is missing"

Open jetpak opened this issue 10 years ago • 5 comments

after upgrading our salt-minion from 2015.5.5-1.el7 to 2015.8.4-1.el7 one of our old states that used to work started failing

the master is at: 2015.8.4 (Beryllium)

Summary:

  • looks like ssh_auth.present fails to find our ssh public key that is in our file_roots
  • the file url is: salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub
  • the same file is successfully referenced by file.managed
  • however, ssh_auth.present (source:) seems to fail to find this file

Here is a snippet of the failing state:

tomcat_jenkins_ssh_auth_centos:
  ssh_auth.present:
    - user: centos
    - source: salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub

Here is the output of the failure:

sym-es4-dev-ause1-aha3:
----------
          ID: tomcat_jenkins_ssh_auth_centos
    Function: ssh_auth.present
      Result: False
     Comment: Failed to add the ssh key. Source file salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub is missing
     Started: 05:59:18.113648
    Duration: 6.623 ms
     Changes:

Summary
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1

jetpak avatar Feb 03 '16 06:02 jetpak

@jetpak, thanks for reporting. Will you also post the minion debug log when this happens?

jfindlay avatar Feb 04 '16 00:02 jfindlay

hi @jfindlay here is the snippet from our minion log - let me know if you need anything else

2016-02-05 01:13:12,901 [salt.minion ][INFO ][17357] User sudo_jerome Executing command state.sls with jid 20160205011312872925 2016-02-05 01:13:12,908 [salt.minion ][INFO ][82233] Starting a new job with PID 82233 2016-02-05 01:13:13,671 [salt.state ][INFO ][82233] Loading fresh modules for state activity 2016-02-05 01:13:13,688 [salt.fileclient ][INFO ][82233] Fetching file from saltenv 'prod', ** skipped ** latest already in cache u'salt://exp/jjp/salt-30851.sls' 2016-02-05 01:13:13,697 [salt.state ][INFO ][82233] Running state [/tmp/ssh_id_rsa.pub] at time 01:13:13.697304 2016-02-05 01:13:13,698 [salt.state ][INFO ][82233] Executing state file.managed for /tmp/ssh_id_rsa.pub 2016-02-05 01:13:13,711 [salt.fileclient ][INFO ][82233] Fetching file from saltenv 'prod', ** skipped ** latest already in cache u'salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub' 2016-02-05 01:13:13,712 [salt.state ][INFO ][82233] File changed: New file 2016-02-05 01:13:13,712 [salt.state ][INFO ][82233] Completed state [/tmp/ssh_id_rsa.pub] at time 01:13:13.712363 2016-02-05 01:13:13,713 [salt.state ][INFO ][82233] Running state [ssh_auth_fails] at time 01:13:13.712984 2016-02-05 01:13:13,713 [salt.state ][INFO ][82233] Executing state ssh_auth.present for ssh_auth_fails 2016-02-05 01:13:13,716 [salt.state ][ERROR ][82233] Failed to add the ssh key. Source file salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub is missing 2016-02-05 01:13:13,716 [salt.state ][INFO ][82233] Completed state [ssh_auth_fails] at time 01:13:13.716387 2016-02-05 01:13:13,718 [salt.minion ][INFO ][82233] Returning information for job: 20160205011312872925

jetpak avatar Feb 05 '16 01:02 jetpak

here is the matching test state that produced the above minion output:

file_managed_works: file.managed: - name: /tmp/ssh_id_rsa.pub - source: salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub

ssh_auth_fails: ssh_auth.present: - user: centos - source: salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub

jetpak avatar Feb 05 '16 01:02 jetpak

what is the 'u' in front of the path: u'salt://_a_binaries/certs/jenkins/ssh_id_rsa.pub'

why doesn't the ssh_auth have the same char in the source path?

jetpak avatar Feb 05 '16 01:02 jetpak

Dup of #30939

meggiebot avatar Feb 05 '16 20:02 meggiebot