From 795db2d4f6c23ea209f3d3b4e96ebab2ee4c2b5a Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jeblair@redhat.com>
Date: Thu, 12 Nov 2020 11:09:11 -0800
Subject: [PATCH] Add with_scopes method to GCS credentials class

This method was added in a recent release of the GCP api; we need to
override it as well since it reinstantiates the class and our constructor
is different.

Change-Id: I11b372bb9e1933aa5705d00f7393d651be66b3ba
---
 .../library/zuul_google_storage_upload.py                 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/roles/upload-logs-base/library/zuul_google_storage_upload.py b/roles/upload-logs-base/library/zuul_google_storage_upload.py
index 8e615eff1..0536a9cc9 100755
--- a/roles/upload-logs-base/library/zuul_google_storage_upload.py
+++ b/roles/upload-logs-base/library/zuul_google_storage_upload.py
@@ -78,6 +78,14 @@ class Credentials(gce_cred.Credentials):
         self.expiry = (datetime.datetime.utcnow() +
                        datetime.timedelta(seconds=data['expires_in']))
 
+    def with_scopes(self, scopes):
+        return self.__class__(
+            path=self._path,
+            scopes=scopes,
+            service_account_email=self._service_account_email,
+            quota_project_id=self._quota_project_id,
+        )
+
 
 class Uploader():
     def __init__(self, client, container, prefix=None,