aboutsummaryrefslogtreecommitdiffstats
path: root/build/f_isoroot/f_repobuild/opnfv_mirror_conf.py
diff options
context:
space:
mode:
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) )