Commit d8c31dd
Make lv that is a substring of a vg work
Prior to this commit a logical volume that was a substring of the name of a volume group could not be created due to a false positive by the `exists?` method of the provider.
The sample output of `lvs` in the spec tests was updated to this:
```
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root VolGroup -wi-ao---- 18.54g
lv_swap VolGroup -wi-ao---- 992.00m
data data -wi-ao---- 992.00m
j1 vg_jenkins -wi-a----- 1.00g
```
After adding a test to verify that a logical volume named `jenkins` does not exist the original `exists?` check failed like so:
```
Puppet::Type::Logical_volume::ProviderLvm
self.instances
returns an array of logical volumes
when checking existence
returns 'true', lv 'data' in vg 'data' exists
returns 'nil', lv 'jenkins' in vg 'vg_jenkins' exists (FAILED - 5)
returns 'nil', lv 'data' in vg 'myvg' does not exist
```
After updating the `exists?` method to instead use `lvs_pattern` the new tests passes:
```
Puppet::Type::Logical_volume::ProviderLvm
self.instances
returns an array of logical volumes
when checking existence
returns 'true', lv 'data' in vg 'data' exists
returns 'nil', lv 'jenkins' in vg 'vg_jenkins' exists
returns 'nil', lv 'data' in vg 'myvg' does not exist
```
Co-authored-by: Ruediger Pluem <r.pluem@gmx.de>1 parent d6c3514 commit d8c31dd
File tree
2 files changed
+12
-5
lines changed- lib/puppet/provider/logical_volume
- spec/unit/puppet/provider/logical_volume
2 files changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
0 commit comments