本文整理汇总了Python中CShowParser.CShowParser.parse_image_existence方法的典型用法代码示例。如果您正苦于以下问题:Python CShowParser.parse_image_existence方法的具体用法?Python CShowParser.parse_image_existence怎么用?Python CShowParser.parse_image_existence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShowParser.CShowParser
的用法示例。
在下文中一共展示了CShowParser.parse_image_existence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_image_existence
# 需要导入模块: from CShowParser import CShowParser [as 别名]
# 或者: from CShowParser.CShowParser import parse_image_existence [as 别名]
def check_image_existence (self, img_name):
""" check_image_existence(self, img_name) -> boolean
Parameters
----------
img_name : str
a string represents the image name.
Check if the image file defined in the platform_config already loaded into the platform.
"""
search_drives = ['bootflash', 'harddisk', self.running_image['drive']]
for search_drive in search_drives:
command = "dir {drive}: | include {image}".format(drive = search_drive, image = img_name)
response = self.cmd_link.run_single_command(command, timeout = 10)
if CShowParser.parse_image_existence(response, img_name):
self.needed_image_path = '%s:/%s' % (search_drive, img_name)
print('Found image in platform:', self.needed_image_path)
return True
return False