예제 #1
0
    def test_invalid_platform(self, mocker, deckhand_ingester, drydock_state,
                              input_files):
        mock_images = mocker.patch(
            "drydock_provisioner.drivers.node.maasdriver.driver."
            "MaasNodeDriver.get_available_images")
        mock_images.return_value = ['xenial']
        mock_kernels = mocker.patch(
            "drydock_provisioner.drivers.node.maasdriver.driver."
            "MaasNodeDriver.get_available_kernels")
        mock_kernels.return_value = ['ga-16.04', 'hwe-16.04']

        input_file = input_files.join("invalid_kernel.yaml")
        design_ref = "file://%s" % str(input_file)

        orch = Orchestrator(state_manager=drydock_state,
                            ingester=deckhand_ingester,
                            enabled_drivers=config.config_mgr.conf.plugins)

        status, site_design = Orchestrator.get_effective_site(orch, design_ref)

        validator = PlatformSelection()
        message_list = validator.execute(site_design, orchestrator=orch)

        for r in message_list:
            LOG.debug(r.to_dict())

        msg = message_list[0].to_dict()
        assert 'invalid kernel lts' in msg.get('message')
        assert msg.get('error')
        assert len(msg.get('documents')) > 0
        assert len(message_list) == 1
예제 #2
0
            result_status.set_status(hd_fields.ValidationResult.Failure)
            result_status.message = "Site design failed validation."
            result_status.reason = "See detail messages."
        else:
            result_status.set_status(hd_fields.ValidationResult.Success)
            result_status.message = "Site design passed validation"

        return result_status


rule_set = [
    BootStorageRational(),
    CidrValidity(),
    HugepagesValidity(),
    IpLocalityCheck(),
    MtuRational(),
    NetworkTrunkingRational(),
    NoDuplicateIpsCheck(),
    PlatformSelection(),
    RationalNetworkBond(),
    StoragePartitioning(),
    StorageSizing(),
    StorageMountpoints(),
    UniqueNetworkCheck(),
    HostnameValidity(),
    IpmiValidity(),
    LibvirtValidity(),
    BootactionDefined(),
    BootactionPackageListValid(),
]