You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2020/12/12 06:27:37 UTC

[airflow] branch master updated: Handle None values properly when CLI output is YAML/JSON format (#13024)

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 5057f56  Handle None values properly when CLI output is YAML/JSON format (#13024)
5057f56 is described below

commit 5057f56d2bce30bb74e44564bc6e49a451443e54
Author: Xiaodong DENG <xd...@gmail.com>
AuthorDate: Sat Dec 12 07:26:07 2020 +0100

    Handle None values properly when CLI output is YAML/JSON format (#13024)
    
    str() should not be applied to None when we 'normalize' the data before we print it,
    otherwise it's not given in proper format in YAML/JSON format of the CLI output
---
 airflow/cli/simple_table.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/airflow/cli/simple_table.py b/airflow/cli/simple_table.py
index 8cdb6de..93c9e42 100644
--- a/airflow/cli/simple_table.py
+++ b/airflow/cli/simple_table.py
@@ -60,6 +60,8 @@ class AirflowConsole(Console):
             return [self._normalize_data(x, output) for x in value]
         if isinstance(value, dict) and output != "table":
             return {k: self._normalize_data(v, output) for k, v in value.items()}
+        if value is None:
+            return None
         return str(value)
 
     def print_as(self, data: List[Union[Dict, Any]], output: str, mapper: Optional[Callable] = None):