linux-system-roles / cockpit

https://linux-system-roles.github.io/cockpit/
GNU General Public License v3.0
15 stars 19 forks source link

Error with cockpit-* globbing #51

Closed tabowling closed 1 month ago

tabowling commented 2 years ago

When using the latest version of linux-system-roles.cockpit from galaxy, I'm receiving the following error:

fatal: [rhel8latest]: FAILED! => {"changed": false, "failures": ["cockpit-* All matches were filtered out by exclude filtering for argument: cockpit-*"], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

playbook is fairly simple, specifying the 'full' option to install all cockpit packages

- hosts: all
  remote_user: root

  vars:
    USE_FIREWALL: 1
  tasks:

    - name: Install RHEL/Fedora Web Console (Cockpit)
      include_role:
        name: linux-system-roles.cockpit
      vars:
        cockpit_packages: "full"   # or minimal, default

    - name: Configure Firewall for Web Console
      include_role:
        name: linux-system-roles.firewall
      vars:
        firewall:
          service: cockpit
          state: enabled
      when: USE_FIREWALL|bool
tabowling commented 2 years ago

Attaching error log with -vvv output errors.log

If I comment out var cockpit_packages: "full" allowing the default package selection, it succeeds.

martinpitt commented 2 years ago

Hey @tabowling , thanks for the report! I cannot reproduce this on at least my RHEL 8.6 and Fedora 35 cloud images. I filed PR #53 to add a test for the "full" scenario, which is prudent anyway.

Your debug log looks ok to me at first sight. The error message sounds like the exclude list

["cockpit-docker", "cockpit-ostree", "cockpit-tests"]

would be all that cockpit-* matches -- but there are still the explicit packages. Perhaps your machine is missing package indexes, and thus the globbing somehow fails?

Interestingly, full also fails in the GitHub workflow run (Ubuntu 20.04), but for an entirely different reason. I'll wait for the integration tests and collect more data.

martinpitt commented 2 years ago

The principal difference is that on my local Ubuntu 16.04 runs, and also on github's, the glob actually gets expanded:

"__cockpit_packages_full": ["cockpit-doc", "cockpit-machines", "cockpit-pcp"]

but on Debian/Ubuntu it uses (log confirms that) vars/Debian.yml, which hardcodes that list.

On my local Fedora 35 and RHEL 8.6 runs, it uses vars/Fedora.yml and vars/RedHat-8.yml respectively, and that also looks okay:

TASK [linux-system-roles.cockpit : Set version specific variables] ***********************************************************
ok: [f35] => (item=/var/home/martin/upstream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/Fedora.yml) => {"ansible_
facts": {"__cockpit_packages": {"default": "{{ __cockpit_packages_minimal + __cockpit_packages_default }}", "full": "{{ __cock
pit_packages_minimal + __cockpit_packages_default + __cockpit_packages_full }}", "minimal": "{{ __cockpit_packages_minimal }}"
}, "__cockpit_packages_default": ["cockpit", "cockpit-networkmanager", "cockpit-packagekit", "cockpit-selinux", "cockpit-stora
ged"], "__cockpit_packages_exclude": ["cockpit-docker", "cockpit-ostree", "cockpit-tests"], "__cockpit_packages_full": ["cockp
it-*"], "__cockpit_packages_minimal": ["cockpit-system", "cockpit-ws"]}, "ansible_included_var_files": ["/var/home/martin/upst
ream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/Fedora.yml"], "ansible_loop_var": "item", "changed": false, "item": "/var/home/martin/upstream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/Fedora.yml"}
ok: [r8] => (item=/var/home/martin/upstream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/RedHat-8.yml) => {"ansible_facts": {"__cockpit_packages": {"default": "{{ __cockpit_packages_minimal + __cockpit_packages_default }}", "full": "{{ __cockpit_packages_minimal + __cockpit_packages_default + __cockpit_packages_full }}", "minimal": "{{ __cockpit_packages_minimal }}"}, "__cockpit_packages_default": ["cockpit", "cockpit-networkmanager", "cockpit-packagekit", "cockpit-selinux", "cockpit-storaged"], "__cockpit_packages_exclude": ["cockpit-docker", "cockpit-ostree", "cockpit-tests"], "__cockpit_packages_full": ["cockpit-*"], "__cockpit_packages_minimal": ["cockpit-system", "cockpit-ws"]}, "ansible_included_var_files": ["/var/home/martin/upstream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/var/home/martin/upstream/lsr-cockpit/tests/roles/linux-system-roles.cockpit/vars/RedHat-8.yml"}

changed: [f35] => {"changed": true, "msg": "", "rc": 0, "results": ["Installed: cockpit-composer-31-1.fc35.noarch", "Installed: cockpit-session-recording-9-1.fc35.noarch", "Installed: cockpit-260-1.fc35.x86_64", "Installed: cockpit-389-ds-2.0.12-1.fc35.noarch", "Installed: cockpit-bridge-260-1.fc35.x86_64", "Installed: cockpit-doc-260-1.fc35.noarch", "Installed: cockpit-file-sharing-2.4.1-5.fc35.noarch", "Installed: cockpit-kdump-260-1.fc35.noarch", "Installed: cockpit-machines-257-1.fc35.noarch", "Installed: cockpit-navigator-0.5.8-3.fc35.noarch", "Installed: cockpit-networkmanager-260-1.fc35.noarch", "Installed: cockpit-packagekit-260-1.fc35.noarch", "Installed: cockpit-pcp-260-1.fc35.x86_64", "Installed: cockpit-podman-39-1.fc35.noarch", "Installed: cockpit-selinux-260-1.fc35.noarch", "Installed: cockpit-sosreport-260-1.fc35.noarch", "Installed: cockpit-storaged-260-1.fc35.noarch", "Installed: cockpit-system-260-1.fc35.noarch", "Installed: cockpit-ws-260-1.fc35.x86_64"]}
changed: [r8] => {"changed": true, "msg": "", "rc": 0, "results": ["Installed: cockpit-composer-32-1.el8.noarch", "Installed: cockpit-machines-261-1.el8.noarch", "Installed: cockpit-packagekit-261-1.el8.noarch", "Installed: cockpit-pcp-261-1.el8.x86_64", "Installed: cockpit-podman-39-1.module+el8.6.0+13755+68a3e12f.noarch", "Installed: cockpit-session-recording-11-2.el8.noarch", "Installed: cockpit-storaged-261-1.el8.noarch", "Installed: subscription-manager-cockpit-1.28.25-1.el8.noarch", "Installed: cockpit-261-1.el8.x86_64", "Installed: cockpit-bridge-261-1.el8.x86_64", "Installed: cockpit-doc-261-1.el8.noarch", "Installed: cockpit-system-261-1.el8.noarch", "Installed: cockpit-ws-261-1.el8.x86_64"]}

But in your log it doesn't:

TASK [linux-system-roles.cockpit : Set version specific variables] 
 task path: /root/.ansible/roles/linux-system-roles.cockpit/tasks/main.yml:1
ok: [rhel8latest] => (item=/root/.ansible/roles/linux-system-roles.cockpit/vars/RedHat-8.yml) => {
    "ansible_facts": {
        "__cockpit_packages_default": [
            "cockpit",
            "cockpit-networkmanager",
            "cockpit-packagekit",
            "cockpit-selinux",
            "cockpit-storaged"
        ],
        "__cockpit_packages_exclude": [
            "cockpit-docker",
            "cockpit-ostree",
            "cockpit-tests"
        ],
        "__cockpit_packages_full": [
            "cockpit-*"
        ],

So for some reason, yum/dnf can't figure out the globbing.

@tabowling , on the machine where you tried to run this, what's the output of `sudo dnf install 'cockpit-*'? On mine (small cloud VM) it looks like this:

# dnf install 'cockpit-*'
Extra Packages for Enterprise Linux Modular 8 - x86_64                                        1.0 MB/s | 979 kB     00:00    
baseos                                                                                        1.4 MB/s | 2.4 MB     00:01    
appstream                                                                                     2.7 MB/s | 7.4 MB     00:02    
Dependencies resolved.
==============================================================================================================================
 Package                            Architecture Version                                   Repository                    Size
==============================================================================================================================
Installing:
 cockpit-bridge                     x86_64       261-1.el8                                 RHEL-NIGHTLY-BaseOS          533 k
 cockpit-composer                   noarch       32-1.el8                                  RHEL-NIGHTLY-AppStream       2.3 M
 cockpit-doc                        noarch       261-1.el8                                 RHEL-NIGHTLY-BaseOS          186 k
 cockpit-machines                   noarch       261-1.el8                                 RHEL-NIGHTLY-AppStream       811 k
 cockpit-packagekit                 noarch       261-1.el8                                 RHEL-NIGHTLY-AppStream       626 k
 cockpit-pcp                        x86_64       261-1.el8                                 RHEL-NIGHTLY-AppStream       128 k
 cockpit-podman                     noarch       39-1.module+el8.6.0+13755+68a3e12f        RHEL-NIGHTLY-AppStream       484 k
 cockpit-session-recording          noarch       11-2.el8                                  RHEL-NIGHTLY-AppStream       1.6 M
 cockpit-storaged                   noarch       261-1.el8                                 RHEL-NIGHTLY-AppStream       629 k
 cockpit-system                     noarch       261-1.el8                                 RHEL-NIGHTLY-BaseOS          3.2 M
 cockpit-ws                         x86_64       261-1.el8                                 RHEL-NIGHTLY-BaseOS          1.3 M
Installing dependencies:
 cockpit                            x86_64       261-1.el8                                 RHEL-NIGHTLY-BaseOS           78 k
 fuse                               x86_64       2.9.7-12.el8                              RHEL-NIGHTLY-BaseOS           83 k
 osbuild                            noarch       46-1.el8                                  RHEL-NIGHTLY-AppStream       111 k
 osbuild-composer                   x86_64       40-1.el8                                  RHEL-NIGHTLY-AppStream        19 k
 osbuild-composer-core              x86_64       40-1.el8                                  RHEL-NIGHTLY-AppStream       5.5 M
 osbuild-composer-dnf-json          x86_64       40-1.el8                                  RHEL-NIGHTLY-AppStream        12 k
 osbuild-composer-worker            x86_64       40-1.el8                                  RHEL-NIGHTLY-AppStream       8.0 M
 osbuild-ostree                     noarch       46-1.el8                                  RHEL-NIGHTLY-AppStream        26 k
 osbuild-selinux                    noarch       46-1.el8                                  RHEL-NIGHTLY-AppStream        27 k
 ostree                             x86_64       2022.1-2.el8                              RHEL-NIGHTLY-AppStream       251 k
 ostree-libs                        x86_64       2022.1-2.el8                              RHEL-NIGHTLY-AppStream       438 k
 python3-osbuild                    noarch       46-1.el8                                  RHEL-NIGHTLY-AppStream       147 k
 rpm-ostree                         x86_64       2022.1-1.el8                              RHEL-NIGHTLY-AppStream       2.8 M
 rpm-ostree-libs                    x86_64       2022.1-1.el8                              RHEL-NIGHTLY-AppStream        52 k
Installing weak dependencies:
 subscription-manager-cockpit       noarch       1.28.25-1.el8                             RHEL-NIGHTLY-BaseOS          889 k

Transaction Summary
==============================================================================================================================
Install  26 Packages

Total download size: 30 M
Installed size: 110 M
Is this ok [y/N]: 
richm commented 2 years ago

according to the Ansible team - you should not use package: name: something-* because globbing is not a supported feature - it is not guaranteed to work on all platforms, and in addition, it may be taken away at some point in the future - so we need to come up with a better, portable way to do "give me a list of all possible packages which matches cockpit-*"

martinpitt commented 2 years ago

Idea: For DNF (RHEL 8/9/Fedora) we compute the list ourselves with

dnf -C repoquery -a --queryformat='%{name}' '*cockpit*'

I am not sure if that works with yum on RHEL/CentOS 7, but there we can honestly just hardcode the list like we do on other OSes -- it's not going to change any more.

richm commented 2 years ago

Idea: For DNF (RHEL 8/9/Fedora) we compute the list ourselves with

dnf -C repoquery -a --queryformat='%{name}' '*cockpit*'

I am not sure if that works with yum on RHEL/CentOS 7, but there we can honestly just hardcode the list like we do on other OSes -- it's not going to change any more.

works for me - do we need a BZ for this?

richm commented 1 month ago

fixed by https://github.com/linux-system-roles/cockpit/pull/161