Skip to content

Commit

Permalink
Fix bug that disallowed JSON flags in unity-catalog recipients update…
Browse files Browse the repository at this point in the history
… command (#549)

* .

* tests

* FixMinor
  • Loading branch information
wchau authored Aug 29, 2022
1 parent 84b9456 commit 375af9d
Show file tree
Hide file tree
Showing 2 changed files with 620 additions and 5 deletions.
7 changes: 2 additions & 5 deletions databricks_cli/unity_catalog/delta_sharing_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def update_recipient_cli(api_client, name, new_name, comment, owner,
The public specification for the JSON request is in development.
"""
if ((new_name is not None) or (comment is not None) or (owner is not None) or
(allowed_ip_address is not None)):
len(allowed_ip_address) > 0):
if (json_file is not None) or (json is not None):
raise ValueError('Cannot specify JSON if any other update flags are specified')
data = {'name': new_name, 'comment': comment, 'owner': owner}
Expand All @@ -291,6 +291,7 @@ def update_recipient_cli(api_client, name, new_name, comment, owner,
short_help='Rotate token for the recipient.')
@click.option('--name', required=True, help='Name of new recipient.')
@click.option('--existing-token-expire-in-seconds', default=None, required=False,
type=int,
help='Expire the existing token in number of seconds from now,' +
' 0 to expire it immediately.')
@debug_option
Expand Down Expand Up @@ -359,10 +360,6 @@ def create_provider_cli(api_client, name, comment, recipient_profile_json_file,
The public specification for the JSON request is in development.
"""
if recipient_profile_json is None and recipient_profile_json_file is None:
created_provider = UnityCatalogApi(api_client).create_provider(
name, comment, recipient_profile=None)
click.echo(mc_pretty_format(created_provider))
json_cli_base(recipient_profile_json_file, recipient_profile_json,
lambda json: UnityCatalogApi(api_client).create_provider(name, comment, json),
error_msg='Either --recipient-profile-json-file or ' +
Expand Down
Loading

0 comments on commit 375af9d

Please sign in to comment.