当前位置: 首页>>代码示例>>Python>>正文


Python DockerContainers.list_containers_with_name方法代码示例

本文整理汇总了Python中dockertest.containers.DockerContainers.list_containers_with_name方法的典型用法代码示例。如果您正苦于以下问题:Python DockerContainers.list_containers_with_name方法的具体用法?Python DockerContainers.list_containers_with_name怎么用?Python DockerContainers.list_containers_with_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dockertest.containers.DockerContainers的用法示例。


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

示例1: container_cleanup

# 需要导入模块: from dockertest.containers import DockerContainers [as 别名]
# 或者: from dockertest.containers.DockerContainers import list_containers_with_name [as 别名]
 def container_cleanup(self):
     """
     Cleanup the container
     """
     if self.sub_stuff.get('container_name') is None:
         return  # Docker was not created, we are clean
     containers = DockerContainers(self.parent_subtest)
     name = self.sub_stuff['container_name']
     conts = containers.list_containers_with_name(name)
     if conts == []:
         return  # Docker was created, but apparently doesn't exist, clean
     elif len(conts) > 1:
         msg = ("Multiple containers matches name %s, not removing any of "
                "them...", name)
         raise xceptions.DockerTestError(msg)
     NoFailDockerCmd(self, 'rm', ['--force', '--volumes', name],
                     verbose=False).execute()
开发者ID:Acidburn0zzz,项目名称:autotest-docker,代码行数:19,代码来源:kill.py

示例2: postprocess

# 需要导入模块: from dockertest.containers import DockerContainers [as 别名]
# 或者: from dockertest.containers.DockerContainers import list_containers_with_name [as 别名]
 def postprocess(self):
     super(psa, self).postprocess()
     cl0_len = len(self.stuff['cl0'])
     cl1_len = len(self.stuff['cl1'])
     cl2_len = len(self.stuff['cl2'])
     self.failif(cl1_len <= cl0_len, "Container list length did not "
                                     "increase.")
     self.failif(cl1_len != cl2_len, "Third container list length did "
                                     "not stay same as second list.")
     # TODO: Use 'inspect' command output to get actual PID
     #       and utils.pid_is_alive(PID) to verify it's stopped
     # Might as well do some more checking
     dc = DockerContainers(self, 'cli')  # check output
     cnts = dc.list_containers_with_name(self.stuff['container_name'])
     self.failif(len(cnts) < 1, "Test container not found in list")
     cnt = cnts[0]
     self.failif(str(cnt.status) != "Exit 0", "Exit status mismatch")
开发者ID:xiaoqing-wei,项目名称:autotest-docker,代码行数:19,代码来源:psa.py


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