From 24bea87780cb1f86c9f46037d69d51fb133a3f72 Mon Sep 17 00:00:00 2001 From: Daniel Kimsey Date: Tue, 25 Apr 2017 11:19:59 -0500 Subject: [PATCH] Check AD status using lowercase domain to match Centrify --- manifests/adjoin/keytab.pp | 7 ++++--- manifests/adjoin/password.pp | 5 +++-- manifests/adjoin/selfserve.pp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/manifests/adjoin/keytab.pp b/manifests/adjoin/keytab.pp index 847f3ce..e5500ef 100644 --- a/manifests/adjoin/keytab.pp +++ b/manifests/adjoin/keytab.pp @@ -69,18 +69,19 @@ $_join_opts = delete(concat($_opts, $extra_args), '') $_options = join($_join_opts, ' ') $_command = "adjoin ${_options} '${domain}'" + $_is_joined = "adinfo -d | grep ${domain.downcase()}" exec { 'run_kinit_with_keytab': path => '/usr/share/centrifydc/kerberos/bin:/usr/bin:/usr/sbin:/bin', command => "kinit -kt ${krb_keytab} ${join_user}", - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, } if $precreate { exec { 'run_adjoin_precreate_with_keytab': path => '/usr/bin:/usr/sbin:/bin', command => "${_command} -P", - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, require => Exec['run_kinit_with_keytab'], before => Exec['run_adjoin_with_keytab'], } @@ -89,7 +90,7 @@ exec { 'run_adjoin_with_keytab': path => '/usr/bin:/usr/sbin:/bin', command => $_command, - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, require => Exec['run_kinit_with_keytab'], notify => Exec['run_adflush_and_adreload'], } diff --git a/manifests/adjoin/password.pp b/manifests/adjoin/password.pp index 1406d12..922147c 100644 --- a/manifests/adjoin/password.pp +++ b/manifests/adjoin/password.pp @@ -41,13 +41,14 @@ $_join_opts = delete(concat($_opts, $extra_args), '') $_options = join($_join_opts, ' ') $_command = "adjoin ${_options} '${domain}'" + $_is_joined = "adinfo -d | grep ${domain.downcase()}" if $precreate { exec { 'adjoin_precreate_with_password': path => '/usr/bin:/usr/sbin:/bin', command => "${_command} -P", environment => "CENTRIFY_JOIN_PASSWORD=${join_password}", - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, before => Exec['adjoin_with_password'], } } @@ -56,7 +57,7 @@ path => '/usr/bin:/usr/sbin:/bin', command => $_command, environment => "CENTRIFY_JOIN_PASSWORD=${join_password}", - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, notify => Exec['run_adflush_and_adreload'], } diff --git a/manifests/adjoin/selfserve.pp b/manifests/adjoin/selfserve.pp index 3ec3cb1..119967d 100644 --- a/manifests/adjoin/selfserve.pp +++ b/manifests/adjoin/selfserve.pp @@ -24,11 +24,12 @@ $_join_opts = delete(concat($_opts, $extra_args), '') $_options = join($_join_opts, ' ') $_command = "adjoin ${_options} '${domain}'" + $_is_joined = "adinfo -d | grep ${domain.downcase()}" exec { 'adjoin_with_selfserve': path => '/usr/bin:/usr/sbin:/bin', command => $_command, - unless => "adinfo -d | grep ${domain}", + unless => $_is_joined, notify => Exec['run_adflush_and_adreload'], }