Skip to content

Commit

Permalink
(CAT-1302) - LVM module failure when LVM package is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramesh7 committed Aug 9, 2023
1 parent 22ba15e commit 56801bf
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions lib/facter/lvm_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
Facter.add('lvm_vgs') do
confine lvm_support: true

vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)

if vgs.nil?
setcode { 0 }
else
vg_list = vgs.split
setcode { vg_list.length }
end
setcode {

Check failure on line 20 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/BlockDelimiters: Prefer `do...end` for multi-line blocks without chaining. (https://rubystyle.guide#single-line-blocks)

Check failure on line 20 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/BlockDelimiters: Prefer `do...end` for multi-line blocks without chaining. (https://rubystyle.guide#single-line-blocks)
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
unless vgs.nil?

Check failure on line 22 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/UnlessElse: Do not use `unless` with `else`. Rewrite these with the positive case first. (https://rubystyle.guide#no-else-with-unless)

Check failure on line 22 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/UnlessElse: Do not use `unless` with `else`. Rewrite these with the positive case first. (https://rubystyle.guide#no-else-with-unless)
vg_list = vgs.split
vg_list.length
else
0
end
}
end

# lvm_vg_[0-9]+
Expand All @@ -47,13 +48,15 @@
Facter.add('lvm_pvs') do
confine lvm_support: true

pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
if pvs.nil?
setcode { 0 }
else
pv_list = pvs.split
setcode { pv_list.length }
end
setcode {

Check failure on line 51 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/BlockDelimiters: Prefer `do...end` for multi-line blocks without chaining. (https://rubystyle.guide#single-line-blocks)

Check failure on line 51 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/BlockDelimiters: Prefer `do...end` for multi-line blocks without chaining. (https://rubystyle.guide#single-line-blocks)
pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
unless pvs.nil?

Check failure on line 53 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Style/UnlessElse: Do not use `unless` with `else`. Rewrite these with the positive case first. (https://rubystyle.guide#no-else-with-unless)

Check failure on line 53 in lib/facter/lvm_support.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Style/UnlessElse: Do not use `unless` with `else`. Rewrite these with the positive case first. (https://rubystyle.guide#no-else-with-unless)
pv_list = pvs.split
pv_list.length
else
0
end
}
end

# lvm_pv_[0-9]+
Expand Down

0 comments on commit 56801bf

Please sign in to comment.