diff --git a/manifests/admin_instance.pp b/manifests/admin_instance.pp index 66cc44a..fa7e8b9 100644 --- a/manifests/admin_instance.pp +++ b/manifests/admin_instance.pp @@ -1,4 +1,4 @@ -define sedue::admin_instance($user, $instance, $instance_file_content, $config_server) { +define sedue::admin_instance($user, $instance, $admin_conf, $config_server) { sedue::directory { "sedue::${instance}::admin::directory_log": user => $user, instance => $instance, @@ -11,13 +11,26 @@ require => Sedue::Directory["sedue::${instance}::admin::directory_log"] } - file { "sedue::${instance}::admin::instance_file": - path => "${sedue_home}/etc/${instance}.instance", + # 2011/6/23 Masahiro Nakagawa + # Virtual resource does not work for unique resource across each instances. + # I use 'if !defined' to avoid this problem. + if !defined(File["sedue::admin::conf_directory"]) { + file { "sedue::admin::conf_directory": + path => "${sedue_home}/etc/admin", + owner => $user, + group => $user, + mode => '0755', + ensure => 'directory' + } + } + + file { "sedue::${instance}::admin::conf_file": + path => "${sedue_home}/etc/admin/${instance}.conf", owner => $user, group => $user, mode => '0644', - content => $instance_file_content, - require => File["${instance}_serve_directory"] + content => $admin_conf, + require => [File["sedue::admin::conf_directory"], File["${instance}_serve_directory"]] } sedue::mongodb { "sedue::${instance}::admin::mongodb": @@ -26,6 +39,6 @@ port => $config_server['port'], pair => $config_server['pair'], run => $config_server['run'], - require => File["sedue::${instance}::admin::instance_file"] + require => File["sedue::${instance}::admin::conf_file"] } }