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

unable to set config-file #1228

Closed
Eimert opened this issue Apr 1, 2018 · 5 comments

Comments

@Eimert
Copy link
Contributor

@Eimert Eimert commented Apr 1, 2018

Issue Type

  • Bug report

Molecule and Ansible details

ansible --version

2.5.0

molecule --version

1.11.0

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Desired Behavior

yamllint -c .yamllint . or

eimert@EIM ansible-role-awx $ yamllint .
./tests/test-no-playbook.yml
  5:31      warning  truthy value is not quoted  (truthy)

./tasks/main.yml
  17:12     warning  truthy value is not quoted  (truthy)
  18:21     warning  truthy value is not quoted  (truthy)

./tasks/awx-install-playbook.yml
  13:17     warning  truthy value is not quoted  (truthy)

./defaults/main.yml
  5:19      warning  truthy value is not quoted  (truthy)
  6:27      warning  truthy value is not quoted  (truthy)
eimert@EIM ansible-role-awx $ cat .yamllint 
---
extends: default

ignore: |
  /roles/
  /molecule/

Actual Behaviour (Bug report only)

eimert@EIM ansible-role-awx $ molecule test --scenario-name="default"; echo $? 
...snip..
--> Scenario: 'default'
--> Action: 'lint'
--> Executing Yamllint on files found in /home/eimert/dev/ansible-role-awx/...
    /home/eimert/dev/ansible-role-awx/tests/test-no-playbook.yml
      5:31      warning  truthy value is not quoted  (truthy)
    
    /home/eimert/dev/ansible-role-awx/molecule/centos-7/verifier.yml
      18:81     error    line too long (84 > 80 characters)  (line-length)
      19:81     error    line too long (114 > 80 characters)  (line-length)
      45:22     warning  truthy value is not quoted  (truthy)
    
    /home/eimert/dev/ansible-role-awx/molecule/centos-7/destroy.yml
      5:17      warning  truthy value is not quoted  (truthy)
    
    /home/eimert/dev/ansible-role-awx/molecule/centos-7/prepare.yml
      4:17      warning  truthy value is not quoted  (truthy)
    
    /home/eimert/dev/ansible-role-awx/molecule/centos-7/create.yml
      5:17      warning  truthy value is not quoted  (truthy)
      9:81      error    line too long (87 > 80 characters)  (line-length)
      10:81     error    line too long (85 > 80 characters)  (line-length)
      16:81     error    line too long (116 > 80 characters)  (line-length)
      30:81     error    line too long (92 > 80 characters)  (line-length)
      33:81     error    line too long (124 > 80 characters)  (line-length)
      41:19     warning  truthy value is not quoted  (truthy)
      43:81     error    line too long (93 > 80 characters)  (line-length)
... snip ...

As you can see, files in the /molecule/ dir are included 👎

head default/molecule.yml:

---
dependency:
  name: galaxy
  options:
    role-file: requirements.yml
driver:
  name: docker
lint:
  name: yamllint
  options:
    config-file: .yamllint

The default yamllint config files is also ignored with this molecule.yml setting:

lint:
  name: yamllint

Please give some details of what is actually happening.
It seems molecule neglects the .yamllint config file, even though it is configured. Changing the filename leads to a python FileNotFoundError:

--> Executing Yamllint on files found in /home/eimert/dev/ansible-role-awx/...
Traceback (most recent call last):
  File "/usr/local/bin/yamllint", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.5/dist-packages/yamllint/cli.py", line 125, in run
    conf = YamlLintConfig(file=args.config_file)
  File "/usr/local/lib/python3.5/dist-packages/yamllint/config.py", line 36, in __init__
    with open(file) as f:
FileNotFoundError: [Errno 2] No such file or directory: '.yamllindt'
An error occured during the test sequence.  Cleaning up.

Identical to yamllint -c .yamllinat . It seems molecule feeds the right filename to yamllint. Not sure this error resides in molecule or yamllint.

code on github

travis-ci pipeline output (molecule)

@retr0h

This comment has been minimized.

Copy link
Contributor

@retr0h retr0h commented Apr 1, 2018

Please migrate to Molecule v2.

@Eimert

This comment has been minimized.

Copy link
Contributor Author

@Eimert Eimert commented Apr 1, 2018

@retr0h I'm using the latest version of molecule: molecule, version 2.12.1

@retr0h

This comment has been minimized.

Copy link
Contributor

@retr0h retr0h commented Apr 1, 2018

I'll look at this later today. I suggest running molecule --debug lint to see what arguments are being passed to yamllint.

Also, it should be noted yamllint is executed by having a list of all yaml files found by Molecule passed to yamllint vs it being passed a directory to test. I don't remember why I actually did this, but I am guessing that is the problem.

@retr0h

This comment has been minimized.

Copy link
Contributor

@retr0h retr0h commented Apr 2, 2018

Looks like if you change your yamllint file to the following it will work.

---
extends: default

ignore: |
  roles/
  molecule/
@retr0h retr0h added the question label Apr 2, 2018
@retr0h retr0h closed this Apr 2, 2018
Eimert added a commit to Eimert/ansible-role-awx that referenced this issue Apr 2, 2018
@Eimert

This comment has been minimized.

Copy link
Contributor Author

@Eimert Eimert commented Apr 2, 2018

@retr0h issue is now resolved by removing the leading slash (/). Thank you very much 👍

Eimert added a commit to Eimert/yamllint that referenced this issue Apr 2, 2018
[Solved](ansible/molecule#1228), when yamllint is used by molecule.
adrienverge added a commit to adrienverge/yamllint that referenced this issue Apr 2, 2018
[Solved](ansible/molecule#1228), when yamllint is used by molecule.
adrienverge added a commit to adrienverge/yamllint that referenced this issue Apr 2, 2018
[Solved](ansible/molecule#1228), when
yamllint is used by molecule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.