Пример #1
0
 def show_databases(self, user, password):
     print("Going to connect to %s, %s, %s"
           % (instance_info.get_address(), user, password))
     with create_mysql_connection(instance_info.get_address(),
                                  user, password) as db:
         print(db)
         dbs = db.execute("show databases")
         return [row['Database'] for row in dbs]
Пример #2
0
 def show_databases(self, user, password):
     print("Going to connect to %s, %s, %s" %
           (instance_info.get_address(), user, password))
     with create_mysql_connection(instance_info.get_address(), user,
                                  password) as db:
         print(db)
         dbs = db.execute("show databases")
         return [row['Database'] for row in dbs]
Пример #3
0
 def mess_up_mysql(self):
     """Ruin MySQL's ability to restart."""
     self.fix_mysql()  # kill files
     cmd = """ssh %s 'sudo cp /dev/null /var/lib/mysql/ib_logfile%d'"""
     for index in range(2):
         full_cmd = cmd % (instance_info.get_address(), index)
         print("RUNNING COMMAND: %s" % full_cmd)
         util.process(full_cmd)
 def mess_up_mysql(self):
     """Ruin MySQL's ability to restart."""
     self.fix_mysql()  # kill files
     cmd = """ssh %s 'sudo cp /dev/null /var/lib/mysql/ib_logfile%d'"""
     for index in range(2):
         full_cmd = cmd % (instance_info.get_address(), index)
         print("RUNNING COMMAND: %s" % full_cmd)
         util.process(full_cmd)
Пример #5
0
 def _check_connection(self, username, password):
     if not FAKE:
         util.assert_mysql_connection_fails(username, password,
                                            instance_info.get_address())
     # Also determine the db is gone via API.
     result = self.dbaas.users.list(instance_info.id)
     for item in result:
         if item.name == username:
             fail("User %s was not deleted." % user)
Пример #6
0
 def show_databases(self, user, password):
     cmd = "sudo mysql -h %s -u '%s' -p'%s' -e 'show databases;'"\
             % (instance_info.get_address(), user, password)
     print("Running cmd: %s" % cmd)
     dblist, err = process(cmd)
     print("returned: %s" % dblist)
     if err:
         assert_false(True, err)
     return dblist
Пример #7
0
 def _check_connection(self, username, password):
     if not FAKE:
         util.assert_mysql_connection_fails(username, password,
                                            instance_info.get_address())
     # Also determine the db is gone via API.
     result = self.dbaas.users.list(instance_info.id)
     for item in result:
         if item.name == username:
             fail("User %s was not deleted." % user)
Пример #8
0
 def show_databases(self, user, password):
     cmd = "sudo mysql -h %s -u '%s' -p'%s' -e 'show databases;'"\
             % (instance_info.get_address(), user, password)
     print("Running cmd: %s" % cmd)
     dblist, err = process(cmd)
     print("returned: %s" % dblist)
     if err:
         assert_false(True, err)
     return dblist
 def set_up(self):
     if USE_IP:
         address = instance_info.get_address()
         self.connection = MySqlConnection(address)
     self.dbaas = instance_info.dbaas
Пример #10
0
def log_in_as_root(root_password):
    con = create_mysql_connection(instance_info.get_address(), 'root',
                                  root_password)
    return con
Пример #11
0
 def test_mysql_root(self):
     """Ensure we aren't allowed access with root and wrong password."""
     assert_mysql_connection_fails("root", "dsfgnear",
                                   instance_info.get_address())
Пример #12
0
def log_in_as_root(root_password):
    con = create_mysql_connection(instance_info.get_address(), "root", root_password)
    return con
Пример #13
0
 def test_mysql_admin(self):
     """Ensure we aren't allowed access with os_admin and wrong password."""
     assert_mysql_connection_fails("os_admin", "asdfd-asdf234",
                                   instance_info.get_address())
Пример #14
0
 def fix_mysql(self):
     """Fix MySQL's ability to restart."""
     if not FAKE_MODE:
         cmd = "ssh %s 'sudo rm /var/lib/mysql/ib_logfile%d'"
         for index in range(2):
             util.process(cmd % (instance_info.get_address(), index))
Пример #15
0
 def set_up(self):
     """If you're using this as a base class, call this method first."""
     if USE_IP:
         address = instance_info.get_address()
         self.connection = MySqlConnection(address)
     self.dbaas = instance_info.dbaas
 def fix_mysql(self):
     """Fix MySQL's ability to restart."""
     if not FAKE_MODE:
         cmd = "ssh %s 'sudo rm /var/lib/mysql/ib_logfile%d'"
         for index in range(2):
             util.process(cmd % (instance_info.get_address(), index))
Пример #17
0
 def test_mysql_root(self):
     """Ensure we aren't allowed access with root and wrong password."""
     assert_mysql_connection_fails("root", "dsfgnear",
                                   instance_info.get_address())
Пример #18
0
 def test_mysql_admin(self):
     """Ensure we aren't allowed access with os_admin and wrong password."""
     assert_mysql_connection_fails("os_admin", "asdfd-asdf234",
                                   instance_info.get_address())
 def set_up(self):
     address = instance_info.get_address()
     assert_equal(1, len(address), "Instance must have one fixed ip.")
     self.connection = MySqlConnection(address[0])
     self.dbaas = instance_info.dbaas