pytest-ansible hangs when using shell/command with 2.0.2 & it is unable to parse inventory file
geetikakay opened this issue · 1 comments
Issue 1 : It is unable to parse inventory file with recently supported format as ansible.
Ansible 2.7 host file format for python3:
[master] 10.8.241.181 hostname=10.8.241.181[all]
10.8.241.181 hostname=10.8.241.181
[localhost:vars]
ansible_python_interpreter=/usr/bin/python3
[master:vars]
ansible_python_interpreter=/usr/libexec/platform-python
[WARNING]: * Failed to parse /pki-pytest-ansible/hosts with ini plugin: /pki-pytest-ansible/hosts:7: Section
[localhost:vars] not valid for undefined group: localhost
[WARNING]: Unable to parse /pki-pytest-ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
Issue 2: We see a hang at times in pytest-ansible during shell/command execution in remote hosts.
We are simply running a command using shell. and it never gets executed on the remote instance.
versions:
pytest-ansible==2.0.2
INFO:utils:Submit csr to the RootCA: Dogtagpki
DEBUG:pytest_ansible.module_dispatcher.v24:[master] shell: {'_raw_params': 'pki -p 20080 ca-cert-request-submit --profile caCACert --csr-file /tmp/ca_signing.csr'}
DEBUG:pytest_ansible.module_dispatcher.v24:Play({'gather_facts': 'no', 'tasks': [{'action': {'args': {'_raw_params': 'pki -p 20080 ca-cert-request-submit --profile caCACert --csr-file /tmp/ca_signing.csr'}, 'module': 'shell'}}], 'hosts': 'master', 'name': 'pytest-ansible'})
DEBUG:pytest_ansible.module_dispatcher.v24:TaskQueueManager({'passwords': {'conn_pass': None, 'become_pass': None}, 'inventory': <ansible.inventory.manager.InventoryManager object at 0x7f816c409d50>, 'stdout_callback': <pytest_ansible.module_dispatcher.v24.ResultAccumulator object at 0x7f8169a1c050>, 'variable_manager': <ansible.vars.manager.VariableManager object at 0x7f816b13ca50>, 'options': <Values at 0x7f8169990b90: {'subset': None, 'ask_pass': False, 'become_user': u'root', 'poll_interval': 15, 'sudo': False, 'private_key_file': None, 'syntax': None, 'one_line': None, 'diff': False, 'sftp_extra_args': '', 'check': False, 'remote_user': None, 'become_method': u'sudo', 'ask_su_pass': False, 'vault_ids': [], 'become_ask_pass': False, 'inventory': None, 'vault_password_files': [], 'forks': 5, 'listhosts': None, 'ssh_extra_args': '', 'seconds': 0, 'become': False, 'su_user': None, 'ask_sudo_pass': False, 'extra_vars': [], 'verbosity': 5, 'tree': None, 'su': False, 'ssh_common_args': '', 'connection': u'smart', 'ask_vault_pass': False, 'timeout': 10, 'module_path': [u'/builds/gkapoor/pki-pytest-ansible/common-modules'], 'sudo_user': None, 'scp_extra_args': ''}>, 'loader': <ansible.parsing.dataloader.DataLoader object at 0x7f816c409cd0>})
DEBUG:pytest_ansible.module_dispatcher.v24:{'unreachable': {}, 'contacted': {u'10.8.249.214': {'_ansible_parsed': True, 'stderr_lines': [], u'changed': True, u'end': u'2�[31;1mERROR: Job failed: execution took longer than 1h0m0s seconds<
- With pytest-ansible==1.3
INFO:utils:Submit csr to the RootCA: Dogtagpki
DEBUG:pytest_ansible.plugin:[master] shell: {'_raw_params': 'pki -p 20080 ca-cert-request-submit --profile caCACert --csr-file /tmp/ca_signing.csr'}
DEBUG:pytest_ansible.plugin:{'unreachable': {}, 'contacted': {u'10.8.252.3': {'_ansible_parsed': True, 'stderr_lines': [], u'cmd': [u'pki', u'-p', u'20080', u'ca-cert-request-submit', u'--profile', u'caCACert', u'--csr-file', u'/tmp/ca_signing.csr'], u'end': u'2019-04-02 05:14:02.020011', '_ansible_no_log': False, u'stdout': u'-----------------------------
Submitted certificate request
Request ID: 18
Type: enrollment
Request Status: pending
Operation Result: success', u'changed': True, u'rc': 0, u'start': u'2019-04-02 05:14:00.668801', u'stderr': u'', u'delta': u'0:00:01.351210', u'invocation': {u'module_args': {u'warn': True, u'executable': None, u'_uses_shell': False, u'_raw_params': u'pki -p 20080 ca-cert-request-submit --profile caCACert --csr-file /tmp/ca_signing.csr', u'removes': None, u'creates': None, u'chdir': None}}, 'stdout_lines': [u'-----------------------------', u'Submitted certificate request', u'-----------------------------', u' Request ID: 18', u' Type: enrollment', u' Request Status: pending', u' Operation Result: success']}}}
INFO:test_externalca_dogtagpki: Checking output : {u'10.8.252.3': {'_ansible_parsed': True, 'stderr_lines': [], u'cmd': [u'pki', u'-p', u'20080', u'ca-cert-request-submit', u'--profile', u'caCACert', u'--csr-file', u'/tmp/ca_signing.csr'], u'end': u'2019-04-02 05:14:02.020011', '_ansible_no_log': False, u'stdout': u'-----------------------------
Submitted certificate request
Request ID: 18
Type: enrollment
Request Status: pending
One issue per report please. Let's make this report specific to the inventory format issue you noted.
Can you please update your original report to attach the original (formatted) inventory file you are using? Also, the full output. What you pasted appears truncated. Please use backticks (`) to format correctly. Thanks!
Regarding the second issue, this appears to me to be an issue you are experiencing with Ansible itself, not pytest-ansible, or rather the command that ansible is running on your behalf. The text in the response (ERROR: Job failed: execution took longer than 1h0m0s
) is not from pytest-ansible or ansible, but from the software you are running. I would suggest continuing further analysis there.