[stable-2.19] Avoid the ssh-agent exiting before tests end (#85979) (#86007)

There were couple of occurrences where the hard 30 seconds limit on
running ssh-agent was not enough for the test to run and the ssh-agent
was killed resulting in the test failing with "Connection refused". This
change just lets the agent run in the background and kills it
manually after the tests finish.
(cherry picked from commit 05d5b0f168)
pull/86094/head
Martin Krizek 1 month ago committed by GitHub
parent e93bc92d97
commit 33ee48c590
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -29,15 +29,17 @@
vars:
pid: '{{ auto.stdout|regex_findall("ssh-agent\[(\d+)\]")|first }}'
- command: ssh-agent -D -s -a '{{ output_dir }}/agent.sock'
async: 30
poll: 0
- shell: ssh-agent -D -s -a '{{ output_dir }}/agent.sock' &
register: ssh_agent_result
- block:
- command: ansible-playbook -i {{ ansible_inventory_sources|first|quote }} -vvv {{ role_path }}/auto.yml
environment:
ANSIBLE_CALLBACK_RESULT_FORMAT: yaml
ANSIBLE_SSH_AGENT: '{{ output_dir }}/agent.sock'
register: existing
always:
- command: "kill {{ ssh_agent_result.stdout | regex_search('Agent pid ([0-9]+)', '\\1') | first }}"
- assert:
that:

Loading…
Cancel
Save