Skip to content

Commit

Permalink
fix: handling for overwrite class without json output
Browse files Browse the repository at this point in the history
  • Loading branch information
ejseqera committed Dec 3, 2024
1 parent cc03184 commit de9cb70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions seqerakit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ def __init__(self, sp, list_for_add_method):
"""
self.sp = sp
self.list_for_add_method = list_for_add_method
# Create an instance of Overwrite class
self.overwrite_method = overwrite.Overwrite(self.sp)

# Create a separate instance of the Overwrite class without JSON output
sp_without_json = seqeraplatform.SeqeraPlatform(
cli_args=sp.cli_args,
dryrun=sp.dryrun,
json=False,
)
self.overwrite_method = overwrite.Overwrite(sp_without_json)

def handle_block(self, block, args, destroy=False, dryrun=False):
# Check if delete is set to True, and call delete handler
Expand Down
6 changes: 4 additions & 2 deletions seqerakit/seqeraplatform.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ def _execute_command(self, full_cmd, to_json=False, print_stdout=True):

if self.json or to_json:
out = json.loads(stdout)
print(json.dumps(out))
if should_print:
print(json.dumps(out))
else:
out = stdout
print(stdout)
if should_print:
print(stdout)

return out

Expand Down

0 comments on commit de9cb70

Please sign in to comment.