Ejemplo n.º 1
0
    def test_01_backup_mysql(self):
        if not core.options.backupmysql:
            return

        core.skip_ok_unless_installed(mysql.client_rpm(), mysql.server_rpm())
        core.config['mysql.datadir'] = None
        core.config['mysql.backup'] = None

        mysql.start() # Need mysql up to determine its datadir

        command = ('mysql', '-sNe', "SHOW VARIABLES where Variable_name='datadir';")
        mysql_cfg = core.check_system(command, 'dump mysql config')[0]
        core.config['mysql.datadir'] = re.match('datadir\s*(.+?)\/\s*$', mysql_cfg).group(1)
        self.assert_(core.config['mysql.datadir'] is not None, 'could not extract MySQL datadir')

        # Backup the old mysql folder
        mysql.stop()
        backup = core.config['mysql.datadir'] + '-backup'
        self.assert_(not os.path.exists(backup), 'mysql-backup already exists')
        try:
            shutil.move(core.config['mysql.datadir'], backup)
        except IOError, e:
            if e.errno == 2:
                # Folder doesn't exist so we don't have to worry about backups
                pass
Ejemplo n.º 2
0
    def test_01_backup_mysql(self):
        if not core.options.backupmysql:
            return

        core.skip_ok_unless_installed(mysql.client_rpm(), mysql.server_rpm())
        core.config['mysql.datadir'] = None
        core.config['mysql.backup'] = None

        mysql.start()  # Need mysql up to determine its datadir

        command = ('mysql', '-sNe',
                   "SHOW VARIABLES where Variable_name='datadir';")
        mysql_cfg = core.check_system(command, 'dump mysql config')[0]
        core.config['mysql.datadir'] = re.match('datadir\s*(.+?)\/\s*$',
                                                mysql_cfg).group(1)
        self.assert_(core.config['mysql.datadir'] is not None,
                     'could not extract MySQL datadir')

        # Backup the old mysql folder
        mysql.stop()
        backup = core.config['mysql.datadir'] + '-backup'
        self.assert_(not os.path.exists(backup), 'mysql-backup already exists')
        try:
            shutil.move(core.config['mysql.datadir'], backup)
        except IOError, e:
            if e.errno == 2:
                # Folder doesn't exist so we don't have to worry about backups
                pass
Ejemplo n.º 3
0
    def test_02_restore_backup(self):
        if not core.options.backupmysql:
            return

        core.skip_ok_unless_installed(mysql.server_rpm())

        if core.config['mysql.backup']:
            files.remove(core.config['mysql.datadir'], force=True)
            shutil.move(core.config['mysql.backup'], core.config['mysql.datadir'])
Ejemplo n.º 4
0
def server_is_installed():
    """Return True if the dependencies for setting up and using VOMS are installed.
    EL7 requires a minimum version of the voms-server package to get the service file fix from SOFTWARE-2357.
    """
    for dep in 'voms-server', 'voms-clients', 'voms-mysql-plugin', mysql.client_rpm(
    ), mysql.server_rpm():
        if not core.dependency_is_installed(dep):
            return False

    return True
Ejemplo n.º 5
0
def is_installed():
    """Return True if the dependencies for setting up and using VOMS are installed.
    EL7 requires a minimum version of the voms-server package to get the service file fix from SOFTWARE-2357.
    """
    for dep in 'voms-server', 'voms-clients', 'voms-mysql-plugin', mysql.client_rpm(
    ), mysql.server_rpm():
        if not core.dependency_is_installed(dep):
            return False

    # TODO: drop this check when 3.3 is completely EOL
    if core.el_release() >= 7:
        epoch, _, version, release, _ = core.get_package_envra('voms-server')
        if core.version_compare((epoch, version, release), '2.0.12-3.2') < 0:
            core.log_message(
                "voms-server installed but too old (missing SOFTWARE-2357 fix)"
            )
            return False

    return True
Ejemplo n.º 6
0
 def test_01_stop_mysqld(self):
     core.skip_ok_unless_installed(mysql.server_rpm())
     mysql.stop()
Ejemplo n.º 7
0
def is_installed():
    """Return True if the dependencies for setting up and using VOMS are installed.
    EL7 requires a minimum version of the voms-server package to get the service file fix from SOFTWARE-2357.
    """
    for dep in 'voms-server', 'voms-clients', 'voms-mysql-plugin', mysql.client_rpm(), mysql.server_rpm():
        if not core.dependency_is_installed(dep):
            return False

    # TODO: drop this check when 3.3 is completely EOL
    if core.el_release() >= 7:
        if core.PackageVersion('voms-server') < '2.0.12-3.2':
            core.log_message("voms-server installed but too old (missing SOFTWARE-2357 fix)")
            return False

    return True
Ejemplo n.º 8
0
 def test_02_start_mysqld(self):
     core.skip_ok_unless_installed(mysql.server_rpm())
     mysql.start()
Ejemplo n.º 9
0
 def test_02_start_mysqld(self):
     core.skip_ok_unless_installed(mysql.server_rpm())
     mysql.start()