Skip to content

Instantly share code, notes, and snippets.

@nuriel77
Last active March 10, 2017 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuriel77/8ddf9d9d487d054c1f1a80f983066aac to your computer and use it in GitHub Desktop.
Save nuriel77/8ddf9d9d487d054c1f1a80f983066aac to your computer and use it in GitHub Desktop.
#!/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