78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# File 'manifests/init.pp', line 78
class yum_cron (
String $package_name,
String $service_name,
Stdlib::Absolutepath $config_path,
Enum['present', 'absent'] $ensure = 'present',
Boolean $enable = true,
Boolean $download_updates = true,
Boolean $apply_updates = false,
# EL8 only options
Enum['default','security'] $upgrade_type = 'default',
# EL8 and EL7 options
Pattern[/^(?:-)?[0-9]$/] $debug_level = '-2',
Pattern[/^[0-9]+$/] $randomwait = '360',
Array $exclude_packages = [],
String $mailto = 'root',
String $systemname = $facts['networking']['fqdn'],
String $email_host = 'localhost',
# EL7 only options
Yum_cron::Update_cmd $update_cmd = 'default',
Enum['yes','no'] $update_messages = 'yes',
# Misc configs
Hash $extra_configs = {},
Hash $extra_hourly_configs = {},
# Scientific Linux configs
Enum['undef', 'UNSET', 'absent', 'disabled'] $yum_autoupdate_ensure = 'disabled',
# Package, Service and Config params
Optional[String] $package_ensure = undef,
Optional[String] $service_ensure = undef,
Optional[Boolean] $service_enable = undef,
Boolean $service_hasstatus = true,
Boolean $service_hasrestart = true,
) {
case $ensure {
'present': {
$package_ensure_default = 'present'
if $enable {
$service_ensure_default = 'running'
$service_enable_default = true
$config_notify = Service['yum-cron']
} else {
$service_ensure_default = 'stopped'
$service_enable_default = false
$config_notify = undef
}
}
'absent': {
$package_ensure_default = 'absent'
$service_ensure_default = 'stopped'
$service_enable_default = false
$config_notify = undef
}
default: {
# Do nothing
}
}
$package_ensure_real = pick($package_ensure, $package_ensure_default)
$service_ensure_real = pick($service_ensure, $service_ensure_default)
$service_enable_real = pick($service_enable, $service_enable_default)
if $apply_updates {
$apply_updates_str = 'yes'
$download_updates_str = 'yes'
$check_only = 'no'
$download_only = 'no'
} else {
$apply_updates_str = 'no'
$check_only = 'yes'
if $download_updates {
$download_updates_str = 'yes'
$download_only = 'yes'
} else {
$download_updates_str = 'no'
$download_only = 'no'
}
}
if empty($exclude_packages) {
$exclude_packages_ensure = 'absent'
} else {
$exclude_packages_ensure = 'present'
}
contain yum_cron::install
contain yum_cron::service
Class['yum_cron::install']
-> Class['yum_cron::service']
if $ensure == 'present' {
contain yum_cron::config
Class['yum_cron::install']
-> Class['yum_cron::config']
-> Class['yum_cron::service']
}
}
|