Defined Type: registry::value
- Defined in:
- manifests/value.pp
Summary
High level abstraction on top of registry_key and registry_value resourcesOverview
Actions:
- Manage the parent key if not already managed.
- Manage the value
Requires:
- Registry Module
- Stdlib Module
Note:
This defined resource type provides a higher level of abstraction on top of the registry_key and registry_value resources. Using this defined resource type, you do not need to explicitly manage the parent key for a particular value. Puppet will automatically manage the parent key for you.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'manifests/value.pp', line 39
define registry::value (
Pattern[/^\w+/] $key,
Optional[String] $value = undef,
Pattern[/^\w+/] $type = 'string',
Optional[Variant[
String,
Numeric,
Array[String]
]] $data = undef,
) {
# ensure windows os
if $facts['os']['name'] != 'windows' {
fail("Unsupported OS ${facts['os']['name']}")
}
$value_real = $value ? {
undef => $name,
'(default)' => '',
default => $value,
}
# Resource defaults.
Registry_key { ensure => present }
Registry_value { ensure => present }
if !defined(Registry_key[$key]) {
registry_key { $key: }
}
# If value_real is an empty string then the default value of the key will be
# managed. Use a double backslash so value names with a backslash are supported
registry_value { "${key}\\\\${value_real}":
type => $type,
data => $data,
}
}
|