This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b9a918  Bugfix: Fix rendering of ``object_name`` in 
``GCSToLocalFilesystemOperator`` (#15487)
3b9a918 is described below

commit 3b9a91806ea102cc2bc00b545f63f57031f458c9
Author: Kaxil Naik <[email protected]>
AuthorDate: Thu Apr 22 16:27:08 2021 +0100

    Bugfix: Fix rendering of ``object_name`` in 
``GCSToLocalFilesystemOperator`` (#15487)
    
    https://github.com/apache/airflow/pull/14918 made coms consistency changes
    where the template_fields was changed for ``GCSToLocalFilesystemOperator``.
    
    While the change was correct since``object`` param was deprecated, the
    instance attribute wasn't updated hence you see this error:
    
    ```
    AttributeError: 'GCSToLocalFilesystemOperator' object has no attribute 
'object_name'
    ```
---
 airflow/providers/google/cloud/transfers/gcs_to_local.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/airflow/providers/google/cloud/transfers/gcs_to_local.py 
b/airflow/providers/google/cloud/transfers/gcs_to_local.py
index 956f891..12a61ef 100644
--- a/airflow/providers/google/cloud/transfers/gcs_to_local.py
+++ b/airflow/providers/google/cloud/transfers/gcs_to_local.py
@@ -119,7 +119,7 @@ class GCSToLocalFilesystemOperator(BaseOperator):
 
         super().__init__(**kwargs)
         self.bucket = bucket
-        self.object = object_name
+        self.object_name = object_name
         self.filename = filename  # noqa
         self.store_to_xcom_key = store_to_xcom_key  # noqa
         self.gcp_conn_id = gcp_conn_id
@@ -127,7 +127,7 @@ class GCSToLocalFilesystemOperator(BaseOperator):
         self.impersonation_chain = impersonation_chain
 
     def execute(self, context):
-        self.log.info('Executing download: %s, %s, %s', self.bucket, 
self.object, self.filename)
+        self.log.info('Executing download: %s, %s, %s', self.bucket, 
self.object_name, self.filename)
         hook = GCSHook(
             gcp_conn_id=self.gcp_conn_id,
             delegate_to=self.delegate_to,
@@ -135,10 +135,10 @@ class GCSToLocalFilesystemOperator(BaseOperator):
         )
 
         if self.store_to_xcom_key:
-            file_bytes = hook.download(bucket_name=self.bucket, 
object_name=self.object)
+            file_bytes = hook.download(bucket_name=self.bucket, 
object_name=self.object_name)
             if sys.getsizeof(file_bytes) < MAX_XCOM_SIZE:
                 context['ti'].xcom_push(key=self.store_to_xcom_key, 
value=str(file_bytes))
             else:
                 raise AirflowException('The size of the downloaded file is too 
large to push to XCom!')
         else:
-            hook.download(bucket_name=self.bucket, object_name=self.object, 
filename=self.filename)
+            hook.download(bucket_name=self.bucket, 
object_name=self.object_name, filename=self.filename)

Reply via email to