mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-10 12:40:31 -07:00
fix: 🐛 Fix add_rows method
This commit is contained in:
parent
94e7200e42
commit
47073e747d
2 changed files with 6 additions and 4 deletions
plugins
|
@ -114,9 +114,10 @@ class ActionModule(ActionBase):
|
|||
# Configure alignments
|
||||
self._configure_alignments(table, field_names)
|
||||
|
||||
# Add rows
|
||||
# Add rows - use add_row instead of add_rows for compatibility with older versions
|
||||
rows = [[item.get(col, "") for col in field_names] for item in data]
|
||||
table.add_rows(rows)
|
||||
for row in rows:
|
||||
table.add_row(row)
|
||||
|
||||
return table
|
||||
|
||||
|
|
|
@ -146,9 +146,10 @@ def to_prettytable(data, *args, **kwargs):
|
|||
# Configure alignments
|
||||
_configure_alignments(table, field_names, kwargs.get('column_alignments', {}))
|
||||
|
||||
# Add rows
|
||||
# Add rows - use add_row instead of add_rows for compatibility with older versions
|
||||
rows = [[item.get(col, "") for col in field_names] for item in data]
|
||||
table.add_rows(rows)
|
||||
for row in rows:
|
||||
table.add_row(row)
|
||||
|
||||
return to_text(table)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue