summaryrefslogtreecommitdiffstats
path: root/build/f_isoroot/f_bootstrap
diff options
context:
space:
mode:
authorStefan Berg <stefan.k.berg@ericsson.com>2016-01-29 13:30:28 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-29 13:30:29 +0000
commitf32ce90a3a08891ab2253ca910b7025314b0c8d8 (patch)
tree4d0434c3acb6e7c8d1bb7ce4f3d40fe31911831c /build/f_isoroot/f_bootstrap
parente9316d44c551390327bb9661ad8d8ed10c28b3ae (diff)
parent156c25b5283ca91517b47f72f4381071203dc5eb (diff)
Merge "Sync with recent changes in fuel-main" into stable/brahmaputra
Diffstat (limited to 'build/f_isoroot/f_bootstrap')
-rwxr-xr-xbuild/f_isoroot/f_bootstrap/bootstrap_admin_node.sh92
-rwxr-xr-xbuild/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig94
2 files changed, 176 insertions, 10 deletions
diff --git a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
index 85a35043f..35d107ab4 100755
--- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
+++ b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
@@ -1,5 +1,56 @@
#!/bin/bash
-FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+mkdir -p /var/log/puppet
+exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log)
+exec 2>&1
+
+FUEL_RELEASE=$(cat /etc/fuel_release)
+ASTUTE_YAML='/etc/fuel/astute.yaml'
+BOOTSTRAP_NODE_CONFIG="/etc/fuel/bootstrap_admin_node.conf"
+bs_build_log='/var/log/fuel-bootstrap-image-build.log'
+bs_status=0
+# Backup network configs to this folder. Folder will be created only if
+# backup process actually will be.
+bup_folder="/var/bootstrap_admin_node_bup_$(date +%Y-%m-%d-%H-%M-%S)/"
+### Long messages inside code makes them more complicated to read...
+# bootstrap messages
+# FIXME fix help links
+bs_skip_message="WARNING: Ubuntu bootstrap build has been skipped. \
+Please build and activate bootstrap manually with CLI command \
+\`fuel-bootstrap build --activate\`. \
+While you don't activate any bootstrap - new nodes cannot be discovered \
+and added to cluster. \
+For more information please visit \
+https://docs.mirantis.com/openstack/fuel/fuel-master/"
+bs_error_message="WARNING: Failed to build the bootstrap image, see $bs_build_log \
+for details. Perhaps your Internet connection is broken. Please fix the \
+problem and run \`fuel-bootstrap build --activate\`. \
+While you don\'t activate any bootstrap - new nodes cannot be discovered \
+and added to cluster. \
+For more information please visit \
+https://docs.mirantis.com/openstack/fuel/fuel-master/"
+bs_progress_message="There is no active bootstrap. Bootstrap image building \
+is in progress. Usually it takes 15-20 minutes. It depends on your internet \
+connection and hardware performance. Please reboot failed to discover nodes \
+after bootstrap image become available."
+bs_done_message="Default bootstrap image building done. Now you can boot new \
+nodes over PXE, they will be discovered and become available for installing \
+OpenStack on them"
+bs_centos_message="WARNING: Deprecated Centos bootstrap has been chosen \
+and activated. Now you can boot new nodes over PXE, they will be discovered \
+and become available for installing OpenStack on them."
+# Update issues messages
+update_warn_message="There is an issue connecting to the Fuel update repository. \
+Please fix your connection prior to applying any updates. \
+Once the connection is fixed, we recommend reviewing and applying \
+Maintenance Updates for this release of Mirantis OpenStack: \
+https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\
+release-notes.html#maintenance-updates"
+update_done_message="We recommend reviewing and applying Maintenance Updates \
+for this release of Mirantis OpenStack: \
+https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\
+release-notes.html#maintenance-updates"
+fuelmenu_fail_message="Fuelmenu was not able to generate '/etc/fuel/astute.yaml' file! \
+Please, restart it manualy using 'fuelmenu' command."
function countdown() {
local i
@@ -72,6 +123,18 @@ systemctl enable iptables.service
systemctl start iptables.service
+if [ ! -f "${ASTUTE_YAML}" ]; then
+ echo ${fuelmenu_fail_message}
+ fail
+fi
+
+systemctl reload sshd
+
+# Enable iptables
+systemctl enable iptables.service
+systemctl start iptables.service
+
+
if [ "$wait_for_external_config" == "yes" ]; then
wait_timeout=3000
pidfile=/var/lock/wait_for_external_config
@@ -112,11 +175,30 @@ make_ubuntu_bootstrap_stub () {
}
get_bootstrap_flavor () {
- local ASTUTE_YAML='/etc/fuel/astute.yaml'
python <<-EOF
- from fuelmenu.fuelmenu import Settings
- conf = Settings().read("$ASTUTE_YAML").get('BOOTSTRAP', {})
- print(conf.get('flavor', 'centos'))
+ from yaml import safe_load
+ with open("$ASTUTE_YAML", 'r') as f:
+ conf = safe_load(f).get('BOOTSTRAP', {})
+ print(conf.get('flavor', 'centos').lower())
+ EOF
+}
+
+get_bootstrap_skip () {
+ python <<-EOF
+ from yaml import safe_load
+ with open("$ASTUTE_YAML", 'r') as f:
+ conf = safe_load(f).get('BOOTSTRAP', {})
+ print(conf.get('skip_default_img_build', False))
+ EOF
+}
+
+set_ui_bootstrap_error () {
+ # This notify can't be closed or removed by user.
+ # For remove notify - send empty string.
+ local message=$1
+ python <<-EOF
+ from fuel_bootstrap.utils import notifier
+ notifier.notify_webui('${message}')
EOF
}
diff --git a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
index 1bc349314..e637c7b6d 100755
--- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
+++ b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
@@ -1,5 +1,56 @@
#!/bin/bash
-FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+mkdir -p /var/log/puppet
+exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log)
+exec 2>&1
+
+FUEL_RELEASE=$(cat /etc/fuel_release)
+ASTUTE_YAML='/etc/fuel/astute.yaml'
+BOOTSTRAP_NODE_CONFIG="/etc/fuel/bootstrap_admin_node.conf"
+bs_build_log='/var/log/fuel-bootstrap-image-build.log'
+bs_status=0
+# Backup network configs to this folder. Folder will be created only if
+# backup process actually will be.
+bup_folder="/var/bootstrap_admin_node_bup_$(date +%Y-%m-%d-%H-%M-%S)/"
+### Long messages inside code makes them more complicated to read...
+# bootstrap messages
+# FIXME fix help links
+bs_skip_message="WARNING: Ubuntu bootstrap build has been skipped. \
+Please build and activate bootstrap manually with CLI command \
+\`fuel-bootstrap build --activate\`. \
+While you don't activate any bootstrap - new nodes cannot be discovered \
+and added to cluster. \
+For more information please visit \
+https://docs.mirantis.com/openstack/fuel/fuel-master/"
+bs_error_message="WARNING: Failed to build the bootstrap image, see $bs_build_log \
+for details. Perhaps your Internet connection is broken. Please fix the \
+problem and run \`fuel-bootstrap build --activate\`. \
+While you don\'t activate any bootstrap - new nodes cannot be discovered \
+and added to cluster. \
+For more information please visit \
+https://docs.mirantis.com/openstack/fuel/fuel-master/"
+bs_progress_message="There is no active bootstrap. Bootstrap image building \
+is in progress. Usually it takes 15-20 minutes. It depends on your internet \
+connection and hardware performance. Please reboot failed to discover nodes \
+after bootstrap image become available."
+bs_done_message="Default bootstrap image building done. Now you can boot new \
+nodes over PXE, they will be discovered and become available for installing \
+OpenStack on them"
+bs_centos_message="WARNING: Deprecated Centos bootstrap has been chosen \
+and activated. Now you can boot new nodes over PXE, they will be discovered \
+and become available for installing OpenStack on them."
+# Update issues messages
+update_warn_message="There is an issue connecting to the Fuel update repository. \
+Please fix your connection prior to applying any updates. \
+Once the connection is fixed, we recommend reviewing and applying \
+Maintenance Updates for this release of Mirantis OpenStack: \
+https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\
+release-notes.html#maintenance-updates"
+update_done_message="We recommend reviewing and applying Maintenance Updates \
+for this release of Mirantis OpenStack: \
+https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\
+release-notes.html#maintenance-updates"
+fuelmenu_fail_message="Fuelmenu was not able to generate '/etc/fuel/astute.yaml' file! \
+Please, restart it manualy using 'fuelmenu' command."
function countdown() {
local i
@@ -51,6 +102,20 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
fi
fi
+if [ ! -f "${ASTUTE_YAML}" ]; then
+ echo ${fuelmenu_fail_message}
+ fail
+fi
+
+# Enable sshd
+systemctl enable sshd
+systemctl start sshd
+
+# Enable iptables
+systemctl enable iptables.service
+systemctl start iptables.service
+
+
if [ "$wait_for_external_config" == "yes" ]; then
wait_timeout=3000
pidfile=/var/lock/wait_for_external_config
@@ -91,11 +156,30 @@ make_ubuntu_bootstrap_stub () {
}
get_bootstrap_flavor () {
- local ASTUTE_YAML='/etc/fuel/astute.yaml'
python <<-EOF
- from fuelmenu.fuelmenu import Settings
- conf = Settings().read("$ASTUTE_YAML").get('BOOTSTRAP', {})
- print(conf.get('flavor', 'centos'))
+ from yaml import safe_load
+ with open("$ASTUTE_YAML", 'r') as f:
+ conf = safe_load(f).get('BOOTSTRAP', {})
+ print(conf.get('flavor', 'centos').lower())
+ EOF
+}
+
+get_bootstrap_skip () {
+ python <<-EOF
+ from yaml import safe_load
+ with open("$ASTUTE_YAML", 'r') as f:
+ conf = safe_load(f).get('BOOTSTRAP', {})
+ print(conf.get('skip_default_img_build', False))
+ EOF
+}
+
+set_ui_bootstrap_error () {
+ # This notify can't be closed or removed by user.
+ # For remove notify - send empty string.
+ local message=$1
+ python <<-EOF
+ from fuel_bootstrap.utils import notifier
+ notifier.notify_webui('${message}')
EOF
}