def test_get_install_task_flavor_override_project(self): config = dict( tasks=[ dict(install=dict()), ], overrides=dict(install=dict(ceph=dict(flavor='notcmalloc', ), ), ), ) assert suite.get_install_task_flavor(config) == 'notcmalloc'
def test_get_install_task_flavor_bare(self): config = dict( tasks=[ dict( install=dict(), ), ], ) assert suite.get_install_task_flavor(config) == 'basic'
def test_get_install_task_flavor_simple(self): config = dict( tasks=[ dict( install=dict( flavor='notcmalloc', ), ), ], ) assert suite.get_install_task_flavor(config) == 'notcmalloc'
def test_get_install_task_flavor_override_project(self): config = dict( tasks=[ dict(install=dict()), ], overrides=dict( install=dict( ceph=dict( flavor='notcmalloc', ), ), ), ) assert suite.get_install_task_flavor(config) == 'notcmalloc'
def __init__(self, project, job_config, ctx=None, remote=None): self.project = project self.job_config = job_config #TODO: we could get around the need for ctx by using a list # of roles instead, ctx is only used in _get_config_value_for_remote. self.ctx = ctx self.remote = remote # avoiding circular imports from teuthology.suite import get_install_task_flavor self.flavor = get_install_task_flavor(self.job_config) self.sha1 = self.job_config.get("sha1") if remote and ctx: self._init_from_remote() else: self._init_from_config() self.dist_release = self._get_dist_release()
def check_packages(ctx, config): """ Checks gitbuilder to determine if there are missing packages for this job. If there are missing packages, fail the job. """ log.info("Checking packages...") sha1 = ctx.config.get("sha1") os_type = ctx.config.get("os_type") flavor = get_install_task_flavor(ctx.config) # We can only do this check if there are a defined sha1 and os_type # in the job config. if os_type and sha1: template = "Checking packages for os_type,'{os}' flavor '{flav}' and" \ " ceph hash '{ver}'" log.info( template.format( os=os_type, flav=flavor, ver=sha1, ) ) if not has_packages_for_distro(sha1, os_type, flavor): msg = "Packages for os_type '{os}' and ceph hash '{ver}' not found" msg = msg.format( os=os_type, ver=sha1, ) log.error(msg) # set the failure message and update paddles with the status ctx.summary["failure_reason"] = msg set_status(ctx.summary, "dead") report.try_push_job_info(ctx.config, dict(status='dead')) raise RuntimeError(msg) else: log.info( "Checking packages skipped, missing os_type '{os}' or ceph hash '{ver}'".format( os=os_type, ver=sha1, ) )
def _init_from_config(self): """ Initializes the class from a teuthology job config """ # a bad assumption, but correct for most situations I believe self.arch = "x86_64" self.os_type = self.job_config.get("os_type") self.os_version = self._get_version() self.distro = self._get_distro( distro=self.os_type, version=self.os_version, ) self.pkg_type = "deb" if self.os_type.lower() in ( "ubuntu", "debian", ) else "rpm" # avoiding circular imports from teuthology.suite import get_install_task_flavor # when we're initializing from a full teuthology config, not just a # task config we need to make sure we're looking at the flavor for # the install task self.flavor = get_install_task_flavor(self.job_config)
def test_get_install_task_flavor_override_simple(self): config = dict(tasks=[dict(install=dict())], overrides=dict(install=dict(flavor="notcmalloc"))) assert suite.get_install_task_flavor(config) == "notcmalloc"