-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
lsr_role2collection.py
Outdated
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that line is wrong too . . . https://github.com/ansible/ansible-lint/blob/master/lib/ansiblelint/utils.py
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thank you, @richm. Merged. |
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.