示例#1
0
 def search_content(self, searchKey, filename, hostname="localhost"):
     """
     Search content of a file
     @param searchKey: search key in regular expression
     @param filename: filename
     @param hostname: hostname, default localhost
     @return True or False
     """
     content = self.get_content(filename, hostname)
     return mstring.match_array(content, searchKey)
示例#2
0
文件: FileUtil.py 项目: 50wu/gpdb
 def search_content(self, searchKey, filename, hostname="localhost"):
     """
     Search content of a file
     @param searchKey: search key in regular expression
     @param filename: filename
     @param hostname: hostname, default localhost
     @return True or False
     """
     content = self.get_content(filename, hostname)
     return mstring.match_array(content, searchKey)
示例#3
0
文件: FileUtil.py 项目: 50wu/gpdb
 def exists(self, filename, hostname="localhost"):
     cmdLine = "ls -d %s" % filename
     cmd = Command(name=' Search content of a file', cmdStr = cmdLine)
     cmd.run(validateAfter=False)
     result = cmd.get_results()
     (ok, out) = (result.rc, result.stdout)
     """
     @note: Check content for "No such file or directory"
     [jsoedomo-mbp] /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp
     jsoedomo-mbp:functional jsoedomo$ python /Users/jsoedomo/greenplum-db-devel/bin/gpssh -h jsoedomo-mbp -u jsoedomo ls -d /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp/pgsql_tmp_*
     [jsoedomo-mbp] ls: /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp/pgsql_tmp_*: No such file or directory
     """
     pattern = [".*No such file or directory.*"]
     return not mstring.match_array(out, pattern) # If pattern is not match, then file exist
示例#4
0
 def exists(self, filename, hostname="localhost"):
     cmdLine = "ls -d %s" % filename
     cmd = Command(name=' Search content of a file', cmdStr=cmdLine)
     cmd.run(validateAfter=False)
     result = cmd.get_results()
     (ok, out) = (result.rc, result.stdout)
     """
     @note: Check content for "No such file or directory"
     [jsoedomo-mbp] /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp
     jsoedomo-mbp:functional jsoedomo$ python /Users/jsoedomo/greenplum-db-devel/bin/gpssh -h jsoedomo-mbp -u jsoedomo ls -d /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp/pgsql_tmp_*
     [jsoedomo-mbp] ls: /Users/jsoedomo/Greenplum/cdbfast/private/jsoedomo/storage/gp_filespace_tablespace/gpfs_a_01/primary/gp0/pgsql_tmp/pgsql_tmp_*: No such file or directory
     """
     pattern = [".*No such file or directory.*"]
     return not mstring.match_array(
         out, pattern)  # If pattern is not match, then file exist