Exemple #1
0
def run_build(test, params, env):
    """
    Installs virtualization software using the selected installers

    @param test: test object.
    @param params: Dictionary with test parameters.
    @param env: Test environment.
    """
    srcdir = params.get("srcdir", test.srcdir)
    params["srcdir"] = srcdir

    # Flag if a installer minor failure ocurred
    minor_failure = False
    minor_failure_reasons = []

    try:
        for name in params.get("installers", "").split():
            installer_obj = installer.make_installer(name, params, test)
            installer_obj.install()
            installer_obj.write_version_keyval(test)
            if installer_obj.minor_failure == True:
                minor_failure = True
                reason = "%s_%s: %s" % (installer_obj.name, installer_obj.mode,
                                        installer_obj.minor_failure_reason)
                minor_failure_reasons.append(reason)
            env.register_installer(installer_obj)

    except Exception, e:
        # if the build/install fails, don't allow other tests
        # to get a installer.
        msg = "Virtualization software install failed: %s" % (e)
        env.register_installer(base_installer.FailedInstaller(msg))
        raise
Exemple #2
0
def run_build(test, params, env):
    """
    Installs virtualization software using the selected installers

    @param test: test object.
    @param params: Dictionary with test parameters.
    @param env: Test environment.
    """
    srcdir = params.get("srcdir", test.srcdir)
    params["srcdir"] = srcdir

    # Flag if a installer minor failure ocurred
    minor_failure = False
    minor_failure_reasons = []

    try:
        for name in params.get("installers", "").split():
            installer_obj = installer.make_installer(name, params, test)
            installer_obj.install()
            installer_obj.write_version_keyval(test)
            if installer_obj.minor_failure == True:
                minor_failure = True
                reason = "%s_%s: %s" % (installer_obj.name,
                                        installer_obj.mode,
                                        installer_obj.minor_failure_reason)
                minor_failure_reasons.append(reason)
            env.register_installer(installer_obj)

    except Exception, e:
        # if the build/install fails, don't allow other tests
        # to get a installer.
        msg = "Virtualization software install failed: %s" % (e)
        env.register_installer(base_installer.FailedInstaller(msg))
        raise
Exemple #3
0
def run_install(test, params, env):
    """
    Installs virtualization software using the selected installers

    @param test: test object.
    @param params: Dictionary with test parameters.
    @param env: Test environment.
    """
    srcdir = params.get("srcdir", test.srcdir)
    params["srcdir"] = srcdir

    # Flag if a installer minor failure ocurred
    minor_failure = False
    minor_failure_reasons = []

    sm = software_manager.SoftwareManager()

    try:
        for name in params.get("installers", "").split():
            installer_obj = installer.make_installer(name, params, test)
            if installer_obj.name == "ovirt_engine_sdk":
                installer_obj.install(cleanup=False, build=False, install=False)
                if installer_obj.minor_failure == True:
                    minor_failure = True
                    reason = "%s_%s: %s" % (installer_obj.name,
                                            installer_obj.mode,
                                            installer_obj.minor_failure_reason)
                    minor_failure_reasons.append(reason)
                env.register_installer(installer_obj)
                ovirt_src = os.path.join(srcdir, installer_obj.name)
                topdir = os.getcwd()
                os.chdir(ovirt_src)
                utils.make("rpm")
                os.chdir(topdir)
                pkgs = glob.glob(os.path.join(ovirt_src, "rpmtop/RPMS/noarch/*"))
                for pkg in pkgs:
                    sm.install(pkg)
            else:
                installer_obj.install(cleanup=False, build=False)
                time.sleep(5)
                if installer_obj.minor_failure == True:
                    minor_failure = True
                    reason = "%s_%s: %s" % (installer_obj.name,
                                            installer_obj.mode,
                                            installer_obj.minor_failure_reason)
                    minor_failure_reasons.append(reason)
                env.register_installer(installer_obj)


    except Exception, e:
        # if the build/install fails, don't allow other tests
        # to get a installer.
        msg = "Virtualization software install failed: %s" % (e)
        env.register_installer(base_installer.FailedInstaller(msg))
        raise
    def test_make_installer(self):
        config = """install_mode = test_install_mode
vm_type = test"""

        class Installer:
            def __init__(self, mode, name, test, params):
                pass

        installer.INSTALLER_REGISTRY.register('test_install_mode', Installer,
                                              'test')

        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        instance = installer.make_installer("test_install_mode_test", params)
        self.assertTrue(isinstance(instance, Installer))
    def test_make_installer(self):
        config = """install_mode = test_install_mode
vm_type = test"""

        class Installer:
            def __init__(self, mode, name, test, params):
                pass

        installer.INSTALLER_REGISTRY.register('test_install_mode',
                                              Installer,
                                              'test')

        config_parser = cartesian_config.Parser()
        config_parser.parse_string(config)
        params = config_parser.get_dicts().next()

        instance = installer.make_installer("test_install_mode_test", params)
        self.assertTrue(isinstance(instance, Installer))