diff --git a/library/find_unused_disk.py b/library/find_unused_disk.py index 098f235f..270fb589 100644 --- a/library/find_unused_disk.py +++ b/library/find_unused_disk.py @@ -149,9 +149,9 @@ def get_disks(module): if not line: continue - m = re.search(r'NAME="(?P[^"]*)" TYPE="(?P[^"]*)" SIZE="(?P\d+)" FSTYPE="(?P[^"]*)" LOG-SEC="(?P\d+)"', line) + m = re.search(r'NAME="(?P[^"]*)" TYPE="(?P[^"]*)" SIZE="(?P\d+)" FSTYPE="(?P[^"]*)" LOG[_-]SEC="(?P\d+)"', line) if m is None: - module.log(line) + module.log("Line did not match: " + line) continue if m.group('type') != "disk": diff --git a/tests/get_unused_disk.yml b/tests/get_unused_disk.yml index a61487e1..0402770c 100644 --- a/tests/get_unused_disk.yml +++ b/tests/get_unused_disk.yml @@ -22,6 +22,15 @@ match_sector_size: "{{ match_sector_size | d(omit) }}" register: unused_disks_return +- name: Debug why there are no unused disks + shell: | + set -x + exec 1>&2 + lsblk -p --pairs --bytes -o NAME,TYPE,SIZE,FSTYPE,LOG-SEC + journalctl -ex + changed_when: false + when: "'Unable to find unused disk' in unused_disks_return.disks" + - name: Set unused_disks if necessary set_fact: unused_disks: "{{ unused_disks_return.disks }}"