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

Expand environment vars and ~ #672

Merged
merged 13 commits into from
Feb 27, 2020
Merged

Expand environment vars and ~ #672

merged 13 commits into from
Feb 27, 2020

Conversation

evilhamsterman
Copy link
Contributor

Signed-off-by: Dan Mills evilhamsterman@gmail.com

Simply adds the ability to expand environment vars and ~ in the exclude and rulesdirs config. This could close #541 by allowing you to easily exclude the traditional galaxy roles directory with the following

exclude_paths:
    - ~/.ansible/roles

@evilhamsterman evilhamsterman changed the title Expand home vars Expand environment vars and ~ Feb 1, 2020
@evilhamsterman
Copy link
Contributor Author

Looks like the 🚨 / lint/2.7@ubuntu-16.04 (pull_request) test is failing in general. It failed because tox was missing in the test not because of my code, and it looks like it failed on another recent PR.

@webknjaz
Copy link
Member

Yes, please ignore that failing jobs. I haven't had time to figure out what's causing that failure. Maybe it's because of recent releases of ecosystem-level dists.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Mind adding a test for this behavior?

lib/ansiblelint/__init__.py Outdated Show resolved Hide resolved
@evilhamsterman
Copy link
Contributor Author

I did a bunch of refactoring. I broke out the expansion code to the utils module so it can be reused. I also change the RulesCollection class to work more like the Runner class and setup the rulesdir on class creation rather than having to use a class method after the creation. I couldn't see why it was done that way but this way seemed cleaner. I can clean up the tests to use the new methodology.

evilhamsterman and others added 9 commits February 18, 2020 15:38
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
test/TestUtils.py Outdated Show resolved Hide resolved
test/TestUtils.py Outdated Show resolved Hide resolved
test/TestUtils.py Outdated Show resolved Hide resolved
test/TestRunner.py Outdated Show resolved Hide resolved
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
Signed-off-by: Dan Mills <evilhamsterman@gmail.com>
@evilhamsterman
Copy link
Contributor Author

@webknjaz I believe I've made all the changes you requested

@@ -22,15 +22,15 @@
import unittest

import ansiblelint
from ansiblelint import Runner, RulesCollection
from ansiblelint import default_rulesdir, Runner, RulesCollection
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if using this var makes sense in tests but let's keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default_rules is the same as what the the setup in the class was doing.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, I just think that we could be testing a more generic case or many cases w/o depending on this.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

LGTM

@webknjaz
Copy link
Member

Thanks for the PR @evilhamsterman! I'll merge it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do you exclude third party roles in requirements.yml
3 participants