Skip to content

Commit a0494b8

Browse files
authored
fix: Make get permset licenses return active only (#3888)
The get_available_permission_set_licenses task returns unavailable permset licenses because removed PSLs are still returned by SOQL. This commit adds a filter for Status to prevent this.
1 parent b45b2d7 commit a0494b8

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

cumulusci/tasks/preflight/licenses.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ def _run_task(self):
1515

1616
class GetAvailablePermissionSetLicenses(BaseSalesforceApiTask):
1717
def _run_task(self):
18+
query = "SELECT PermissionSetLicenseKey FROM PermissionSetLicense WHERE Status = 'Active'"
1819
self.return_values = [
1920
result["PermissionSetLicenseKey"]
20-
for result in self.sf.query(
21-
"SELECT PermissionSetLicenseKey FROM PermissionSetLicense"
22-
)["records"]
21+
for result in self.sf.query(query)["records"]
2322
]
2423
licenses = "\n".join(self.return_values)
2524
self.logger.info(f"Found permission set licenses:\n{licenses}")

cumulusci/tasks/preflight/tests/test_licenses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_psl_preflight(self):
4141
task()
4242

4343
task._init_api.return_value.query.assert_called_once_with(
44-
"SELECT PermissionSetLicenseKey FROM PermissionSetLicense"
44+
"SELECT PermissionSetLicenseKey FROM PermissionSetLicense WHERE Status = 'Active'"
4545
)
4646
assert task.return_values == ["TEST1", "TEST2"]
4747

0 commit comments

Comments
 (0)