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

lsr_role2collection.py - the source role path does not have to end with the role name #28

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

nhosoi
Copy link
Contributor

@nhosoi nhosoi commented Oct 29, 2020

Instead of checking the existence of the path with the role name, use meta/main.yml.

Plus, instead of using print, use the logging module to output the log messages.
And introduced an env var LSR_INFO to output the info level messages.

if not src_path.exists():
print(f"Error: {src_path} does not exists.")
src_owner = os.path.basename(src_path)
_meta_path = src_path / "meta/main.yml"
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using the existence of meta/main.yml to determine if the directory contains a role? If so, then according to Ansible the bare minimum for a role is tasks/main.yml - ansible-lint also uses this to determine if the directory is a role or not.

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. Let me replace it with tasks. I thought it is common to check meta/main.yml looking at this line. :)
https://github.com/linux-system-roles/test-harness/blob/master/test/run-tests#L375

Copy link
Contributor

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.

Shall I open another PR for the line? or is it ok to include the fix in linux-system-roles/test-harness#113?

Copy link
Contributor

Choose a reason for hiding this comment

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

Shall I open another PR for the line? or is it ok to include the fix in linux-system-roles/test-harness#113?

I think this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, test-harness intentionally uses meta/main.yml to check meta info in checkmeta.py.
So, they are good with meta.

…th the role name

Instead of checking the existence of the path with the role name,
use tasks/main.yml.

Plus, instead of using print, use the logging module to output the
log messages except ANSIBLE_COLLECTIONS_PATHS message. And introduced
an env var LSR_INFO to output the info level messages.
Copy link
Contributor

@richm richm left a comment

Choose a reason for hiding this comment

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

lgtm

@nhosoi nhosoi merged commit f3c2502 into linux-system-roles:master Oct 30, 2020
@nhosoi
Copy link
Contributor Author

nhosoi commented Oct 30, 2020

Thank you, @richm. Merged.

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.

2 participants