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. |
| # 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.
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.
Should this be made a public API?
| if not os.path.exists(self.path): | ||
| os.makedirs(self.path) | ||
|
|
||
| for path in os.listdir(temporary_dest): |
There was a problem hiding this comment.
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.
This really needs tests first, please disregard the draft.
There was a problem hiding this comment.
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