Skip to content

Commit a00a1cf

Browse files
authored
Added roles to cleanup script and added if for owner (#2161)
1 parent 4e274c8 commit a00a1cf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scripts/cleanup.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def remove_resources(single: str, plural: str, known_instances: t.List[str], rol
4545
items = session.sql(f"show {plural}").collect()
4646

4747
for item in items:
48-
if item.name not in known_instances:
48+
# services don't have an owner
49+
if item.name not in known_instances and (
50+
plural == "services" or item.owner == "INTEGRATION_TESTS"
51+
):
4952
remove_resource(resource_type=single, item=item, role=role)
5053

5154

@@ -80,6 +83,15 @@ def remove_resources(single: str, plural: str, known_instances: t.List[str], rol
8083
("application", "applications"): [],
8184
("warehouse", "warehouses"): ["XSMALL"],
8285
("image repository", "image repositories"): ["SNOWCLI_REPOSITORY"],
86+
("role", "roles"): [
87+
"ACCOUNTADMIN",
88+
"PUBLIC",
89+
"SECURITYADMIN",
90+
"SYSADMIN",
91+
"USERADMIN",
92+
"INTEGRATION_TESTS",
93+
"APP_PUBLIC",
94+
],
8395
}
8496

8597
for (single, plural), known in known_objects.items():

0 commit comments

Comments
 (0)