Commit 97698b0b authored by Recteur LP's avatar Recteur LP

add a button to download an easy repo config file

parent 3086d565
Pipeline #1163 failed with stage
in 5 minutes and 53 seconds
......@@ -61,13 +61,13 @@ Create packagemanager.yml configuration file (default location is /etc/pyrmin/)
env:
- name: prod
color-class: danger
icon-class: "fa fa-circle-o"
icon-class: "fa fa-dot-circle"
- name: preprod
color-class: warning
icon-class: "fa fa-circle-o"
icon-class: "fa fa-dot-circle"
- name: qualif
color-class: info
icon-class: "fa fa-circle-o"
icon-class: "fa fa-dot-circle"
dnf_config: /etc/pyrmin/dnf.conf
root: /data/repos
repo_base_url: https://localhost/repos/
......
/download
=========
You can download a rpm from a specific repo
/<repo_id>/<pkg_name>
---------------------
:return: a RPM file
......@@ -33,6 +33,7 @@ Endpoints
repos
upload
check_updates
download
Indices and tables
==================
......
......@@ -69,7 +69,7 @@ class html():
)
def register(self):
return ['upload', 'download']
return ['upload', 'download', 'repo_config']
@cherrypy.expose
def upload(self, **kwargs):
......@@ -155,6 +155,28 @@ class html():
file_path = returnSrcFilePath(file_path, pkg_name)
return cherrypy.lib.static.serve_file(file_path, 'application/octet-stream', pkg_name)
@cherrypy.expose
def repo_config(self, repo_id, env=None):
if env is None:
env = self.config['latest']
pyrmin.tools(self.config).init_html('repo.conf').stream(
repo=PM(self.config).repo(repo_id, env),
root_url=os.path.join(self.config.get('repo_base_url', self.config['pyrmin']['root_url']), env)
).dump(
os.path.join(
self.config['root'],
env,
PM(self.config).repo(repo_id)['path'],
repo_id + '.repo'
)
)
return cherrypy.lib.static.serve_file(os.path.join(
self.config['root'],
env,
PM(self.config).repo(repo_id)['path'],
repo_id + '.repo'
), "text/plain", "attachment")
def submenu(self):
""" Register submenu
"""
......
......@@ -762,6 +762,15 @@ class PM():
params.append("-g")
params.append(os.path.join('repodata', 'comps.xml'))
params.append(path)
pyrmin.tools(self.config).init_html('repo.conf').stream(
repo=self.repo(id, env),
root_url=os.path.join(self.config.get('repo_base_url', self.config['pyrmin']['root_url']), env)
).dump(
os.path.join(
path,
id + '.repo'
)
)
run = run_cli(params)
if run:
repomd_xml = os.path.join(path, 'repodata', 'repomd.xml')
......
......@@ -269,13 +269,25 @@
Deltarpms
</a>
</li>
<li><a href="#" id="sync_btn" onclick="javascript: get_data('/rest/packagemanager/repos/{{ id }}/sync', updatemeta_callback);">
<i class="fas fa-fw fa-cloud-download-alt"></i>
Sync Upstream Repo</a>
<li>
<a href="#" id="sync_btn" onclick="javascript: get_data('/rest/packagemanager/repos/{{ id }}/sync', updatemeta_callback);">
<i class="fas fa-fw fa-cloud-download-alt"></i>
Sync Upstream Repo
</a>
</li>
</ul>
</div>
<div class="input-group-btn open pull-left" style="margin-left: 79px;">
<button class="btn btn-flat btn-sm pull-left" aria-expanded="false">
<a href="/packagemanager/repo_config/{{ id }}/{{ current_env }}" id="repo_config_btn">
Donwload Repo file
<i class="fa fa-fw fa-download"></i>
</a>
</button>
</div>
<button type="button" class="btn btn-flat btn-sm pull-right" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
......
[{{ repo.id }}]
name={{ repo.group }} - {{ repo.id }}
baseurl={{ root_url }}/{{ repo.path }}
enabled=1
metadata_expire=7d
repo_gpgcheck={{ repo.repo_gpgcheck }}
type=rpm
gpgcheck={{ repo.gpgcheck }}
{%- if 'gpgkey' in repo %}
gpgkey={{ repo.gpgkey }}
{% endif %}
skip_if_unavailable=False
\ No newline at end of file
......@@ -66,9 +66,12 @@
</div>
</a>
</li>
</ul>
{%- endfor -%}
</ul>
</div>
</div>
<!-- /.box-body -->
</div>
......@@ -88,8 +91,9 @@
d = data['data'];
$('#plugincontent').append("<div id='widgets' class='row'></div>");
$.each(d, function(group) {
$('#widgets').append('<h3 style="margin-left: 50px; clear: both;">' + group + "</h4><div id='widget_" + group + "'' ></div>");
$.each(d[group], function(repo) {
$('#widgets').append('<div class="col-md-4">' +
$("#widget_" + group).append('<div class="col-md-4">' +
nunjucks.render(
'repo_widget.html',
{repo: d[group][repo]}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment