dirname = os.path.join(dirname, "files") for root, dirs, files in os.walk(dirname): for _filename in files: print(_filename) _filename = os.path.join(root, _filename) with open(_filename, "rb") as fp: for lineno, line in enumerate(fp): for obj in objects: if obj.klass in line or obj.name in line: referenced_objects[obj].append( (_filename, lineno)) print(referenced_objects) out_file.write("{}\n".format(filename)) for obj, refs in referenced_objects.items(): out_file.write("\n\t{}\n".format(obj)) for ref in refs: out_file.write("\t\t{0} {1}\n".format(*ref)) if __name__ == "__main__": cli = Cli(main=main) try: cli.run() except SystemExit: pass except: make_logger("error").exception( "Sorry, an unhandled exception occurred") raise
for domain in _domains: changed = False print "\t", domain config = appliance.get_config(domain=domain, persisted=False) config = etree.fromstring(str(config)) objs = config.xpath('.//*[./DebugMode/text()="on"]') if len(objs): change = True for obj in objs: if not ignore_unsaved and obj.find("DebugMode").attrib.get("persisted") == "false": appliance.request.clear() request = appliance.request.request(domain=domain).modify_config()[obj.tag](name=obj.attrib.get("name")) request.append(debug_mode_off) if not dry_run: print(appliance.send_request()) else: print(appliance.request) if save_config and not dry_run and changed: appliance.SaveConfig(domain=domain) if __name__ == "__main__": cli = Cli(main=main, description=__doc__) try: cli.run() except SystemExit: pass except: make_logger("error").exception("An unhandled exception occurred") raise
print "Output of installation:\n" for line in out.splitlines(): print "\t", line if err: print "Errors were encountered during installation:\n" for line in err.splitlines(): print "\t", line else: print "No Errors were encountered during installation" print "See more details in log file: {}".format(os.path.join( dist_dir, "install.log")) if remove_build_dir: # Get out of build_dir so we can zip it up os.chdir(cwd) shutil.rmtree(build_dir) print "\n\nhotfix zip can be found here: {}".format(output_file) if __name__ == "__main__": try: cli = Cli(main=main, description=dedent(main.__doc__)) cli.run() except SystemExit: pass except: make_logger("error").exception( "An unhandled exception occurred during execution") raise