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 2021/02/23 10:44:03 UTC

[GitHub] [airflow] haard commented on a change in pull request #14380: Prevent mixed case env vars from crashing a worker

haard commented on a change in pull request #14380:
URL: https://github.com/apache/airflow/pull/14380#discussion_r580932236



##########
File path: tests/core/test_configuration.py
##########
@@ -80,6 +80,15 @@ def test_case_sensitivity(self):
         assert conf.get("core", "PERCENT") == "with%inside"
         assert conf.get("CORE", "PERCENT") == "with%inside"
 
+    def test_config_as_dict(self):
+        """Test that getting config as dict works even if
+        environment has non-legal env vars"""
+        with unittest.mock.patch.dict('os.environ'):
+            os.environ['AIRFLOW__VAR__broken'] = "not_ok"
+            asdict = conf.as_dict(raw=True, display_sensitive=True)
+        assert asdict.get('VAR') is None

Review comment:
       
   > This is not the behaviour I would expect. It should instead still be present.
   > 
   > There are a few plugins out there that add their own config sections, and that is something we want to support.
   
   If they do and do not enforce ALL_UPPER_CASE they will break if using `as_dict()` with the current code, with this patch they will be ignored but not crash. I don't know that allowing mixed case env vars is wanted?
   The only functional change here is to not crash if `is_dict` is called while there is mixed case env vars (starting with `AIRFLOW__` but then not all uppercase). 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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