summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/galaxy/api.py3
-rw-r--r--lib/ansible/galaxy/collection/__init__.py3
-rw-r--r--lib/ansible/galaxy/dependency_resolution/dataclasses.py12
-rw-r--r--lib/ansible/galaxy/dependency_resolution/providers.py1
4 files changed, 15 insertions, 4 deletions
diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py
index 03d9104f5c..0d51998044 100644
--- a/lib/ansible/galaxy/api.py
+++ b/lib/ansible/galaxy/api.py
@@ -926,8 +926,7 @@ class GalaxyAPI:
try:
signatures = data["signatures"]
except KeyError:
- # Noisy since this is used by the dep resolver, so require more verbosity than Galaxy calls
- display.vvvvvv(f"Server {self.api_server} has not signed {namespace}.{name}:{version}")
+ display.vvvv(f"Server {self.api_server} has not signed {namespace}.{name}:{version}")
return []
else:
return [signature_info["signature"] for signature_info in signatures]
diff --git a/lib/ansible/galaxy/collection/__init__.py b/lib/ansible/galaxy/collection/__init__.py
index 5a3928f88d..07a81eee32 100644
--- a/lib/ansible/galaxy/collection/__init__.py
+++ b/lib/ansible/galaxy/collection/__init__.py
@@ -769,6 +769,9 @@ def install_collections(
"Skipping signature verification."
)
+ if concrete_coll_pin.type == 'galaxy':
+ concrete_coll_pin = concrete_coll_pin.with_signatures_repopulated()
+
try:
install(concrete_coll_pin, output_path, artifacts_manager)
except AnsibleError as err:
diff --git a/lib/ansible/galaxy/dependency_resolution/dataclasses.py b/lib/ansible/galaxy/dependency_resolution/dataclasses.py
index ac1edc7735..2299ea5edf 100644
--- a/lib/ansible/galaxy/dependency_resolution/dataclasses.py
+++ b/lib/ansible/galaxy/dependency_resolution/dataclasses.py
@@ -27,7 +27,7 @@ if t.TYPE_CHECKING:
)
-from ansible.errors import AnsibleError
+from ansible.errors import AnsibleError, AnsibleAssertionError
from ansible.galaxy.api import GalaxyAPI
from ansible.galaxy.collection import HAS_PACKAGING, PkgReq
from ansible.module_utils._text import to_bytes, to_native, to_text
@@ -584,3 +584,13 @@ class Candidate(
def __init__(self, *args, **kwargs):
super(Candidate, self).__init__()
+
+ def with_signatures_repopulated(self): # type: (Candidate) -> Candidate
+ """Populate a new Candidate instance with Galaxy signatures.
+ :raises AnsibleAssertionError: If the supplied candidate is not sourced from a Galaxy-like index.
+ """
+ if self.type != 'galaxy':
+ raise AnsibleAssertionError(f"Invalid collection type for {self!r}: unable to get signatures from a galaxy server.")
+
+ signatures = self.src.get_collection_signatures(self.namespace, self.name, self.ver)
+ return self.__class__(self.fqcn, self.ver, self.src, self.type, frozenset([*self.signatures, *signatures]))
diff --git a/lib/ansible/galaxy/dependency_resolution/providers.py b/lib/ansible/galaxy/dependency_resolution/providers.py
index 1dcaf1c8d2..93f0e7a00b 100644
--- a/lib/ansible/galaxy/dependency_resolution/providers.py
+++ b/lib/ansible/galaxy/dependency_resolution/providers.py
@@ -392,7 +392,6 @@ class CollectionDependencyProviderBase(AbstractProvider):
if not unsatisfied:
if self._include_signatures:
- signatures = src_server.get_collection_signatures(first_req.namespace, first_req.name, version)
for extra_source in extra_signature_sources:
signatures.append(get_signature_from_source(extra_source))
latest_matches.append(