本文整理汇总了Python中cloudmesh_base.Shell.Shell.cat方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.cat方法的具体用法?Python Shell.cat怎么用?Python Shell.cat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_base.Shell.Shell
的用法示例。
在下文中一共展示了Shell.cat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _grep
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import cat [as 别名]
def _grep(self, search, platform):
if not search:
search = "'OS_PASSWORD': '[a-zA-Z0-9]+'"
cmd = "egrep -ri \"{0}\" * | cut -d\":\" -f1 > a.tmp".format(search)
print("[{0}]:{1}".format(platform, cmd))
os.system(cmd)
res = Shell.cat("a.tmp")
if res:
print ('[{0}]: [ERROR] PASSWORD(OR SECRET KEY) DETECTED, SEE FILES '
'BELOW'.format(platform))
print ("")
print (res)
else:
print ("[{0}]: NO PASSWORD DETECTED".format(platform))
Shell.rm("a.tmp")
print ("")
示例2: test_15_jobscript
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import cat [as 别名]
def test_15_jobscript(self):
HEADING()
db = self.db
db.connect()
name = "test1"
contents = "hallo"
db.add_script(name, contents)
db.add_script("test2", "other")
script = db.get_script(name)
print ("Script:", script)
print ("Content:", contents)
db.write_script(name, "/tmp/script.txt")
what = Shell.cat("/tmp/script.txt")
assert contents == what
assert contents == script