- Timestamp:
- Jul 31, 2017, 6:42:27 PM (9 years ago)
- Branches:
- 0.5, app-cordova, debian/bullseye, debian/jessie, master
- Children:
- fc9d514
- Parents:
- eb1ccd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/puppetcode/environments/gnuboat/modules/apt/manifests/key.pp
reb1ccd6 rbe0859f 1 1 # == Define: apt::key 2 2 define apt::key ( 3 $id = $title, 4 $ensure = present, 5 $content = undef, 6 $source = undef, 7 $server = $::apt::keyserver, 8 $options = undef, 9 $key = undef, 10 $key_content = undef, 11 $key_source = undef, 12 $key_server = undef, 13 $key_options = undef, 14 ) { 3 String $id = $title, 4 Enum['present', 'absent'] $ensure = present, 5 Optional[String] $content = undef, 6 Optional[String] $source = undef, 7 String $server = $::apt::keyserver, 8 Optional[String] $options = undef, 9 ) { 15 10 16 if $key != undef { 17 warning('$key is deprecated and will be removed in the next major release. Please use $id instead.') 18 $_id = $key 19 } else { 20 $_id = $id 11 validate_re($id, ['\A(0x)?[0-9a-fA-F]{8}\Z', '\A(0x)?[0-9a-fA-F]{16}\Z', '\A(0x)?[0-9a-fA-F]{40}\Z']) 12 13 if $source { 14 validate_re($source, ['\Ahttps?:\/\/', '\Aftp:\/\/', '\A\/\w+']) 21 15 } 22 16 23 if $key_content != undef { 24 warning('$key_content is deprecated and will be removed in the next major release. Please use $content instead.') 25 $_content = $key_content 26 } else { 27 $_content = $content 28 } 29 30 if $key_source != undef { 31 warning('$key_source is deprecated and will be removed in the next major release. Please use $source instead.') 32 $_source = $key_source 33 } else { 34 $_source = $source 35 } 36 37 if $key_server != undef { 38 warning('$key_server is deprecated and will be removed in the next major release. Please use $server instead.') 39 $_server = $key_server 40 } else { 41 $_server = $server 42 } 43 44 if $key_options != undef { 45 warning('$key_options is deprecated and will be removed in the next major release. Please use $options instead.') 46 $_options = $key_options 47 } else { 48 $_options = $options 49 } 50 51 validate_re($_id, ['\A(0x)?[0-9a-fA-F]{8}\Z', '\A(0x)?[0-9a-fA-F]{16}\Z', '\A(0x)?[0-9a-fA-F]{40}\Z']) 52 validate_re($ensure, ['\Aabsent|present\Z',]) 53 54 if $_content { 55 validate_string($_content) 56 } 57 58 if $_source { 59 validate_re($_source, ['\Ahttps?:\/\/', '\Aftp:\/\/', '\A\/\w+']) 60 } 61 62 if $_server { 63 validate_re($_server,['\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$']) 64 } 65 66 if $_options { 67 validate_string($_options) 17 if $server { 18 validate_re($server,['\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$']) 68 19 } 69 20 70 21 case $ensure { 71 22 present: { 72 if defined(Anchor["apt_key ${ _id} absent"]){73 fail("key with id ${ _id} already ensured as absent")23 if defined(Anchor["apt_key ${id} absent"]){ 24 fail("key with id ${id} already ensured as absent") 74 25 } 75 26 76 if !defined(Anchor["apt_key ${ _id} present"]) {27 if !defined(Anchor["apt_key ${id} present"]) { 77 28 apt_key { $title: 78 29 ensure => $ensure, 79 id => $_id, 80 source => $_source, 81 content => $_content, 82 server => $_server, 83 options => $_options, 84 } -> 85 anchor { "apt_key ${_id} present": } 30 id => $id, 31 source => $source, 32 content => $content, 33 server => $server, 34 options => $options, 35 } -> anchor { "apt_key ${id} present": } 86 36 } 87 37 } 88 38 89 39 absent: { 90 if defined(Anchor["apt_key ${ _id} present"]){91 fail("key with id ${ _id} already ensured as present")40 if defined(Anchor["apt_key ${id} present"]){ 41 fail("key with id ${id} already ensured as present") 92 42 } 93 43 94 if !defined(Anchor["apt_key ${ _id} absent"]){44 if !defined(Anchor["apt_key ${id} absent"]){ 95 45 apt_key { $title: 96 46 ensure => $ensure, 97 id => $_id, 98 source => $_source, 99 content => $_content, 100 server => $_server, 101 options => $_options, 102 } -> 103 anchor { "apt_key ${_id} absent": } 47 id => $id, 48 source => $source, 49 content => $content, 50 server => $server, 51 options => $options, 52 } -> anchor { "apt_key ${id} absent": } 104 53 } 105 54 }
Note:
See TracChangeset
for help on using the changeset viewer.
