Skip to content

Commit

Permalink
store augeas lenses independently of augeas installation
Browse files Browse the repository at this point in the history
  • Loading branch information
mruzicka committed Mar 9, 2012
1 parent 683d561 commit e7dbd10
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions modules/augeas/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
class augeas {
package { 'augeas-libs':
ensure => latest,
$lens_dir = '/var/lib/augeas'

file { "${lens_dir}":
ensure => directory,
owner => root,
group => root,
mode => 0755,
}
}
6 changes: 4 additions & 2 deletions modules/augeas/manifests/lens.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
define augeas::lens($source) {
file { "/usr/share/augeas/lenses/${name}.aug":
include augeas

file { "${augeas::lens_dir}/${name}.aug":
ensure => present,
source => "${source}",
owner => root,
group => root,
mode => 0644,
require => Package['augeas-libs'],
require => File["${augeas::lens_dir}"],
}
}
4 changes: 4 additions & 0 deletions modules/wordpress/manifests/config_param.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
define wordpress::config_param($wp_root, $key, $value) {
include augeas
include internal::lens

# first try to see if there is a double quoted param of the specified name
# and if it is then replace it with a single quoted version and set it to the desired value
augeas { "wp_replace_double_quoted_config_param-${wp_root}-${key}":
incl => "${wp_root}/wp-config.php",
lens => 'Wordpress.lns',
load_path => "${augeas::lens_dir}"
context => "/files${wp_root}/wp-config.php",
onlyif => "match \"\\\"${key}\\\"\" != []",
changes => [
Expand All @@ -20,6 +22,7 @@
augeas { "wp_insert_new_config_param-${wp_root}-${key}":
incl => "${wp_root}/wp-config.php",
lens => 'Wordpress.lns',
load_path => "${augeas::lens_dir}"
context => "/files${wp_root}/wp-config.php",
onlyif => "match \"'${key}'\" == []",
changes => [
Expand All @@ -33,6 +36,7 @@
augeas { "wp_set_config_param-${wp_root}-${key}":
incl => "${wp_root}/wp-config.php",
lens => 'Wordpress.lns',
load_path => "${augeas::lens_dir}"
context => "/files${wp_root}/wp-config.php",
changes => [
"set \"'${key}'\" \"'${value}'\"",
Expand Down
1 change: 0 additions & 1 deletion modules/wordpress/manifests/internal/prerequisites.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
include php5::apache_module
include php5::mysql
include mysql::server
include augeas

package { ['curl', 'tar']:
ensure => present,
Expand Down

0 comments on commit e7dbd10

Please sign in to comment.