Update git test to not rm ~/.ssh/known_hosts.

pull/25044/merge
Matt Clay 7 years ago
parent 02311604c9
commit cbb5d1e5d5

@ -18,9 +18,6 @@ gce_project_id:
azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
# GITHUB SSH private key - a path to a SSH private key for use with github.com
github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa"
# Cloudflare Credentials
cloudflare_api_token:
cloudflare_email:

@ -1,15 +1,10 @@
---
- name: remove known_host files
file:
state: absent
path: '{{ item }}'
with_items: "{{known_host_files}}"
- name: checkout ssh://git@github.com repo without accept_hostkey (expected fail)
git:
repo: '{{ repo_format2 }}'
dest: '{{ checkout_dir }}'
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
register: git_result
ignore_errors: true
@ -23,19 +18,20 @@
dest: '{{ checkout_dir }}'
accept_hostkey: true
key_file: '{{ github_ssh_private_key }}'
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
register: git_result
when: github_ssh_private_key is defined
- assert:
that:
- 'git_result.changed'
when: not git_result|skipped
when: github_ssh_private_key is defined
- name: clear checkout_dir
file:
state: absent
path: '{{ checkout_dir }}'
when: github_ssh_private_key is defined
- name: checkout ssh://git@github.com repo with accept_hostkey (expected pass)
git:
@ -44,10 +40,11 @@
version: 'master'
accept_hostkey: false # should already have been accepted
key_file: '{{ github_ssh_private_key }}'
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
register: git_result
when: github_ssh_private_key is defined
- assert:
that:
- 'git_result.changed'
when: not git_result|skipped
when: github_ssh_private_key is defined

@ -18,3 +18,5 @@ known_host_files:
- '/etc/ssh/ssh_known_hosts'
git_version_supporting_depth: 1.9.1
git_version_supporting_ls_remote: 1.7.5
# path to a SSH private key for use with github.com (tests skipped if undefined)
# github_ssh_private_key: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"

Loading…
Cancel
Save