Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fixes #249: Add class table view #752

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pywbemtools/pywbemcli/_cmd_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,11 @@ def cmd_class_get(context, classname, options):
the class. If the class cannot be found, the server returns a CIMError
exception.
"""

format_group = get_format_group(context, options)
output_format = validate_output_format(context.output_format, format_group)
# TODO what is this
#format_group = get_format_group(context, options)
#output_format = validate_output_format(context.output_format, format_group)
output_format = validate_output_format(context.output_format, ['CIM',
'TABLE'])

try:
result_class = context.conn.GetClass(
Expand Down Expand Up @@ -745,7 +747,8 @@ def cmd_class_enumerate(context, classname, options):
Enumerate the classes returning a list of classes from the WBEM server.
That match the qualifier filter options
"""
format_group = get_format_group(context, options)
#format_group = get_format_group(context, options)
format_group = ['CIM', 'TABLE', 'TEXT']
output_format = validate_output_format(context.output_format, format_group)

try:
Expand Down
10 changes: 7 additions & 3 deletions pywbemtools/pywbemcli/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,11 +1155,15 @@ def column_is_empty(rows, column):
return False
return True

# Remove empty rows
# Validate row lengths are the same as header length
len_hdr = len(headers)
for row in rows:
assert len(row) == len_hdr, "row: {}\nhdrs: {}". \
format(row, headers)
if len(row) != len_hdr:
import pdb; pdb.set_trace()
assert len(row) == len_hdr, "Header len and row len mismatch:" \
"row_len {} len hdr {}\n" \
"row: {}\nhdrs: {}". \
format(len(row), len_hdr, row, headers)
for column in range(len(headers) - 1, -1, -1):
if column_is_empty(rows, column):
if isinstance(headers, tuple):
Expand Down
Loading