You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/09/11 22:02:00 UTC

[jira] [Commented] (AIRFLOW-952) Cannot save an empty extra field via the connections UI

    [ https://issues.apache.org/jira/browse/AIRFLOW-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611315#comment-16611315 ] 

ASF GitHub Bot commented on AIRFLOW-952:
----------------------------------------

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


> Cannot save an empty extra field via the connections UI 
> --------------------------------------------------------
>
>                 Key: AIRFLOW-952
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-952
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: models, ui
>            Reporter: Vijay Bhat
>            Assignee: Vijay Bhat
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> Once you fill out the extra field parameter in the connections web UI, you cannot clear it out. 
> Steps to reproduce:
> - open the default mysql connection via the web UI
> - enter a JSON string for the extra field and save
> - go back to editing the mysql connection and clear out the extra field.
> - hit save, and go back to the mysql connection edit UI, and the JSON string will still be there.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)