Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where ansible_lvm facts silently fails if a PV isn't in an VG #28684

Merged
merged 1 commit into from
Aug 28, 2017

Conversation

pmcclory
Copy link
Contributor

@pmcclory pmcclory commented Aug 25, 2017

If a PV hasn't been added to a VG i.e.:

[pmcclory@box ~]$ sudo pvs --noheadings --nosuffix --units g
/dev/xvdb lvm2 ---- 10.00 10.00
/dev/xvdv1 vg0 lvm2 a--u 24.99 0

Than ansible_facts.ansible_lvm will be unset after running setup module.

The issue is that the module splits on whitespace, which causes an
indexing error when the VG column is empty.

Fix is to add the separator field and safely split on that.

SUMMARY
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/module_utils/facts/hardware/linux.py

ANSIBLE VERSION
ansible 2.4.0 (lvm-facts-bugfix 9bae0c1733) last updated 2017/08/25 17:42:18 (GMT -400)
ADDITIONAL INFORMATION

If a PV hasn't been added to a VG i.e.:

[pmcclory@box ~]$ sudo pvs --noheadings --nosuffix --units g
  /dev/xvdb       lvm2 ---- 10.00 10.00
  /dev/xvdv1 vg0  lvm2 a--u 24.99     0

Than ansible_facts.ansible_lvm will be unset after running setup module.

The issue is that the module splits on whitespace, which causes an
indexing error when the VG column is empty.

Fix is to add the separator field and safely split on that.
@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bugfix_pull_request c:module_utils/facts needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 25, 2017
@alikins alikins removed the needs_triage Needs a first human triage before being processed. label Aug 28, 2017
@alikins alikins merged commit 5065bf1 into ansible:devel Aug 28, 2017
@alikins
Copy link
Contributor

alikins commented Aug 28, 2017

Thanks for the fix!

prasadkatti pushed a commit to prasadkatti/ansible that referenced this pull request Oct 1, 2017
…ansible#28684)

If a PV hasn't been added to a VG i.e.:

[pmcclory@box ~]$ sudo pvs --noheadings --nosuffix --units g
  /dev/xvdb       lvm2 ---- 10.00 10.00
  /dev/xvdv1 vg0  lvm2 a--u 24.99     0

Than ansible_facts.ansible_lvm will be unset after running setup module.

The issue is that the module splits on whitespace, which causes an
indexing error when the VG column is empty.

Fix is to add the separator field and safely split on that.
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. c:module_utils/facts support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants