2 FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
7 for ((i=$1-1; i>=1; i--)); do
14 echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2
17 # LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details
18 export LANG=en_US.UTF8
20 if [ -f /root/.showfuelmenu ]; then
24 echo -n "Applying default Fuel settings..."
25 fuelmenu --save-only --iface=eth0
28 ### OPNFV addition BEGIN
30 for script in /opt/opnfv/bootstrap/pre.d/*.sh
32 echo "Pre script: $script" >> /root/pre.log 2>&1
33 $script >> /root/pre.log 2>&1
36 ### OPNFV addition END
38 if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
41 #Give user 15 seconds to enter fuelmenu or else continue
43 echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15"
45 if ! read -s -n 1 -t 15 key; then
46 echo -e "\nSkipping Fuel Setup..."
48 { kill "$pid"; wait $!; } 2>/dev/null
50 $'\e') echo "Skipping Fuel Setup.."
52 *) echo -e "\nEntering Fuel Setup..."
60 #Reread /etc/sysconfig/network to inform puppet of changes
61 . /etc/sysconfig/network
66 if [ -f /root/.build_images ]; then
71 echo "Loading Fuel base image for Docker..."
72 docker load -i /var/www/nailgun/docker/images/fuel-images.tar
74 echo "Building Fuel Docker images..."
75 WORKDIR=$(mktemp -d /tmp/docker-buildXXX)
76 SOURCE=/var/www/nailgun/docker
77 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')
78 RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2)
80 for imagesource in /var/www/nailgun/docker/sources/*; do
81 if ! [ -f "$imagesource/Dockerfile" ]; then
82 echo "Skipping ${imagesource}..."
85 image=$(basename "$imagesource")
86 cp -R "$imagesource" $WORKDIR/$image
87 mkdir -p $WORKDIR/$image/etc
88 cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc
89 sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile
90 sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml
91 docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image
93 docker rm -f $REPO_CONT_ID
96 #Remove trap for normal deployment
100 echo "Loading docker images. (This may take a while)"
101 docker load -i /var/www/nailgun/docker/images/fuel-images.tar
105 puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
109 rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
111 dockerctl check || fail
114 ### OPNFV addition BEGIN
116 for script in /opt/opnfv/bootstrap/post.d/*.sh
118 echo "Post script: $script" >> /root/post.log 2>&1
119 $script >> /root/post.log 2>&1
122 ### OPNFV addition END
124 # Enable updates repository
125 cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF
126 [mos${FUEL_RELEASE}-updates]
127 name=mos${FUEL_RELEASE}-updates
128 baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/
130 skip_if_unavailable=1
133 # Enable security repository
134 cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF
135 [mos${FUEL_RELEASE}-security]
136 name=mos${FUEL_RELEASE}-security
137 baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/
139 skip_if_unavailable=1
142 #Check if repo is accessible
143 echo "Checking for access to updates repository..."
144 repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
145 if urlaccesscheck check "$repourl" ; then
151 if [ $UPDATE_ISSUES -eq 1 ]; then
152 warning="WARNING: There are issues connecting to Fuel update repository.\
153 \nPlease fix your connection and update this node with \`yum update\`\
154 \nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
155 \nto repeat bootstrap on Fuel Master with the latest updates.\
156 \nFor more information, check out Fuel documentation at:\
157 \nhttp://docs.mirantis.com/fuel"
159 warning="WARNING: There may be updates available for Fuel.\
160 \nYou should update this node with \`yum update\`. If there are available\
161 \n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
162 \nto repeat bootstrap on Fuel Master with the latest updates.\
163 \nFor more information, check out Fuel documentation at:\
164 \nhttp://docs.mirantis.com/fuel"
167 echo "*************************************************"
169 echo "*************************************************"
170 echo "Sending notification to Fuel UI..."
171 fuel notify --topic warning --send "$warning"
172 echo "Fuel node deployment complete!"