Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure absent has dependency loop #17

Open
gregswift opened this issue Jan 20, 2016 · 2 comments
Open

ensure absent has dependency loop #17

gregswift opened this issue Jan 20, 2016 · 2 comments

Comments

@gregswift
Copy link

Off v0.1.8 we ran into a dependency loop when setting ensure => absent

To resolve it we pulled the exec out of the equation and just set the service restart command to reload. Also set the Augeas require to point directly at the lens rather than the class.. but that may be optional. It was our first step.

# git diff
diff --git a/manifests/config.pp b/manifests/config.pp
index c8b45a7..897c5d8 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -69,7 +69,7 @@ class pgpool::config {

   file { $pgpool_config_file:
     ensure => $::pgpool::file_ensure,
-    notify => Exec['pgpool_reload']
+    notify => Service['pgpool']
   }

   file { $pgpool_sysconfig_file:
@@ -79,17 +79,17 @@ class pgpool::config {

   file { $pool_passwd_file:
     ensure => $::pgpool::file_ensure,
-    notify => Exec['pgpool_reload']
+    notify => Service['pgpool']
   }

   file { $pool_hba_file:
     ensure => $::pgpool::file_ensure,
-    notify => Exec['pgpool_reload']
+    notify => Service['pgpool']
   }

   file { $pcp_file:
     ensure => $::pgpool::file_ensure,
-    notify => Exec['pgpool_reload']
+    notify => Service['pgpool']
   }

   file { $log_dir:
diff --git a/manifests/config/val.pp b/manifests/config/val.pp
index 40100af..3488d9b 100644
--- a/manifests/config/val.pp
+++ b/manifests/config/val.pp
@@ -59,9 +59,8 @@ define pgpool::config::val (
   Augeas {
     incl    => $target_real,
     lens    => 'Pgpool.lns',
-    require => Class['pgpool::config'],
-    notify  => Exec['pgpool_reload'],
-    before  => Service['pgpool']
+    require => Augeas::Lens['pgpool'],
+    notify  => Service['pgpool']
   }

   case $ensure_real {
diff --git a/manifests/hba.pp b/manifests/hba.pp
index f80c98e..a41715e 100644
--- a/manifests/hba.pp
+++ b/manifests/hba.pp
@@ -95,7 +95,6 @@ define pgpool::hba (
     options  => $options,
     position => $position,
     target   => $target_real,
-    notify   => Exec['pgpool_reload'],
-    before   => Service['pgpool']
+    notify   => Service['pgpool'],
   }
 }
diff --git a/manifests/service.pp b/manifests/service.pp
index fa09f6b..51e3ac2 100644
--- a/manifests/service.pp
+++ b/manifests/service.pp
@@ -36,22 +36,17 @@ class pgpool::service {

   $pgpool_service_name = $::pgpool::service_name_real

-  service { 'pgpool':
-    ensure => $::pgpool::service_ensure_real,
-    name   => $pgpool_service_name,
-    enable => $::pgpool::service_enable_real
-  }
-
   $exec_command_reload = $::osfamily ? {
     /RedHat/ => '/usr/bin/pgpool reload',
     /Debian/ => '/usr/sbin/pgpool reload',
     default  => '/usr/bin/pgpool reload',
   }

-
-  exec { 'pgpool_reload':
-    command     => $exec_command_reload,
-    require     => Service['pgpool'],
-    refreshonly => true,
+  service { 'pgpool':
+    ensure  => $::pgpool::service_ensure_real,
+    name    => $::pgpool_service_name,
+    enable  => $::pgpool::service_enable_real,
+    restart => $exec_command_reload,
   }
+
 }
@gregswift gregswift changed the title ensure = absent has dependency loop ensure absent has dependency loop Jan 20, 2016
@gregswift
Copy link
Author

and that still wasnt enough :)

@gregswift
Copy link
Author

Not sure how much of the above was still needed, but it got better once we stopped passing in the following:

-  ::pgpool::pool_passwd { $profile_mine::db_app_user:
-    password_hash => $profile_mine::db_app_password_hash,
-  }
-
-  ::pgpool::pcp { $profile_mine::pgpool_pcp_user:
-    password_hash => md5($profile_mine::pgpool_pcp_password)
-  }
-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant