def update_hook(node_settings):
 logger.warn('Updating GitHub hook on node {0}'.format(node_settings.owner._id))
 connection = GitHub.from_settings(node_settings.user_settings)
 repo = connection.repo(node_settings.user, node_settings.repo)
 hook = repo.hook(node_settings.hook_id)
 if (hook is None):
  logger.warn('Hook {0} not found'.format(node_settings.hook_id))
  return
 secret = utils.make_hook_secret()
 config = hook.config
 config['content_type'] = github_settings.HOOK_CONTENT_TYPE
 config['secret'] = secret
 hook.edit(config=config)
 node_settings.hook_secret = secret
 node_settings.save()

def update_hook ( node_settings ) : logger . warn ( 'Updating GitHub hook on node {0}' . format ( node_settings . owner . _id ) ) connection = GitHub . from_settings ( node_settings . user_settings ) repo = connection . repo ( node_settings . user , node_settings . repo ) hook = repo . hook ( node_settings . hook_id ) if ( hook is None ) : logger . warn ( 'Hook {0} not found' . format ( node_settings . hook_id ) ) return secret = utils . make_hook_secret ( ) config = hook . config config [ 'content_type' ] = github_settings . HOOK_CONTENT_TYPE config [ 'secret' ] = secret hook . edit ( config = config ) node_settings . hook_secret = secret node_settings . save ( )
discard the existing webhook for a github node add-on and create a new one .