DNF Handle Empty AppStream stream definition (#63819)

* DNF Handle Empty AppStream stream definition

Fixes #63683

Signed-off-by: Adam Miller <admiller@redhat.com>

* Switch Fedora dnf test target modularity to stratis

In Fedora 29, the metadata was not properly set for a default stream
for ripgrep even though there is a profile called "default", however
that's an arbitrary string and the module maintainer must set the
default stream (which it never was for the ripgrep module, thus
failing the "empty stream" install test)

Signed-off-by: Adam Miller <admiller@redhat.com>
pull/63882/head
Adam Miller 6 years ago committed by ansibot
parent b96ae6ab67
commit ed86907587

@ -0,0 +1,3 @@
---
minor_changes:
- dnf - Properly handle module AppStreams that don't define stream (https://github.com/ansible/ansible/issues/63683)

@ -886,9 +886,16 @@ class DnfModule(YumDnf):
if self.with_modules:
module_spec = module_spec.strip()
module_list, nsv = self.module_base._get_modules(module_spec)
enabled_streams = self.base._moduleContainer.getEnabledStream(nsv.name)
if nsv.stream in self.base._moduleContainer.getEnabledStream(nsv.name):
return True
if enabled_streams:
if nsv.stream:
if nsv.stream in enabled_streams:
return True # The provided stream was found
else:
return False # The provided stream was not found
else:
return True # No stream provided, but module found
return False # seems like a sane default

@ -49,3 +49,51 @@
that:
- "not dnf_result.failed"
- "not dnf_result.changed"
- name: install "{{ astream_name_no_stream }}" module without providing stream
dnf:
name: "{{ astream_name_no_stream }}"
state: present
register: dnf_result
- name: verify installation of "{{ astream_name_no_stream }}" module without providing stream
assert:
that:
- "not dnf_result.failed"
- "dnf_result.changed"
- name: install "{{ astream_name_no_stream }}" module again without providing stream
dnf:
name: "{{ astream_name_no_stream }}"
state: present
register: dnf_result
- name: verify installation of "{{ astream_name_no_stream }}" module again without providing stream
assert:
that:
- "not dnf_result.failed"
- "not dnf_result.changed"
- name: uninstall "{{ astream_name_no_stream }}" module without providing stream
dnf:
name: "{{ astream_name_no_stream }}"
state: absent
register: dnf_result
- name: verify uninstallation of "{{ astream_name_no_stream }}" module without providing stream
assert:
that:
- "not dnf_result.failed"
- "dnf_result.changed"
- name: uninstall "{{ astream_name_no_stream }}" module again without providing stream
dnf:
name: "{{ astream_name_no_stream }}"
state: absent
register: dnf_result
- name: verify uninstallation of "{{ astream_name_no_stream }}" module again without providing stream
assert:
that:
- "not dnf_result.failed"
- "not dnf_result.changed"

@ -1 +1,2 @@
astream_name: '@ripgrep:master/default'
astream_name: '@stratis:1/default'
astream_name_no_stream: '@stratis/default'

@ -1 +1,2 @@
astream_name: '@php:7.2/minimal'
astream_name_no_stream: '@php/minimal'

Loading…
Cancel
Save