github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/mysql/hooks/db-relation-broken (about)

     1  #!/usr/bin/env python
     2  
     3  import os
     4  
     5  from common import *
     6  
     7  print "Relationship with %s broken." % database_name
     8  
     9  open(broken_path,'w').close()
    10  
    11  cursor = get_db_cursor()
    12  try:
    13      cursor.execute("revoke all privileges on `%s`.* from `%s`" % (database_name, user))
    14      print "revoked privileges for `%s` on database `%s`" % (user, database_name)
    15  except Exception as e:
    16      print "revoking failed, possibly incomplete relation. %s" % (e)
    17  
    18  cleanup_service_user(database_name)
    19  
    20  if slave and slave_configured:
    21      os.unlink(slave_configured_path)