docker-puppet not always returning proper error code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tripleo |
Fix Released
|
High
|
Michele Baldessari |
Bug Description
So I was given an environment for some unrelated issue and I noticed that docker-puppet did not return error even though puppet did indeed fail. This was on a recent master deplyment with all the right --detailed-
1) All status_codes are successful:
$ grep status_code var/lib/
17
$ grep status_code var/lib/
17
2) But puppet did indeed fail in at least one docker-puppet run:
"Error: Evaluation Error: Error while evaluating a Function Call, wrong number of arguments (0 for 1+) at /etc/puppet/
"+ rc=1",
"+ set -e",
"+ '[' 1 -ne 2 -a 1 -ne 0 ']'",
"+ exit 1",
"2017-11-19 22:36:06,232 INFO: 21121 -- Finished processing puppet configs for rabbitmq",
"2017-11-19 22:36:09,261 INFO: 21122 -- Removing container: docker-
"2017-11-19 22:36:09,310 INFO: 21122 -- Finished processing puppet configs for horizon",
"2017-11-19 22:36:09,311 ERROR: 21119 -- ERROR configuring rabbitmq"
Since this seems to be a race, I wonder if the code somewhere in docker-puppet.py is racy when collecting the results from the parallel docker-puppet runs *or* if docker is not always returning the right error code back from the container?
Changed in tripleo: | |
assignee: | nobody → Michele Baldessari (michele) |
status: | Triaged → In Progress |
No this seems just the broken way we are doing stuff with the ansible log collection: when_test. yaml stderr| default( '')).split( '\n')|union( outputs. stdout_ lines|default( []))
$ ansible --version |grep ^ansible
ansible 2.4.1.0
$ more playbooks/
---
- hosts: localhost
gather_facts: no
tasks:
- name: return code
shell: |
echo "fail 1"
exit 2
failed_when: false
log_when: false
register: outputs
- debug:
msg: "rc: {{ outputs.rc }}"
- debug: var=(outputs.
when: outputs is defined
failed_when: outputs|failed
Now when we run the playbook: when_test. yaml ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* *****
$ ansible-playbook playbooks/
PLAY [localhost] *******
TASK [return code] ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ***
changed: [localhost]
TASK [debug] ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* **
ok: [localhost] => {
"msg": "rc: 2"
}
TASK [debug] ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ** stderr| default( '')).split( '\n')|union( outputs. stdout_ lines|default( []))": [ when_result" : false
ok: [localhost] => {
"(outputs.
"",
"fail 1"
],
"failed_
}
PLAY RECAP ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ******* ****
localhost : ok=3 changed=1 unreachable=0 failed=0
Notice how failed=0. It seems that our 'outputs|failed' does not work at all in the debug log collecting statements