File tree 3 files changed +26
-22
lines changed
3 files changed +26
-22
lines changed Original file line number Diff line number Diff line change 13
13
# include yum::plugin::versionlock
14
14
#
15
15
class yum::plugin::versionlock (
16
- $ensure = present
16
+ $ensure = present ,
17
+ $path = ' /etc/yum/pluginconf.d/versionlock.list'
17
18
) {
18
19
yum::plugin { 'versionlock' :
19
20
ensure => $ensure ,
20
21
}
22
+ concat { $path:
23
+ mode => ' 0644' ,
24
+ owner => ' root' ,
25
+ group => ' root' ,
26
+ }
21
27
}
Original file line number Diff line number Diff line change 4
4
#
5
5
# Parameters:
6
6
# [*ensure*] - specifies if versionlock should be present, absent or exclude
7
- # [*path*] - configuration of Yum plugin versionlock
8
7
#
9
8
# Actions:
10
9
#
18
17
#
19
18
define yum::versionlock (
20
19
$ensure = present ,
21
- $path = ' /etc/yum/pluginconf.d/versionlock.list'
22
20
) {
23
- require ::yum::plugin::versionlock
21
+ include ::yum::plugin::versionlock
24
22
25
23
if ($name =~ /^[0-9]+:.+\*$/) {
26
- $_name = $name
24
+ $line = $name
27
25
} elsif ($name =~ /^[0-9]+:.+-.+-.+\./) {
28
- $_name = " ${name} *"
26
+ $line = " ${name} *"
29
27
} else {
30
28
fail(' Package name must be formated as \' EPOCH:NAME-VERSION-RELEASE.ARCH\' ' )
31
29
}
32
30
33
- case $ensure {
34
- ' present' , ' absent' , ' exclude' : {
35
- if ($ensure == present ) or ($ensure == absent ) {
36
- file_line { "versionlock.list-${name}" :
37
- ensure => $ensure ,
38
- line => $_name,
39
- path => $path ,
40
- }
41
- }
31
+ $line_prefix = $ensure ? {
32
+ ' exclude' => ' !' ,
33
+ default => ' ' ,
34
+ }
42
35
43
- if ($ensure == exclude) or ($ensure == absent ) {
44
- file_line { "versionlock.list-!${name}" :
45
- ensure => $ensure ,
46
- line => " !${_name}" ,
47
- path => $path ,
48
- }
36
+ case $ensure {
37
+ ' present' ,' exclude' : {
38
+ concat::fragment { "yum-versionlock-${name}" :
39
+ content => " ${line_prefix}${line} \n " ,
40
+ target => $yum::plugin::versionlock::path ,
49
41
}
50
42
}
51
-
43
+ ' absent' :{
44
+ # fragment will be removed
45
+ }
52
46
default: {
53
47
fail(" Invalid ensure state: ${ensure} " )
54
48
}
Original file line number Diff line number Diff line change 11
11
{
12
12
"name" : " puppetlabs/stdlib" ,
13
13
"version_requirement" : " >= 4.2.0 < 5.0.0"
14
+ },
15
+ {
16
+ "name" : " puppetlabs/concat" ,
17
+ "version_requirement" : " >= 1.1.1"
14
18
}
15
19
],
16
20
"tags" : [
You can’t perform that action at this time.
0 commit comments