endpoints.trigger: activate: ret private config
This commit is contained in:
parent
2a13eade80
commit
852aa33101
2 changed files with 8 additions and 4 deletions
|
@ -217,8 +217,12 @@ class BuildTriggerActivate(RepositoryParamResource):
|
|||
'$token', write_token.code,
|
||||
app.config['SERVER_HOSTNAME'], path)
|
||||
|
||||
final_config, trigger.private_key = handler.activate(trigger.uuid, authed_url,
|
||||
final_config, private_config = handler.activate(trigger.uuid, authed_url,
|
||||
trigger.auth_token, new_config_dict)
|
||||
|
||||
if 'private_key' in private_config:
|
||||
trigger.private_key = private_config['private_key']
|
||||
|
||||
except TriggerActivationException as exc:
|
||||
write_token.delete_instance()
|
||||
raise request_error(message=exc.message)
|
||||
|
|
|
@ -107,7 +107,7 @@ class BuildTrigger(object):
|
|||
def activate(self, trigger_uuid, standard_webhook_url, auth_token, config):
|
||||
"""
|
||||
Activates the trigger for the service, with the given new configuration.
|
||||
Returns new configuration that should be stored if successful.
|
||||
Returns new public and private config that should be stored if successful.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -216,7 +216,7 @@ class GithubBuildTrigger(BuildTrigger):
|
|||
msg = 'Unable to create webhook on repository: %s' % new_build_source
|
||||
raise TriggerActivationException(msg)
|
||||
|
||||
return config, private_key
|
||||
return config, {'private_key': private_key}
|
||||
|
||||
def deactivate(self, auth_token, config):
|
||||
gh_client = self._get_client(auth_token)
|
||||
|
@ -688,7 +688,7 @@ class CustomBuildTrigger(BuildTrigger):
|
|||
'value': standard_webhook_url,
|
||||
},
|
||||
]
|
||||
return config, private_key
|
||||
return config, {'private_key': private_key}
|
||||
|
||||
def deactivate(self, auth_token, config):
|
||||
config.pop('credentials', None)
|
||||
|
|
Reference in a new issue