ansible-galaxy - ensure variable is defined for any error when getting the ansible-core distribution (#77993)

pull/78010/head
Sloane Hertel 2 years ago committed by GitHub
parent c2b36ba04d
commit db335498d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,7 @@ from collections import namedtuple
from contextlib import contextmanager
from hashlib import sha256
from io import BytesIO
from importlib.metadata import distribution, PackageNotFoundError
from importlib.metadata import distribution
from itertools import chain
try:
@ -1594,7 +1594,7 @@ def _resolve_depenency_map(
raise AnsibleError("Failed to import packaging, check that a supported version is installed")
try:
dist = distribution('ansible-core')
except PackageNotFoundError:
except Exception:
req = None
else:
req = next((rr for r in (dist.requires or []) if (rr := PkgReq(r)).name == 'resolvelib'), None)

Loading…
Cancel
Save