def __init__(self, name, usage, summary, aliases=None, optparser=None): self.name = name self.summary = summary self.aliases = aliases self.config_required = True # does the command access config data if optparser is None: self.parser = cliutils.CustomOptionParser() else: self.parser = optparser self.parser.usage = usage self._cli = cliutils.CLI()
pkgName = 'extensions' + pkgName try: extensions.Commands[cName] = getattr(\ importlib.import_module(pkgName), cName) except Exception as excp: sys.stderr.write("Error locating extension %s at location %s\n" % \ (cName, 'extensions' + name)) raise excp #---------End of imports--------- # always flush stdout and stderr sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0) try: CLI = cliutils.CLI() except cliutils.ResourceAllocationError as excp: sys.stdout.write("Unable to allocate more resources.\n") sys.stdout.write("ILOREST return code: %s\n" % \ ReturnCodes.RESOURCE_ALLOCATION_ISSUES_ERROR) sys.exit(ReturnCodes.RESOURCE_ALLOCATION_ISSUES_ERROR) try: # enable fips mode if our special functions are available in _ssl and OS is # in FIPS mode FIPSSTR = "" if Encryption.check_fips_mode_os() and not ssl.FIPS_mode(): ssl.FIPS_mode_set(long(1)) if ssl.FIPS_mode(): FIPSSTR = "FIPS mode enabled using openssl version %s.\n" % \ ssl.OPENSSL_VERSION