diff options
author | George Kraft <george.kraft@calxeda.com> | 2012-10-04 10:02:10 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2012-10-04 10:02:10 -0500 |
commit | d0f5f6ee7740be4d3936a0cd573ef9a72df86a46 (patch) | |
tree | 41c795eab9a368a3c6b64ff07e1eea1278805f4d | |
parent | bb18e2241e8117aaa6451fae3e9f4ed0262472ad (diff) | |
download | pyipmi-d0f5f6ee7740be4d3936a0cd573ef9a72df86a46.tar.gz |
CXMAN-92: Add bindings for the ipmitool "info card" command
-rw-r--r-- | pyipmi/bmc.py | 3 | ||||
-rw-r--r-- | pyipmi/commands/info.py | 25 | ||||
-rw-r--r-- | pyipmi/info.py | 4 |
3 files changed, 31 insertions, 1 deletions
diff --git a/pyipmi/bmc.py b/pyipmi/bmc.py index a214218..693303e 100644 --- a/pyipmi/bmc.py +++ b/pyipmi/bmc.py @@ -435,6 +435,9 @@ class BMC(object): def get_info_basic(self): return self.handle.info_basic() + def get_info_card(self): + return self.handle.info_card() + class LanBMC(BMC): """A BMC that's accessed over the LAN""" diff --git a/pyipmi/commands/info.py b/pyipmi/commands/info.py index b4ebc75..0801705 100644 --- a/pyipmi/commands/info.py +++ b/pyipmi/commands/info.py @@ -31,6 +31,8 @@ from .. import Command from pyipmi.info import * +from pyipmi.tools.responseparser import ResponseParserMixIn +from pyipmi import IpmiError class InfoBasicCommand(Command): """ Describes the cxoem info basic IPMI command @@ -69,6 +71,27 @@ class InfoBasicCommand(Command): return result +class InfoCardCommand(Command, ResponseParserMixIn): + """ Describes the cxoem info card IPMI command + """ + + name = "Retrieve card info" + + ipmitool_args = ["cxoem", "info", "card"] + + result_type = InfoCardResult + response_fields = { + 'Board Type' : {'attr' : 'type'}, + 'Board Revision' : {'attr' : 'revision'} + } + + def parse_results(self, out, err): + result = ResponseParserMixIn.parse_results(self, out, err) + if not (hasattr(result, 'type') and hasattr(result, 'revision')): + raise IpmiError(out.strip()) + return result + info_commands = { - "info_basic" : InfoBasicCommand + "info_basic" : InfoBasicCommand, + "info_card" : InfoCardCommand } diff --git a/pyipmi/info.py b/pyipmi/info.py index 6ba8532..2cd0072 100644 --- a/pyipmi/info.py +++ b/pyipmi/info.py @@ -34,3 +34,7 @@ class InfoBasicResult(object): """Object to hold info basic results""" pass + +class InfoCardResult(object): + """Object to hold info card results""" + pass |