You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2017/05/04 16:27:55 UTC
[1/2] beam git commit: [BEAM-2152] Remove gcloud auth as application
default credentials does it
Repository: beam
Updated Branches:
refs/heads/master d1afdd8e1 -> 93020941a
[BEAM-2152] Remove gcloud auth as application default credentials does it
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/70dad36f
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/70dad36f
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/70dad36f
Branch: refs/heads/master
Commit: 70dad36f099ea0b454e2900302f7e7f866579f79
Parents: d1afdd8
Author: Sourabh Bajaj <so...@google.com>
Authored: Wed May 3 13:50:46 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Thu May 4 09:27:38 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/internal/gcp/auth.py | 32 --------------------
.../runners/dataflow/internal/apiclient.py | 3 +-
2 files changed, 1 insertion(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/70dad36f/sdks/python/apache_beam/internal/gcp/auth.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/gcp/auth.py b/sdks/python/apache_beam/internal/gcp/auth.py
index 53c2d07..3c8dd64 100644
--- a/sdks/python/apache_beam/internal/gcp/auth.py
+++ b/sdks/python/apache_beam/internal/gcp/auth.py
@@ -26,7 +26,6 @@ import urllib2
from oauth2client.client import GoogleCredentials
from oauth2client.client import OAuth2Credentials
-from apache_beam.utils import processes
from apache_beam.utils import retry
@@ -94,27 +93,6 @@ class GCEMetadataCredentials(OAuth2Credentials):
datetime.timedelta(seconds=token_data['expires_in']))
-class _GCloudWrapperCredentials(OAuth2Credentials):
- """Credentials class wrapping gcloud credentials via shell."""
-
- def __init__(self, user_agent, **kwds):
- super(_GCloudWrapperCredentials, self).__init__(
- None, None, None, None, None, None, user_agent, **kwds)
-
- def _refresh(self, http_request):
- """Gets an access token using the gcloud client."""
- try:
- gcloud_process = processes.Popen(
- ['gcloud', 'auth', 'print-access-token'], stdout=processes.PIPE)
- except OSError:
- message = 'gcloud tool not found so falling back to using ' +\
- 'application default credentials'
- logging.warning(message)
- raise AuthenticationException(message)
- output, _ = gcloud_process.communicate()
- self.access_token = output.strip()
-
-
def get_service_credentials():
"""Get credentials to access Google services."""
user_agent = 'beam-python-sdk/1.0'
@@ -135,16 +113,6 @@ def get_service_credentials():
]
try:
- credentials = _GCloudWrapperCredentials(user_agent)
- # Check if we are able to get an access token. If not fallback to
- # application default credentials.
- credentials.get_access_token()
- return credentials
- except AuthenticationException:
- logging.warning('Unable to find credentials from gcloud.')
-
- # Falling back to application default credentials.
- try:
credentials = GoogleCredentials.get_application_default()
credentials = credentials.create_scoped(client_scopes)
logging.debug('Connecting using Google Application Default '
http://git-wip-us.apache.org/repos/asf/beam/blob/70dad36f/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
index 26ed7b6..e64cf8d 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
@@ -411,8 +411,7 @@ class DataflowApplicationClient(object):
if e.status_code in reportable_errors:
raise IOError(('Could not upload to GCS path %s: %s. Please verify '
'that credentials are valid and that you have write '
- 'access to the specified path. Stale credentials can be '
- 'refreshed by executing "gcloud auth login".') %
+ 'access to the specified path.') %
(gcs_or_local_path, reportable_errors[e.status_code]))
raise
logging.info('Completed GCS upload to %s', gcs_location)
[2/2] beam git commit: This closes #2869
Posted by al...@apache.org.
This closes #2869
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/93020941
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/93020941
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/93020941
Branch: refs/heads/master
Commit: 93020941a251bb62fc26f5e123a12df4f8e4ab1e
Parents: d1afdd8 70dad36
Author: Ahmet Altay <al...@google.com>
Authored: Thu May 4 09:27:43 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Thu May 4 09:27:43 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/internal/gcp/auth.py | 32 --------------------
.../runners/dataflow/internal/apiclient.py | 3 +-
2 files changed, 1 insertion(+), 34 deletions(-)
----------------------------------------------------------------------