diff options
author | Micah Anderson <micah@riseup.net> | 2013-01-21 12:13:54 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-01-21 12:13:54 -0500 |
commit | 4d8c8ba362cc57c12451e581f27feea97797e8c0 (patch) | |
tree | 68ba95abe534ce2286af64b5ee913fd010a8f936 | |
parent | 44e84a988b859622e7b3583ac27331cf816017ed (diff) | |
parent | 51a9f5b617ea6245860b653d6cea01be878a4693 (diff) |
Merge remote-tracking branch 'camptocamp/master'
Conflicts:
manifests/debian.pp
-rw-r--r-- | manifests/debian.pp | 11 | ||||
-rw-r--r-- | manifests/init.pp | 2 | ||||
-rw-r--r-- | manifests/lens.pp | 53 | ||||
-rw-r--r-- | manifests/redhat.pp | 7 |
4 files changed, 45 insertions, 28 deletions
diff --git a/manifests/debian.pp b/manifests/debian.pp index 2584310..bc2e3eb 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -2,10 +2,17 @@ class augeas::debian inherits augeas::base { package { ['augeas-lenses', 'libaugeas0', 'augeas-tools']: - ensure => "${augeas::base::version}", + ensure => $augeas::base::version, before => File['/usr/share/augeas/lenses'], } - package {'libaugeas-ruby1.9.1': ensure => "${augeas::base::rubylib_version}" } + $augeas_ruby = $::lsbdistcodename ? { + 'wheezy' => 'libaugeas-ruby1.9.1', + default => 'libaugeas-ruby1.8', + } + + package {$augeas_ruby: + ensure => $augeas::base::rubylib_version, + } } diff --git a/manifests/init.pp b/manifests/init.pp index 7919625..e82e21c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,5 +1,5 @@ class augeas { - case $operatingsystem { + case $::operatingsystem { /RedHat|CentOS|Fedora/: { include augeas::redhat } /Debian|Ubuntu|kFreeBSD/: { include augeas::debian } default: { include augeas::base } diff --git a/manifests/lens.pp b/manifests/lens.pp index 95f7370..55dc9ae 100644 --- a/manifests/lens.pp +++ b/manifests/lens.pp @@ -3,18 +3,22 @@ == Definition: augeas::lens Deploy an Augeas lens (and its test file). -Check the lens (and run the unit tests) automatically and remove the files if the checks fail. +Check the lens (and run the unit tests) automatically and remove the files if +the checks fail. Parameters: - *ensure*: present/absent - *lens_source*: the source for the lens - *test_source*: optionally, the source for the test file. +- *stock_since*: optionally, indicate in which version of Augeas + the lens became stock, so it will not be deployed above that version. Example usage: augeas::lens { 'networkmanager': lens_source => 'puppet:///modules/networkmanager/lenses/networkmanager.aug', test_source => 'puppet:///modules/networkmanager/lenses/test_networkmanager.aug', + stock_since => '1.0.0', } */ @@ -22,36 +26,39 @@ Example usage: define augeas::lens ( $lens_source, $ensure=present, - $test_source=false + $test_source=false, + $stock_since=false, ) { - include augeas::base + if (!$stock_since or !versioncmp($::augeasversion, $stock_since)) { + include augeas::base - $lens_dest = "${augeas::base::lens_dir}/${name}.aug" - $test_dest = "${augeas::base::lens_dir}/tests/test_${name}.aug" + $lens_dest = "${augeas::base::lens_dir}/${name}.aug" + $test_dest = "${augeas::base::lens_dir}/tests/test_${name}.aug" - file { $lens_dest: - ensure => $ensure, - source => $lens_source, - } - - exec { "Typecheck lens ${name}": - command => "augparse -I ${augeas::base::lens_dir} ${lens_dest} || (rm -f ${lens_dest} && exit 1)", - refreshonly => true, - subscribe => File[$lens_dest], - } - - if $test_source { - file { $test_dest: + file { $lens_dest: ensure => $ensure, - source => $test_source, - notify => Exec["Test lens ${name}"], + source => $lens_source, } - exec { "Test lens ${name}": - command => "augparse -I ${augeas::base::lens_dir} ${test_dest} || (rm -f ${lens_dest} && rm -f ${test_dest} && exit 1)", + exec { "Typecheck lens ${name}": + command => "augparse -I ${augeas::base::lens_dir} ${lens_dest} || (rm -f ${lens_dest} && exit 1)", refreshonly => true, - subscribe => File[$lens_dest, $test_dest], + subscribe => File[$lens_dest], + } + + if $test_source { + file { $test_dest: + ensure => $ensure, + source => $test_source, + notify => Exec["Test lens ${name}"], + } + + exec { "Test lens ${name}": + command => "augparse -I ${augeas::base::lens_dir} ${test_dest} || (rm -f ${lens_dest} && rm -f ${test_dest} && exit 1)", + refreshonly => true, + subscribe => File[$lens_dest, $test_dest], + } } } } diff --git a/manifests/redhat.pp b/manifests/redhat.pp index e03b420..1e95728 100644 --- a/manifests/redhat.pp +++ b/manifests/redhat.pp @@ -2,9 +2,12 @@ class augeas::redhat inherits augeas::base { package { ['augeas', 'augeas-libs']: - ensure => "${augeas::base::version}", + ensure => $augeas::base::version, before => File['/usr/share/augeas/lenses'], } - package { 'ruby-augeas': ensure => "${augeas::base::rubylib_version}" } + + package { 'ruby-augeas': + ensure => $augeas::base::rubylib_version, + } } |