瀏覽代碼

HUE-5605 [metadata] Do not enable if desktop auth_password is set

Romain Rigaux 9 年之前
父節點
當前提交
a65a90ceda
共有 1 個文件被更改,包括 10 次插入14 次删除
  1. 10 14
      desktop/libs/metadata/src/metadata/conf.py

+ 10 - 14
desktop/libs/metadata/src/metadata/conf.py

@@ -17,8 +17,7 @@
 
 from django.utils.translation import ugettext_lazy as _t
 
-from desktop.conf import AUTH_USERNAME as DEFAULT_AUTH_USERNAME, AUTH_PASSWORD as DEFAULT_AUTH_PASSWORD, \
-                         AUTH_PASSWORD_SCRIPT, default_ssl_validate
+from desktop.conf import AUTH_USERNAME as DEFAULT_AUTH_USERNAME, default_ssl_validate
 from desktop.lib.conf import Config, ConfigSection, coerce_bool, coerce_password_from_script
 from desktop.lib.paths import get_config_root
 
@@ -30,14 +29,6 @@ def get_auth_username():
   return DEFAULT_AUTH_USERNAME.get()
 
 
-def get_auth_password():
-  """Get from script or backward compatibility"""
-  password = AUTH_PASSWORD_SCRIPT.get()
-  if password:
-    return password
-  return DEFAULT_AUTH_PASSWORD.get()
-
-
 def default_navigator_config_dir():
   """Get from usual main Hue config directory"""
   return get_config_root()
@@ -90,7 +81,7 @@ OPTIMIZER = ConfigSection(
       key="product_secret",
       help=_t("A secret passphrase associated with the productName."),
       private=True,
-      dynamic_default=get_auth_password),
+      default=None),
     PRODUCT_SECRET_SCRIPT=Config(
       key="product_secret_script",
       help=_t("Execute this script to produce the product secret. This will be used when `product_secret` is not set."),
@@ -101,7 +92,7 @@ OPTIMIZER = ConfigSection(
       key="product_auth_secret",
       help=_t("A secret passphrase associated with the productName."),
       private=True,
-      dynamic_default=get_auth_password),
+      default=None),
     PRODUCT_AUTH_SECRET_SCRIPT=Config(
       key="product_auth_secret_script",
       help=_t("Execute this script to produce the product secret. This will be used when `product_secret` is not set."),
@@ -118,7 +109,7 @@ OPTIMIZER = ConfigSection(
       key="email_password",
       help=_t("The password associated with the Optimizer account you to associate with the Product."),
       private=True,
-      dynamic_default=get_auth_password),
+      default=None),
     EMAIL_PASSWORD_SCRIPT=Config(
       key="password_script",
       help=_t("Execute this script to produce the email password. This will be used when `email_password` is not set."),
@@ -136,6 +127,11 @@ OPTIMIZER = ConfigSection(
 )
 
 
+def get_navigator_auth_password():
+  '''Get default password from secured file'''
+  return NAVIGATOR.AUTH_PASSWORD_SCRIPT.get()
+
+
 NAVIGATOR = ConfigSection(
   key='navigator',
   help=_t("""Configuration options for Navigator API"""),
@@ -152,7 +148,7 @@ NAVIGATOR = ConfigSection(
       key="auth_password",
       help=_t("LDAP/PAM/.. password of the hue user used for authentications."),
       private=True,
-      dynamic_default=get_auth_password),
+      dynamic_default=get_navigator_auth_password),
     AUTH_PASSWORD_SCRIPT=Config(
       key="auth_password_script",
       help=_t("Execute this script to produce the auth password. This will be used when `auth_password` is not set."),