Validate Spinnaker setup.
17445
def add_validate(subparsers):
    """"""
    validate_parser = subparsers.add_parser(
        'validate', help=add_validate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_parser.set_defaults(func=validate_parser.print_help)

    validate_subparsers = validate_parser.add_subparsers(title='Testers')

    validate_all_parser = validate_subparsers.add_parser(
        'all', help=validate.validate_all.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_all_parser.set_defaults(func=validate.validate_all)

    validate_gate_parser = validate_subparsers.add_parser(
        'gate', help=validate.validate_gate.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    validate_gate_parser.set_defaults(func=validate.validate_gate)
688428
def _validate(self):
        

        if self._state is not states.INITIAL:
            raise ValueError(obj=self._uid,
                             attribute='state',
                             expected_value=states.INITIAL,
                             actual_value=self._state)

        if not self._executable:
            raise MissingError(obj=self._uid,
                               missing_attribute='executable')
987378
public function validate()
    {
        if ($this->binary === false) {
            throw new CommandException("Command not found.");
        }

        if (!is_executable($this->binary)) {
            throw new CommandException("$this not executable.");
        }

        $nargs = false;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                if ($nargs) {
                    throw new CommandException("Multiple nargs detected.");
                }

                $nargs = true;
            }
        }
    }
377203
protected function validate()
    {
        // Regenerate session if gone too long and reset timers
        if ((time() - $this->get('timer.start', null, 'session') > self::EXPIRE)) {
            session_regenerate_id(true);
            $this->setTimers(true);
        }

        // Destroy session if expired and start a new one
        if ((time() - $this->get('timer.last', null, 'session') > self::EXPIRE)) {
            $this->destroy();
            $this->start();
        }
    }
403136
def validate(self, *args, **kwds):
        
        if self.behavior:
            return self.behavior.validate(self, *args, **kwds)
        return True
140340
def _validate_build_target(self, spec, target):
        

        if not realpath(target).startswith(spec[BUILD_DIR]):
            raise ValueError('build_target %s is outside build_dir' % target)
736281
def _validate_install(self):

        '''  '''

        from subprocess import check_output, STDOUT
        sys_command = 'docker --help'
        try:
            check_output(sys_command, shell=True, stderr=STDOUT).decode('utf-8')
            # call(sys_command, stdout=open(devnull, 'wb'))
        except Exception as err:
            raise Exception('"docker" not installed. GoTo: https://www.docker.com')
    
        return True
164447
def validate(config):
    '''
    
    '''
    vcfg_ret = True
    vcfg_msg = 'Valid beacon configuration'

    if not isinstance(config, list):
        vcfg_ret = False
        vcfg_msg = 'Configuration for vmadm beacon must be a list!'

    return vcfg_ret, vcfg_msg
480529
def verify_system_status(self):
        """"""
        if not sys.platform.startswith('linux'):
            raise InstallError('Supported platform is Linux only.')

        if self.python.is_system_python():
            if self.python.is_python_binding_installed():
                message = '''
RPM Python binding already installed on system Python.
Nothing to do.
'''
                Log.info(message)
                raise InstallSkipError(message)
            elif self.sys_installed:
                pass
            else:
                message = '''
RPM Python binding on system Python should be installed manually.
Install the proper RPM package of python{,2,3}-rpm,
or set a environment variable RPM_PY_SYS=true
'''
                raise InstallError(message)

        if self.rpm.is_system_rpm():
            self.verify_package_status()
154441
def validate(self, instance):
        """"""
        errors = {}
        self._validate_instance(instance, errors)

        if len(errors) > 0:
            raise ValidationException(errors)
1209476
def setup(self):
        """"""

        self.allow = self.config['allow']
        self.halt = self.config['halt']
        self.skip = self.config['skip']
416790
def _validate(wrapped):
    '''
    
    '''
    @functools.wraps(wrapped)
    def wrapper(*args, **kwargs):
        container_type = kwargs.get('container_type')
        exec_driver = kwargs.get('exec_driver')
        valid_driver = {
            'docker': ('lxc-attach', 'nsenter', 'docker-exec'),
            'lxc': ('lxc-attach',),
            'nspawn': ('nsenter',),
        }
        if container_type not in valid_driver:
            raise SaltInvocationError(
                'Invalid container type \'{0}\'. Valid types are: {1}'
                .format(container_type, ', '.join(sorted(valid_driver)))
            )
        if exec_driver not in valid_driver[container_type]:
            raise SaltInvocationError(
                'Invalid command execution driver. Valid drivers are: {0}'
                .format(', '.join(valid_driver[container_type]))
            )
        if exec_driver == 'lxc-attach' and not salt.utils.path.which('lxc-attach'):
            raise SaltInvocationError(
                'The \'lxc-attach\' execution driver has been chosen, but '
                'lxc-attach is not available. LXC may not be installed.'
            )
        return wrapped(*args, **salt.utils.args.clean_kwargs(**kwargs))
    return wrapper
1277420
protected function validateInstallerInstall()
    {
        $handlers = $this->install->getHandlers();

        if (count($handlers) >= 2) {

            $options = array();
            foreach ($handlers as $id => $handler) {
                $options[$id] = $handler['title'];
            }

            $input = $this->menu($options, 'default', $this->text('Installation profile (enter a number)'));

            if (!$this->isValidInput($input, 'installer', 'install')) {
                $this->errors();
                $this->validateInstallerInstall();
            }
        }
    }
1146938
public void validate() {
        if (swidTag.getEntitlementRequiredIndicator() == null) {
            throw new SwidException("'entitlement_required_indicator' is not set");
        }
        if (swidTag.getProductTitle() == null) {
            throw new SwidException("'product_title' is not set");
        }
        if (swidTag.getProductVersion() == null) {
            throw new SwidException("'product_version' is not set");
        }
        if (swidTag.getSoftwareCreator() == null) {
            throw new SwidException("'software_creator' is not set");
        }
        if (swidTag.getSoftwareLicensor() == null) {
            throw new SwidException("'software_licensor' is not set");
        }
        if (swidTag.getSoftwareId() == null) {
            throw new SwidException("'software_id' is not set");
        }
        if (swidTag.getTagCreator() == null) {
            throw new SwidException("'tag_creator' is not set");
        }
    }
1208066
def validate(self):
        """"""

        changes = self.change_collector.collect_changes()

        features = []
        imported_okay = True
        for importer, modname, modpath in changes.new_feature_info:
            try:
                mod = importer()
                features.extend(_get_contrib_features(mod))
            except (ImportError, SyntaxError):
                logger.info(
                    'Failed to import module at {}'
                    .format(modpath))
                logger.exception('Exception details: ')
                imported_okay = False

        if not imported_okay:
            return False

        # if no features were added at all, reject
        if not features:
            logger.info('Failed to collect any new features.')
            return False

        return all(
            validate_feature_api(feature, self.X, self.y, subsample=False)
            for feature in features
        )
631218
def validate(config):
    '''
    
    '''
    if not isinstance(config, list):
        return False, ('Configuration for haproxy beacon must '
                       'be a list.')
    else:
        _config = {}
        list(map(_config.update, config))

        if 'backends' not in _config:
            return False, ('Configuration for haproxy beacon '
                           'requires backends.')
        else:
            if not isinstance(_config['backends'], dict):
                return False, ('Backends for haproxy beacon '
                               'must be a dictionary.')
            else:
                for backend in _config['backends']:
                    log.debug('_config %s', _config['backends'][backend])
                    if 'servers' not in _config['backends'][backend]:
                        return False, ('Backends for haproxy beacon '
                                       'require servers.')
                    else:
                        _servers = _config['backends'][backend]['servers']
                        if not isinstance(_servers, list):
                            return False, ('Servers for haproxy beacon '
                                           'must be a list.')
    return True, 'Valid beacon configuration'
155782
def validate(config):
    '''
    
    '''
    # Configuration for pkg beacon should be a list
    if not isinstance(config, list):
        return False, ('Configuration for pkg beacon must be a list.')

    # Configuration for pkg beacon should contain pkgs
    pkgs_found = False
    pkgs_not_list = False
    for config_item in config:
        if 'pkgs' in config_item:
            pkgs_found = True
            if isinstance(config_item['pkgs'], list):
                pkgs_not_list = True

    if not pkgs_found or not pkgs_not_list:
        return False, 'Configuration for pkg beacon requires list of pkgs.'
    return True, 'Valid beacon configuration'