本文整理汇总了Python中cloudmesh_base.Shell.Shell.rm方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.rm方法的具体用法?Python Shell.rm怎么用?Python Shell.rm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_base.Shell.Shell
的用法示例。
在下文中一共展示了Shell.rm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _grep
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import rm [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: run
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import rm [as 别名]
def run(self):
banner("Reset the cloudmesh management yaml files ")
yaml_files = ['cloudmesh_user.yaml', 'cloudmesh_project.yaml']
dir_path = path_expand("~/.cloudmesh/{0}".format("accounts"))
if not os.path.exists(dir_path):
Shell.mkdir(dir_path)
for yaml_file in yaml_files:
filename = path_expand("~/.cloudmesh/{0}/{1}".format("accounts", yaml_file))
if os.path.isfile(filename):
Console.info("Removing file: {0}".format(filename))
Shell.rm(filename)
Console.info("Copying file: {0} -> {1} ".format(path_expand("etc/{0}/{1}".format("accounts", yaml_file)), filename))
shutil.copy("etc/{0}/{1}".format("accounts", yaml_file), path_expand("~/.cloudmesh/{0}/{1}".format("accounts", yaml_file)))
else:
Console.info("Copying file: {0} -> {1} ".format(path_expand("etc/{0}/{1}".format("accounts", yaml_file)), filename))
shutil.copy("etc/{0}/{1}".format("accounts", yaml_file), path_expand("~/.cloudmesh/{0}/{1}".format("accounts", yaml_file)))