6
change_unit = os.environ.get("ENSEMBLE_REMOTE_UNIT")
7
# We'll name the database the same as the service.
8
database_name, _ = change_unit.split("/")
9
# A user per service unit so we can deny access quickly
10
user = change_unit.replace("/","-")
15
passwd = open("/var/lib/ensemble/mysql.passwd").read().strip()
17
connection = MySQLdb.connect(user="root", host="localhost", passwd=passwd)
19
return connection.cursor()