ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
787 stars 1.45k forks source link

Cannot zypper patch --with interactive #6936

Open aaronhollandplum opened 12 months ago

aaronhollandplum commented 12 months ago

Summary

Using community.general.zypper module there is no way to run certain patches (such as kernel updates)

        - name: Patch all packages on OpenSUSE/SUSE Linux
          community.general.zypper:
                name: '*'
                state: latest
                type: patch

will patch anything that is not tagged as 'interactive'

using extra_args: --with-interactive fails as it applies the arg to Zypper and not to patch

my current work around:

        - name: Patch Kernel
          ansible.builtin.shell: "zypper -n patch --with-interactive"
          ignore_errors: true

Issue Type

Bug Report

Component Name

zypper module

Ansible Version

(base) aaron:ansible_impl$ ansible --version
ansible [core 2.15.1]
  config file = /Users/aaron/work/bitbucket.myuniversity.state.edu/manual_patching/ansible_impl/ansible.cfg
  configured module search path = ['/Users/aaron/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/aaron/opt/anaconda3/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/aaron/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/aaron/opt/anaconda3/bin/ansible
  python version = 3.9.12 (main, Apr  5 2022, 01:53:17) [Clang 12.0.0 ] (/Users/aaron/opt/anaconda3/bin/python)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

(base) aaron:ansible_impl$  ansible-galaxy collection list community.general

# /Users/aaron/opt/anaconda3/lib/python3.9/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.1.0

Configuration

(base) aaron:ansible_impl$ ansible-config dump --only-changed
CONFIG_FILE() = /Users/aaron/work/bitbucket.myuniversity.state.edu/manual_patching/ansible_impl/ansible.cfg
DEFAULT_HOST_LIST(/Users/aaron/work/bitbucket.myuniversity.state.edu/manual_patching/ansible_impl/ansible.cfg) = ['/Users/aaron/work/bitbucket.myuniversity.state.edu/manual_patching/ansible_impl/hosts']
INTERPRETER_PYTHON(/Users/aaron/work/bitbucket.myuniversity.state.edu/manual_patching/ansible_impl/ansible.cfg) = auto_silent

OS / Environment

MacOS Ventura 13.4

Steps to Reproduce

Run below on anything with interactive or kernel patches and it will skip those:

        - name: Rerun Patch to account for Zypper Patches
          community.general.zypper:
                name: '*'
                state: latest
                type: patch

Run below, and fails on extra_args

        - name: Rerun Patch to account for Zypper Patches
          community.general.zypper:
                name: '*'
                state: latest
                type: patch
                extra_args:  --with-interactive

Expected Results

Some way to pass the '--with-interactive' argument to the patch subcommand of 'zypper patch'

Actual Results

with --with-interactive

fatal: [admin-log1.ops.myuniversity.state.edu]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3.6"
    },
    "changed": false,
    "cmd": [
        "/usr/bin/zypper",
        "--quiet",
        "--non-interactive",
        "--xmlout",
        "refresh",
        "--with-interactive"
    ],
    "invocation": {
        "module_args": {
            "allow_vendor_change": false,
            "clean_deps": false,
            "disable_gpg_check": false,
            "disable_recommends": true,
            "extra_args": "--with-interactive",
            "extra_args_precommand": null,
            "force": false,
            "force_resolution": false,
            "name": [
                "*"
            ],
            "oldpackage": false,
            "replacefiles": false,
            "state": "latest",
            "type": "patch",
            "update_cache": true
        }
    },
    "msg": "Zypper run command failed with return code 2.",
    "rc": 2,
    "stderr": "",
    "stderr_lines": [],
    "stdout": "<?xml version='1.0'?>\n<stream>\n<message type=\"error\">The flag --with-interactive is not known.</message>\n</stream>\n",
    "stdout_lines": [
        "<?xml version='1.0'?>",
        "<stream>",
        "<message type=\"error\">The flag --with-interactive is not known.</message>",
        "</stream>"
    ]
}

without --with-interactive I am just left with the below (from the host)

admin-log1:~ # zypper -n patch
Loading repository data...
Reading installed packages...
Patch 'CL-SUSE-SLE-INSTALLER-15-SP4-2022-4464-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-INSTALLER-15-SP4-2022-4464' to install it, or '--with-optional' to include all optional patches.
Warning: Patch 'CL-SUSE-SLE-Product-WE-15-SP4-2023-2653-1' is interactive, skipping.
Warning: Patch 'CL-SUSE-SLE-Product-WE-15-SP4-2023-1897-1' is interactive, skipping.
Patch 'CL-SUSE-SLE-Product-WE-15-SP4-2023-401-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Product-WE-15-SP4-2023-401' to install it, or '--with-optional' to include all optional patches.
Patch 'CL-SUSE-SLE-Product-WE-15-SP4-2022-4601-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Product-WE-15-SP4-2022-4601' to install it, or '--with-optional' to include all optional patches.
Patch 'CL-SUSE-SLE-Module-Desktop-Applications-15-SP4-2022-4601-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Module-Desktop-Applications-15-SP4-2022-4601' to install it, or '--with-optional' to include all optional patches.
Patch 'CL-SUSE-SLE-Module-Development-Tools-15-SP4-2023-2523-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Module-Development-Tools-15-SP4-2023-2523' to install it, or '--with-optional' to include all optional patches.
Warning: Patch 'CL-SUSE-SLE-Product-WE-15-SP4-2023-2140-1' is interactive, skipping.
Warning: Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2243-1' is interactive, skipping.
Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2161-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2161' to install it, or '--with-optional' to include all optional patches.
Warning: Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2140-1' is interactive, skipping.
Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2192-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2192' to install it, or '--with-optional' to include all optional patches.
Warning: Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2438-1' is interactive, skipping.
Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2269-1' is optional. Use 'zypper in patch:CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2269' to install it, or '--with-optional' to include all optional patches.
Warning: Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-2653-1' is interactive, skipping.
Warning: Patch 'CL-SUSE-SLE-Module-Basesystem-15-SP4-2023-1897-1' is interactive, skipping.

Code of Conduct

ansibullbot commented 12 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 12 months ago

cc @AnderEnder @alxgu @andytom @commel @evrardjp @lrupp @sealor @toabctl click here for bot help