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: 2 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bundles
* engine/direct: Fix drift in grants resource due to privilege reordering ([#4794](https://github.com/databricks/cli/pull/4794))
* engine/direct: Fix 400 error when deploying grants with ALL_PRIVILEGES ([#4801](https://github.com/databricks/cli/pull/4801))
* Deduplicate grant entries with duplicate principals or privileges during initialization ([#4801](https://github.com/databricks/cli/pull/4801))

### Dependency updates

Expand Down
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.

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.

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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

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
Loading
Loading