-
-
Save marcoceppi/8713685 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
def validate_database_relationship(): | |
#Connect to the sentrys and fetch the transmitted details | |
sent_config = d.sentry.unit['mysql/0'].relation('db', 'owncloud:db') | |
#Connect to owncloud's sentry and read the configuration PHP file | |
prod_config = d.sentry.unit['owncloud/0'].file_contents('/var/www/owncloud/config/config.php') | |
cfg_to_check = {'dbuser': 'user', 'dbpass': 'password', 'dbhost': 'host'} | |
for cfg_file_key, juju_cfg_key in cfg_to_check.items(): | |
#Search the return string of the config for the transmit values | |
if prod_config.find("'%s' => '%s'" % (cfg_file_key, sent_config[juju_cfg_key]) == -1: | |
amulet.raise_status(amulet.SKIP, msg="Unable to validate db sent %s" % juju_cfg_key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment