GabLeRoux

Untitled

Jul 18th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.24 KB | None | 0 0
  1. {% set user = "" %}
  2. {% set group = "" %}
  3. {% set team = "" %}
  4. {% set repo_name = "" %}
  5. {% set deployment_key_path = "/home/" + user + "/.ssh/deployment_key_rsa" %}
  6.  
  7. # this works
  8. git:
  9.  pkg.installed
  10.  
  11. # this works
  12. github.com known host for {{ user }}:
  13.   ssh_known_hosts.present:
  14.     - user: {{ user }}
  15.     - name: github.com
  16.     - fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
  17.  
  18. # this works (key looks exactly like it should)
  19. deployment key {{ deployment_key_path }}:
  20.   file.managed:
  21.     - name: {{ deployment_key_path }}
  22.     # - contents_pillar: deployment_key
  23.     - mode: 0600
  24.     - user: {{ user }}
  25.     - group: {{ group }}
  26.  
  27. # this fails
  28. update repository {{ team }}/{{ repo_name }}:
  29.   git.latest:
  30.     - name: ssh://git@github.com:{{ team }}/{{ repo_name }}.git
  31.     - user: {{ user }}
  32.     - target: /opt/git/{{ repo_name }}
  33.     - identity: {{ deployment_key_path }}
  34.     - require:
  35.       - pkg: git
  36.       - ssh_known_hosts: github.com
  37.       - file: {{ deployment_key_path }}
  38.  
  39.  
  40. # output: (note: repository is private, hence the not found)
  41. ----------
  42.  
  43. ...
  44. [INFO    ] Running state [ssh://git@github.com:<snip>/<snip>.git] at time 01:05:23.911302
  45. [INFO    ] Executing state git.latest for ssh://git@github.com:<snip>/<snip>.git
  46. [INFO    ] Checking remote revision for ssh://git@github.com:<snip>/<snip>.git
  47. [INFO    ] Attempting git authentication using identity file /home/<snip>/.ssh/deployment_key_rsa
  48. [INFO    ] Executing command ['git', 'ls-remote', 'ssh://git@github.com:<snip>/<snip>.git'] as user '<snip>' in directory '/home/<snip>'
  49. [ERROR   ] Command ['git', 'ls-remote', 'ssh://git@github.com:<snip>/<snip>.git'] failed with return code: 128
  50. [ERROR   ] stderr: ERROR: Repository not found.
  51.  
  52.  
  53.           ID: update repository <snip>/<snip>
  54.     Function: git.latest
  55.         Name: ssh://git@github.com:<snip>/<snip>.git
  56.       Result: False
  57.      Comment: Failed to check remote refs: Unable to authenticate using identity file:
  58.              
  59.               ERROR: Repository not found.
  60.               fatal: Could not read from remote repository.
  61.              
  62.               Please make sure you have the correct access rights
  63.               and the repository exists.
  64.      Started: 01:05:23.911302
  65.     Duration: 941.62 ms
  66.      Changes:
  67. ### salt version:
  68.  
  69. Salt Version:
  70.            Salt: 2015.8.8.2
  71.  
  72. Dependency Versions:
  73.          Jinja2: 2.8
  74.        M2Crypto: Not Installed
  75.            Mako: Not Installed
  76.          PyYAML: 3.11
  77.           PyZMQ: 14.4.0
  78.          Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
  79.            RAET: Not Installed
  80.         Tornado: 4.2.1
  81.             ZMQ: 4.0.5
  82.            cffi: 0.8.6
  83.        cherrypy: Not Installed
  84.        dateutil: 2.5.3
  85.           gitdb: Not Installed
  86.       gitpython: Not Installed
  87.           ioflo: Not Installed
  88.         libgit2: Not Installed
  89.         libnacl: Not Installed
  90.    msgpack-pure: Not Installed
  91.  msgpack-python: 0.4.2
  92.    mysql-python: 1.2.3
  93.       pycparser: 2.10
  94.        pycrypto: 2.6.1
  95.          pygit2: Not Installed
  96.    python-gnupg: 0.3.8
  97.           smmap: Not Installed
  98.         timelib: Not Installed
  99.  
  100. System Versions:
  101.            dist: debian 8.1
  102.         machine: x86_64
  103.         release: 3.16.0-4-amd64
  104.          system: debian 8.1
Add Comment
Please, Sign In to add comment