DMTF / Redfishtool

A Python34 program that implements a command line tool for accessing the Redfish API.
Other
231 stars 69 forks source link

Question: how can I use redfishtool from the code #45

Closed ghost closed 6 years ago

ghost commented 6 years ago

The documentation for redfishtool very well describes how to use it as a command line utility, but there is no information how to use modules to write code. For example, if I want to get root:

`from redfishtool.ServiceRoot import RfServiceRoot

root = RfServiceRoot.getServiceRoot () print (root)`

Executed with an error: root = RfServiceRoot.getServiceRoot () TypeError: getServiceRoot () missing 2 required positional arguments: 'self' and 'rft' And how can I choose a port for example. What is rft and where to take these all abbreviations. Help please start using this module

billdodd commented 6 years ago

Redfishtool is designed to be a command-line tool rather than a programmatic API. For programmatic use, you probably would be better off using python-redfish-library.

That said, it is possible to use Redfishtool programmatically (albeit a bit awkward). For a couple of examples, see:

  1. https://github.com/DMTF/Redfish-Usecase-Checkers/blob/master/account_management/account_management.py
  2. https://github.com/DMTF/Redfish-Usecase-Checkers/blob/master/power_control/power_control.py
mraineri commented 6 years ago

Discussion 6/7: the group agrees that using Redfishtool as a module really isn't the right approach. While we did that in a couple of instances, we should consider changing those other tools to leverage the python-redfish-library.

mraineri commented 6 years ago

7/19: Our stance is still that redfishtool is a standalone tool and not meant for being a module in an application.