Molecule: `MOLECULE_DEBUG` env var is not honoured

Created on 17 Jan 2019  路  4Comments  路  Source: ansible-community/molecule

Issue Type

  • Feature request

Desired Behavior

Like Ansible, molecule should load environment variable declared with MOLECULE_ prefix and and use them as default values for command line arguments.

At this moment to enable debug more, user needs to add --debug after molecule and before the commands. This may prove quite inconvenient as the CLI call could be in a file or even other ci repository.

By regonnizing MOLECULE_DEBUG=1 it would be much easier to trigger the debug mode without having to alter the source code and the entire build chain.

Hint: Ansible has quite a nice implementaiton regarding parsing environment variables and translating them directly into default values, avoiding the need to implement this feature for each command line option.

bug

All 4 comments

OK, MOLECULE_DEBUG is already being honoured.

See https://github.com/ansible/molecule/blob/master/molecule/config.py#L189.

I assume you already tried this and it didn't work, so, is it that it needs to be =True/False?

Hey @ssbarnea, I've played around with this with MOLECULE_DEBUG=1 and MOLECULE_DEBUG=True and it didn't work. So, this looks like a bug!

We need to be sure that we correctly recognize:

  • true: =1 =[tT]rue =yes
  • false: =0 =[Ff]false =no
    Just to be sure people are not surprised when they define it. If we cover for these we are safe.

PS. I am not sure which should be the behavior when variable is defined but empty.

I've looked at the source and the root of the issue is that when merging os.environ with default hardcoded config default takes precedence over OS-provided env vars.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srizzling picture srizzling  路  3Comments

surfer190 picture surfer190  路  3Comments

asg1612 picture asg1612  路  4Comments

decentral1se picture decentral1se  路  3Comments

brucellino picture brucellino  路  4Comments