Sloane Hertel 2 weeks ago committed by GitHub
commit b99c5fa1f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy collection install - remove old installation info when installing collections (https://github.com/ansible/ansible/issues/83182).

@ -8,6 +8,7 @@ from __future__ import annotations
import errno
import fnmatch
import functools
import glob
import inspect
import json
import os
@ -1525,6 +1526,7 @@ def install(collection, path, artifacts_manager): # FIXME: mv to dataclasses?
artifacts_manager.required_successful_signature_count,
artifacts_manager.ignore_signature_errors,
)
remove_source_metadata(collection, b_collection_path)
if (collection.is_online_index_pointer and isinstance(collection.src, GalaxyAPI)):
write_source_metadata(
collection,
@ -1561,6 +1563,22 @@ def write_source_metadata(collection, b_collection_path, artifacts_manager):
raise
def remove_source_metadata(collection, b_collection_path):
pattern = f"{collection.namespace}.{collection.name}-*.info"
info_path = os.path.join(
b_collection_path,
b'../../',
to_bytes(pattern, errors='surrogate_or_strict')
)
if (outdated_info := glob.glob(info_path)):
display.vvvv(f"Removing {pattern} metadata from previous installations")
for info_dir in outdated_info:
try:
shutil.rmtree(info_dir)
except Exception:
pass
def verify_artifact_manifest(manifest_file, signatures, keyring, required_signature_count, ignore_signature_errors):
# type: (str, list[str], str, str, list[str]) -> None
failed_verify = False

@ -31,6 +31,9 @@
- install_normal_files.files[2].path | basename in ['MANIFEST.json', 'FILES.json', 'README.md']
- (install_normal_manifest.content | b64decode | from_json).collection_info.version == '1.0.9'
- 'from_first_good_server.stdout|regex_findall("has not signed namespace1\.name1")|length == 1'
- "info_dir is is_dir"
vars:
info_dir: "{{ galaxy_dir }}/ansible_collections/namespace1.name1-1.0.9.info"
- name: Remove the collection
file:
@ -105,6 +108,10 @@
that:
- '"Installing ''namespace1.name1:1.1.0-beta.1'' to" in install_prerelease.stdout'
- (install_prerelease_actual.content | b64decode | from_json).collection_info.version == '1.1.0-beta.1'
- not ([info_dir, "namespace1.name1-1.0.9.info"] | path_join) is is_dir
- ([info_dir, "namespace1.name1-1.1.0-beta.1.info"] | path_join) is is_dir
vars:
info_dir: "{{ galaxy_dir }}/ansible_collections"
- name: Remove beta
file:

Loading…
Cancel
Save