Skip to content

Commit b30e123

Browse files
committed
Fixes issue #249, add table view of cim classes
Adds functions to display class(es) as a table.
1 parent acc0d06 commit b30e123

File tree

4 files changed

+565
-19
lines changed

4 files changed

+565
-19
lines changed

pywbemtools/pywbemcli/_cmd_class.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,11 @@ def cmd_class_get(context, classname, options):
711711
the class. If the class cannot be found, the server returns a CIMError
712712
exception.
713713
"""
714-
715-
format_group = get_format_group(context, options)
716-
output_format = validate_output_format(context.output_format, format_group)
714+
# TODO what is this
715+
#format_group = get_format_group(context, options)
716+
#output_format = validate_output_format(context.output_format, format_group)
717+
output_format = validate_output_format(context.output_format, ['CIM',
718+
'TABLE'])
717719

718720
try:
719721
result_class = context.conn.GetClass(
@@ -745,7 +747,8 @@ def cmd_class_enumerate(context, classname, options):
745747
Enumerate the classes returning a list of classes from the WBEM server.
746748
That match the qualifier filter options
747749
"""
748-
format_group = get_format_group(context, options)
750+
#format_group = get_format_group(context, options)
751+
format_group = ['CIM', 'TABLE', 'TEXT']
749752
output_format = validate_output_format(context.output_format, format_group)
750753

751754
try:

pywbemtools/pywbemcli/_common.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1155,11 +1155,15 @@ def column_is_empty(rows, column):
11551155
return False
11561156
return True
11571157

1158-
# Remove empty rows
1158+
# Validate row lengths are the same as header length
11591159
len_hdr = len(headers)
11601160
for row in rows:
1161-
assert len(row) == len_hdr, "row: {}\nhdrs: {}". \
1162-
format(row, headers)
1161+
if len(row) != len_hdr:
1162+
import pdb; pdb.set_trace()
1163+
assert len(row) == len_hdr, "Header len and row len mismatch:" \
1164+
"row_len {} len hdr {}\n" \
1165+
"row: {}\nhdrs: {}". \
1166+
format(len(row), len_hdr, row, headers)
11631167
for column in range(len(headers) - 1, -1, -1):
11641168
if column_is_empty(rows, column):
11651169
if isinstance(headers, tuple):

0 commit comments

Comments
 (0)