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

Fix errors produced by ansible-lint #159

Merged
merged 7 commits into from
Apr 30, 2019
Merged

Conversation

zbrojny120
Copy link
Contributor

  • Removed trailing whitespace
  • Fixed bare variable in tasks/yum.yml
  • Handler for update-initramfs

@rndmh3ro
Copy link
Member

rndmh3ro commented Jan 5, 2018

There's something wrong with the syntax:

fatal: [localhost]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ - '/etc/yum.conf' - '{{ yum_repos.stdout_lines | default([]) }}' }}): bad operand type for unary -: 'str'"}```

@zbrojny120
Copy link
Contributor Author

Already fixed

tasks/yum.yml Outdated
with_flattened:
- '/etc/yum.conf'
- '{{ yum_repos.stdout_lines| default([]) }}'
with_flattened: "{{ ['/etc/yum.conf', yum_repos.stdout_lines | default([]) ] }}"
Copy link
Member

Choose a reason for hiding this comment

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

I don't know about this one...
What's the advantage here? Right now, all it does for me is make it harder to parse..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It removes ansible-lint errors related to bare variables. Do you have any other ideas how to fix this error?

Copy link
Member

Choose a reason for hiding this comment

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

It can be "fixed" like this:

    - ['/etc/yum.conf']
    - '{{ yum_repos.stdout_lines| default([]) }}'

However I'm not sure if this is not maybe a bug with ansible-lint. I'll ask there.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, we will see how it goes, because I was also surprised by this error, and consider this a dirty fix.

Copy link
Member

Choose a reason for hiding this comment

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

To go on with this PR: How about you keep the task the way it is in master and add a skip_ansible_lint tag to it? And add a comment to reference the ansible/ansible-lint#315 issue?

@rndmh3ro
Copy link
Member

Thanks, @zbrojny120 !

@rndmh3ro rndmh3ro merged commit 29d0421 into dev-sec:master Apr 30, 2019
@rndmh3ro rndmh3ro added bug and removed enhancement labels May 4, 2019
divialth pushed a commit to divialth/ansible-collection-hardening that referenced this pull request Aug 3, 2022
Fix errors produced by ansible-lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants