Exemplo n.º 1
0
 def test_01_fix_symlinks(self):
     if core.rpm_is_installed('jdk') and \
        (java.is_openjdk_installed() or java.is_openjdk_devel_installed()):
         # We regenerate these symlinks via alternatives so it's unnecessary to back them up
         command = ('rm', '-f', '/usr/bin/java', '/usr/bin/javac', '/usr/bin/javadoc', '/usr/bin/jar')
         core.check_system(command, 'Remove old symlinks')
         command = ['yum', 'reinstall', '-y', java.JAVA_RPM, java.JAVAC_RPM]
         yum.retry_command(command)
Exemplo n.º 2
0
    def test_03_remove_packages(self):
        # We didn't ask to install anything
        if len(core.options.packages) == 0:
            return

        # Nothing actually got installed
        if len(core.state['install.installed']) == 0:
            core.log_message('No packages installed')
            return

        el_version = core.el_release()

        if el_version >= 6:
            # Rolling back is a lot more reliable in yum post EL5
            core.state['install.transaction_ids'].reverse()
            for transaction in core.state['install.transaction_ids']:
                command = ['yum', 'history', 'undo', '-y', transaction]
                for repo in core.options.extrarepos:
                    command.append('--enablerepo=%s' % repo)
                fail_msg, _, stdout, _ = yum.retry_command(command)
                if fail_msg:
                    self.fail(fail_msg)
        elif el_version == 5:
            # rpm -Uvh --rollback was very finicky so we had to
            # spin up our own method of rolling back installations
            if len(core.state['install.updated']) != 0:
                command = ['yum', 'downgrade', '-y'] + core.state['install.updated']
                fail_msg, _, stdout, _ = yum.retry_command(command)
                if fail_msg:
                    self.fail(fail_msg)
                # Remove packages from install list that were brought in as deps for `yum update`
                yum.parse_output_for_packages(stdout)

            if len(core.state['install.installed']) != 0:
                for pkg in core.state['install.os_updates']:
                    try:
                        core.state['install.installed'].remove(pkg)
                    except ValueError:
                        pass # it was already removed from under us
                rpm_erase_list = self.list_special_install_rpms(core.state['install.installed'])
                package_count = len(rpm_erase_list)
                command = ['rpm', '--quiet', '--erase'] + rpm_erase_list
                core.check_system(command, 'Remove %d packages' % (package_count))
            else:
                core.log_message('No new RPMs')
                return
Exemplo n.º 3
0
    def test_02_install_packages(self):
        core.state['install.success'] = False
        core.state['install.installed'] = []
        core.state['install.updated'] = []
        core.state['install.replace'] = []
        core.state['install.orphaned'] = []
        core.state['install.os_updates'] = []

        # Install packages
        core.state['install.transaction_ids'] = set()
        fail_msg = ''
        pkg_repo_dict = OrderedDict(
            (x, core.options.extrarepos) for x in core.options.packages)

        # HACK: Install x509-scitokens-issuer-client out of development (SOFTWARE-3649)
        x509_scitokens_issuer_packages = [
            'xrootd-scitokens', 'osg-tested-internal'
        ]
        for pkg in x509_scitokens_issuer_packages:
            if pkg in pkg_repo_dict:
                pkg_repo_dict["x509-scitokens-issuer-client"] = [
                    "osg-development"
                ]
                break

        # Special case: htcondor-ce-collector on EL8 needs mod_auth_oidc, only avaiable in a module
        if "htcondor-ce-collector" in pkg_repo_dict:
            if core.el_release() > 7:
                core.check_system(
                    ["dnf", "-y", "module", "enable", "mod_auth_openidc"],
                    "Enable mod_auth_openidc module")

        for pkg, repos in pkg_repo_dict.items():
            # Do not try to re-install packages
            if core.rpm_is_installed(pkg):
                continue

            # Attempt installation
            command = ['yum', '-y']
            command += ['--enablerepo=%s' % x for x in repos]
            command += ['install', pkg]

            retry_fail, _, stdout, _ = yum.retry_command(command)
            if retry_fail == '':  # the command succeeded
                core.state['install.transaction_ids'].add(
                    yum.get_transaction_id())
                if not pkg.startswith("/"):
                    # ^^ rpm --verify doesn't work if you asked for a file instead of a package
                    command = ('rpm', '--verify', pkg)
                    core.check_system(command, 'Verify %s' % (pkg))
                yum.parse_output_for_packages(stdout)

            fail_msg += retry_fail

        if fail_msg:
            self.fail(fail_msg)
        core.state['install.success'] = True
Exemplo n.º 4
0
    def test_02_install_packages(self):
        core.state['install.success'] = False
        core.state['install.installed'] = []
        core.state['install.updated'] = []
        core.state['install.replace'] = []
        core.state['install.orphaned'] = []
        core.state['install.os_updates'] = []

        # Install packages
        core.state['install.transaction_ids'] = []
        fail_msg = ''
        pkg_repo_dict = OrderedDict((x, core.options.extrarepos) for x in core.options.packages)

        # HACK: Install Slurm and osg-tested-internal out of development-like repos.
        # SOFTWARE-1733 may one day give us a generalized solution.
        if core.osg_release() > '3.4':
            dev_repo = ['devops-itb']
            if 'osg-tested-internal' in pkg_repo_dict:
                pkg_repo_dict['osg-tested-internal'] += dev_repo
        else:
            dev_repo = ['osg-development']

        if 'osg-tested-internal' in pkg_repo_dict or 'slurm' in pkg_repo_dict:
            pkg_repo_dict.update(dict((x, core.options.extrarepos + dev_repo) for x in core.SLURM_PACKAGES))

        # HACK: Install x509-scitokens-issuer-client out of development (SOFTWARE-3649)
        if 'xrootd-scitokens' in pkg_repo_dict:
            pkg_repo_dict["x509-scitokens-issuer-client"] = ["osg-development"]

        for pkg, repos in pkg_repo_dict.items():
            # Do not try to re-install packages
            if core.rpm_is_installed(pkg):
                continue

            # Attempt installation
            command = ['yum', '-y']
            command += ['--enablerepo=%s' % x for x in repos]
            command += ['install', pkg]

            retry_fail, _, stdout, _ = yum.retry_command(command)
            if retry_fail == '':   # the command succeeded
                core.state['install.transaction_ids'].append(yum.get_transaction_id())
                command = ('rpm', '--verify', pkg)
                core.check_system(command, 'Verify %s' % (pkg))
                yum.parse_output_for_packages(stdout)

            fail_msg += retry_fail

        if fail_msg:
            self.fail(fail_msg)
        core.state['install.success'] = True
Exemplo n.º 5
0
    def test_04_restore_orphaned_packages(self):
        # We didn't ask to install anything and thus didn't remove anything
        if len(core.options.packages) == 0:
            return

        if core.state['install.orphaned']:
            self.skip_ok_unless(core.state['install.orphaned'], 'No orphaned packages')
            # Reinstall packages that we removed but didn't install
            # Technically, this doesn't bring the system back to its original
            # state of packages: we don't track state of EPEL/OSG repos and we
            # leave the ones we drop in
            command = ['yum', '-y', 'install'] + core.state['install.orphaned']
            fail_msg, _, _, _ = yum.retry_command(command)
            if fail_msg:
                self.fail(fail_msg)
Exemplo n.º 6
0
    def test_02_obsoleting_packages(self):
        # If packages were obsoleted in upgrade, remove the packages that obsoleted them
        # Also skip if we didn't install anything
        if core.el_release() > 5 or len(core.options.packages) == 0:
            return
        self.skip_ok_unless(core.state['install.replace'], 'no packages were replaced')

        # This also removes any package that required the obsoleted packages! If we're not
        # supposed to be removing these packages, they will be considered
        # orphaned and reinstalled in test_04_orphaned_packages
        command = ['yum', '-y', 'remove'] + core.state['install.replace']
        fail_msg, _, stdout, _ = yum.retry_command(command)
        if fail_msg:
            self.fail(fail_msg)
        yum.parse_output_for_packages(stdout)
Exemplo n.º 7
0
    def test_04_restore_orphaned_packages(self):
        # We didn't ask to install anything and thus didn't remove anything
        if len(core.options.packages) == 0:
            return

        if core.state['install.orphaned']:
            self.skip_ok_unless(core.state['install.orphaned'], 'No orphaned packages')
            # Reinstall packages that we removed but didn't install
            # Technically, this doesn't bring the system back to its original
            # state of packages: we don't track state of EPEL/OSG repos and we
            # leave the ones we drop in
            command = ['yum', '-y', 'install'] + core.state['install.orphaned']
            fail_msg, _, _, _ = yum.retry_command(command)
            if fail_msg:
                self.fail(fail_msg)
Exemplo n.º 8
0
    def test_04_update_packages(self):
        if not (core.options.updaterepos and core.state['install.installed']):
            return

        self.skip_bad_unless(core.state['install.success'], 'Install did not succeed')

        # Update packages
        command = ['yum', 'update', '-y']
        for repo in core.options.updaterepos:
            command.append('--enablerepo=%s' % repo)
        fail_msg, status, stdout, stderr = yum.retry_command(command)
        yum.parse_output_for_packages(stdout)

        if fail_msg:
            self.fail(fail_msg)
        else:
            core.state['install.transaction_ids'].append(yum.get_transaction_id())
Exemplo n.º 9
0
    def test_02_remove_packages(self):
        # We didn't ask to install anything
        if len(core.options.packages) == 0:
            return

        # Nothing actually got installed
        if len(core.state['install.installed']) == 0:
            core.log_message('No packages installed')
            return

        for transaction in reversed(
                sorted(core.state['install.transaction_ids'])):
            command = ['yum', 'history', 'undo', '-y', str(transaction)]
            for repo in core.options.extrarepos:
                command.append('--enablerepo=%s' % repo)
            fail_msg, _, _, _ = yum.retry_command(command)
            if fail_msg:
                self.fail(fail_msg)
Exemplo n.º 10
0
    def test_02_remove_packages(self):
        # We didn't ask to install anything
        if len(core.options.packages) == 0:
            return

        # Nothing actually got installed
        if len(core.state['install.installed']) == 0:
            core.log_message('No packages installed')
            return

        core.state['install.transaction_ids'].reverse()
        for transaction in core.state['install.transaction_ids']:
            command = ['yum', 'history', 'undo', '-y', transaction]
            for repo in core.options.extrarepos:
                command.append('--enablerepo=%s' % repo)
            fail_msg, _, _, _ = yum.retry_command(command)
            if fail_msg:
                self.fail(fail_msg)
Exemplo n.º 11
0
    def test_02_install_packages(self):
        core.state['install.success'] = False
        core.state['install.installed'] = []
        core.state['install.updated'] = []
        core.state['install.replace'] = []
        core.state['install.orphaned'] = []
        core.state['install.os_updates'] = []

        # Install packages
        core.state['install.transaction_ids'] = []
        fail_msg = ''
        pkg_repo_dict = OrderedDict(
            (x, core.options.extrarepos) for x in core.options.packages)

        # FIXME: Install slurm out of contrib if we're running 'All' tests until
        # SOFTWARE-1733 gives us a generalized solution
        if 'osg-tested-internal' in pkg_repo_dict:
            pkg_repo_dict.update(
                dict((x, ['osg-development']) for x in core.SLURM_PACKAGES))

        for pkg, repos in pkg_repo_dict.items():
            # Do not try to re-install packages
            if core.rpm_is_installed(pkg):
                continue

            # Attempt installation
            command = ['yum', '-y']
            command += ['--enablerepo=%s' % x for x in repos]
            command += ['install', pkg]

            retry_fail, _, stdout, _ = yum.retry_command(command)
            if retry_fail == '':  # the command succeeded
                core.state['install.transaction_ids'].append(
                    yum.get_transaction_id())
                command = ('rpm', '--verify', pkg)
                core.check_system(command, 'Verify %s' % (pkg))
                yum.parse_output_for_packages(stdout)

            fail_msg += retry_fail

        if fail_msg:
            self.fail(fail_msg)
        core.state['install.success'] = True
Exemplo n.º 12
0
    def test_02_install_packages(self):
        core.state['install.success'] = False
        core.state['install.installed'] = []
        core.state['install.updated'] = []
        core.state['install.replace'] = []
        core.state['install.orphaned'] = []
        core.state['install.os_updates'] = []

        # Install packages
        core.state['install.transaction_ids'] = []
        fail_msg = ''
        pkg_repo_dict = OrderedDict((x, core.options.extrarepos) for x in core.options.packages)

        # FIXME: Install slurm out of contrib if we're running 'All' tests until
        # SOFTWARE-1733 gives us a generalized solution
        if 'osg-tested-internal' in pkg_repo_dict or 'slurm' in pkg_repo_dict:
            pkg_repo_dict.update(dict((x, ['osg-development']) for x in core.SLURM_PACKAGES))

        for pkg, repos in pkg_repo_dict.items():
            # Do not try to re-install packages
            if core.rpm_is_installed(pkg):
                continue

            # Attempt installation
            command = ['yum', '-y']
            command += ['--enablerepo=%s' % x for x in repos]
            command += ['install', pkg]

            retry_fail, _, stdout, _ = yum.retry_command(command)
            if retry_fail == '':   # the command succeeded
                core.state['install.transaction_ids'].append(yum.get_transaction_id())
                command = ('rpm', '--verify', pkg)
                core.check_system(command, 'Verify %s' % (pkg))
                yum.parse_output_for_packages(stdout)

            fail_msg += retry_fail

        if fail_msg:
            self.fail(fail_msg)
        core.state['install.success'] = True
Exemplo n.º 13
0
    def test_02_install_packages(self):
        core.state['install.success'] = False
        core.state['install.installed'] = []
        core.state['install.updated'] = []
        core.state['install.replace'] = []
        core.state['install.orphaned'] = []
        core.state['install.os_updates'] = []

        # Install packages
        core.state['install.transaction_ids'] = []
        fail_msg = ''
        for package in core.options.packages:

            # Do not try to re-install packages
            if core.rpm_is_installed(package):
                continue

            # Attempt installation
            command = ['yum', '-y']
            for repo in core.options.extrarepos:
                command.append('--enablerepo=%s' % repo)
            command += ['install', package]

            retry_fail, status, stdout, stderr = yum.retry_command(command)
            if retry_fail == '':   # the command succeeded
                if core.el_release() >= 6:
                    # RHEL 6 does not have the rollback option, so store the
                    # transaction IDs so we can undo each transaction in the
                    # proper order
                    core.state['install.transaction_ids'].append(yum.get_transaction_id())
                command = ('rpm', '--verify', package)
                core.check_system(command, 'Verify %s' % (package))
                yum.parse_output_for_packages(stdout)

            fail_msg += retry_fail

        if fail_msg:
            self.fail(fail_msg)
        core.state['install.success'] = True