Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.selobj.selectfunction(inputline)
else:
try:
inputline = list()
selector = self._rdmc.app.get_selector()
if options.filter:
inputline.extend(["--filter", options.filter])
if options.includelogs:
inputline.extend(["--includelogs"])
if options.path:
inputline.extend(["--path", options.path])
inputline.extend([selector])
self.selobj.selectfunction(inputline)
except:
raise redfish.ris.NothingSelectedSetError
# ****** CLI ERRORS ******
except cliutils.CommandNotFoundException as excp:
self.retcode = ReturnCodes.UI_CLI_COMMAND_NOT_FOUND_EXCEPTION
UI().command_not_found(excp)
extensions._Commands['HelpCommand'](rdmc=self).run("")
# ****** RMC/RIS ERRORS ******
except redfish.ris.UndefinedClientError:
self.retcode = ReturnCodes.RIS_UNDEFINED_CLIENT_ERROR
UI().error(u"Please login before making a selection")
except redfish.ris.InstanceNotFoundError as excp:
self.retcode = ReturnCodes.RIS_INSTANCE_NOT_FOUND_ERROR
UI().printmsg(excp)
except redfish.ris.CurrentlyLoggedInError as excp:
self.retcode = ReturnCodes.RIS_CURRENTLY_LOGGED_IN_ERROR
UI().error(excp)
except redfish.ris.NothingSelectedError as excp:
self.retcode = ReturnCodes.RIS_NOTHING_SELECTED_ERROR
UI().nothing_selected()
except redfish.ris.NothingSelectedSetError as excp:
self.retcode = ReturnCodes.RIS_NOTHING_SELECTED_SET_ERROR
UI().nothing_selected_set()
except redfish.ris.InvalidSelectionError as excp:
self.retcode = ReturnCodes.RIS_INVALID_SELECTION_ERROR
UI().error(excp)
except redfish.ris.rmc_helper.SessionExpired as excp:
self.retcode = ReturnCodes.RIS_SESSION_EXPIRED
self.app.logout()
UI().printmsg(u"Current session has expired or is invalid, "\
"please login again with proper credentials to continue.\n")
# ****** RMC/RIS ERRORS ******
except redfish.rest.v1.RetriesExhaustedError as excp:
self.retcode = ReturnCodes.V1_RETRIES_EXHAUSTED_ERROR
self.selobj.selectfunction(inputline)
else:
try:
inputline = list()
selector = self._rdmc.app.get_selector()
if options.filter:
inputline.extend(["--filter", options.filter])
if options.includelogs:
inputline.extend(["--includelogs"])
if options.path:
inputline.extend(["--path", options.path])
inputline.extend([selector])
self.selobj.selectfunction(inputline)
except:
raise redfish.ris.NothingSelectedError
#filename validations and checks
self.filename = None
if options.filename and len(options.filename) > 1:
raise InvalidCommandLineError("Save command doesn't support " \
"multiple filenames.")
elif options.filename:
self.filename = options.filename[0]
elif self._rdmc.app.config:
if self._rdmc.app.config._ac__savefile:
self.filename = self._rdmc.app.config._ac__savefile
if not self.filename:
self.filename = __filename__
UI().command_not_found(excp)
extensions._Commands['HelpCommand'](rdmc=self).run("")
# ****** RMC/RIS ERRORS ******
except redfish.ris.UndefinedClientError:
self.retcode = ReturnCodes.RIS_UNDEFINED_CLIENT_ERROR
UI().error(u"Please login before making a selection")
except redfish.ris.InstanceNotFoundError as excp:
self.retcode = ReturnCodes.RIS_INSTANCE_NOT_FOUND_ERROR
UI().printmsg(excp)
except redfish.ris.CurrentlyLoggedInError as excp:
self.retcode = ReturnCodes.RIS_CURRENTLY_LOGGED_IN_ERROR
UI().error(excp)
except redfish.ris.NothingSelectedError as excp:
self.retcode = ReturnCodes.RIS_NOTHING_SELECTED_ERROR
UI().nothing_selected()
except redfish.ris.NothingSelectedSetError as excp:
self.retcode = ReturnCodes.RIS_NOTHING_SELECTED_SET_ERROR
UI().nothing_selected_set()
except redfish.ris.InvalidSelectionError as excp:
self.retcode = ReturnCodes.RIS_INVALID_SELECTION_ERROR
UI().error(excp)
except redfish.ris.rmc_helper.SessionExpired as excp:
self.retcode = ReturnCodes.RIS_SESSION_EXPIRED
self.app.logout()
UI().printmsg(u"Current session has expired or is invalid, "\
"please login again with proper credentials to continue.\n")
# ****** RMC/RIS ERRORS ******
except redfish.rest.v1.RetriesExhaustedError as excp:
self.retcode = ReturnCodes.V1_RETRIES_EXHAUSTED_ERROR
UI().retries_exhausted_attemps()
except redfish.rest.v1.InvalidCredentialsError as excp:
self.retcode = ReturnCodes.V1_INVALID_CREDENTIALS_ERROR