-
Notifications
You must be signed in to change notification settings - Fork 24k
ansible-galaxy - fixup role install failure handling #82052
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
base: devel
Are you sure you want to change the base?
ansible-galaxy - fixup role install failure handling #82052
Conversation
53ecfd5
to
9d54a6d
Compare
f5bc6ad
to
81d0a32
Compare
@s-hertel and @nitzmahone, this PR promises to fix other galaxy roles as well - do you have an ETA when this will land? Thanks. |
lib/ansible/galaxy/role.py
Outdated
# Doesn't happen with our build process, but avoid extracting members that aren't adjacent to the role metadata | ||
display.warning(f"Only extracting members in {n_archive_parent_dir}: ignoring {member.name}") | ||
ignore_external.add(member) | ||
continue |
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.
If a tarfile contains something like:
./role-data/
├── role-name
│ ├── meta/main.yml
│ └── tasks
└── hitchhiker
└── keep
we find the meta/main.yml in the role-name directory, but install all tarfile members (not just those adjacent to the meta directory). On devel this ends up installing an invalid role (and so it needs to be manually deleted to reinstall).
This could be an error instead, but I thought the warning was better at least than installing a broken role.
@HarryWeppner I don't have an ETA (it needs a review), but I decided to split the symlinks fix into a separate PR #82165 to make it safer to backport, since the other issues this is fixing are not new. |
A rebase should fix the rpmfluff issue in CI. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Make install more strict about what is extracted from the tarfile: - fail on invalid content we previously skipped - give a warning for excluded tarfile content that previously would have been included
06fdc78
to
74ed460
Compare
|
||
from ansible import context | ||
from ansible.errors import AnsibleError, AnsibleParserError | ||
from ansible.galaxy.api import GalaxyAPI | ||
from ansible.galaxy.collection import _tempdir |
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.
Should this be made a public API?
|
||
for path in os.listdir(temporary_dest): |
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.
Wouldn't it be more atomic to move the entire directory rather than parts of it one by one?
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.
This really needs tests first, please disregard the draft.
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.
I was just rebasing PRs with the stale_pr label.
SUMMARY
Roles are now extracted to a tempdir to prevent partial installs.
Tarfile members outside of the role root are no longer installed (leading to broken roles).
This method is getting long, maybe it's time to refactor it.
ISSUE TYPE