repo-settings: expose pull api endpoint into remote pull view for easier automation.
This commit is contained in:
parent
58fe679096
commit
a5f15dc8cf
3 changed files with 21 additions and 3 deletions
|
|
@ -75,7 +75,7 @@ Example call for auto pulling from remote repositories using curl:
|
|||
.. code-block:: bash
|
||||
|
||||
curl https://server.com/_admin/api -X POST -H 'content-type:text/plain' --data-binary '{"id":1,
|
||||
"auth_token":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull", "args":{"repo":"CPython"}}'
|
||||
"auth_token":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull", "args":{"repoid":"CPython"}}'
|
||||
|
||||
Provide those parameters:
|
||||
- **id** A value of any type, which is used to match the response with the
|
||||
|
|
|
|||
|
|
@ -1992,6 +1992,16 @@ def get_last_path_part(file_node):
|
|||
return u'../' + path
|
||||
|
||||
|
||||
def route_url(*args, **kwds):
|
||||
"""
|
||||
Wrapper around pyramids `route_url` function. It is used to generate
|
||||
URLs from within pylons views or templates. This will be removed when
|
||||
pyramid migration if finished.
|
||||
"""
|
||||
req = get_current_request()
|
||||
return req.route_url(*args, **kwds)
|
||||
|
||||
|
||||
def route_path(*args, **kwds):
|
||||
"""
|
||||
Wrapper around pyramids `route_path` function. It is used to generate
|
||||
|
|
|
|||
|
|
@ -6,7 +6,15 @@
|
|||
|
||||
%if c.repo_info.clone_uri:
|
||||
|
||||
<div class="panel-body-title-text">${_('Remote mirror url')}: <a href="${c.repo_info.clone_uri}">${c.repo_info.clone_uri_hidden}</a></div>
|
||||
<div class="panel-body-title-text">${_('Remote mirror url')}:
|
||||
<a href="${c.repo_info.clone_uri}">${c.repo_info.clone_uri_hidden}</a>
|
||||
<p>
|
||||
${_('Pull can be automated by such api call called periodically (in crontab etc)')}
|
||||
</p>
|
||||
<code>
|
||||
curl ${h.route_url('apiv2')} -X POST -H 'content-type:text/plain' --data-binary '{"id":1, "auth_token":"SECRET","method":"pull", "args":{"repoid":"${c.repo_info.repo_name}"}}'
|
||||
</code>
|
||||
</div>
|
||||
|
||||
${h.secure_form(url('edit_repo_remote', repo_name=c.repo_name), method='put')}
|
||||
<div class="form">
|
||||
|
|
@ -18,7 +26,7 @@
|
|||
%else:
|
||||
<div class="panel-body-title-text">${_('This repository does not have any remote mirror url set.')}</div>
|
||||
|
||||
<button class="btn btn-default" type="submit" disabled="disabled">
|
||||
<button class="btn disabled" type="submit" disabled="disabled">
|
||||
${_('Pull changes from remote location')}
|
||||
</button>
|
||||
%endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue