• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utilities.find函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sos.utilities.find函数的典型用法代码示例。如果您正苦于以下问题:Python find函数的具体用法?Python find怎么用?Python find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了find函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: postproc

    def postproc(self):
        """
        Obfuscate passwords.
        """

        password_xml_regex = re.compile(r'<password>.*</password>', re.IGNORECASE)

        for dir_ in self.__jbossServerConfigDirs:
            path = os.path.join(self.__jbossHome, dir_)

            self.doRegexSub(os.path.join(path,"configuration","*.xml"),
                            password_xml_regex,
                            r'<password>********</password>')

            tmp = os.path.join(path,"configuration")
            for propFile in find("*-users.properties", tmp):
                self.doRegexSub(propFile,
                                r"=(.*)",
                                r'=********')

#             Remove PW from -ds.xml files
            tmp = os.path.join(path, "deployments")
            for dsFile in find("*-ds.xml", tmp):
                self.doRegexSub(dsFile,
                                password_xml_regex,
                                r"<password>********</password>")
开发者ID:acarboni,项目名称:jboss-as,代码行数:26,代码来源:as7.py


示例2: __getFiles

    def __getFiles(self, configDirAry):
        """
        This function will collect files from JBOSS_HOME for analysis.  The scope of files to
        be collected are determined by options to this SOS plug-in.
        """

        for dir_ in configDirAry:
            path = os.path.join(self.__jbossHome, dir_)
            ## First add forbidden files
            self.addForbiddenPath(os.path.join(path, "tmp"))
            self.addForbiddenPath(os.path.join(path, "work"))
            self.addForbiddenPath(os.path.join(path, "data"))

            if os.path.exists(path):
                ## First get everything in the conf dir
                confDir = os.path.join(path, "configuration")
                self.addForbiddenPath(os.path.join(confDir, 'mgmt-users.properties'))

                self.doCopyFileOrDir(confDir, sub=(self.__jbossHome, 'JBOSSHOME'))
                ## Log dir next
                logDir = os.path.join(path, "log")

                for logFile in find("*", logDir):
                    self.addCopySpecLimit(logFile,
                            self.getOption("logsize"),
                            sub=(self.__jbossHome, 'JBOSSHOME'))

                ## Deploy dir
                deployDir = os.path.join(path, "deployments")

                for deployFile in find("*", deployDir, max_depth=1):
                    self.addCopySpec(deployFile, sub=(self.__jbossHome, 'JBOSSHOME'))
开发者ID:akoledzhikov,项目名称:jboss-as,代码行数:32,代码来源:eap6.py


示例3: __getFiles

    def __getFiles(self, configDirAry):
        """
        This function will collect files from JBOSS_HOME for analysis.  The scope of files to
        be collected are determined by options to this SOS plug-in.
        """

        for dir_ in configDirAry:
            path = os.path.join(self.__jbossHome, dir_)
            ## First add forbidden files
            self.addForbiddenPath(os.path.join(path, "tmp"))
            self.addForbiddenPath(os.path.join(path, "work"))
            self.addForbiddenPath(os.path.join(path, "data"))

            if os.path.exists(path):
                ## First get everything in the conf dir
                confDir = os.path.join(path, "configuration")
                self.addForbiddenPath(os.path.join(confDir, 'mgmt-users.properties'))
                self.addForbiddenPath(os.path.join(confDir, 'application-users.properties'))

                self.doCopyFileOrDir(confDir, sub=(self.__jbossHome, 'JBOSSHOME'))

                for logFile in find("*.log", path):
                    self.addCopySpecLimit(logFile,
                            self.getOption("logsize"),
                            sub=(self.__jbossHome, 'JBOSSHOME'))

                for xml in find("*.xml", path):
                    self.addCopySpec(xml)

                deployment_info = self.__get_deployment_info(confDir)
                deployments = self.__get_deployments(path)
                for deployment in deployments:
                    self.__get_listing_from_deployment(deployment, deployment_info)
开发者ID:marciowerner,项目名称:jboss-as,代码行数:33,代码来源:as7.py


示例4: postproc

    def postproc(self):
        """
        Obfuscate passwords.
        """

        for dir in self.__jbossServerConfigDirs:
            path=os.path.join(self.__jbossHome, "server", dir)
            ## Really annoying that there appears to be no vehicle to
            ## say I want ignore case...argh!
            self.doRegexSub(os.path.join(path,"conf","login-config.xml"),
                            r"\"[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]\".*>.*</[Mm][Oo][Dd][Uu][Ll][Ee]-[Oo][Pp][Tt][Ii][Oo][Nn].*>",
                            r'"password">********</module-option>')

            tmp = os.path.join(path,"conf", "props")
            for propFile in find("*-users.properties", tmp):
                self.doRegexSub(propFile,
                                r"=(.*)",
                                r'=********')

            ## Remove PW from -ds.xml files
            tmp=os.path.join(path, "deploy")
            for dsFile in find("*-ds.xml", tmp):
                self.doRegexSub(dsFile,
                                r"<[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>.*</[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>",
                                r"<password>********</password>")
        return
开发者ID:aravindavk,项目名称:sosreport,代码行数:26,代码来源:jboss.py


示例5: setup

    def setup(self):
        super(RedHatPostgreSQL, self).setup()

        scl = "rh-postgresql95"
        pghome = self.get_option("pghome")

        # Copy PostgreSQL log files.
        for filename in find("*.log", pghome):
            self.add_copy_spec(filename)
        for filename in find("*.log", self.convert_copyspec_scl(scl, pghome)):
            self.add_copy_spec(filename)

        # Copy PostgreSQL config files.
        for filename in find("*.conf", pghome):
            self.add_copy_spec(filename)
        for filename in find("*.conf", self.convert_copyspec_scl(scl, pghome)):
            self.add_copy_spec(filename)

        self.add_copy_spec(os.path.join(pghome, "data", "PG_VERSION"))
        self.add_copy_spec(os.path.join(pghome, "data", "postmaster.opts"))

        self.add_copy_spec_scl(scl, os.path.join(pghome, "data", "PG_VERSION"))
        self.add_copy_spec_scl(scl, os.path.join(
                pghome,
                "data",
                "postmaster.opts"
            )
        )

        if scl in self.scls_matched:
            self.do_pg_dump(scl=scl, filename="pgdump-scl-%s.tar" % scl)
开发者ID:jmagrini,项目名称:sos,代码行数:31,代码来源:postgresql.py


示例6: setup

    def setup(self):
        super(RedHatPostgreSQL, self).setup()

        # Copy PostgreSQL log files.
        for file in find("*.log", self.get_option("pghome")):
            self.add_copy_spec(file)
        # Copy PostgreSQL config files.
        for file in find("*.conf", self.get_option("pghome")):
            self.add_copy_spec(file)

        self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "PG_VERSION"))
        self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "postmaster.opts"))
开发者ID:Nick-Harvey,项目名称:sosreport,代码行数:12,代码来源:postgresql.py


示例7: setup

    def setup(self):
        if self.getOption("dbname"):
            if self.getOption("password"):
                self.tmp_dir = tempfile.mkdtemp()
                self.pg_dump()
            else:
                self.addAlert("WARN: password must be supplied to dump a database.")

        # Copy PostgreSQL log files.
        for file in find("*.log", self.getOption("pghome")):
            self.addCopySpec(file)
        # Copy PostgreSQL config files.
        for file in find("*.conf", self.getOption("pghome")):
            self.addCopySpec(file)

        self.addCopySpec(os.path.join(self.getOption("pghome"), "data" , "PG_VERSION"))
        self.addCopySpec(os.path.join(self.getOption("pghome"), "data" , "postmaster.opts"))
开发者ID:gkotton,项目名称:sosreport,代码行数:17,代码来源:postgresql.py


示例8: __getServerConfigJarInfo

    def __getServerConfigJarInfo(self, configDirAry):

        self.__jbossHTMLBody += """
    <br/>
    <br/>
    <div id="profile-jar-info" style="font-weight: bold;">&ndash; JBoss Server Configurations Jar Information</div>
        """
        for dir in configDirAry:
            serverDir = os.path.join("server", dir)
            path=os.path.join(self.__jbossHome, serverDir)
            if os.path.exists(path):
                nicePath=path.replace(os.sep, "-")
                self.__jbossHTMLBody += """
    <div>
        &mdash; Summary of Jar Files in the <tt>%s</tt> JBoss Server Configuration
        ( <a href="javascript:show('%s')">Show</a> / <a
            href="javascript:hide('%s')">Hide</a> ):
    </div>
    <div id="%s" style="overflow: hidden; display: none">
        <ul style="list-style-type: square">
                """ % (dir, nicePath,nicePath,nicePath)

                found = False
                for jarFile in find("*.jar", path):
                    found = True
                    nicePath=jarFile.replace(os.sep, "-")
                    self.__jbossHTMLBody += """
        <li id="system-jar-info">Jar File: <tt>%s</tt><br/>
            MD5: <tt>%s</tt>
            <br /> Manifest File (
            <a href="javascript:show('%s')">Show</a> /
            <a href="javascript:hide('%s')">Hide</a> ):<br />
            <div id="%s" style="overflow: hidden; display: none">
                <pre>
                %s
                </pre>
            </div>
        </li>
                    """ % (jarFile,
                           self.__getMd5(jarFile),
                           nicePath,
                           nicePath,
                           nicePath,
                           self.__getManifest(jarFile))

                if not found:
                    self.addAlert("WARN: No jars found in the JBoss server configuration (%s)." % (path))

                self.__jbossHTMLBody += """
     </ul>
</div>
            """
            else:
                self.addAlert("ERROR: JBoss server configuration path (" + path + ") does not exist.")

        return
开发者ID:aravindavk,项目名称:sosreport,代码行数:56,代码来源:jboss.py


示例9: __getFiles

    def __getFiles(self, configDirAry):
        """
        This function will collect files from JBOSS_HOME for analysis.  The scope of files to
        be collected are determined by options to this SOS plug-in.
        """

        for dir in configDirAry:
            path=os.path.join(self.__jbossHome, "server", dir)
            ## First add forbidden files
            self.addForbiddenPath(os.path.join(path, "tmp"))
            self.addForbiddenPath(os.path.join(path, "work"))
            self.addForbiddenPath(os.path.join(path, "data"))

            if os.path.exists(path):
                ## First get everything in the conf dir
                confDir=os.path.join(path, "conf")
                self.doCopyFileOrDir(confDir)
                ## Log dir next
                logDir=os.path.join(path, "log")

                for logFile in find("*", logDir):
                    self.addCopySpecLimit(logFile, self.getOption("logsize"))
                ## Deploy dir
                deployDir=os.path.join(path, "deploy")

                for deployFile in find("*", deployDir, max_depth=1):
                    self.addCopySpec(deployFile)

                ## Get application deployment descriptors if designated.
                if self.isOptionEnabled("appxml"):
                    appxml=self.getOption("appxml")
                    ## I'd rather use comma as the delimiter but getOption doesn't seem to be passing it through.
                    ## Since we are using spaces as the delimiter, we need to filter out empty list elements
                    ## if the user did something like ' all   default  web '.
                    appxml=appxml.split(' ')
                    ## Flter(None doesn't  work.  Allows 0.
                    appxml=filter(lambda x: len(x), appxml)
                    for app in appxml:
                        pat = os.path.join("*%s*" % (app,), "WEB-INF")
                        for file in find("*.xml", deployDir, path_pattern=pat):
                            self.addCopySpec(file)
        return
开发者ID:aravindavk,项目名称:sosreport,代码行数:42,代码来源:jboss.py


示例10: setup

    def setup(self):
        super(RedHatPostgreSQL, self).setup()

        pghome = self.get_option("pghome")

        scl = None
        for pkg in self.packages[1:]:
            # The scl name, package name, and service name all differ slightly
            # but is at least consistent in doing so across versions, so we
            # need to do some mangling here
            if self.service_is_running(pkg.replace('-server', '')):
                scl = pkg.split('-postgresql-')[0]

        # Copy PostgreSQL log files.
        for filename in find("*.log", pghome):
            self.add_copy_spec(filename)
        for filename in find("*.log", self.convert_copyspec_scl(scl, pghome)):
            self.add_copy_spec(filename)

        # Copy PostgreSQL config files.
        for filename in find("*.conf", pghome):
            self.add_copy_spec(filename)
        for filename in find("*.conf", self.convert_copyspec_scl(scl, pghome)):
            self.add_copy_spec(filename)

        self.add_copy_spec(os.path.join(pghome, "data", "PG_VERSION"))
        self.add_copy_spec(os.path.join(pghome, "data", "postmaster.opts"))

        self.add_copy_spec_scl(scl, os.path.join(pghome, "data", "PG_VERSION"))
        self.add_copy_spec_scl(scl, os.path.join(
                pghome,
                "data",
                "postmaster.opts"
            )
        )

        if scl and scl in self.scls_matched:
            self.do_pg_dump(scl=scl, filename="pgdump-scl-%s.tar" % scl)
开发者ID:robbmanes,项目名称:sos,代码行数:38,代码来源:postgresql.py


示例11: __get_deployment_info

 def __get_deployment_info(self, dir_):
     """Gets the deployment name to sha1 mapping for all deployments defined
     in configs under dir_"""
     deployment_info = {}
     for config in find("*.xml", dir_):
         root = ElementTree.parse(config).getroot()
         # the namespace is harder to fetch than it should be
         ns = root.tag.rpartition("}")[0]
         ns += "}"
         for deployment in root.findall("./%sdeployments/%sdeployment" % (ns, ns)):
             name = deployment.attrib.get("name")
             sha1 = deployment.getchildren()[0].attrib.get("sha1")
             deployment_info[sha1] = name
     return deployment_info
开发者ID:Aldjinn,项目名称:jboss-as,代码行数:14,代码来源:as7.py


示例12: postproc

    def postproc(self):
        """
        Obfuscate passwords.
        """

        for dir_ in self.__jbossServerConfigDirs:
            path = os.path.join(self.__jbossHome, dir_)

            self.doRegexSub(os.path.join(path,"configuration","login-config.xml"),
                            re.compile(r'"password".*>.*</module-option>', re.IGNORECASE),
                            r'"password">********</module-option>')

            tmp = os.path.join(path,"conf", "props")
            for propFile in find("*-users.properties", tmp):
                self.doRegexSub(propFile,
                                r"=(.*)",
                                r'=********')

#             Remove PW from -ds.xml files
            tmp = os.path.join(path, "deploy")
            for dsFile in find("*-ds.xml", tmp):
                self.doRegexSub(dsFile,
                                re.compile(r"<password.*>.*</password.*>", re.IGNORECASE),
                                r"<password>********</password>")
开发者ID:StatensPensjonskasse,项目名称:jboss-as,代码行数:24,代码来源:eap6.py


示例13: __getStdJarInfo

 def __getStdJarInfo(self):
     found = False
     jar_info_list = []
     for jarFile in find("*.jar", self.__jbossHome):
         checksum = self.__getMd5(jarFile)
         manifest = self.__getManifest(jarFile)
         path = jarFile.replace(self.__jbossHome, 'JBOSSHOME')
         if manifest:
             manifest = manifest.strip()
         jar_info_list.append((path, checksum, manifest))
         found = True
     if found:
         jar_info_list.sort()
         self.addStringAsFile("\n".join([
             "%s\n%s\n%s\n" % (name, checksum, manifest)
             for (name, checksum, manifest) in jar_info_list]),
             'jarinfo.txt')
     else:
         self.addAlert("WARN: No jars found in JBoss system path (" + self.__jbossHome + ").")
开发者ID:acarboni,项目名称:jboss-as,代码行数:19,代码来源:as7.py


示例14: test_find_leaf

 def test_find_leaf(self):
     leaves = find("leaf", TEST_DIR)
     self.assertTrue(any(name.endswith("leaf") for name in leaves))
开发者ID:bcrochet,项目名称:sosreport,代码行数:3,代码来源:utilities_tests.py


示例15: test_not_in_pattern

 def test_not_in_pattern(self):
     leaves = find("leaf", TEST_DIR, path_pattern="tests/path")
     self.assertFalse(any(name.endswith("leaf") for name in leaves))
开发者ID:bcrochet,项目名称:sosreport,代码行数:3,代码来源:utilities_tests.py


示例16: test_too_shallow

 def test_too_shallow(self):
     leaves = find("leaf", TEST_DIR, max_depth=1)
     self.assertFalse(any(name.endswith("leaf") for name in leaves))
开发者ID:bcrochet,项目名称:sosreport,代码行数:3,代码来源:utilities_tests.py


示例17: __get_deployments

 def __get_deployments(self, path):
     return list(chain(
         find("*", os.path.join(path, "deployments")),
         find("content", path)))
开发者ID:Aldjinn,项目名称:jboss-as,代码行数:4,代码来源:as7.py



注:本文中的sos.utilities.find函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utilities.grep函数代码示例发布时间:2022-05-27
下一篇:
Python policies.PackageManager类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap