airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] kaxil commented on a change in pull request #7130: [AIRFLOW-6533] Add cli commands to manage config
Date Sat, 11 Jan 2020 10:33:27 GMT
kaxil commented on a change in pull request #7130: [AIRFLOW-6533] Add cli commands to manage
config
URL: https://github.com/apache/airflow/pull/7130#discussion_r365513469
 
 

 ##########
 File path: airflow/cli/commands/config_command.py
 ##########
 @@ -17,11 +17,54 @@
 """Config sub-commands"""
 import io
 
-from airflow.configuration import conf
+from configupdater import ConfigUpdater, NoSectionError
+
+from airflow.configuration import AIRFLOW_CONFIG, AirflowConfigException, conf
 
 
 def show_config(args):
     """Show current application configuration"""
     with io.StringIO() as output:
-        conf.write(output)
+        if args.section:
+            section = args.section
+            if conf.has_section(section):
+                conf._write_section(  # pylint: disable=protected-access
+                    fp=output,
+                    section_name=section,
+                    section_items=conf.getsection(section).items(),
+                    delimiter=" = "
+                )
+            else:
+                raise AirflowConfigException(f"No section '{section}'")
+        else:
+            conf.write(output)
 
 Review comment:
   This is to safeguard against accidental rewrite of fernet key, sql_alchemy_conn.
   
   Ansible, Terraform have their prompts on different command.
   
   It is similar to how not many Apps allow changing config via CLI

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message