summaryrefslogtreecommitdiffstats
path: root/fuel/build/f_isoroot/f_predeployment
diff options
context:
space:
mode:
authorStefan K. Berg <stefan.k.berg@ericsson.com>2015-09-10 14:46:28 +0200
committerStefan K. Berg <stefan.k.berg@ericsson.com>2015-09-14 13:53:11 +0200
commit07f4e6531023cbf742e7d187c6a0ee0800b64e01 (patch)
treea03c4311c4b9ac58d4105b5c3ac4741901146e8a /fuel/build/f_isoroot/f_predeployment
parent2c06022aa12ec8fc0ac3e50de36b900c92bf9817 (diff)
Refactoring build system to support Fuel 6.1
As Fuel 6.1 has changed both Debian package handling (fetching repositories from Internet) as well as Puppet packaging, the support for patching these has been disabled. The pre-deploy logic of Fuel has been removed together with a number of patches applied on top of a Fuel build, among them fixes for NTP, DNS and /etc/hosts injection. Instead, when changed default behavior is required, this will be introduced as Fuel plugins which more cleanly integrates into the Fuel system, and also decouples additional functionality from the ISO build stage. Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/build/f_isoroot/f_predeployment')
-rw-r--r--fuel/build/f_isoroot/f_predeployment/Makefile28
-rw-r--r--fuel/build/f_isoroot/f_predeployment/README18
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/pre-deploy.sh401
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/sysinfo.sh12
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/transform_yaml.py68
5 files changed, 0 insertions, 527 deletions
diff --git a/fuel/build/f_isoroot/f_predeployment/Makefile b/fuel/build/f_isoroot/f_predeployment/Makefile
deleted file mode 100644
index a5252df..0000000
--- a/fuel/build/f_isoroot/f_predeployment/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.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
-##############################################################################
-
-TOP := $(shell pwd)
-
-.PHONY: all
-all:
- @mkdir -p release/opnfv
- @cp pre-deploy.sh release/opnfv
- @cp sysinfo.sh release/opnfv
- @cp transform_yaml.py release/opnfv
- @chmod 755 release/opnfv/*
-
-.PHONY: clean
-clean:
- @rm -rf release
-
-
-.PHONY: release
-release:clean all
- @cp -Rvp release/* ../release
diff --git a/fuel/build/f_isoroot/f_predeployment/README b/fuel/build/f_isoroot/f_predeployment/README
deleted file mode 100644
index 3eef9f2..0000000
--- a/fuel/build/f_isoroot/f_predeployment/README
+++ /dev/null
@@ -1,18 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.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
-##############################################################################
-
-This is the start of the interactive frontend that will add OPNFV configuration into
-the astute.yaml of the nodes. Currently just a test setup - prepare an installation
-up to the point of "deploy changes", but run "./pre-deploy.sh <envid> fragment.yaml"
-before actually hitting deploy, which will make sure to add the example fragment to
-the nodes.
-
-Note that the only part of the fragment.yaml that actually is acted on is the hosts
-part at this time.
diff --git a/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh b/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh
deleted file mode 100755
index c5c6c42..0000000
--- a/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh
+++ /dev/null
@@ -1,401 +0,0 @@
-#!/bin/bash -e
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.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
-##############################################################################
-
-
-error_exit () {
- echo "$@" >&2
- exit 1
-}
-
-get_env() {
- local env_id=${1:-""}
-
- if [ -z $env_id ]; then
- local n_envs=$(fuel env --list | grep -v -E "^id|^--|^ *$" | wc -l)
- if [ $n_envs -ne 1 ]; then
- echo "Usage: $0 [<env-id>]" >&2
- error_exit "If only a single environment is present it can be left" \
- "out. Otherwise the environment must be selected"
- fi
- env_id=$(fuel env --list | grep -v -E "^id|^--" | awk '{print $1}')
- else
- if ! fuel --env $env_id environment 2>/dev/null grep -v -E "^id|^--" | \
- grep -q ^$env_id; then
- error_exit "No such environment ID: $env_id"
- fi
- fi
- echo $env_id
-}
-
-get_node_uid () {
- cat $1 | grep "^uid: " | sed "s/^uid: '//" | sed "s/'$//"
-}
-
-get_node_role () {
- cat $1 | grep "^role: " | sed "s/^role: //"
-}
-
-get_next_cic () {
- file=$1
-
- last=`cat $file | sed 's/.*://' | grep "cic-" | sed 's/cic\-.*sl//' | sort -n | tail -1`
- if [ -z "$last" ]; then
- next=1
- else
- next=$[$last + 2]
- fi
- echo $next
-}
-
-get_next_compute () {
- file=$1
-
- last=`cat $file | sed 's/.*://' | grep "cmp-" | sed 's/cmp\-.*sl//' | sort -n | tail -1`
- if [ -z "$last" ]; then
- next=7
- else
- next=$[$last + 2]
- fi
- echo $next
-}
-
-modify_hostnames () {
- env=$1
- file=$2
- for line in `cat $file`
- do
- old=`echo $line | sed 's/:.*//'`
- new=`echo $line | sed 's/.*://'`
- echo "Applying: $old -> $new"
-
- for dfile in deployment_$env/*.yaml
- do
- sed -i "s/$old/$new/g" $dfile
- done
-
- for pfile in provisioning_$env/*.yaml
- do
- sed -i "s/$old/$new/g" $pfile
- done
- done
-}
-
-setup_hostnames () {
- ENV=$1
- cd ${CONFIGDIR}
- touch hostnames.$ENV
-
- for dfile in deployment_$ENV/*.yaml
- do
- uid=`get_node_uid $dfile`
- hostname=`grep "^node-$uid:" hostnames.$ENV | sed 's/.*://'`
- if [ -z $hostname ]; then
-
- pfile=provisioning_$ENV/node-$uid.yaml
- role=`get_node_role $dfile`
-
- case $role in
- primary-controller)
- hostname="cic-pod0-sh0-sl`get_next_cic hostnames.$ENV`"
- ;;
- controller)
- hostname="cic-pod0-sh0-sl`get_next_cic hostnames.$ENV`"
- ;;
- compute)
- hostname="cmp-pod0-sh0-sl`get_next_compute hostnames.$ENV`"
- ;;
- *)
- echo "Unknown node type for UID $uid"
- exit 1
- ;;
- esac
-
- echo "node-$uid:$hostname" >> hostnames.$ENV
- else
- echo "Already got hostname $hostname for node-$uid"
-
- fi
- done
-
- rm -f hostnames.$ENV.old
- mv hostnames.$ENV hostnames.$ENV.old
- sort hostnames.$ENV.old | uniq > hostnames.$ENV
- modify_hostnames $ENV hostnames.$ENV
-}
-
-
-
-get_provisioning_info () {
- ENV=$1
- mkdir -p ${CONFIGDIR}
- cd ${CONFIGDIR}
- rm -Rf provisioning_$ENV
- echo "Getting provisioning info..."
- fuel --env $ENV provisioning --default
- if [ $? -ne 0 ]; then
- echo "Error: Could not get provisioning info for env $ENV">&2
- exit 1
- fi
-}
-
-get_deployment_info () {
- ENV=$1
- mkdir -p ${CONFIGDIR}
- cd ${CONFIGDIR}
- rm -Rf deployment_$ENV
- echo "Getting deployment info..."
- fuel --env $ENV deployment --default
- if [ $? -ne 0 ]; then
- echo "Error: Could not get deployment info for env $ENV">&2
- exit 1
- fi
-}
-
-transform_yaml () {
- ENV=$1
- cd ${CONFIGDIR}
- for dfile in deployment_$ENV/*.yaml
- do
- /opt/opnfv/transform_yaml.py $dfile
- done
-}
-
-commit_changes () {
- ENV=$1
- cd ${CONFIGDIR}
-
- fuel --env $ENV deployment --upload
- fuel --env $ENV provisioning --upload
-}
-
-add_yaml_fragment () {
- ENV=$1
- FRAGMENT=${CONFIGDIR}/fragment.yaml.$ENV
-
- cd ${CONFIGDIR}
- for dfile in deployment_$ENV/*.yaml
- do
- cnt=`grep "^opnfv:" $dfile | wc -l `
- if [ $cnt -eq 0 ]; then
- echo "Adding fragment to $dfile"
- cat $FRAGMENT >> $dfile
- else
- echo "Already have fragment in $dfile"
- fi
- done
-}
-
-
-ip_valid() {
- IP_ADDRESS="$1"
- # Check if the format looks right_
- echo "$IP_ADDRESS" | egrep -qE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' || return 1
- #check that each octect is less than or equal to 255:
- echo $IP_ADDRESS | awk -F'.' '$1 <=255 && $2 <= 255 && $3 <=255 && $4 <= 255 {print "Y" } ' | grep -q Y || return 1
- return 0
-}
-
-
-generate_ntp_entry() {
- FILE=$1
- read -p "NTP server:" NTP_SERVER
- if [ -z "$NTP_SERVER" ]; then
- return 1
- elif confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " server $NTP_SERVER" >> $FILE
- fi
-}
-
-generate_hostfile_entry() {
- FILE=$1
- read -p "Name:" HOST_NAME
- if [ -z "$HOST_NAME" ]; then
- return 1
- else
- read -p "FQDN:" HOST_FQDN
- read -p "IP: " HOST_IP
- while ! ip_valid "$HOST_IP"
- do
- echo "This is not a valid IP! Try again."
- read -p "IP: " HOST_IP
- done
- fi
- if confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " - name: $HOST_NAME" >> $FILE
- echo " address: $HOST_IP" >> $FILE
- echo " fqdn: $HOST_FQDN" >> $FILE
- else
- echo "Not confirmed"
- fi
- return 0
-}
-
-generate_dns_entry() {
- FILE=$1
- PROMPT=$2
- read -p "${PROMPT}:" DNS_IP
- if [ -z "$DNS_IP" ]; then
- return 1
- else
- while ! ip_valid "$DNS_IP"
- do
- echo "This is not a valid IP! Try again."
- read -p "${PROMPT}: " DNS_IP
- done
- fi
- if confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " - $DNS_IP" >> $FILE
- else
- echo "Not confirmed"
- fi
- return 0
-}
-
-confirm_yes() {
- prompt=$1
- while true
- do
- read -p "$prompt" YESNO
- case $YESNO in
- [Yy])
- return 0
- ;;
- [Nn])
- return 1
- ;;
- esac
- done
-}
-
-generate_yaml_fragment() {
- ENV=$1
- FRAGMENT=${CONFIGDIR}/fragment.yaml.$ENV
-
- if [ -f $FRAGMENT ]; then
- echo "Manual configuration already performed, reusing previous data from $FRAGMENT."
- echo "Press return to continue or ^C to stop."
- read ans
- return
- fi
-
- echo "opnfv:" > ${FRAGMENT}
-
- clear
- echo -e "\n\nPre-deployment configuration\n\n"
-
- echo -e "\n\nIPs for the DNS servers to go into /etc/resolv.conf. You will be"
- echo -e "prompted for one IP at the time. Press return on an empty line"
- echo -e "to complete your input. If no DNS server is specified, the IP of"
- echo -e "the Fuel master will be used instead.\n"
-
- DNSCICYAML=${CONFIGDIR}/cicdns.yaml.$ENV
- rm -f $DNSCICYAML
-
- echo -e "\n\n"
-
- while generate_dns_entry $DNSCICYAML "IP for CIC name servers"
- do
- :
- done
-
- if [ -f $DNSCICYAML ]; then
- echo " dns:" >> $FRAGMENT
- echo " controller:" >> $FRAGMENT
- cat $DNSCICYAML >> $FRAGMENT
- fi
-
-
- DNSCMPYAML=${CONFIGDIR}/cmpdns.yaml.$ENV
- rm -f $DNSCMPYAML
-
- echo -e "\n\n"
-
- while generate_dns_entry $DNSCMPYAML "IP for compute node name servers"
- do
- :
- done
-
-
- if [ -f $DNSCMPYAML ]; then
- if [ ! -f $DNSCICYAML ]; then
- echo " dns:" >> $FRAGMENT
- fi
- echo " compute:" >> $FRAGMENT
- cat $DNSCMPYAML >> $FRAGMENT
- fi
-
- echo -e "\n\nHosts file additions for controllers and compute nodes. You will be"
- echo -e "prompted for name, FQDN and IP for each entry. Press return when prompted"
- echo -e "for a name when you have completed your input.\n"
-
-
- HOSTYAML=${CONFIGDIR}/hosts.yaml.$ENV
- rm -f $HOSTYAML
- while generate_hostfile_entry $HOSTYAML
- do
- :
- done
-
- if [ -f $HOSTYAML ]; then
- echo " hosts:" >> $FRAGMENT
- cat $HOSTYAML >> $FRAGMENT
- fi
-
- echo -e "\n\nNTP upstream configuration for controllers.You will be"
- echo -e "prompted for a NTP server each entry. Press return when prompted"
- echo -e "for a NTP serverwhen you have completed your input.\n"
-
-
- NTPYAML=${CONFIGDIR}/ntp.yaml.$ENV
- rm -f $NTPYAML
- while generate_ntp_entry $NTPYAML
- do
- :
- done
-
- if [ -f $NTPYAML ]; then
- echo " ntp:" >> $FRAGMENT
- echo " controller: |" >> $FRAGMENT
- cat $NTPYAML >> $FRAGMENT
-
- echo " compute: |" >> $FRAGMENT
- for ctl in `find $CONFIGDIR/deployment_$ENV -name '*controller*.yaml'`
- do
- fqdn=`grep "^fqdn:" $ctl | sed 's/fqdn: *//'`
- echo " server $fqdn" >> $FRAGMENT
- done
- fi
-
- # If nothing added make sure we get an empty opnfv hash
- # instead of a NULL hash.
- if [ $(wc -l $FRAGMENT | awk '{print $1}') -le 1 ]; then
- echo "opnfv: {}" >$FRAGMENT
- fi
-}
-
-ENV=$(get_env "$@")
-
-CONFIGDIR="/var/lib/opnfv"
-mkdir -p $CONFIGDIR
-
-get_deployment_info $ENV
-# Uncomment the below to enable the control_bond example
-#transform_yaml $ENV
-get_provisioning_info $ENV
-generate_yaml_fragment $ENV
-# The feature to change hostnames from node-<n> to cmp- or cic- is disabled.
-# To turn it on, uncomment the following line.
-#setup_hostnames $ENV
-add_yaml_fragment $ENV
-commit_changes $ENV
diff --git a/fuel/build/f_isoroot/f_predeployment/sysinfo.sh b/fuel/build/f_isoroot/f_predeployment/sysinfo.sh
deleted file mode 100755
index e99cac0..0000000
--- a/fuel/build/f_isoroot/f_predeployment/sysinfo.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.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
-##############################################################################
-
-dockerctl shell cobbler cobbler system list | grep -v default | xargs -n 1 host | sort | sed 's/\..* /\t/'
diff --git a/fuel/build/f_isoroot/f_predeployment/transform_yaml.py b/fuel/build/f_isoroot/f_predeployment/transform_yaml.py
deleted file mode 100755
index 14eec4c..0000000
--- a/fuel/build/f_isoroot/f_predeployment/transform_yaml.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.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
-##############################################################################
-
-# Remove control and management network transformations from file.
-# Only to be used together with f_control_bond_example (enable in
-# pre-deploy.sh)
-
-import yaml
-import re
-import sys
-import os
-
-if len(sys.argv) != 2:
- sys.stderr.write("Usage: "+sys.argv[0]+" <filename>\n")
- sys.exit(1)
-
-filename = sys.argv[1]
-if not os.path.exists(filename):
- sys.stderr.write("ERROR: The file "+filename+" could not be opened\n")
- sys.exit(1)
-
-ignore_values = [ "eth0", "eth1", "br-mgmt", "br-fw-admin" ]
-
-infile = open(filename, 'r')
-doc = yaml.load(infile)
-infile.close()
-
-out={}
-
-for scheme in doc:
- if scheme == "network_scheme":
- mytransformation = {}
- for operation in doc[scheme]:
- if operation == "transformations":
- # We need the base bridges for l23network to be happy,
- # remove everything else.
- mytrans = [ { "action": "add-br", "name": "br-mgmt" },
- { "action": "add-br", "name": "br-fw-admin" } ]
- for trans in doc[scheme][operation]:
- delete = 0
- for ignore in ignore_values:
- matchObj = re.search(ignore,str(trans))
- if matchObj:
- delete = 1
- if delete == 0:
- mytrans.append(trans)
- else:
- pass
- #print "Deleted", trans
-
- mytransformation[operation] = mytrans
- else:
- mytransformation[operation] = doc[scheme][operation]
- out[scheme] = mytransformation
- else:
- out[scheme] = doc[scheme]
-
-outfile = open(filename, 'w')
-outfile.write(yaml.dump(out, default_flow_style=False))
-outfile.close()