Skip to content

Commit

Permalink
Fix non absolute path processing for cat and dump in interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Jun 19, 2024
1 parent 202ff70 commit e0c0a7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/ccdb/cmd/commands/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def get_assignment_by_request(self, request):

# In non-interactive mode, cat should handle path without leading / as absolute anyway
# Check mode and if relative path is given
if not self.context.is_interactive and request.path_is_parsed and not request.path.startswith("/"):
path_check_needed = not self.context.is_interactive or self.context.current_path in ["/", ""]
if path_check_needed and request.path_is_parsed and not request.path.startswith("/"):
# PatCH the PaTH
request.path = "/" + request.path

Expand Down Expand Up @@ -405,7 +406,7 @@ def print_assignment_vertical(self, assignment, print_header=True, display_borde
def print_help(self):
"""Prints help of the command"""

print ("""Show data values for assignment.
print("""Show data values for assignment.
Usage:
cat <request or table path>
Expand Down
5 changes: 5 additions & 0 deletions python/tests/integ_test_cli_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def test_cat_not_abs_path(self):
self.cli.process_command_line("cat test/test_vars/test_table")
self.assertIn("2.3", self.output.getvalue())

# in interactive mode it should also work if the path is absolute
self.cli.context.is_interactive = True
self.cli.process_command_line("cat test/test_vars/test_table")
self.assertIn("2.3", self.output.getvalue())

def test_variation_backup(self):
"""Test Backup of """

Expand Down

0 comments on commit e0c0a7c

Please sign in to comment.