Created
April 9, 2013 22:05
-
-
Save marcoceppi/5349842 to your computer and use it in GitHub Desktop.
If you have a relation and configuration option that are complimentary, this is one way to track those.
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 | |
# Just a common function file to rebuild the configuration | |
. lib/functions | |
master_server=`config-get master-server` | |
# Have the install script create a servers.d directory | |
# Store all the different values in there | |
if [ -z $master_server ]; then | |
rm -f servers.d/config | |
else | |
echo "$master_server" > servers.d/config | |
fi | |
# This lives in lib/functions - or wherever you want. | |
update_configuration |
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 | |
update_configuration() { | |
servers="" | |
for server in `ls servers.d`; do | |
$servers="$servers;$server" | |
done | |
# Us ch_template_file, sed, or some other means to put that | |
# variable in to your configuration file. | |
} |
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 | |
# Just a common function file to rebuild the configuration | |
. lib/functions | |
rm -f servers.d/$JUJU_RELATION_ID | |
# This lives in lib/functions - or wherever you want. | |
update_configuration |
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 | |
# Just a common function file to rebuild the configuration | |
. lib/functions | |
master_server=`relation-get private-address` | |
if [ -z "$master_server" ]; then | |
juju-log "Waiting for relation details" | |
exit 0 | |
fi | |
# $JUJU_RELATION_ID is unique for each relation. This is | |
# important for tracking later when you _remove_ a relation. | |
echo "$master_server" > servers.d/$JUJU_RELATION_ID | |
# This lives in lib/functions - or wherever you want. | |
update_configuration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment