diff options
Diffstat (limited to 'fuel/build/f_isoroot/f_bootstrap')
7 files changed, 0 insertions, 404 deletions
diff --git a/fuel/build/f_isoroot/f_bootstrap/Makefile b/fuel/build/f_isoroot/f_bootstrap/Makefile deleted file mode 100644 index 7404319..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/Makefile +++ /dev/null @@ -1,29 +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/bootstrap/pre.d - @mkdir -p release/opnfv/bootstrap/post.d - @mkdir -p release/usr/local/sbin - @cp pre-scripts/* release/opnfv/bootstrap/pre.d - @cp post-scripts/* release/opnfv/bootstrap/post.d - @cp bootstrap_admin_node.sh release - @cp bootstrap_admin_node.sh.orig release - -.PHONY: clean -clean: - @rm -rf release - -.PHONY: release -release:all - @cp -Rvp release/* ../release diff --git a/fuel/build/f_isoroot/f_bootstrap/README b/fuel/build/f_isoroot/f_bootstrap/README deleted file mode 100644 index 5da954c..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/README +++ /dev/null @@ -1,24 +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 function modifies the adds hooks to the beginning and end of -/usr/local/sbin/bootstrap_admin_nodes.sh, which is run as the -last post step from ks.cfg - -This enables other functions to place scripts into two directories -run either at the beginning or the end of the bootstrap procedure: - - /opt/opnfv/bootstrap/pre.d - /opt/opnfv/bootstrap/post.d - -These will be run in lexical order at pre or post. - -CI note: Using pre.d, it would be possible to "inject" a pre-defined -astute.yaml for Fuel. diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh deleted file mode 100755 index 8bdf566..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/bin/bash -FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ') - -function countdown() { - local i - sleep 1 - for ((i=$1-1; i>=1; i--)); do - printf '\b\b%02d' "$i" - sleep 1 - done -} - -function fail() { - echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2 - exit 1 -} -# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details -export LANG=en_US.UTF8 -showmenu="no" -if [ -f /root/.showfuelmenu ]; then - . /root/.showfuelmenu -fi - -echo -n "Applying default Fuel settings..." -fuelmenu --save-only --iface=eth0 -echo "Done!" - -### OPNFV addition BEGIN -shopt -s nullglob -for script in /opt/opnfv/bootstrap/pre.d/*.sh -do - echo "Pre script: $script" >> /root/pre.log 2>&1 - $script >> /root/pre.log 2>&1 -done -shopt -u nullglob -### OPNFV addition END - -if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then - fuelmenu - else - #Give user 15 seconds to enter fuelmenu or else continue - echo - echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15" - countdown 15 & pid=$! - if ! read -s -n 1 -t 15 key; then - echo -e "\nSkipping Fuel Setup..." - else - { kill "$pid"; wait $!; } 2>/dev/null - case "$key" in - $'\e') echo "Skipping Fuel Setup.." - ;; - *) echo -e "\nEntering Fuel Setup..." - fuelmenu - ;; - esac - fi -fi - - -#Reread /etc/sysconfig/network to inform puppet of changes -. /etc/sysconfig/network -hostname "$HOSTNAME" - -service docker start - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT - - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar - - echo "Building Fuel Docker images..." - WORKDIR=$(mktemp -d /tmp/docker-buildXXX) - SOURCE=/var/www/nailgun/docker - REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND') - RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2) - - for imagesource in /var/www/nailgun/docker/sources/*; do - if ! [ -f "$imagesource/Dockerfile" ]; then - echo "Skipping ${imagesource}..." - continue - fi - image=$(basename "$imagesource") - cp -R "$imagesource" $WORKDIR/$image - mkdir -p $WORKDIR/$image/etc - cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc - sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile - sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml - docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image - done - docker rm -f $REPO_CONT_ID - rm -rf "$WORKDIR" - - #Remove trap for normal deployment - trap - EXIT - set +e -else - echo "Loading docker images. (This may take a while)" - docker load -i /var/www/nailgun/docker/images/fuel-images.tar -fi - -# apply puppet -puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp -if [ $? -ge 4 ];then - fail -fi -rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote - -dockerctl check || fail -bash /etc/rc.local - -### OPNFV addition BEGIN -shopt -s nullglob -for script in /opt/opnfv/bootstrap/post.d/*.sh -do - echo "Post script: $script" >> /root/post.log 2>&1 - $script >> /root/post.log 2>&1 -done -shopt -u nullglob -### OPNFV addition END - -# Enable updates repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF -[mos${FUEL_RELEASE}-updates] -name=mos${FUEL_RELEASE}-updates -baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -# Enable security repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF -[mos${FUEL_RELEASE}-security] -name=mos${FUEL_RELEASE}-security -baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -#Check if repo is accessible -echo "Checking for access to updates repository..." -repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1) -if urlaccesscheck check "$repourl" ; then - UPDATE_ISSUES=0 -else - UPDATE_ISSUES=1 -fi - -if [ $UPDATE_ISSUES -eq 1 ]; then - warning="WARNING: There are issues connecting to Fuel update repository.\ -\nPlease fix your connection and update this node with \`yum update\`\ -\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\ -\nto repeat bootstrap on Fuel Master with the latest updates.\ -\nFor more information, check out Fuel documentation at:\ -\nhttp://docs.mirantis.com/fuel" -else - warning="WARNING: There may be updates available for Fuel.\ -\nYou should update this node with \`yum update\`. If there are available\ -\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\ -\nto repeat bootstrap on Fuel Master with the latest updates.\ -\nFor more information, check out Fuel documentation at:\ -\nhttp://docs.mirantis.com/fuel" -fi -echo -echo "*************************************************" -echo -e "$warning" -echo "*************************************************" -echo "Sending notification to Fuel UI..." -fuel notify --topic warning --send "$warning" -echo "Fuel node deployment complete!" diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig deleted file mode 100755 index 8d21c1e..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash -FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ') - -function countdown() { - local i - sleep 1 - for ((i=$1-1; i>=1; i--)); do - printf '\b\b%02d' "$i" - sleep 1 - done -} - -function fail() { - echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2 - exit 1 -} -# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details -export LANG=en_US.UTF8 -showmenu="no" -if [ -f /root/.showfuelmenu ]; then - . /root/.showfuelmenu -fi - -echo -n "Applying default Fuel settings..." -fuelmenu --save-only --iface=eth0 -echo "Done!" - -if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then - fuelmenu - else - #Give user 15 seconds to enter fuelmenu or else continue - echo - echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15" - countdown 15 & pid=$! - if ! read -s -n 1 -t 15 key; then - echo -e "\nSkipping Fuel Setup..." - else - { kill "$pid"; wait $!; } 2>/dev/null - case "$key" in - $'\e') echo "Skipping Fuel Setup.." - ;; - *) echo -e "\nEntering Fuel Setup..." - fuelmenu - ;; - esac - fi -fi - - -#Reread /etc/sysconfig/network to inform puppet of changes -. /etc/sysconfig/network -hostname "$HOSTNAME" - -service docker start - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT - - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar - - echo "Building Fuel Docker images..." - WORKDIR=$(mktemp -d /tmp/docker-buildXXX) - SOURCE=/var/www/nailgun/docker - REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND') - RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2) - - for imagesource in /var/www/nailgun/docker/sources/*; do - if ! [ -f "$imagesource/Dockerfile" ]; then - echo "Skipping ${imagesource}..." - continue - fi - image=$(basename "$imagesource") - cp -R "$imagesource" $WORKDIR/$image - mkdir -p $WORKDIR/$image/etc - cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc - sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile - sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml - docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image - done - docker rm -f $REPO_CONT_ID - rm -rf "$WORKDIR" - - #Remove trap for normal deployment - trap - EXIT - set +e -else - echo "Loading docker images. (This may take a while)" - docker load -i /var/www/nailgun/docker/images/fuel-images.tar -fi - -# apply puppet -puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp -if [ $? -ge 4 ];then - fail -fi -rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote - -dockerctl check || fail -bash /etc/rc.local - -# Enable updates repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF -[mos${FUEL_RELEASE}-updates] -name=mos${FUEL_RELEASE}-updates -baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -# Enable security repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF -[mos${FUEL_RELEASE}-security] -name=mos${FUEL_RELEASE}-security -baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -#Check if repo is accessible -echo "Checking for access to updates repository..." -repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1) -if urlaccesscheck check "$repourl" ; then - UPDATE_ISSUES=0 -else - UPDATE_ISSUES=1 -fi - -if [ $UPDATE_ISSUES -eq 1 ]; then - warning="WARNING: There are issues connecting to Fuel update repository.\ -\nPlease fix your connection and update this node with \`yum update\`\ -\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\ -\nto repeat bootstrap on Fuel Master with the latest updates.\ -\nFor more information, check out Fuel documentation at:\ -\nhttp://docs.mirantis.com/fuel" -else - warning="WARNING: There may be updates available for Fuel.\ -\nYou should update this node with \`yum update\`. If there are available\ -\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\ -\nto repeat bootstrap on Fuel Master with the latest updates.\ -\nFor more information, check out Fuel documentation at:\ -\nhttp://docs.mirantis.com/fuel" -fi -echo -echo "*************************************************" -echo -e "$warning" -echo "*************************************************" -echo "Sending notification to Fuel UI..." -fuel notify --topic warning --send "$warning" -echo "Fuel node deployment complete!" diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh deleted file mode 100755 index 7ac8965..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/sh -date -echo "This is an example file run at post-bootstrap." -exit 0 diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh deleted file mode 100755 index 427a55a..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh +++ /dev/null @@ -1,19 +0,0 @@ -#/bin/sh -echo "Installing pre-build repo" -if [ ! -d /opt/opnfv/nailgun ]; then - echo "Error - found no repo!" - exit 1 -fi - -mkdir -p /var/www/nailgun -mv /opt/opnfv/nailgun/* /var/www/nailgun -if [ $? -ne 0 ]; then - echo "Error moving repos to their correct location!" - exit 1 -fi -rmdir /opt/opnfv/nailgun -if [ $? -ne 0 ]; then - echo "Error removing /opt/opnfv/nailgun directory!" - exit 1 -fi -echo "Done installing pre-build repo" diff --git a/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh b/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh deleted file mode 100755 index ac427bf..0000000 --- a/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh +++ /dev/null @@ -1,4 +0,0 @@ -#/bin/sh -date -echo "This is an example file run at pre-bootstrap." -exit 0 |