molecule: PY_COLORS fails with vagrant
Issue Type
PY_COLORS does not perform as it was supposed to, it requires sudo. Gitlab CI environment.
Molecule and Ansible details
$ python -V
Python 2.7.5
$ molecule --version
molecule, version 2.20.0
$ ansible --version
ansible 2.7.8
Both installed with pip
Log:
$ sudo molecule destroy -s libvirt –> Validating schema /builds/test/molecule/libvirt/molecule.yml. Validation completed successfully. –> Test matrix
└── libvirt ├── cleanup └── destroy
–> Scenario: ‘libvirt’ –> Action: ‘cleanup’ Skipping, cleanup playbook not configured. –> Scenario: ‘libvirt’ –> Action: ‘destroy’
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
ok: [localhost] => (item=None)
ok: [localhost]
TASK [Populate instance config] ************************************************
ok: [localhost]
TASK [Dump instance config] ****************************************************
skipping: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
$ export PY_COLORS=0 $ molecule destroy -s libvirt –> Validating schema /builds/test/molecule/libvirt/molecule.yml. Validation completed successfully. –> Test matrix
└── libvirt ├── cleanup └── destroy
–> Scenario: ‘libvirt’ –> Action: ‘cleanup’ Skipping, cleanup playbook not configured. –> Scenario: ‘libvirt’ –> Action: ‘destroy’
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
ok: [localhost] => (item=None)
ok: [localhost]
TASK [Populate instance config] ************************************************
ok: [localhost]
TASK [Dump instance config] ****************************************************
skipping: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
$ export PY_COLORS=1 $ molecule destroy -s libvirt –> Validating schema /builds/test/molecule/libvirt/molecule.yml. Validation completed successfully. –> Test matrix
└── libvirt ├── cleanup └── destroy
–> Scenario: ‘libvirt’ –> Action: ‘cleanup’ Skipping, cleanup playbook not configured. –> Scenario: ‘libvirt’ –> Action: ‘destroy’
PLAY [Destroy] *****************************************************************
TASK [Destroy molecule instance(s)] ********************************************
failed: [localhost] (item=None) => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
fatal: [localhost]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1
Detailed log
$ export PY_COLORS=1 $ molecule destroy -s libvirt . . failed: [localhost] (item={‘box’: u’centos/7’, ‘provider_options’: {‘memory’: 1024, ‘cpus’: 1, ‘uri’: u"‘qemu:///system’"}, ‘name’: u’centos7’, ‘groups’: [u’centos’]}) => { “changed”: false, “item”: { “box”: “centos/7”, “groups”: [ “centos” ], “name”: “centos7”, “provider_options”: { “cpus”: 1, “memory”: 1024, “uri”: “‘qemu:///system’” } }, “rc”: 0 }
MSG:
MODULE FAILURE
See stdout/stderr for the exact error
MODULE_STDOUT:
--> Validating schema /builds/ansible/roles/molecule/libvirt/molecule.yml.
Validation completed successfully.
{"invocation": {"module_args": {"config_options": {}, "platform_box_url": null, "provider_cpus": 2, "provider_raw_config_args": null, "platform_box": "centos/7", "provider_override_args": null, "state": "destroy", "instance_interfaces": [], "instance_name": "centos7", "platform_box_version": null, "provider_memory": 512, "instance_raw_config_args": null, "provider_options": {"memory": 1024, "uri": "'qemu:///system'", "cpus": 1}, "provider_name": "libvirt", "provision": false, "force_stop": true}}, "changed": false}
PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1
Desired Behavior
I would like to use PY_COLORS fully without sudo.
Actual Behaviour
Running as root in the container(gitlab CI executor), tested with privileged and without it. Everything worked with molecule 2.19. I updated to 2.20 and added PY_COLORS=1, now molecule create and destroy fails. Adding sudo lets create and destroy pass through but the color disappears.
It could be somehow issued with gitlab Ci, but it keeps me wondering that with PY_COLORS=0 all works flawlessly.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (6 by maintainers)
FYI, https://github.com/ansible/molecule/pull/2001 was merged which was chasing some bug related to the colorama code which is also related here. Perhaps give a re-run with the latest master and see if that is working.