本文整理汇总了Python中dockertest.dockercmd.NoFailDockerCmd.subargs方法的典型用法代码示例。如果您正苦于以下问题:Python NoFailDockerCmd.subargs方法的具体用法?Python NoFailDockerCmd.subargs怎么用?Python NoFailDockerCmd.subargs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dockertest.dockercmd.NoFailDockerCmd
的用法示例。
在下文中一共展示了NoFailDockerCmd.subargs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_once
# 需要导入模块: from dockertest.dockercmd import NoFailDockerCmd [as 别名]
# 或者: from dockertest.dockercmd.NoFailDockerCmd import subargs [as 别名]
def run_once(self):
super(every_last, self).run_once()
total = len(self.sub_stuff['lastfiles'])
self.sub_stuff['expected_total'] = total
self.loginfo("Testing copy of %d files from container" % total)
self.sub_stuff['results'] = {} # cont_path -> cmdresult
# Avoid excessive logging
nfdc = NoFailDockerCmd(self, 'cp', verbose=False)
nfdc.quiet = True
nfiles = 0
for index, srcfile in enumerate(self.sub_stuff['lastfiles']):
if index % 100 == 0:
self.loginfo("Copied %d of %d", index, total)
cont_path = "%s:%s" % (self.sub_stuff['container_name'], srcfile)
host_path = self.tmpdir
host_fullpath = os.path.join(host_path, os.path.basename(srcfile))
nfdc.subargs = [cont_path, host_path]
nfdc.execute()
self.failif(not os.path.isfile(host_fullpath),
"Not a file: '%s'" % host_fullpath)
nfiles += 1
if nfiles >= self.config['max_files']:
break