SERVER      IP of the SMB server
        NAME        SCF file name
        CLEANUP     Cleanup (choices: True or False)
766401
def options(self, context, module_options):
        '''
        
        '''

        self.cleanup = False

        if 'CLEANUP' in module_options:
            self.cleanup = bool(module_options['CLEANUP'])

        if 'NAME' not in module_options:
             context.log.error('NAME option is required!')
             exit(1)
  
        if not self.cleanup and 'SERVER' not in module_options:
            context.log.error('SERVER option is required!')
            exit(1)
 
        self.scf_name = module_options['NAME']
        self.scf_path = '/tmp/{}.scf'.format(self.scf_name)
        self.file_path = ntpath.join('\\', '{}.scf'.format(self.scf_name))
  
        if not self.cleanup:
            self.server = module_options['SERVER']
            scuf = open(self.scf_path, 'a');
            scuf.write("[Shell]" + '\n');
            scuf.write("Command=2" + '\n');
            scuf.write("IconFile=" + '\\\\{}\\share\\icon.ico'.format(self.server) + '\n');
            scuf.close();
1066580
private static String cleanupStatusKey(String s) {
        String result = s;
        if (s.startsWith(PREFIX_CONTEXT)) {
            result = s.substring(PREFIX_CONTEXT.length());

        }

        if (s.startsWith(PREFIX_THREAD_POOL)) {
            result = s.substring(PREFIX_THREAD_POOL.length());
        }

        return result;
    }
1196139
function checkServerIP()
    {
        $remoteHostIP   = eZSys::clientIP();
        $serverIPList   = $this->ini->variable( 'ServerSettings', 'ServerIP');

        if ( $serverIPList === false )
        {
            $this->logger->writeTimedString( "Skipped the IP check because ServerIP is not set in the settings. Remote host is: $remoteHostIP.", 'checkServerIP' );
            return true;
        }


        if ( is_array( $serverIPList ) && in_array( $remoteHostIP, $serverIPList ) )
        {
            return true;
        }

        $this->logger->writeTimedString( "server with ip = $remoteHostIP does not exist.", 'checkServerIP failed' );
        $this->logger->writeTimedString( $serverIPList, 'serverIPList from ini file is' );

        return false;
    }
1121934
public static String cleanFilename(String fileName){
        int lastIndex = fileName.lastIndexOf(".");
        return fileName.substring(0, lastIndex);
    }
439834
private function _hostname()
    {
        if (PSI_USE_VHOST === true) {
            if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
        } else {
            if (CommonFunctions::executeProgram('hostname', '', $ret)) {
                $this->sys->setHostname($ret);
            }
        }
    }
190628
public boolean scpGet(String remoteFile, String localDir, String dst, String instanceName) {
        LOG.info("remoteFile:" + remoteFile + " localdir:" + localDir +
                " dst:" + dst + " instanceName:" + instanceName);
        LOG.info("srchost:" + srcHost + "  dsthost:" + dstHost + "  amHost:" + amHost);

        ScpFrom scpFrom = new ScpFrom(srcHost, user, password);
        ScpTo scpTo = new ScpTo(dstHost, user, password);
        Exec exec = new Exec(srcHost, user, password);

        try {
            String execCommand = "cd " + remoteFile + " && cd .. && tar -cf " + instanceName + ".tar "
                    + instanceName;
            LOG.info("execCommand1:" + execCommand);
            exec.execute(execCommand);
            LOG.info("exec success");
        } catch (Exception ex) {
            try {
                exec = new Exec(srcHost, user, oldPassword);
                String execCommand = "cd " + remoteFile + " && cd .. && tar -cf " + instanceName + ".tar "
                        + instanceName;
                LOG.info("execCommand1:" + execCommand);
                exec.execute(execCommand);
                LOG.info("exec success");
            } catch (Exception eex) {
                LOG.error(eex);
                LOG.error("username:" + user + "  password:" + password);
                return false;
            }
        }

        try {
            //
            if (!amHost.split("/")[1].equals(srcHost) && !amHost.split("/")[0].equals(srcHost)) {
                scpFrom.getRemoteFile(remoteFile + ".tar", localDir);
                LOG.info("getRemoteFile:" + remoteFile + ".tar");
            }
        } catch (Exception ex) {
            try {
                scpFrom = new ScpFrom(srcHost, user, oldPassword);
                scpFrom.getRemoteFile(remoteFile + ".tar", localDir);
                LOG.info("getRemoteFile:" + remoteFile + ".tar");
            } catch (Exception eex) {
                LOG.error(eex);
                LOG.error("username:" + user + "  password:" + password);
                return false;
            }
        }

        try {
            if (!amHost.split("/")[1].equals(dstHost) && !amHost.split("/")[0].equals(dstHost)) {
                //put file to remote
                scpTo.putFile(localDir + instanceName + ".tar", localDir);
                LOG.info("putFileToRemote:" + remoteFile + ".tar");
            }
        } catch (Exception ex) {
            try {
                scpTo = new ScpTo(srcHost, user, oldPassword);
                scpTo.putFile(remoteFile + ".tar", localDir);
                LOG.info("putFileToRemote:" + remoteFile + ".tar");
            } catch (Exception eex) {
                LOG.error(eex);
                LOG.error("username:" + user + "  password:" + oldPassword);
                return false;
            }
        }

        try {
            Exec execRemote = new Exec(dstHost, user, password);
            execRemote.execute("cd " + localDir + "  &&  tar -xf " + instanceName + ".tar");
        } catch (Exception ex) {
            try {
                Exec execRemote = new Exec(dstHost, user, oldPassword);
                execRemote.execute("cd " + localDir + "  && tar -xf " + instanceName + ".tar");
            } catch (Exception eex) {
                LOG.error(eex);
                LOG.error("username:" + user + "  password:" + oldPassword);
                return false;
            }
        }

        return true;
    }
888522
def guess_server_name():
    """"""
    if   os.environ.get('CSCSERVICE')          == 'sisu':         return "sisu"
    elif os.environ.get('SLURM_JOB_PARTITION') == 'halvan':       return "halvan"
    elif os.environ.get('SNIC_RESOURCE')       == 'milou':        return "milou"
    elif os.environ.get('LAPTOP')              == 'macbook_air':  return "macbook_air"
    else:                                                         return "unknown"
899225
def prune_dump(sessionid):
    '''
    

    '''
    out = __salt__['cmd.run_all']("xfsinvutil -s {0} -F".format(sessionid))
    _verify_run(out)

    data = _xfs_prune_output(out['stdout'], sessionid)
    if data:
        return data

    raise CommandExecutionError("Session UUID \"{0}\" was not found.".format(sessionid))
1171699
def filename(self):
        
        if self.buildver:
            buildver = '-' + self.buildver
        else:
            buildver = ''
        pyver = '.'.join(self.pyver)
        abi = '.'.join(self.abi)
        arch = '.'.join(self.arch)
        # replace - with _ as a local version separator
        version = self.version.replace('-', '_')
        return '%s-%s%s-%s-%s-%s.whl' % (self.name, version, buildver,
                                         pyver, abi, arch)
905990
def path_mapped(script_name, *args)
    return cleanup_paths("/#{script_name}/#{@locations[:root]}") if args.empty?
    a = replace_symbols(script_name, *args)
    cleanup_paths("/#{script_name}/#{@locations[:root]}/#{a.join('/')}")
  end
1044231
private void purgeFiles(List<File> files, String vfsName, Set<String> scrubbedFiles) {

        for (File file : files) {
            purgeFile(file.getAbsolutePath(), vfsName);
            String rfsName = CmsFileUtil.normalizePath(
                OpenCms.getStaticExportManager().getRfsPrefix(vfsName)
                    + "/"
                    + file.getAbsolutePath().substring(
                        OpenCms.getStaticExportManager().getExportPath(vfsName).length()));
            rfsName = CmsStringUtil.substitute(rfsName, new String(new char[] {File.separatorChar}), "/");
            scrubbedFiles.add(rfsName);
        }
    }
363759
public static function serverIP(): string
    {
        if (!empty($_SERVER['SERVER_ADDR'])) {
            $ip = $_SERVER['SERVER_ADDR'];
        } elseif (!empty($_SERVER['SERVER_NAME'])) {
            $ip = gethostbyname($_SERVER['SERVER_NAME']);
        } else {
            // for php-cli(phpunit etc.)
            $ip = defined('PHPUNIT_RUNNING')
                ? '127.0.0.1'
                : gethostbyname(gethostname());
        }
        return filter_var($ip, FILTER_VALIDATE_IP) ?: '127.0.0.1';
    }
825999
private String cleanupFileName(String fileName) {
    String processedFileName = fileName;

    // strip off path parts
    if (StringUtils.contains(processedFileName, "/")) {
      processedFileName = StringUtils.substringAfterLast(processedFileName, "/");
    }
    if (StringUtils.contains(processedFileName, "\\")) {
      processedFileName = StringUtils.substringAfterLast(processedFileName, "\\");
    }

    // make sure filename does not contain any invalid characters
    processedFileName = Escape.validFilename(processedFileName);

    return processedFileName;
  }
281320
private String getRfsName(File file, String vfsName) {

        CmsStaticExportManager manager = OpenCms.getStaticExportManager();
        String filePath = file.getAbsolutePath();
        String result = CmsFileUtil.normalizePath(
            manager.getRfsPrefix(vfsName)
                + filePath.substring(OpenCms.getStaticExportManager().getExportPath(vfsName).length()));
        return CmsStringUtil.substitute(result, new String(new char[] {File.separatorChar}), "/");
    }
127051
def remove filename
      return false unless source_hash.key?(filename)
      source_hash.delete filename
      true
    end
891869
def _get_server_name(self, handle, service_profile_mo, ucsm_ip):
        
        try:
            resolved_dest = handle.ConfigResolveDn(service_profile_mo.PnDn)
            server_list = resolved_dest.OutConfig.GetChild()
            if not server_list:
                return ""
            return server_list[0].Name
        except Exception as e:
            # Raise a Neutron exception. Include a description of
            # the original  exception.
            raise cexc.UcsmConfigReadFailed(ucsm_ip=ucsm_ip, exc=e)
477873
def cleanup_certificates(options)
      puts 'Cleaning up certificates...' if options[:verbose]
      AgentConfig.certs_files("*.{cert,key}").each { |f| FileUtils.rm_f(f) } # requires that root_dir already known in AgentConfig
    end