Last active
March 10, 2017 15:33
-
-
Save nuriel77/8ddf9d9d487d054c1f1a80f983066aac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will correct the "\n\\n" bug in hosts file | |
# Src: https://bugs.launchpad.net/tripleo/+bug/1655375 | |
# It will prevent from rebuild and redeployment to | |
# create a /etc/hosts file with this error. | |
# The nodes data is saved on swift on the undercloud | |
# and being pulled by the os-refresh-config process. | |
if [ "$OS_CLOUDNAME" != "undercloud" ] | |
then | |
echo "You need to source the 'stackrc' undercloud env file" | |
exit 1 | |
fi | |
for o in $(swift list | grep -Px "^ov-.*(Controller|NovaCompute).*$") | |
do | |
object_name=$(swift download $o|awk '{print $1}') | |
echo "Got $object_name, going to repair hosts entries" | |
sed -i 's/\\n\\\\n/\\n\\n/g' "$object_name" | |
echo "Uploading $object_name back to container $o" | |
swift upload "$o" "$object_name" | |
rm "$object_name" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment