本文整理匯總了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