How to use the redfish.ris.InstanceNotFoundError function in redfish

To help you get started, we’ve selected a few redfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DMTF / python-redfish-utility / src / extensions / COMMANDS / TypesCommand.py View on Github external
typeslist = sorted(set(self._rdmc.app.types()))

                if not returntypes:
                    sys.stdout.write("Type options:")
                    sys.stdout.write('\n')

                    for item in typeslist:
                        sys.stdout.write(item)
                        sys.stdout.write('\n')
                else:
                    return typeslist
            else:
                raise InvalidCommandLineError("The 'types' command does not "\
                                                        "take any arguments.")

        except redfish.ris.InstanceNotFoundError as infe:
            raise redfish.ris.InstanceNotFoundError(infe)
github DMTF / python-redfish-utility / src / rdmc.py View on Github external
except InvalidMSCfileInputError as excp:
            self.retcode = ReturnCodes.MULTIPLE_SERVER_INPUT_FILE_ERROR
            UI().multiple_server_config_input_file(excp)
        except FailureDuringCommitError as excp:
            self.retcode = ReturnCodes.FAILURE_DURING_COMMIT_OPERATION
            UI().error(excp)
        # ****** 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
github DMTF / python-redfish-utility / src / extensions / COMMANDS / LoginCommand.py View on Github external
sel = sel.strip()
                        val = val.strip()

                        if val.lower() == "true" or val.lower() == "false":
                            val = val.lower() in ("yes", "true", "t", "1")
                    except:
                        raise InvalidCommandLineError("Invalid filter" \
                        " parameter format. [filter_attribute]=[filter_value]")

                self._rdmc.app.select(query=options.selector, sel=sel, val=val)

                if self._rdmc.opts.verbose:
                    sys.stdout.write("Selected option: '%s'" % options.selector)
                    sys.stdout.write('\n')
            except Exception as excp:
                raise redfish.ris.InstanceNotFoundError(excp)
github DMTF / python-redfish-utility / src / extensions / COMMANDS / TypesCommand.py View on Github external
if not returntypes:
                    sys.stdout.write("Type options:")
                    sys.stdout.write('\n')

                    for item in typeslist:
                        sys.stdout.write(item)
                        sys.stdout.write('\n')
                else:
                    return typeslist
            else:
                raise InvalidCommandLineError("The 'types' command does not "\
                                                        "take any arguments.")

        except redfish.ris.InstanceNotFoundError as infe:
            raise redfish.ris.InstanceNotFoundError(infe)
github DMTF / python-redfish-utility / src / extensions / COMMANDS / SelectCommand.py View on Github external
sys.stdout.write('%s' % ', '.join(map(str, templist)))
                    sys.stdout.write('\n')
            else:
                selector = self._rdmc.app.get_selector()

                if selector:
                    sys.stdout.write("Current selection: '%s'" % selector)
                    sys.stdout.write('\n')
                else:
                    raise InvalidCommandLineError("No type currently selected."\
                                " Please use the 'types' command to\nget a" \
                                " list of types, or pass your type by using" \
                                " the '--selector' flag.")

        except redfish.ris.InstanceNotFoundError as infe:
            raise redfish.ris.InstanceNotFoundError(infe)