From d2db2750284dfeee15f375ce06bbcbc301738b84 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Mon, 21 Dec 2015 15:19:38 -0800 Subject: [PATCH] Create profile::git_webhook to abstract away the details Prior to this commit there were two possible webhooks - zack/r10k webhook - code manager I moved these two profiles under git_webhook and choose the correct one based on the version of PE being used. As a safety hatch, I provide the $force_zack_r10k_webhook param on profile::git_webhook in case someone needs to continue using it instead of code manager. --- site/profile/manifests/git_webhook.pp | 11 +++++++++++ .../manifests/{ => git_webhook}/code_manager.pp | 4 ++-- .../manifests/{ => git_webhook}/zack_r10k_webhook.pp | 2 +- .../code_manager/create_rbac_token.epp | 0 site/role/manifests/all_in_one_pe.pp | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 site/profile/manifests/git_webhook.pp rename site/profile/manifests/{ => git_webhook}/code_manager.pp (97%) rename site/profile/manifests/{ => git_webhook}/zack_r10k_webhook.pp (97%) rename site/profile/templates/{ => git_webhook}/code_manager/create_rbac_token.epp (100%) diff --git a/site/profile/manifests/git_webhook.pp b/site/profile/manifests/git_webhook.pp new file mode 100644 index 0000000..a46d4ea --- /dev/null +++ b/site/profile/manifests/git_webhook.pp @@ -0,0 +1,11 @@ +class profile::git_webhook ( + $force_zack_r10k_webhook = false +) { + + if versioncmp( $::pe_server_version, '2015.2.99' ) <= 0 or $force_zack_r10k_webhook { + include profile::git_webhook::zack_r10k_webhook + } else { + include profile::git_webhook::code_manager + } + +} diff --git a/site/profile/manifests/code_manager.pp b/site/profile/manifests/git_webhook/code_manager.pp similarity index 97% rename from site/profile/manifests/code_manager.pp rename to site/profile/manifests/git_webhook/code_manager.pp index fc0eb8b..60cabf4 100644 --- a/site/profile/manifests/code_manager.pp +++ b/site/profile/manifests/git_webhook/code_manager.pp @@ -1,4 +1,4 @@ -class profile::code_manager { +class profile::git_webhook::code_manager { $authenticate_webhook = hiera('puppet_enterprise::master::code_manager::authenticate_webhook', true) @@ -51,7 +51,7 @@ class profile::code_manager { } exec { "Generate Token for ${code_manager_service_user}" : - command => epp('profile/code_manager/create_rbac_token.epp', + command => epp('profile/git_webhook/code_manager/create_rbac_token.epp', { 'code_manager_service_user' => $code_manager_service_user, 'code_manager_service_user_password' => $code_manager_service_user_password, 'classifier_hostname' => $classifier_hostname, diff --git a/site/profile/manifests/zack_r10k_webhook.pp b/site/profile/manifests/git_webhook/zack_r10k_webhook.pp similarity index 97% rename from site/profile/manifests/zack_r10k_webhook.pp rename to site/profile/manifests/git_webhook/zack_r10k_webhook.pp index 0ab4da2..ed05282 100644 --- a/site/profile/manifests/zack_r10k_webhook.pp +++ b/site/profile/manifests/git_webhook/zack_r10k_webhook.pp @@ -1,4 +1,4 @@ -class profile::zack_r10k_webhook ( +class profile::git_webhook::zack_r10k_webhook ( $use_mcollective = false, ) { diff --git a/site/profile/templates/code_manager/create_rbac_token.epp b/site/profile/templates/git_webhook/code_manager/create_rbac_token.epp similarity index 100% rename from site/profile/templates/code_manager/create_rbac_token.epp rename to site/profile/templates/git_webhook/code_manager/create_rbac_token.epp diff --git a/site/role/manifests/all_in_one_pe.pp b/site/role/manifests/all_in_one_pe.pp index a8152b1..9e93155 100644 --- a/site/role/manifests/all_in_one_pe.pp +++ b/site/role/manifests/all_in_one_pe.pp @@ -1,6 +1,6 @@ class role::all_in_one_pe { include profile::puppetmaster - include profile::code_manager + include profile::git_webhook }