Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Ansible playbooks are not logged #612

Open
jguedez opened this issue Jun 21, 2021 · 0 comments
Open

Errors in Ansible playbooks are not logged #612

jguedez opened this issue Jun 21, 2021 · 0 comments

Comments

@jguedez
Copy link

jguedez commented Jun 21, 2021

Errors in Ansible playbooks from contrib.ansible are not logged. This seems to be related to using check_call instead of check_output on [0].

This creates issues on projects that use this library as end users have no way of knowing what the problem actually is [1]

2021-02-18 23:20:12 WARNING install File "/var/lib/juju/agents/unit-elasticsearch-2/charm/hooks/charmhelpers/contrib/ansible/__init__.py", line 282, in execute
2021-02-18 23:20:12 WARNING install charmhelpers.contrib.ansible.apply_playbook(
2021-02-18 23:20:12 WARNING install File "/var/lib/juju/agents/unit-elasticsearch-2/charm/hooks/charmhelpers/contrib/ansible/__init__.py", line 216, in apply_playbook
2021-02-18 23:20:12 WARNING install subprocess.check_call(call, env=env)
2021-02-18 23:20:12 WARNING install File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
2021-02-18 23:20:12 WARNING install raise CalledProcessError(retcode, cmd)
2021-02-18 23:20:12 WARNING install subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'playbook.yaml', '--tags', 'install']' returned non-zero exit status 2.
2021-02-18 23:20:12 ERROR juju.worker.uniter.operation runhook.go:136 hook "install" (via explicit, bespoke hook script) failed: exit status 1

Another issue has a similar problem [2]

[0] https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/ansible/__init__.py#L216
[1] https://bugs.launchpad.net/charm-elasticsearch/+bug/1916263
[2] #607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant