Skip to content
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

Wepublisher: use service account to query secrets #186

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CollectWebpublisherCredentials(plugin.FtrackPublishContextPlugin):
"""

order = pyblish.api.CollectorOrder + 0.0015
label = "Collect webpublisher credentials"
label = "Collect ftrack credentials for Webpublisher"
hosts = ["webpublisher", "photoshop"]
targets = ["webpublish"]

Expand Down Expand Up @@ -91,13 +91,18 @@ def _get_username_key(self, context):
api_key_secret = service_settings["api_key"]
username_secret = service_settings["username"]

secrets_by_name = {
secret["name"]: secret["value"]
for secret in ayon_api.get_secrets()
}
con = ayon_api.get_server_api_connection()
with con.as_username(None):
secrets_by_name = {
secret["name"]: secret["value"]
for secret in ayon_api.get_secrets()
}
api_key = secrets_by_name.get(api_key_secret)
username = secrets_by_name.get(username_secret)
if not api_key or not username:
raise KnownPublishError("Missing ftrack credentials in settings. "
"Please let admin fill in 'ayon+settings://ftrack/service_settings'") # noqa
raise KnownPublishError(
"Missing ftrack credentials in settings. "
"Please let admin fill in "
"'ayon+settings://ftrack/service_settings'"
)
return api_key, username
Loading