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

Clean up ansible-lint and yamllint issues #106

Merged
merged 1 commit into from
Oct 31, 2020
Merged

Conversation

Shm013
Copy link
Contributor

@Shm013 Shm013 commented Jul 25, 2020

Issue: #103

Lint OK, but ansible test still failed.

@Shm013 Shm013 changed the title 103 new style lint Fix ansible lint - Issue 103 Jul 25, 2020
@lae lae added the enhancement label Sep 2, 2020
@lae
Copy link
Owner

lae commented Sep 2, 2020

Can you squash your commits into one and overwrite this branch (force push) with that commit?

@Shm013
Copy link
Contributor Author

Shm013 commented Sep 19, 2020

@lae Done

.travis.yml Outdated Show resolved Hide resolved
@@ -17,22 +17,22 @@ netbox_config:
- Dale Gribble
- [email protected]
# note that the array is nested above
BANNER_BOTTOM: *BANNER_TOP
BANNER_BOTTOM: '*BANNER_TOP'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change the value? It's a reference to another value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this thing passes to jinja2? If so it must be the same.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

My understanding is that Ansible parses the YAML first, so here I think it was supposed to reference the value of the BANNER_TOP key and that value itself would get passed to Jinja for templating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I don't know how it working. Where does the variable for BANNER_BOTTOM come from?

There is a problem if leave everything as is (without quotes).

❯ ansible-lint
Warning: Failed to load examples/netbox_config.yml with We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
  found undefined alias

The error appears to be in '/home/shm/Documents/projects/ansible-role-netbox/examples/netbox_config.yml': line 20, column 18, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  # note that the array is nested above
  BANNER_BOTTOM: *BANNER_TOP
                 ^ here
, assuming is not a playbook.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the reference creation needs to be placed further above. I think? e.g.:

  BANNER_TOP: &BANNER_TOP 'Your banner text'
  BANNER_BOTTOM: *BANNER_TOP

(but also, it's an example so I'm not sure if the linter should be parsing it)

@lae lae changed the title Fix ansible lint - Issue 103 Clean up ansible-lint and yamllint issues Oct 31, 2020
lae added a commit that referenced this pull request Oct 31, 2020
Clean up ansible-lint and yamllint issues
@lae lae merged commit 213390a into lae:master Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants