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 else: sys.stderr.write("WARNING: Unable to enable FIPS mode!\n") except AttributeError: pass class RdmcCommand(RdmcCommandBase): """ Constructor """ def __init__(self, Args=None): RdmcCommandBase.__init__(self, \ name=versioning.__shortname__, \
# always flush stdout and stderr try: CLI = cliutils.CLI() except cliutils.ResourceAllocationError as excp: RdmcError("Unable to allocate more resources.") RdmcError("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 Encryption.check_fips_mode_ssl(): ssl.FIPS_mode_set(int(1)) if ssl.FIPS_mode(): FIPSSTR = "FIPS mode enabled using openssl version %s.\n" % ssl.OPENSSL_VERSION else: sys.stderr.write("WARNING: Unable to enable FIPS mode!\n") except AttributeError: pass class RdmcCommand(RdmcCommandBase): """ Constructor """ def __init__(self, name, usage, summary, aliases, argparser, Args=None): super().__init__(name, usage, summary, aliases, argparser) self._commands = collections.OrderedDict() self.ui = UI(1)