|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
|
129 | | - if !empty($gms_api_token) { |
130 | | - if $authenticate_webhook and !empty($rbac_token_file_contents) { |
131 | 129 |
|
132 | | - $rbac_token = parsejson($rbac_token_file_contents)['token'] |
| 130 | + if $authenticate_webhook and !empty($rbac_token_file_contents) { |
133 | 131 |
|
134 | | - $token_info = "&token=${rbac_token}" |
135 | | - } |
136 | | - else { |
137 | | - $token_info = '' |
138 | | - } |
| 132 | + $rbac_token = parsejson($rbac_token_file_contents)['token'] |
| 133 | + $token_info = "&token=${rbac_token}" |
| 134 | + } |
| 135 | + else { |
| 136 | + $token_info = '' |
| 137 | + } |
139 | 138 |
|
140 | | - $code_manager_webhook_type = $git_management_system ? { |
141 | | - 'gitlab' => 'github', |
142 | | - default => $git_management_system, |
143 | | - } |
| 139 | + $code_manager_webhook_type = $git_management_system ? { |
| 140 | + 'gitlab' => 'github', |
| 141 | + default => $git_management_system, |
| 142 | + } |
| 143 | + |
| 144 | + $webhook_url = "https://${::fqdn}:8170/code-manager/v1/webhook?type=${code_manager_webhook_type}${token_info}" |
144 | 145 |
|
| 146 | + file { "${token_directory}/webhook_url.txt" : |
| 147 | + ensure => file, |
| 148 | + content => $webhook_url, |
| 149 | + } |
| 150 | + |
| 151 | + if !empty($gms_api_token) { |
145 | 152 | if $create_and_manage_git_deploy_key { |
146 | 153 | git_deploy_key { "add_deploy_key_to_puppet_control-${::fqdn}": |
147 | 154 | ensure => present, |
|
157 | 164 | if $manage_git_webhook { |
158 | 165 | git_webhook { "code_manager_post_receive_webhook-${::fqdn}" : |
159 | 166 | ensure => present, |
160 | | - webhook_url => "https://${::fqdn}:8170/code-manager/v1/webhook?type=${code_manager_webhook_type}${token_info}", |
| 167 | + webhook_url => $webhook_url, |
161 | 168 | token => $gms_api_token, |
162 | 169 | project_name => $control_repo_project_name, |
163 | 170 | server_url => hiera('gms_server_url'), |
|
0 commit comments