Kaynağa Gözat

HUE-8925 [fb] enable S3 by default when IDBroker is configured.

Jean-Francois Desjeans Gauthier 6 yıl önce
ebeveyn
işleme
3cac9d3e51

+ 2 - 0
desktop/libs/aws/src/aws/client.py

@@ -78,6 +78,8 @@ def _init_clients():
   if CLIENT_CACHE is not None:
     return
   CLIENT_CACHE = {} # Can't convert this to django cache, because S3FileSystem is not pickable
+  if conf_idbroker.is_idbroker_enabled('s3a'):
+    return # No default initializations when IDBroker is enabled
   for identifier in list(aws_conf.AWS_ACCOUNTS.keys()):
     CLIENT_CACHE[_get_cache_key(identifier)] = _make_client(identifier)
   # If default configuration not initialized, initialize client connection with IAM metadata

+ 2 - 1
desktop/libs/aws/src/aws/conf.py

@@ -22,6 +22,7 @@ import re
 from django.utils.translation import ugettext_lazy as _, ugettext as _t
 
 from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection, coerce_bool, coerce_password_from_script
+from desktop.lib.idbroker import conf as conf_idbroker
 from hadoop.core_site import get_s3a_access_key, get_s3a_secret_key, get_s3a_session_token
 
 LOG = logging.getLogger(__name__)
@@ -209,7 +210,7 @@ AWS_ACCOUNTS = UnspecifiedConfigSection(
 
 
 def is_enabled():
-  return ('default' in list(AWS_ACCOUNTS.keys()) and AWS_ACCOUNTS['default'].get_raw() and AWS_ACCOUNTS['default'].ACCESS_KEY_ID.get()) or has_iam_metadata()
+  return ('default' in list(AWS_ACCOUNTS.keys()) and AWS_ACCOUNTS['default'].get_raw() and AWS_ACCOUNTS['default'].ACCESS_KEY_ID.get()) or has_iam_metadata() or conf_idbroker.is_idbroker_enabled('s3a')
 
 
 def has_iam_metadata():