Skip to content
Merged
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
2 changes: 1 addition & 1 deletion regtests/client/python/cli/options/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def parse_properties(properties: List[str]) -> Optional[Dict[str, str]]:
if '=' not in property:
raise Exception(f'Could not parse property `{property}`')
key, value = property.split('=', 1)
if '=' in value or not value:
if not value:
raise Exception(f'Could not parse property `{property}`')
if key in results:
raise Exception(f'Duplicate property key `{key}`')
Expand Down
5 changes: 5 additions & 0 deletions regtests/client/python/test/test_cli_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ def get(obj, arg_string):
'get_catalog', {
(0, None): 'foo',
})
check_arguments(
mock_execute(['catalogs', 'update', 'foo', '--set-property', 'listkey=k1=v1,k2=v2']),
'get_catalog', {
(0, None): 'foo',
})
check_arguments(
mock_execute(['catalogs', 'update', 'foo', '--remove-property', 'key']),
'get_catalog', {
Expand Down
14 changes: 14 additions & 0 deletions regtests/t_cli/src/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,20 @@ def test_update_catalog():
checker=lambda s: 'foo' not in s and 'prop2' not in s and
'"prop3": "3333"' in s and '"prop4": "4444"' in s)

# Update to add a property whose value is a key-value list
check_output(root_cli(
'catalogs',
'update',
f'test_cli_catalog_{SALT}',
'--set-property',
'listprop=k1=v1,k2=v2'
), checker=lambda s: s == '')

# Previous properties still exist, and the new property is parsed properly
check_output(root_cli('catalogs', 'get', f'test_cli_catalog_{SALT}'),
checker=lambda s: '"prop3": "3333"' in s and '"prop4": "4444"' in s and
'"listprop": "k1=v1,k2=v2"' in s)

# Update to set a region
check_output(root_cli(
'catalogs',
Expand Down