Validates that a config file path and a control socket file path
        and pid file path are all present in the HAProxy config.
335835
def validate_config(cls, config):
        
        if "config_file" not in config:
            raise ValueError("No config file path given")
        if "socket_file" not in config:
            raise ValueError("No control socket path given")
        if "pid_file" not in config:
            raise ValueError("No PID file path given")
        if "stats" in config and "port" not in config["stats"]:
            raise ValueError("Stats interface defined, but no port given")
        if "proxies" in config:
            cls.validate_proxies_config(config["proxies"])

        return config
378412
def _validate_alias_file_path(alias_file_path):
    
    if not os.path.exists(alias_file_path):
        raise CLIError(ALIAS_FILE_NOT_FOUND_ERROR)

    if os.path.isdir(alias_file_path):
        raise CLIError(ALIAS_FILE_DIR_ERROR.format(alias_file_path))
868676
def is_prefix(cls, path):
        
        lagofile = paths.Paths(path).prefix_lagofile()
        return os.path.isfile(lagofile)
108858
def ensure_config
      return if @config_found
      found = CONFIG_FILES.all? {|f| File.exists? "#{@options[:config_path]}/#{f}" }
      found ? @config_dir = true : config_not_found
    end
14994
def load_configuration(conf_path):
    
    with open(conf_path) as f:
        conf_dict = yaml.load(f)
    validate_config(conf_dict)
    return conf_dict
730415
def validate_config(raise_=True):
    
    ELIBConfig.check()
    known_paths = set()
    duplicate_values = set()
    missing_values = set()
    for config_value in ConfigValue.config_values:
        if config_value.path not in known_paths:
            known_paths.add(config_value.path)
        else:
            duplicate_values.add(config_value.name)
        try:
            config_value()
        except MissingValueError:
            missing_values.add(config_value.name)

    if raise_ and duplicate_values:
        raise DuplicateConfigValueError(str(duplicate_values))
    if raise_ and missing_values:
        raise MissingValueError(str(missing_values), 'missing config value(s)')
    return duplicate_values, missing_values
675419
private boolean validatePath(String rootKey, String toolPath, boolean full) {

        if (toolPath.equals(TOOLPATH_SEPARATOR)) {
            return true;
        }
        if (!toolPath.startsWith(TOOLPATH_SEPARATOR)) {
            return false;
        }
        List<String> groups = CmsStringUtil.splitAsList(toolPath, TOOLPATH_SEPARATOR);
        Iterator<String> itGroups = groups.iterator();
        String subpath = "";
        while (itGroups.hasNext()) {
            String group = itGroups.next();
            if (subpath.length() != TOOLPATH_SEPARATOR.length()) {
                subpath += TOOLPATH_SEPARATOR + group;
            } else {
                subpath += group;
            }
            if (itGroups.hasNext() || full) {
                try {
                    // just check if the tool is available
                    resolveAdminTool(rootKey, subpath).toString();
                } catch (Exception e) {
                    return false;
                }
            }
        }
        return true;
    }
565641
@VisibleForTesting
  protected void validateHttpRpcPluginPath(final String path) {
    Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
        "Invalid HttpRpcPlugin path. Path is null or empty.");
    final String testPath = path.trim();
    Preconditions.checkArgument(!HAS_PLUGIN_BASE_WEBPATH.matcher(path).matches(),
        "Invalid HttpRpcPlugin path %s. Path contains system's plugin base path.",
        testPath);

    URI uri = URI.create(testPath);
    Preconditions.checkArgument(!Strings.isNullOrEmpty(uri.getPath()),
        "Invalid HttpRpcPlugin path %s. Parsed path is null or empty.", testPath);
    Preconditions.checkArgument(!uri.getPath().equals("/"),
        "Invalid HttpRpcPlugin path %s. Path is equal to root.", testPath);
    Preconditions.checkArgument(Strings.isNullOrEmpty(uri.getQuery()),
        "Invalid HttpRpcPlugin path %s. Path contains query parameters.", testPath);
  }
789754
def _validate_cert_path(name):
    '''
    
    '''
    cmd = r"Test-Path -Path '{0}'".format(name)

    if not ast.literal_eval(_cmd_run(cmd=cmd)):
        raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
365760
protected static void checkSource(Configuration conf, List<Path> srcs
      ) throws InvalidInputException {
    List<IOException> ioes = new ArrayList<IOException>();
    for(Path p : srcs) {
      try {
        if (!p.getFileSystem(conf).exists(p)) {
          ioes.add(new FileNotFoundException("Source "+p+" does not exist."));
        }
      }
      catch(IOException e) {ioes.add(e);}
    }
    if (!ioes.isEmpty()) {
      throw new InvalidInputException(ioes);
    }
  }
855010
def parse_conf_files(conf_paths):
    
    conf_file = ConfigParser.RawConfigParser()
    conf_read = conf_file.read(conf_paths)
    conf = {}
    try:
        if conf_read:
            conf['client_id'] = conf_file.get('runkeeper', 'client_id')
            conf['client_secret'] = conf_file.get('runkeeper', 'client_secret')
            if conf_file.has_option('runkeeper', 'bindport'):
                conf['bindport'] = conf_file.getint('runkeeper', 'bindport')
            if conf_file.has_option('runkeeper', 'bindaddr'):
                conf['bindaddr'] = conf_file.get('runkeeper', 'bindaddr')
            if conf_file.has_option('runkeeper', 'baseurl'):
                conf['baseurl'] = conf_file.get('runkeeper', 'baseurl')
            return conf
    except ConfigParser.Error:
        raise ConfigurationError("Error parsing configuration file(s): %s\n" 
                                 % sys.exc_info()[1])
    else:
        raise ConfigurationError("No valid configuration file (%s) found." 
                                 % defaultConfFilename)
65080
def validate(defaults, metadata, config):
    
    for path, _, default, parent, value in zip_dicts(defaults, config):
        if isinstance(default, Requirement):
            # validate the current value and assign the output
            parent[path[-1]] = default.validate(metadata, path, value)
59316
def __enableProxy(self):
        
        os.environ[
            "HTTP_PROXY"] = self.httpProxy()
        os.environ[
            "HTTPS_PROXY"] = self.httpsProxy()

        os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(
            os.path.dirname(
                os.path.abspath(__file__)),
            "cert.pem")
736389
def validate_proxy_args(cls, *args):
        """"""
        supplied_proxies = Counter((not arg for arg in (*args,))).get(False)
        if not supplied_proxies:
            return
        elif supplied_proxies > 1:
            raise RaccoonException("Must specify only one of the following:\n"
                                   "--tor-routing, --proxy-list, --proxy")
71593
def apply_config(self, config):
        
        self.haproxy_config_path = config["config_file"]

        global_stanza = Stanza("global")
        global_stanza.add_lines(config.get("global", []))
        global_stanza.add_lines([
            "stats socket %s mode 600 level admin" % config["socket_file"],
            "stats timeout 2m"
        ])

        defaults_stanza = Stanza("defaults")
        defaults_stanza.add_lines(config.get("defaults", []))

        proxy_stanzas = [
            ProxyStanza(
                name, proxy["port"], proxy["upstreams"],
                proxy.get("options", []),
                proxy.get("bind_address")
            )
            for name, proxy in six.iteritems(config.get("proxies", {}))
        ]

        stats_stanza = None
        if "stats" in config:
            stats_stanza = StatsStanza(
                config["stats"]["port"], config["stats"].get("uri", "/")
            )
            for timeout in ("client", "connect", "server"):
                if timeout in config["stats"].get("timeouts", {}):
                    stats_stanza.add_line(
                        "timeout %s %d" % (
                            timeout,
                            config["stats"]["timeouts"][timeout]
                        )
                    )

        self.config_file = HAProxyConfig(
            global_stanza, defaults_stanza,
            proxy_stanzas=proxy_stanzas, stats_stanza=stats_stanza,
            meta_clusters=config.get("meta_clusters", {}),
            bind_address=config.get("bind_address")
        )

        self.control = HAProxyControl(
            config["config_file"], config["socket_file"], config["pid_file"],
        )
362504
def validateFilepath( self ):
        
        if ( not self.isValidated() ):
            return
        
        valid = self.isValid()
        if ( not valid ):
            fg = self.invalidForeground()
            bg = self.invalidBackground()
        else:
            fg = self.validForeground()
            bg = self.validBackground()
        
        palette = self.palette()
        palette.setColor(palette.Base, bg)
        palette.setColor(palette.Text, fg)
        self._filepathEdit.setPalette(palette)
880316
function verifyConfig(config) {
  var i = 0;
  var required = ['logs', 'client_name', 'server_port'];
  var optional = {
    'server_host': '127.0.0.1'
  };

  for(i = 0; i < required.lenght; i++) {
    if(!config[required[i]]) {
      throw 'Config missing required: ' + required[i];
    }
  }

  for(i in optional) {
    if(optional.hasOwnProperty(i)) {
      if(!config[i]) {
        config[i] = optional[i];
      }
    }
  }

  return config;
}