mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 18:50:21 -07:00
Fix yum/dnf handling of URIs that don't end in .rpm (#49912)
Fixes #49727 Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
d62d7176b0
commit
0eabb8097b
2 changed files with 11 additions and 4 deletions
|
@ -743,10 +743,11 @@ class DnfModule(YumDnf):
|
||||||
already_loaded_comps = False # Only load this if necessary, it's slow
|
already_loaded_comps = False # Only load this if necessary, it's slow
|
||||||
|
|
||||||
for name in self.names:
|
for name in self.names:
|
||||||
if name.endswith(".rpm"):
|
|
||||||
if '://' in name:
|
if '://' in name:
|
||||||
name = self.fetch_rpm_from_url(name)
|
name = self.fetch_rpm_from_url(name)
|
||||||
filenames.append(name)
|
filenames.append(name)
|
||||||
|
elif name.endswith(".rpm"):
|
||||||
|
filenames.append(name)
|
||||||
elif name.startswith("@") or ('/' in name):
|
elif name.startswith("@") or ('/' in name):
|
||||||
if not already_loaded_comps:
|
if not already_loaded_comps:
|
||||||
self.base.read_comps()
|
self.base.read_comps()
|
||||||
|
|
|
@ -853,7 +853,7 @@ class YumModule(YumDnf):
|
||||||
downgrade_candidate = False
|
downgrade_candidate = False
|
||||||
|
|
||||||
# check if pkgspec is installed (if possible for idempotence)
|
# check if pkgspec is installed (if possible for idempotence)
|
||||||
if spec.endswith('.rpm'):
|
if spec.endswith('.rpm') or '://' in spec:
|
||||||
if '://' not in spec and not os.path.exists(spec):
|
if '://' not in spec and not os.path.exists(spec):
|
||||||
res['msg'] += "No RPM file matching '%s' found on system" % spec
|
res['msg'] += "No RPM file matching '%s' found on system" % spec
|
||||||
res['results'].append("No RPM file matching '%s' found on system" % spec)
|
res['results'].append("No RPM file matching '%s' found on system" % spec)
|
||||||
|
@ -863,6 +863,12 @@ class YumModule(YumDnf):
|
||||||
if '://' in spec:
|
if '://' in spec:
|
||||||
with self.set_env_proxy():
|
with self.set_env_proxy():
|
||||||
package = fetch_file(self.module, spec)
|
package = fetch_file(self.module, spec)
|
||||||
|
if not package.endswith('.rpm'):
|
||||||
|
# yum requires a local file to have the extension of .rpm and we
|
||||||
|
# can not guarantee that from an URL (redirects, proxies, etc)
|
||||||
|
new_package_path = '%s.rpm' % package
|
||||||
|
os.rename(package, new_package_path)
|
||||||
|
package = new_package_path
|
||||||
else:
|
else:
|
||||||
package = spec
|
package = spec
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue