Commit 0ef4796
committed
stdlib::ensure: new fuction to cast ensure values
This CR adds a new function to case the ensureable property to a resource
specific value. e.g.
* stdlib::ensure('present', 'service') == 'running'
* stdlib::ensure('present', 'directory') == 'directory'
This is usefull when you want to pass ensure to a custome class and
ensure all the resource get the correct value e.g.
```
class foo(
Enum['present', 'absent'] $ensure = 'present'
) {
file {'/some/dir':
ensure => stdlib::ensure($ensure, 'directory')
}
file {'/some/file':
ensure => stdlib::ensure($ensure, 'file')
}
file {'/some/link':
ensure => stdlib::ensure($ensure, 'link')
}
service {'some-service':
ensure => stdlib::ensure($ensure, 'service')
}
```
something similar to this was discussed in #8691 parent 452d745 commit 0ef4796
2 files changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments