本文整理汇总了Python中jnpr.jsnapy.check.Comparator.compare_diff方法的典型用法代码示例。如果您正苦于以下问题:Python Comparator.compare_diff方法的具体用法?Python Comparator.compare_diff怎么用?Python Comparator.compare_diff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jnpr.jsnapy.check.Comparator
的用法示例。
在下文中一共展示了Comparator.compare_diff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_arguments
# 需要导入模块: from jnpr.jsnapy.check import Comparator [as 别名]
# 或者: from jnpr.jsnapy.check.Comparator import compare_diff [as 别名]
def check_arguments(self):
"""
checks combination of arguments given from command line and display help if correct
set of combination is not given.
:return: print message in command line, regarding correct usage of JSNAPy
"""
## only four test operation is permitted, if given anything apart from this, then it should print error message
if (self.args.snap is False and self.args.snapcheck is False and self.args.check is False and self.args.diff is False and self.args.version is False):
self.logger.error(colorama.Fore.RED +
"Arguments not given correctly, Please refer help message", extra=self.log_detail)
self.parser.print_help()
sys.exit(1)
if(((self.args.snap is True and (self.args.pre_snapfile is None or self.args.file is None)) or
(self.args.snapcheck is True and self.args.file is None) or
(self.args.check is True and self.args.file is None)) and
(self.args.testfiles is None or self.args.hostname is None)
):
self.logger.error(colorama.Fore.RED +
"Arguments not given correctly, Please refer help message", extra=self.log_detail)
self.parser.print_help()
sys.exit(1)
if self.args.diff is True:
if (self.args.pre_snapfile is not None and os.path.isfile(self.args.pre_snapfile)) and (
self.args.post_snapfile is not None and os.path.isfile(self.args.post_snapfile)):
comp = Comparator()
comp.compare_diff(
self.args.pre_snapfile,
self.args.post_snapfile,
None)
sys.exit(1)
else:
if (self.args.file is None) and (
self.args.testfiles is None or self.args.hostname is None):
self.parser.print_help()
sys.exit(1)