Find config file for sendxmpp binary (default is .sendxmpprc)
968360
public function findConfigFile()
    {
        if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) {
            if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc'))
                !== md5($this->getConfigFormat())) {
                return null;
            }

            return true;
        }

        return null;
    }
1029646
function () {
        let rootPath = process.cwd(),
            config;
        try {
            config = require(rootPath + '/bt-config');
        } catch (err) {
            console.warn("Project has no configuration file for bt command!");
        }

        return config;
    }
243642
def get_plugin_conf(self, phase, name):
        
        match = [x for x in self.template[phase] if x.get('name') == name]
        return match[0]
912225
def find_binaries(cls, tmpdir=None, shellsetup=None, pnmdir=None):
        
        cls.tmpdir = ('/tmp' if (tmpdir is None) else tmpdir)
        # Shell setup command (e.g set library path)
        cls.shellsetup = ('' if (shellsetup is None) else shellsetup)
        if (pnmdir is None):
            cls.pnmdir = '/usr/bin'
            for dir in ('/usr/local/bin', '/sw/bin'):
                if (os.path.isfile(os.path.join(dir, 'pngtopnm'))):
                    cls.pnmdir = dir
        else:
            cls.pnmdir = pnmdir
        # Recklessly assume everything else under cls.pnmdir
        cls.pngtopnm = os.path.join(cls.pnmdir, 'pngtopnm')
        cls.jpegtopnm = os.path.join(cls.pnmdir, 'jpegtopnm')
        cls.pnmfile = os.path.join(cls.pnmdir, 'pnmfile')
        cls.pnmcut = os.path.join(cls.pnmdir, 'pnmcut')
        cls.pnmscale = os.path.join(cls.pnmdir, 'pnmscale')
        cls.pnmrotate = os.path.join(cls.pnmdir, 'pnmrotate')
        cls.pnmflip = os.path.join(cls.pnmdir, 'pnmflip')
        cls.pnmtopng = os.path.join(cls.pnmdir, 'pnmtopng')
        cls.ppmtopgm = os.path.join(cls.pnmdir, 'ppmtopgm')
        cls.pnmtotiff = os.path.join(cls.pnmdir, 'pnmtotiff')
        cls.pnmtojpeg = os.path.join(cls.pnmdir, 'pnmtojpeg')
        cls.pamditherbw = os.path.join(cls.pnmdir, 'pamditherbw')
        # Need djatoka to get jp2 output
        cls.djatoka_comp = '/Users/simeon/packages/adore-djatoka-1.1/bin/compress.sh'
236735
def get_default_config_help(self):
        
        config = super(RiemannHandler, self).get_default_config_help()

        config.update({
            'host': '',
            'port': '',
            'transport': 'tcp or udp',
        })

        return config
1119923
def getConf(cls, settings, options):
        ""
        ports = ['http_port', 'https_port', 'cache_port']
        for port_name in ports:
            port = getattr(settings, port_name.upper(), None)
            # only use the settings ports if the defaults were left unchanged
            default = getattr(defaults, port_name.upper())
            if port and options.get(port_name) == default:
                options[port_name] = port

        _opts = [
            ('key', 'hx_private_key'),
            ('cert', 'hx_certficate'),
            ('wsgi', 'wsgi_application')
        ]
        for opt_name, settings_name in _opts:
            opt = getattr(settings, settings_name.upper(), None)
            if opt:
                options[opt_name] = opt

        if not options['settings']:
            options['settings'] = environ['DJANGO_SETTINGS_MODULE']
        return options
205440
def get_default_config(self):
        
        config = super(NtpCollector, self).get_default_config()
        config.update({
            'bin':      self.find_binary('/usr/sbin/ntpdate'),
            'ntp_pool': 'pool.ntp.org',
            'path':     'ntp',
            'precision': 0,
            'time_scale': 'milliseconds',
        })
        return config
1172470
def jboss_standalone_main_config_files(broker):
        """"""
        ps = broker[DefaultSpecs.ps_auxww].content
        results = []
        search = re.compile(r"\-Djboss\.server\.base\.dir=(\S+)").search
        # JBoss progress command content should contain jboss.home.dir
        for p in ps:
            if '-D[Standalone]' in p:
                match = search(p)
                # Only get the path which is absolute
                if match and match.group(1)[0] == "/":
                    main_config_path = match.group(1)
                    main_config_file = "standalone.xml"
                    if " -c " in p:
                        main_config_file = p.split(" -c ")[1].split()[0]
                    elif "--server-config" in p:
                        main_config_file = p.split("--server-config=")[1].split()[0]
                    results.append(main_config_path + "/" + main_config_file)
        return list(set(results))
875534
def get_default_config(self):
        
        config = super(OpenVPNCollector, self).get_default_config()
        config.update({
            'path':      'openvpn',
            'instances': 'file:///var/log/openvpn/status.log',
            'timeout':   '10',
        })
        return config
939771
def get_default_config(self):
        
        config = super(OssecCollector, self).get_default_config()
        config.update({
            'bin':              '/var/ossec/bin/agent_control',
            'use_sudo':         True,
            'sudo_cmd':         '/usr/bin/sudo',
            'path':             'ossec',
        })
        return config
790495
def get_default_config(self):
        
        config = super(RiemannHandler, self).get_default_config()

        config.update({
            'host': '',
            'port': 123,
            'transport': 'tcp',
        })

        return config
484434
def _get_jvm_opts(data, out_file):
    
    if get_vardict_command(data) == "vardict-java":
        resources = config_utils.get_resources("vardict", data["config"])
        jvm_opts = resources.get("jvm_opts", ["-Xms750m", "-Xmx4g"])
        jvm_opts += broad.get_default_jvm_opts(os.path.dirname(out_file))
        return "export VAR_DICT_OPTS='%s' && " % " ".join(jvm_opts)
    else:
        return ""
314904
def search_configuration_files(findstr, replacestr = None):
    ''''''

    F = open(configurationFilesLocation, "r")
    lines = F.readlines()
    F.close()
    allerrors = {}
    alloutput = {}

    for line in lines:
        line = line.strip()
        if line:
            if line.endswith("generate_fragments.py"):
                # Do not parse the Python script but check that it exists
                if not(os.path.exists(line)):
                    allerrors[line] = "File/directory %s does not exist." % line
            else:
                cmd = ["grep", "-n", "-i",  findstr, line]
                output = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
                errors = output[1]
                output = output[0]
                if errors:
                    errors = errors.strip()
                    allerrors[line] = errors
                if output:
                    output = output.strip()
                    alloutput[line] = output.split("\n")
    return alloutput, allerrors
767812
def getIfConfig(self):
        
        conf = {}
        try:
            out = subprocess.Popen([ipCmd, "addr", "show"], 
                                   stdout=subprocess.PIPE).communicate()[0]
        except:
            raise Exception('Execution of command %s failed.' % ipCmd)
        for line in out.splitlines():
            mobj = re.match('^\d+: (\S+):\s+<(\S*)>\s+(\S.*\S)\s*$', line)
            if mobj:
                iface = mobj.group(1)
                conf[iface] = {}
                continue
            mobj = re.match('^\s{4}link\/(.*\S)\s*$', line)
            if mobj:
                arr = mobj.group(1).split()
                if len(arr) > 0:
                    conf[iface]['type'] = arr[0]
                if len(arr) > 1:
                    conf[iface]['hwaddr'] = arr[1]
                continue
            mobj = re.match('^\s+(inet|inet6)\s+([\d\.\:A-Za-z]+)\/(\d+)($|\s+.*\S)\s*$', line)
            if mobj:
                proto = mobj.group(1)
                if not conf[iface].has_key(proto):
                    conf[iface][proto] = []
                addrinfo = {}
                addrinfo['addr'] = mobj.group(2).lower()
                addrinfo['mask'] = int(mobj.group(3))
                arr = mobj.group(4).split()
                if len(arr) > 0 and arr[0] == 'brd':
                    addrinfo['brd'] = arr[1]
                conf[iface][proto].append(addrinfo)
                continue
        return conf
284199
def find():
        """"""
        names = ('archan.yml', 'archan.yaml', '.archan.yml', '.archan.yaml')
        current_dir = os.getcwd()
        configconfig_file = os.path.join(current_dir, '.configconfig')
        default_config_dir = os.path.join(current_dir, 'config')
        if os.path.isfile(configconfig_file):
            logger.debug('Reading %s to get config folder path',
                         configconfig_file)
            with open(configconfig_file) as stream:
                config_dir = os.path.join(current_dir, stream.read()).strip()
        elif os.path.isdir(default_config_dir):
            config_dir = default_config_dir
        else:
            config_dir = current_dir
        logger.debug('Config folder = %s', config_dir)
        for name in names:
            config_file = os.path.join(config_dir, name)
            logger.debug('Searching for config file at %s', config_file)
            if os.path.isfile(config_file):
                logger.debug('Found %s', config_file)
                return config_file
        logger.debug('No config file found')
        return None
1030082
function locateConfig(url) {
  let configpath = '';

  function check(dir) {
    // Support js, json, and package.json
    const urljs = path.join(dir, DEFAULT_MANIFEST.js);
    const urljson = path.join(dir, DEFAULT_MANIFEST.json);
    const urlpkgjson = path.join(dir, DEFAULT_MANIFEST.pkgjson);
    let urlFinal;

    if (exists((urlFinal = urljs)) || exists((urlFinal = urljson)) || exists((urlFinal = urlpkgjson))) {
      return urlFinal;
    }
    return '';
  }

  if (url) {
    configpath = path.resolve(url);

    try {
      // Try default file name if passed directory
      if (!path.extname(configpath).length || fs.statSync(configpath).isDirectory()) {
        configpath = check(configpath);
        if (!configpath) throw Error('no default found');
      }
    } catch (err) {
      throw Error(strong('buddy') + ' config not found in ' + strong(path.dirname(url)));
    }

    // No url specified
  } else {
    try {
      // Find the first instance of a DEFAULT file based on the current working directory
      configpath = hunt(
        process.cwd(),
        (resource, stat) => {
          if (stat.isFile()) {
            const basename = path.basename(resource);

            return basename == DEFAULT_MANIFEST.js ||
              basename == DEFAULT_MANIFEST.json ||
              basename == DEFAULT_MANIFEST.pkgjson;
          }
        },
        true
      );
    } catch (err) {
      if (!configpath) throw Error(strong('buddy') + ' config not found');
    }
  }

  return configpath;
}
680565
function getPackageConfigMatch(loader, normalized) {
    var pkgName, exactMatch = false, configPath;
    for (var i = 0; i < loader.packageConfigPaths.length; i++) {
      var packageConfigPath = loader.packageConfigPaths[i];
      var p = packageConfigPaths[packageConfigPath] || (packageConfigPaths[packageConfigPath] = createPkgConfigPathObj(packageConfigPath));
      if (normalized.length < p.length)
        continue;
      var match = normalized.match(p.regEx);
      if (match && (!pkgName || (!(exactMatch && p.wildcard) && pkgName.length < match[1].length))) {
        pkgName = match[1];
        exactMatch = !p.wildcard;
        configPath = pkgName + packageConfigPath.substr(p.length);
      }
    }

    if (!pkgName)
      return;

    return {
      packageName: pkgName,
      configPath: configPath
    };
  }