Skip to content

Commit

Permalink
add installation key if one is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
leboff committed May 15, 2024
1 parent f1b8d0c commit 897ebbb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions cumulusci/core/config/org_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,24 +307,29 @@ def has_minimum_package_version(self, package_identifier, version_identifier):
)

return installed_version[0].number >= version_identifier
def get_package_from_version(self, package_version_id):
"""Fetch and return the package details based on a provided package version ID.

def get_package_from_version(self, package_version_id, installationkey=None):
"""Fetch and return the package details based on a provided package version ID.
Find the SubscriberPackageVersion for the 04t Id provided in package_version_id
If no package is found return None. If a package is found return the first record
(assuming that the query will only return one record for a specific Id)."""

query = ("tooling/query/?q=SELECT Id, SubscriberPackageId, MajorVersion, "
"MinorVersion, PatchVersion, BuildNumber from SubscriberPackageVersion "
f"WHERE Id = '{package_version_id}'")
query = (
"tooling/query/?q=SELECT Id, SubscriberPackageId, MajorVersion, "
"MinorVersion, PatchVersion, BuildNumber from SubscriberPackageVersion "
f"WHERE Id = '{package_version_id}'"
)
if installationkey:
query += f" AND InstallationKey = '{installationkey}'"

response = self.salesforce_client.restful(query)

if not response or "records" not in response or not response["records"]:
return None

package = response["records"][0]
return package

@property
def installed_packages(self):
"""installed_packages is a dict mapping a namespace or package Id (033*) to the installed package
Expand Down
2 changes: 1 addition & 1 deletion cumulusci/core/dependencies/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def install(
)
return

package = org.get_package_from_version(self.version_id)
package = org.get_package_from_version(self.version_id, options.password)

if package:
package_id = package["SubscriberPackageId"]
Expand Down

0 comments on commit 897ebbb

Please sign in to comment.