List server id and scripts file name
159
function list(scriptModule, agent, msg, cb) {
    const servers = [];
    const scripts = [];
    const idMap = agent.idMap;

    for (const sid in idMap) {
        if (idMap.hasOwnProperty(sid)) {
            servers.push(sid);
        }
    }

    fs.readdir(scriptModule.root, (err, filenames) => {
        if (err) {
            filenames = [];
        }
        for (let i = 0, l = filenames.length; i < l; i++) {
            scripts.push(filenames[i]);
        }

        cb(null, {
            servers: servers,
            scripts: scripts
        });
    });
}
514282
def filenames(self):
        """"""
        return [p.name for p in self.packets if isinstance(p, FileDescriptionPacket)]
1228771
def list_exports(exports='/etc/exports'):
    '''
    
    '''
    ret = {}
    with salt.utils.files.fopen(exports, 'r') as efl:
        for line in salt.utils.stringutils.to_unicode(efl.read()).splitlines():
            if not line:
                continue
            if line.startswith('#'):
                continue
            comps = line.split()

            # Handle the case where the same path is given twice
            if not comps[0] in ret:
                ret[comps[0]] = []

            newshares = []
            for perm in comps[1:]:
                if perm.startswith('/'):
                    newshares.append(perm)
                    continue
                permcomps = perm.split('(')
                permcomps[1] = permcomps[1].replace(')', '')
                hosts = permcomps[0]
                if not isinstance(hosts, six.string_types):
                    # Lists, etc would silently mangle /etc/exports
                    raise TypeError('hosts argument must be a string')
                options = permcomps[1].split(',')
                ret[comps[0]].append({'hosts': hosts, 'options': options})
            for share in newshares:
                ret[share] = ret[comps[0]]
    return ret
358546
def script(server_):
    ''' 
    '''
    return salt.utils.cloud.os_script(
        config.get_cloud_config_value('script', server_, __opts__),
        server_,
        __opts__,
        salt.utils.cloud.salt_config_to_yaml(
            salt.utils.cloud.minion_config(__opts__, server_)
        )
    )
408172
def listscripts(self):
        
        code, data, listing = self.__send_command(
            "LISTSCRIPTS", withcontent=True)
        if code == "NO":
            return None
        ret = []
        active_script = None
        for l in listing.splitlines():
            if self.__size_expr.match(l):
                continue
            m = re.match(br'"([^"]+)"\s*(.+)', l)
            if m is None:
                ret += [l.strip(b'"').decode("utf-8")]
                continue
            script = m.group(1).decode("utf-8")
            if self.__active_expr.match(m.group(2)):
                active_script = script
                continue
            ret += [script]
        self.__dprint(ret)
        return (active_script, ret)
197721
def ifiles(irods_path):
    """"""
    raw_output = subprocess.check_output(
        "ils -r --bundle {0}"
        "    | grep 'Bundle file:'"
        "    | awk '{{print $3}}'".format(irods_path),
        shell=True
    )
    filenames = raw_output.decode('ascii').strip().split("\n")
    return filenames
1166780
def list_scripts(zap_helper):
    """"""
    scripts = zap_helper.zap.script.list_scripts
    output = []
    for s in scripts:
        if 'enabled' not in s:
            s['enabled'] = 'N/A'

        output.append([s['name'], s['type'], s['engine'], s['enabled']])

    click.echo(tabulate(output, headers=['Name', 'Type', 'Engine', 'Enabled'], tablefmt='grid'))
1006233
def display_servers(server_definitions_filename):
    
    servers = ServerDefinitionFile2(server_definitions_filename)

    title = 'List of all servers that can be tested'

    headers = ['Name', 'Url', 'Default_namespace']
    rows = []
    for server in servers.list_all_servers():
        # specifically does not show server user and pw
        rows.append((server.nickname,
                     server.url,
                     server.default_namespace))

    print_table(title, headers, rows, sort_columns=0)
239774
def listCLIExecutables(baseDir):
    """"""
    return [path for path in glob.glob(os.path.join(os.path.normpath(baseDir), '*'))
            if isCLIExecutable(path)]
594368
def get_server_id():
    '''
    
    '''
    # Provides:
    #   server_id

    if salt.utils.platform.is_proxy():
        server_id = {}
    else:
        use_crc = __opts__.get('server_id_use_crc')
        if bool(use_crc):
            id_hash = getattr(zlib, use_crc, zlib.adler32)(__opts__.get('id', '').encode()) & 0xffffffff
        else:
            log.debug('This server_id is computed not by Adler32 nor by CRC32. '
                      'Please use "server_id_use_crc" option and define algorithm you '
                      'prefer (default "Adler32"). Starting with Sodium, the '
                      'server_id will be computed with Adler32 by default.')
            id_hash = _get_hash_by_shell()
        server_id = {'server_id': id_hash}

    return server_id
229366
def _get_file_list(load):
    '''
    
    '''
    if 'env' in load:
        # "env" is not supported; Use "saltenv".
        load.pop('env')

    if 'saltenv' not in load or load['saltenv'] not in envs():
        return []
    ret = set()
    for repo in init():
        repo['repo'].open()
        ref = _get_ref(repo, load['saltenv'])
        if ref:
            manifest = repo['repo'].manifest(rev=ref[1])
            for tup in manifest:
                relpath = os.path.relpath(tup[4], repo['root'])
                # Don't add files outside the hgfs_root
                if not relpath.startswith('../'):
                    ret.add(os.path.join(repo['mountpoint'], relpath))
        repo['repo'].close()
    return sorted(ret)
323282
def __filename(self, id):
        """"""
        suffix = self.fnsuffix()
        filename = "%s-%s.%s" % (self.fnprefix, id, suffix)
        return os.path.join(self.location, filename)
406007
def get_filenames(directory):
    """"""
    for filename in os.listdir(directory):
        if re.search(r"cp\d{2}mu?-manylinux1_\S+\.whl", filename):
            yield filename
433426
def show
      script_listing = Script::Listing.find(params[:listing_id])
      @script_url = script_listing.urls.friendly.find(params[:id])
    end
1272144
def server_show(self, server_id):
        '''
        
        '''
        ret = {}
        try:
            servers = self.server_list_detailed()
        except AttributeError:
            raise SaltCloudSystemExit('Corrupt server in server_list_detailed. Remove corrupt servers.')
        for server_name, server in six.iteritems(servers):
            if six.text_type(server['id']) == server_id:
                ret[server_name] = server
        return ret
413874
def list_js_files(dir):
    
    for dirpath, dirnames, filenames in os.walk(dir):
        for filename in filenames:
            if is_js_file(filename):
                yield os.path.join(dirpath, filename)
1222594
function extractScriptNames() {
  console.log("Extracting script file names from index.html");

  var regexScriptName = /<script src="(.*?)"><\/script>/g;
  var scriptSection = regexScriptSection.exec(indexFile)[1];

  // extract script names
  var names = []; 
  var match;
  while ((match = regexScriptName.exec(scriptSection)) != null) {
    var script = match[1];
    names.push(script);
  }
    
  return names;
}