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/12/18 06:01:29 UTC

[GitHub] stale[bot] closed pull request #3796: [AIRFLOW-2824] - Add config to disable default conn creation

stale[bot] closed pull request #3796: [AIRFLOW-2824] - Add config to disable default conn creation
URL: https://github.com/apache/incubator-airflow/pull/3796
 
 
   

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/config_templates/default_airflow.cfg b/airflow/config_templates/default_airflow.cfg
index 18c486cb1e..bb1e1c8665 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -122,6 +122,10 @@ non_pooled_task_slot_count = 128
 # The maximum number of active DAG runs per DAG
 max_active_runs_per_dag = 16
 
+# Whether to load the default connections during the CLI command
+# `airflow initdb`.
+load_default_conns = True
+
 # Whether to load the examples that ship with Airflow. It's good to
 # get started, but you probably want to set this to False in a production
 # environment
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index b57b8cf92b..9c9fd6bcad 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -27,6 +27,7 @@
 import os
 import contextlib
 
+from airflow import configuration
 from airflow import settings
 from airflow.utils.log.logging_mixin import LoggingMixin
 
@@ -85,11 +86,8 @@ def merge_conn(conn, session=None):
         session.commit()
 
 
-def initdb(rbac=False):
-    session = settings.Session()
-
+def load_default_conns():
     from airflow import models
-    upgradedb()
 
     merge_conn(
         models.Connection(
@@ -286,6 +284,16 @@ def initdb(rbac=False):
             conn_id='cassandra_default', conn_type='cassandra',
             host='cassandra', port=9042))
 
+
+def initdb(rbac=False):
+    session = settings.Session()
+
+    from airflow import models
+    upgradedb()
+
+    if configuration.conf.getboolean('core', 'LOAD_DEFAULT_CONNS'):
+        load_default_conns()
+
     # Known event types
     KET = models.KnownEventType
     if not session.query(KET).filter(KET.know_event_type == 'Holiday').first():


 

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