Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 214
direct: grants: Fix "Duplicate privileges" error and drift on duplicates #4801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ee6b7a68c8abd685b4d508660651cbfc4d3a283eb1fb384b45b64180c4abcccebb2fd2190b3b211b0db839aa69d16481c80f8d5e6File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| bundle: | ||
| name: schema-dup-grants-$UNIQUE_NAME | ||
| resources: | ||
| schemas: | ||
| apps_schema: | ||
| name: schema_dup_grants_$UNIQUE_NAME | ||
| catalog_name: main | ||
| grants: | ||
| - principal: deco-test-user@databricks.com | ||
| privileges: | ||
| - ALL_PRIVILEGES |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "ALL_PRIVILEGES" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com" | ||
| } | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "ALL_PRIVILEGES" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.schemas.apps_schema | ||
| This action will result in the deletion of the following UC schemas. Any underlying data may be lost: | ||
| delete resources.schemas.apps_schema | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default | ||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
| # The direct engine puts ALL_PRIVILEGES in both the Add and Remove lists in the PATCH request, | ||
| # which the backend rejects with "Duplicate privileges to add and delete". | ||
| $CLI bundle deploy | ||
| print_requests.py --get //permissions --keep > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| RecordRequests = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bundle: | ||
| name: schema-dup-grants-$UNIQUE_NAME | ||
| resources: | ||
| schemas: | ||
| apps_schema: | ||
| name: schema_dup_grants_$UNIQUE_NAME | ||
| catalog_name: main | ||
| grants: | ||
| - principal: deco-test-user@databricks.com | ||
| privileges: | ||
| - CREATE_TABLE | ||
| - principal: deco-test-user@databricks.com | ||
| privileges: | ||
| - CREATE_TABLE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "plan_version": 2, | ||
| "cli_version": "[DEV_VERSION]", | ||
| "lineage": "[UUID]", | ||
| "serial": 1, | ||
| "plan": { | ||
| "resources.schemas.apps_schema": { | ||
| "action": "skip", | ||
| "remote_state": { | ||
| "browse_only": false, | ||
| "catalog_name": "main", | ||
| "catalog_type": "MANAGED_CATALOG", | ||
| "created_at": [UNIX_TIME_MILLIS][0], | ||
| "created_by": "[USERNAME]", | ||
| "full_name": "main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "name": "schema_dup_grants_[UNIQUE_NAME]", | ||
| "owner": "[USERNAME]", | ||
| "updated_at": [UNIX_TIME_MILLIS][0], | ||
| "updated_by": "[USERNAME]" | ||
| } | ||
| }, | ||
| "resources.schemas.apps_schema.grants": { | ||
| "depends_on": [ | ||
| { | ||
| "node": "resources.schemas.apps_schema", | ||
| "label": "${resources.schemas.apps_schema.id}" | ||
| } | ||
| ], | ||
| "action": "skip", | ||
| "remote_state": { | ||
| "securable_type": "schema", | ||
| "full_name": "main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "__embed__": [ | ||
| { | ||
| "principal": "deco-test-user@databricks.com", | ||
| "privileges": [ | ||
| "CREATE_TABLE" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "cli_version": "[DEV_VERSION]", | ||
| "plan": { | ||
| "resources.schemas.apps_schema": { | ||
| "action": "skip" | ||
| }, | ||
| "resources.schemas.apps_schema.grants": { | ||
| "action": "skip" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "CREATE_TABLE" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com", | ||
| "remove": [ | ||
| "ALL_PRIVILEGES" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "CREATE_TABLE" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] bundle plan -o json | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.schemas.apps_schema | ||
| This action will result in the deletion of the following UC schemas. Any underlying data may be lost: | ||
| delete resources.schemas.apps_schema | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default | ||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
| # Same principal listed twice with the same privilege. | ||
| trace $CLI bundle deploy | ||
| print_requests.py --get //permissions --keep > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| trace $CLI bundle plan -o json > out.plan.$DATABRICKS_BUNDLE_ENGINE.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| RecordRequests = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| bundle: | ||
| name: schema-dup-grants-$UNIQUE_NAME | ||
| resources: | ||
| schemas: | ||
| apps_schema: | ||
| name: schema_dup_grants_$UNIQUE_NAME | ||
| catalog_name: main | ||
| grants: | ||
| - principal: deco-test-user@databricks.com | ||
| privileges: | ||
| - CREATE_TABLE | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might worth showing a warning to users about such configs | ||
| - CREATE_TABLE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| >>> [CLI] bundle plan | ||
| Plan: 0 to add, 0 to change, 0 to delete, 2 unchanged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "CREATE_TABLE" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com", | ||
| "remove": [ | ||
| "ALL_PRIVILEGES" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "PATCH", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]", | ||
| "body": { | ||
| "changes": [ | ||
| { | ||
| "add": [ | ||
| "CREATE_TABLE" | ||
| ], | ||
| "principal": "deco-test-user@databricks.com" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.1/unity-catalog/permissions/schema/main.schema_dup_grants_[UNIQUE_NAME]" | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.schemas.apps_schema | ||
| This action will result in the deletion of the following UC schemas. Any underlying data may be lost: | ||
| delete resources.schemas.apps_schema | ||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/schema-dup-grants-[UNIQUE_NAME]/default | ||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
| # Same privilege listed twice for the same principal in a single entry. | ||
| trace $CLI bundle deploy | ||
| print_requests.py --get //permissions --keep > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt | ||
| trace $CLI bundle plan > out.plan.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| RecordRequests = true |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.