Skip to content

Instantly share code, notes, and snippets.

@marcoceppi
Forked from bloodearnest/gist:6779561
Last active December 24, 2015 09:49
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 marcoceppi/6779616 to your computer and use it in GitHub Desktop.
Save marcoceppi/6779616 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import amulet
d = amulet.Deployment()
d.add('mysql')
d.add('wordpress', units=3)
d.relate('mysql:db', 'wordpress:db')
d.configure('wordpress', tuning='bare')
# Runs deployer
d.setup(timeout=900)
d.sentry.wait() # Setup only goes so far as to stringing things together and making sure it says 'started', this makes sure there are no more hooks running. AKA: Actually ready.
relation_data = d.sentry.unit['mysql/0'].relation('db', 'wordpress:db') # This will be an object of the keys and values sent over the relation
d.sentry.unit['wordpress/0'].file_exists('/var/www/wp-config.php')
contents = d.sentry.unit['wordpress/0'].file_contents('/var/www/wp-config.php')
plugins = d.sentry.unit['wordpress/0'].directory_contents('/var/www/wp-content/plugins')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment