2 show introspection commandline
4 Copyright 2007, Red Hat, Inc
7 This software may be freely redistributed under the terms of the GNU
8 general public license.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software
12 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 from func
.overlord
import command
21 from func
.overlord
import client
26 class ShowHardware(client
.command
.Command
):
28 usage
= "show hardware details"
30 # FIXME: we might as well make verbose be in the subclass
31 # and probably an inc variable while we are at it
33 self
.parser
.add_option("-v", "--verbose", dest
="verbose",
35 self
.parser
.add_option("-p", "--port", dest
="port")
38 def handleOptions(self
, options
):
39 self
.port
= DEFAULT_PORT
41 self
.port
= self
.options
.port
43 def parse(self
, argv
):
45 return command
.Command
.parse(self
,argv
)
49 self
.server_spec
= self
.parentCommand
.parentCommand
.server_spec
51 client_obj
= client
.Client(self
.server_spec
,
54 verbose
=self
.options
.verbose
,
57 results
= client_obj
.run("hardware", "info", [])
60 top_options
= ["port","verbose"]
62 for minion
in results
:
64 minion_data
= results
[minion
]
67 pprint
.pprint(minion_data
)
71 if arg
in minion_data
:
72 print minion_data
[arg
]
75 class Show(client
.command
.Command
):
77 usage
= "various simple report stuff"
78 subCommandClasses
= [ShowHardware
]
80 self
.parser
.add_option("-v", "--verbose", dest
="verbose",
82 self
.parser
.add_option("-p", "--port", dest
="port",
85 def handleOptions(self
, options
):
86 self
.options
= options
88 self
.verbose
= options
.verbose
89 self
.port
= options
.port
92 def parse(self
, argv
):
95 return command
.Command
.parse(self
, argv
)