Skip to content

Commit

Permalink
Remove CSV parser workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapaioa committed Oct 2, 2024
1 parent e28c712 commit a0f4af9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions robottelo/cli/hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import re

from robottelo.config import logger
from robottelo.logging import logger


def _normalize(header):
Expand Down Expand Up @@ -39,14 +39,6 @@ def _normalize_obj(obj):

def parse_csv(output):
"""Parse CSV output from Hammer CLI and return a Python dictionary."""

# https://projects.theforeman.org/issues/37264
NON_CSV_PATTERN = r'\d+ task\(s\), \d+ success, \d+ fail'

output, num_changes = re.subn(NON_CSV_PATTERN, '', output)
if num_changes > 0:
logger.warning(f'Removed output from CLI based on regex: {NON_CSV_PATTERN!s}')

output = output.splitlines()

# Normalize the column names to use when generating the dictionary
Expand Down
2 changes: 1 addition & 1 deletion robottelo/cli/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def synchronize(cls, options, return_raw_response=None, timeout=3600000):
cls.command_sub = 'synchronize'
return cls.execute(
cls._construct_command(options),
output_format='base',
output_format='csv',
ignore_stderr=True,
return_raw_response=return_raw_response,
timeout=timeout,
Expand Down

0 comments on commit a0f4af9

Please sign in to comment.