Skip to content

Commit

Permalink
add vg_name to logical_volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
rtib committed Jul 14, 2023
1 parent 3058e94 commit f05f0e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/facter/logical_volumes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
'lv_active',
'lv_size',
'lv_permissions',
'vg_name',
]

output = Facter::Core::Execution.exec("lvs -o #{columns.join(',')} --noheading --nosuffix")
Puppet_X::LVM::Output.parse('lv_name', columns, output)
Puppet_X::LVM::Output.parse('lv_name', columns, output, 'lv_')
end
end
20 changes: 12 additions & 8 deletions spec/unit/facter/logical_volumes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

it 'is able to resolve VGs' do
lvs_output = <<-OUTPUT
E7qan8-4NGf-jq2P-l11v-6fFe-MPHK-T6IGzl root centos/root /dev/centos/root /dev/mapper/centos-root -wi-ao---- linear public active 18.46g writeable
buUXDX-GDUh-rN2t-y80n-vtCt-xhhu-XSZ5kA swap centos/swap /dev/centos/swap /dev/mapper/centos-swap -wi-ao---- linear public active 1.00g writeable
uedsry-OTVv-wGW4-vaFf-c7IY-oH6Z-ig6IXB cool_tasks tasks/cool_tasks /dev/tasks/cool_tasks /dev/mapper/tasks-cool_tasks -wi-a----- linear public active 800.00m writeable
gmNS3G-cAhA-vRj0-2Uf0-21yO-QVdy-LNXfBv lame_tasks tasks/lame_tasks /dev/tasks/lame_tasks /dev/mapper/tasks-lame_tasks -wi-a----- linear public active 400.00m writeable
E7qan8-4NGf-jq2P-l11v-6fFe-MPHK-T6IGzl root centos/root /dev/centos/root /dev/mapper/centos-root -wi-ao---- linear public active 18.46g writeable centos
buUXDX-GDUh-rN2t-y80n-vtCt-xhhu-XSZ5kA swap centos/swap /dev/centos/swap /dev/mapper/centos-swap -wi-ao---- linear public active 1.00g writeable centos
uedsry-OTVv-wGW4-vaFf-c7IY-oH6Z-ig6IXB cool_tasks tasks/cool_tasks /dev/tasks/cool_tasks /dev/mapper/tasks-cool_tasks -wi-a----- linear public active 800.00m writeable tasks
gmNS3G-cAhA-vRj0-2Uf0-21yO-QVdy-LNXfBv lame_tasks tasks/lame_tasks /dev/tasks/lame_tasks /dev/mapper/tasks-lame_tasks -wi-a----- linear public active 400.00m writeable tasks
OUTPUT
lvs_output.dup.lstrip!
Facter::Core::Execution.expects(:exec).at_least(1).returns(lvs_output)
Expand All @@ -55,7 +55,8 @@
'role' => 'public',
'active' => 'active',
'size' => '800.00m',
'permissions' => 'writeable'
'permissions' => 'writeable',
'vg_name' => 'tasks',
},
'lame_tasks' => {
'uuid' => 'gmNS3G-cAhA-vRj0-2Uf0-21yO-QVdy-LNXfBv',
Expand All @@ -67,7 +68,8 @@
'role' => 'public',
'active' => 'active',
'size' => '400.00m',
'permissions' => 'writeable'
'permissions' => 'writeable',
'vg_name' => 'tasks',
},
'root' => {
'uuid' => 'E7qan8-4NGf-jq2P-l11v-6fFe-MPHK-T6IGzl',
Expand All @@ -79,7 +81,8 @@
'role' => 'public',
'active' => 'active',
'size' => '18.46g',
'permissions' => 'writeable'
'permissions' => 'writeable',
'vg_name' => 'centos',
},
'swap' => {
'uuid' => 'buUXDX-GDUh-rN2t-y80n-vtCt-xhhu-XSZ5kA',
Expand All @@ -91,7 +94,8 @@
'role' => 'public',
'active' => 'active',
'size' => '1.00g',
'permissions' => 'writeable'
'permissions' => 'writeable',
'vg_name' => 'centos',
})
end
end
Expand Down

0 comments on commit f05f0e0

Please sign in to comment.