aboutsummaryrefslogtreecommitdiffstats
path: root/build/f_isoroot/f_repobuild/opnfv_mirror_conf.py
diff options
context:
space:
mode:
authorJonas Bjurel <jonas.bjurel@ericsson.com>2016-09-30 20:28:22 +0200
committerJonas Bjurel <jonas.bjurel@ericsson.com>2016-09-30 20:43:13 +0200
commitaf2db33a0ebab98700c3c03ea84a6ba9b987c5b5 (patch)
tree0b789b555d1d62af4e80aea8d802998a32573ad3 /build/f_isoroot/f_repobuild/opnfv_mirror_conf.py
parent095442c4bdf437531eae2aecd364e74d756757fd (diff)
Preparing the experimental branch for improved Danube CI/CD experimentsexperimental
Fast forwarded to commit:cf93e6ee11c96de090b04196cc96b4a6b0948928 Change-Id: I13d10d870e8ffc7317ab03f8810592d5b2205875 Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'build/f_isoroot/f_repobuild/opnfv_mirror_conf.py')
-rwxr-xr-xbuild/f_isoroot/f_repobuild/opnfv_mirror_conf.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/build/f_isoroot/f_repobuild/opnfv_mirror_conf.py b/build/f_isoroot/f_repobuild/opnfv_mirror_conf.py
new file mode 100755
index 000000000..1c7eb591a
--- /dev/null
+++ b/build/f_isoroot/f_repobuild/opnfv_mirror_conf.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# mskalski@mirantis.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import os
+import yaml
+
+current_snapshot = os.environ["LATEST_TARGET_UBUNTU"]
+mos_version = os.environ['MOS_VERSION']
+openstack_version = os.environ['OPENSTACK_VERSION']
+mos_ubuntu = os.environ['MIRROR_MOS_UBUNTU']
+mos_ubuntu_root = os.environ['MIRROR_MOS_UBUNTU_ROOT']
+mirror_ubuntu = os.environ['MIRROR_UBUNTU_URL']
+if os.environ.get('BUILD_FUEL_PLUGINS'):
+ plugins = os.environ['BUILD_FUEL_PLUGINS']
+else:
+ plugins = os.environ['PLUGINS']
+
+
+configuration_file = open('fuel-mirror/contrib/fuel_mirror/etc/config.yaml').read()
+conf = yaml.load(configuration_file)
+conf['pattern_dir'] = '.'
+conf['openstack_version'] = openstack_version
+conf['mos_version'] = mos_version
+
+with open('opnfv-config.yaml', 'w') as outfile:
+ outfile.write( yaml.dump(conf, default_flow_style=False) )
+
+pattern_file = open('fuel-mirror/contrib/fuel_mirror/data/ubuntu.yaml').read()
+pattern = yaml.load(pattern_file)
+pattern['mos_baseurl'] = "http://{}{}".format(mos_ubuntu, mos_ubuntu_root)
+pattern['ubuntu_baseurl'] = mirror_ubuntu
+for group in pattern['groups']['mos']:
+ group['uri'] = pattern['mos_baseurl']
+for group in pattern['groups']['ubuntu']:
+ group['uri'] = pattern['ubuntu_baseurl']
+
+for plugin in plugins.split():
+ path = "../{}/packages.yaml".format(plugin)
+ if os.path.isfile(path):
+ f = open(path).read()
+ plugin_yaml = yaml.load(f)
+ plugin_set = set(plugin_yaml['packages'])
+ main_set = set(pattern['packages'])
+ new_packages = plugin_set - main_set
+ print "Plugin {} require new packages: {}".format(plugin, ', '.join(new_packages))
+ pattern['packages'] = pattern['packages'] + list(new_packages)
+
+pattern['requirements']['ubuntu'] = pattern['packages']
+
+with open('ubuntu.yaml', 'w') as outfile:
+ outfile.write( yaml.safe_dump(pattern, default_flow_style=False) )