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 if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
31 #Give user 15 seconds to enter fuelmenu or else continue
33 echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15"
35 if ! read -s -n 1 -t 15 key; then
36 echo -e "\nSkipping Fuel Setup..."
38 { kill "$pid"; wait $!; } 2>/dev/null
40 $'\e') echo "Skipping Fuel Setup.."
42 *) echo -e "\nEntering Fuel Setup..."
50 #Reread /etc/sysconfig/network to inform puppet of changes
51 . /etc/sysconfig/network
56 if [ -f /root/.build_images ]; then
61 echo "Loading Fuel base image for Docker..."
62 docker load -i /var/www/nailgun/docker/images/fuel-images.tar
64 echo "Building Fuel Docker images..."
65 WORKDIR=$(mktemp -d /tmp/docker-buildXXX)
66 SOURCE=/var/www/nailgun/docker
67 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')
68 RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2)
70 for imagesource in /var/www/nailgun/docker/sources/*; do
71 if ! [ -f "$imagesource/Dockerfile" ]; then
72 echo "Skipping ${imagesource}..."
75 image=$(basename "$imagesource")
76 cp -R "$imagesource" $WORKDIR/$image
77 mkdir -p $WORKDIR/$image/etc
78 cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc
79 sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile
80 sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml
81 docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image
83 docker rm -f $REPO_CONT_ID
86 #Remove trap for normal deployment
90 echo "Loading docker images. (This may take a while)"
91 docker load -i /var/www/nailgun/docker/images/fuel-images.tar
95 puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
99 rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
101 dockerctl check || fail
104 # Enable updates repository
105 cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF
106 [mos${FUEL_RELEASE}-updates]
107 name=mos${FUEL_RELEASE}-updates
108 baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/updates/
110 skip_if_unavailable=1
113 # Enable security repository
114 cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF
115 [mos${FUEL_RELEASE}-security]
116 name=mos${FUEL_RELEASE}-security
117 baseurl=http://mirror.fuel-infra.org/mos/centos-6/mos${FUEL_RELEASE}/security/
119 skip_if_unavailable=1
122 #Check if repo is accessible
123 echo "Checking for access to updates repository..."
124 repourl=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
125 if urlaccesscheck check "$repourl" ; then
131 if [ $UPDATE_ISSUES -eq 1 ]; then
132 warning="WARNING: There are issues connecting to Fuel update repository.\
133 \nPlease fix your connection and update this node with \`yum update\`\
134 \nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
135 \nto repeat bootstrap on Fuel Master with the latest updates.\
136 \nFor more information, check out Fuel documentation at:\
137 \nhttp://docs.mirantis.com/fuel"
139 warning="WARNING: There may be updates available for Fuel.\
140 \nYou should update this node with \`yum update\`. If there are available\
141 \n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
142 \nto repeat bootstrap on Fuel Master with the latest updates.\
143 \nFor more information, check out Fuel documentation at:\
144 \nhttp://docs.mirantis.com/fuel"
147 echo "*************************************************"
149 echo "*************************************************"
150 echo "Sending notification to Fuel UI..."
151 fuel notify --topic warning --send "$warning"
152 echo "Fuel node deployment complete!"