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

ansible-galaxy collection init generates galaxy.yml that fails YAMLlint #60909

Closed
geerlingguy opened this issue Aug 19, 2019 · 4 comments
Closed
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@geerlingguy
Copy link
Contributor

SUMMARY

Not 100% sure if this is a bug or not... but when I initialize a new collection with ansible-galaxy collection init, then run yamllint on it, I get the warnings:

    /Users/jgeerling/Dropbox/VMs/ansible_collections/geerlingguy/testing/galaxy.yml
      6:1       warning  missing document start "---"  (document-start)
      20:1      error    wrong indentation: expected 2 but found 0  (indentation)
      31:1      error    wrong indentation: expected 2 but found 0  (indentation)

It would be nice if the file would pass linting, as the meta/main.yml file does after you fill in a few blanks (with the exception of a 'missing document start').

Or... this can be closed as being pedantic :D

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible-galaxy collection init

ANSIBLE VERSION
$ ansible --version
ansible 2.9.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/Users/jgeerling/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jgeerling/Downloads/ansible/lib/ansible
  executable location = /Users/jgeerling/Downloads/ansible/bin/ansible
  python version = 2.7.16 (default, Apr 12 2019, 15:32:40) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.3)]
CONFIGURATION
$ ansible-config dump --only-changed
ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
ANSIBLE_SSH_CONTROL_PATH(/etc/ansible/ansible.cfg) = /tmp/ansible-ssh-%%h-%%p-%%r
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 20
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = [u'/etc/ansible/hosts']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/Users/jgeerling/Dropbox/VMs/roles']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = yaml
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

macOS 10.14.4

STEPS TO REPRODUCE
ansible-galaxy collection init geerlingguy.testing
< cd into that directory >
yamllint ./
EXPECTED RESULTS

No errors.

ACTUAL RESULTS
    /Users/jgeerling/Dropbox/VMs/ansible_collections/geerlingguy/testing/galaxy.yml
      6:1       warning  missing document start "---"  (document-start)
      20:1      error    wrong indentation: expected 2 but found 0  (indentation)
      31:1      error    wrong indentation: expected 2 but found 0  (indentation)

File affected: https://github.com/ansible/ansible/blob/devel/lib/ansible/galaxy/data/default/collection/galaxy.yml.j2

Example galaxy.yml file: https://gist.github.com/geerlingguy/d0cc44e16b0d6d9938e07939b44107ec

@ansibot
Copy link
Contributor

ansibot commented Aug 19, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 19, 2019
@sivel
Copy link
Member

sivel commented Aug 20, 2019

Based on our CI rules, this YAML file passes without issue. I'm guessing your ruleset is overly strict compared to the rules we use.

https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/_data/sanity/yamllint/config/default.yml

@geerlingguy
Copy link
Contributor Author

Makes sense, then; though I don't particularly like the indentation: disable, because that's one of the few rules that I think helps remove a lot of ambiguity in YAML docs (especially for beginners).

I'm okay with this issue being closed; changes to the overall YAMLlint rules for Ansible would be better served in another issue (if any are desired).

@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Aug 20, 2019
@sivel
Copy link
Member

sivel commented Aug 20, 2019

Closing per above.

@sivel sivel closed this as completed Aug 20, 2019
@ansible ansible locked and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

3 participants