You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/09/11 22:01:42 UTC

[GitHub] r39132 closed pull request #2129: [AIRFLOW-952] Allow deleting extra field in connection UI

r39132 closed pull request #2129: [AIRFLOW-952] Allow deleting extra field in connection UI
URL: https://github.com/apache/incubator-airflow/pull/2129
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/models.py b/airflow/models.py
index 9a075a888a..306c3fdb8b 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -630,6 +630,9 @@ def set_extra(self, value):
             except NameError:
                 self._extra = value
                 self.is_extra_encrypted = False
+        else:
+            self._extra = value
+            self.is_extra_encrypted = False
 
     @declared_attr
     def extra(cls):
diff --git a/tests/core.py b/tests/core.py
index a4757a70a7..be9018673a 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -2211,6 +2211,14 @@ def test_get_connections_db(self):
         assert conns[0].schema == 'airflow'
         assert conns[0].login == 'root'
 
+    def test_empty_extra_field(self):
+        conn = BaseHook.get_connection(conn_id='test_uri')
+
+        conn.set_extra('{"k1": "v1"}')
+        self.assertEqual(conn.get_extra(), '{"k1": "v1"}')
+
+        conn.set_extra(None)
+        self.assertIsNone(conn.get_extra())
 
 class WebHDFSHookTest(unittest.TestCase):
     def setUp(self):


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services