def test_distro_does_not_have_packages(self): result = suite.has_packages_for_distro( "sha1", "rhel", package_versions=self.pv, ) assert not result
def test_has_packages_no_package_versions(self, m_get_package_versions): m_get_package_versions.return_value = self.pv result = suite.has_packages_for_distro( "sha1", "rhel", ) assert not result
def test_distro_has_packages(self): result = suite.has_packages_for_distro( "sha1", "ubuntu", package_versions=self.pv, ) assert result
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 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...") os_type = ctx.config.get("os_type", None) sha1 = ctx.config.get("sha1", None) # We can only do this check if there are a defined sha1 and os_type # in the job config. if os_type and sha1: log.info("Checking packages for os_type '{os}' and ceph hash '{ver}'". format( os=os_type, ver=sha1, )) if not has_packages_for_distro(sha1, os_type): 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, ))