ansible-collections / community.general

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

lvol modules Failed to get LVM version number #5445

Open Duke1616 opened 1 year ago

Duke1616 commented 1 year ago

Summary

error message:

error message

lvm version message:

[root@k8s-master01 ansible-deploy]# lvm version
  LVM version:     2.03.092 20200326
  Library version: 1.02.171 (2020-03-26)
  Driver version:  4.39.0
  Configuration:   ./configure --build=x86_64-koji-linux-gnu --host=x86_64-koji-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm --with-default-pid-dir=/run --with-default-locking-dir=/run/lock/lvm --with-usrlibdir=/usr/lib64 --enable-fsadm --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-applib --enable-cmdlib --enable-dmeventd --enable-blkid_wiping --enable-python3-bindings --with-cluster=internal --with-clvmd=none --with-udevdir=/usr/lib/udev/rules.d --enable-udev_sync --with-thin=internal --enable-lvmetad --with-thin=internal --enable-lvmpolld --enable-lvmlockd-sanlock --enable-dbus-service --enable-notify-dbus --enable-dmfilemapd

Trigger conditions

Through reading the source code, it is found that the lvm version cannot satisfy the regular expression

re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+).*(\d{4}-\d{2}-\d{2})", out)

Issue Type

Bug Report

Component Name

plugins/modules/system/lvol.py

Ansible Version

$ ansible --version
ansible [core 2.11.12] 
  config file = /server/tools/ansible-deploy/ansible.cfg
  configured module search path = ['/server/tools/ansible-deploy/library']
  ansible python module location = /usr/local/lib/python3.7/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.7.9 (default, Mar  2 2021, 02:43:11) [GCC 7.3.0]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
community.general 5.8.0

Configuration

$ ansible-config dump --only-changed

OS / Environment

Linux version 4.19.90-24.4.v2101.ky10.x86_64

Steps to Reproduce

Expected Results

Allow parameter transfer to skip version verification

Actual Results

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description: None

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 1 year 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 1 year ago

cc @abulimov @jhoekx @unkaputtbar112 @zigaSRC click here for bot help

ansibullbot commented 1 year 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

saitiger008 commented 1 year ago

20230228 still unworkable. I try to change the code: m = re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+).*(\d{4}-\d{2}-\d{2})", out) to: m = re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+)", out) Jobs done.

felixfontein commented 1 year ago

@saitiger008 do you want to create a PR for that? If yes, please include a changelog fragment. Thanks!

hellozdp commented 1 year ago

20230228 still unworkable. I try to change the code: m = re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+).*(\d{4}-\d{2}-\d{2})", out) to: m = re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+)", out) Jobs done.

I think this regex is better, add match anything with '.*'

m = re.search(r"LVM version:\s+(\d+)\.(\d+)\.(\d+).*", out)
felixfontein commented 1 year ago

Since the regular expression does not end with $ it ignores everything after the last (\d+). Adding .* should make no difference.