mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-09 16:14:59 +08:00
Merge #319 Some handy scripts for bootstrapping a new instance.
This commit is contained in:
6
bootstrap/README.rst
Normal file
6
bootstrap/README.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
These are some utilities to help with bootstrapping a new MBS instance.
|
||||
|
||||
Usage::
|
||||
|
||||
$ python export-dev-pdc.py
|
||||
$ python import-to-pdc.py staging <AUTH_TOKEN>
|
||||
12
bootstrap/base-runtime-master-3.json
Normal file
12
bootstrap/base-runtime-master-3.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"variant_uid": "base-runtime-master-3",
|
||||
"variant_release": "3",
|
||||
"variant_name": "base-runtime",
|
||||
"build_deps": [],
|
||||
"variant_type": "module",
|
||||
"modulemd": "document: modulemd\r\nversion: 1\r\ndata:\r\n name: base-runtime\r\n stream: master\r\n version: 3\r\n summary: A fake base-runtime module, used to bootstrap the infrastructure.\r\n description: ...\r\n xmd:\r\n mbs_commit: ae993ba84f4bce554471382ccba917ef16265f11\r\n mbs_buildrequires:\r\n base-runtime:\r\n ref: ae993ba84f4bce554471382ccba917ef16265f11\r\n stream: master\r\n version: 3\r\n profiles:\r\n buildroot:\r\n rpms:\r\n - bash\r\n - bzip2\r\n - coreutils\r\n - cpio\r\n - diffutils\r\n - fedora-release\r\n - findutils\r\n - gawk\r\n - gcc\r\n - gcc-c++\r\n - grep\r\n - gzip\r\n - info\r\n - make\r\n - patch\r\n - redhat-rpm-config\r\n - rpm-build\r\n - sed\r\n - shadow-utils\r\n - tar\r\n - unzip\r\n - util-linux\r\n - which\r\n - xz\r\n srpm-buildroot:\r\n rpms:\r\n - bash\r\n - fedora-release\r\n - fedpkg-minimal\r\n - gnupg2\r\n - redhat-rpm-config\r\n - rpm-build\r\n - shadow-utils",
|
||||
"koji_tag": "module-base-runtime-master-3",
|
||||
"runtime_deps": [],
|
||||
"variant_id": "base-runtime",
|
||||
"variant_version": "master"
|
||||
}
|
||||
13
bootstrap/export-dev-pdc.py
Normal file
13
bootstrap/export-dev-pdc.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import json
|
||||
import requests
|
||||
|
||||
url = 'http://modularity.fedorainfracloud.org:8080/rest_api/v1/unreleasedvariants/'
|
||||
params = dict(variant_uid='base-runtime-master-3')
|
||||
print("Querying %r with %r" % (url, params))
|
||||
response = requests.get(url, params=params)
|
||||
data = response.json()
|
||||
entry = data['results'][0]
|
||||
filename = 'base-runtime-master-3.json'
|
||||
with open(filename, 'w') as f:
|
||||
f.write(json.dumps(entry, indent=2))
|
||||
print("Wrote %s" % filename)
|
||||
23
bootstrap/import-to-pdc.py
Normal file
23
bootstrap/import-to-pdc.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pdc_client
|
||||
|
||||
servername, token = sys.argv[-2], sys.argv[-1]
|
||||
|
||||
if os.path.basename(__file__) in (servername, token,):
|
||||
raise ValueError("Provide a PDC server name defined in /etc/pdc.d/ and a token")
|
||||
|
||||
filename = 'base-runtime-master-3.json'
|
||||
print("Reading %s" % filename)
|
||||
with open(filename, 'r') as f:
|
||||
entry = json.loads(f.read())
|
||||
|
||||
print("Connecting to PDC server %r with token %r" % (servername, token))
|
||||
pdc = pdc_client.PDCClient(servername, token=token)
|
||||
|
||||
print("Submitting POST.")
|
||||
pdc['unreleasedvariants']._(entry)
|
||||
print("Done.")
|
||||
Reference in New Issue
Block a user