zypper: add additional flag --force-resolution (#61705)
This commit is contained in:
parent
712abfd1a1
commit
034afd40a3
2 changed files with 34 additions and 0 deletions
|
@ -91,6 +91,13 @@ options:
|
|||
required: false
|
||||
default: "no"
|
||||
type: bool
|
||||
force_resolution:
|
||||
version_added: "2.10"
|
||||
description:
|
||||
- Adds C(--force-resolution) option to I(zypper). Allows to (un)install packages with conflicting requirements (resolver will choose a solution).
|
||||
required: false
|
||||
default: "no"
|
||||
type: bool
|
||||
update_cache:
|
||||
version_added: "2.2"
|
||||
description:
|
||||
|
@ -338,6 +345,8 @@ def get_cmd(m, subcommand):
|
|||
cmd.append('--no-recommends')
|
||||
if m.params['force']:
|
||||
cmd.append('--force')
|
||||
if m.params['force_resolution']:
|
||||
cmd.append('--force-resolution')
|
||||
if m.params['oldpackage']:
|
||||
cmd.append('--oldpackage')
|
||||
if m.params['extra_args']:
|
||||
|
@ -479,6 +488,7 @@ def main():
|
|||
disable_gpg_check=dict(required=False, default='no', type='bool'),
|
||||
disable_recommends=dict(required=False, default='yes', type='bool'),
|
||||
force=dict(required=False, default='no', type='bool'),
|
||||
force_resolution=dict(required=False, default='no', type='bool'),
|
||||
update_cache=dict(required=False, aliases=['refresh'], default='no', type='bool'),
|
||||
oldpackage=dict(required=False, default='no', type='bool'),
|
||||
extra_args=dict(required=False, default=None),
|
||||
|
|
|
@ -413,3 +413,27 @@
|
|||
- zypper_result_update_cache is successful
|
||||
- zypper_result_update_cache_check is successful
|
||||
- zypper_result_update_cache_check is not changed
|
||||
|
||||
|
||||
- name: install netcat-openbsd which conflicts with gnu-netcat
|
||||
zypper:
|
||||
name: netcat-openbsd
|
||||
state: present
|
||||
|
||||
- name: try installation of gnu-netcat which should fail due to the conflict
|
||||
zypper:
|
||||
name: gnu-netcat
|
||||
state: present
|
||||
ignore_errors: yes
|
||||
register: zypper_pkg_conflict
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- zypper_pkg_conflict is failed
|
||||
- "'conflicts with netcat-openbsd provided' in zypper_pkg_conflict.stdout"
|
||||
|
||||
- name: retry installation of gnu-netcat with force_resolution set to choose a resolution
|
||||
zypper:
|
||||
name: gnu-netcat
|
||||
state: present
|
||||
force_resolution: True
|
||||
|
|
Loading…
Reference in a new issue