diff options
author | mail_redacted_for_web | 2015-11-15 10:44:53 -0800 |
---|---|---|
committer | mail_redacted_for_web | 2015-12-09 09:44:50 -0800 |
commit | b71ab8d42eca09d24c4f0b4955b0779fcbb3a5bc (patch) | |
tree | e5e0a84aea08fb98def761912687feb31ffc5912 /site/profile/manifests | |
parent | 2d7a9a72e10526c07bdc77b2b8eefcc368db8b45 (diff) | |
download | control-repo-template-b71ab8d42eca09d24c4f0b4955b0779fcbb3a5bc.tar.bz2 |
Allow code_manager profile to not error out on first run
Prior to this commit, the code manger profile could not complete
on the first run because the file function would error out
I implemented a new version of the file function that returns
nothing when the file does not exist instead of erroring out which
allows me to gate creating the webhook on whether there is content
in the file.
As a result this means that it takes 2 runs to get everything setup
but this is preferable over having to manually intervene in some
other way if the token file doesn't exist.
Diffstat (limited to 'site/profile/manifests')
-rw-r--r-- | site/profile/manifests/code_manager.pp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/site/profile/manifests/code_manager.pp b/site/profile/manifests/code_manager.pp index f244564..6416054 100644 --- a/site/profile/manifests/code_manager.pp +++ b/site/profile/manifests/code_manager.pp @@ -42,11 +42,14 @@ class profile::code_manager { } - if !empty($gms_api_token) { + #this file cannont be read until the next run after the above exec + #because the file function runs on the master not on the agent + #so the file doesn't exist at the time the function is run + $rbac_token_file_contents = no_fail_file($token_filename) - #this file cannont be read until the next run after the above exec - #because the file function runs on the master not on the agent - $rbac_token = parsejson(file($token_filename))['token'] + if !empty($gms_api_token) and !empty($rbac_token_file_contents) { + + $rbac_token = parsejson($rbac_token_file_contents)['token'] $code_manager_webhook_type = $git_management_system ? { 'gitlab' => 'github', |