Stephen Reichling created BEAM-1068:
---------------------------------------

             Summary: Service Account Credentials File Specified via Pipeline 
Option Ignored
                 Key: BEAM-1068
                 URL: https://issues.apache.org/jira/browse/BEAM-1068
             Project: Beam
          Issue Type: Bug
          Components: sdk-py
            Reporter: Stephen Reichling
            Assignee: Frances Perry
            Priority: Minor


When writing a pipeline that authenticates with Google Dataflow APIs using a 
service account, specifying the path to that service account's credentials file 
in the {{PipelineOptions}} object passed in to the pipeline does not work, it 
only works when passed as a command-line flag.

For example, if I write code like so:
{code}
pipelineOptions = options.PipelineOptions()
gcOptions = pipelineOptions.view_as(options.GoogleCloudOptions)
gcOptions.service_account_name = 'My Service Account Name'
gcOptions.service_account_key_file = '/some/path/keyfile.p12'

pipeline = beam.Pipeline(options=pipelineOptions)
# ... add stages to the pipeline
p.run()
{code}
and execute it like so:
{{python ./my_pipeline.py}}
...the service account I specify will not be used.

Only if I were to execute the code like so:
{{python ./my_pipeline.py --service_account_name 'My Service Account Name' 
--service_account_key_file /some/path/keyfile.p12}}
...does it actually use the service account.

The problem appears to be rooted in `auth.py` which reconstructs the 
{{PipelineOptions}} object directly from {{sys.argv}} rather than using the 
instance passed in to the pipeline: 
https://github.com/apache/incubator-beam/blob/9ded359daefc6040d61a1f33c77563474fcb09b6/sdks/python/apache_beam/internal/auth.py#L129-L130



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to