|
|
@@ -23,49 +23,50 @@ from desktop.lib.paths import get_desktop_root
|
|
|
import os
|
|
|
import socket
|
|
|
import stat
|
|
|
+from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
USE_CHERRYPY_SERVER = Config(
|
|
|
key="use_cherrypy_server",
|
|
|
- help="If set to true, CherryPy will be used. Otherwise, Spawning will be used as the webserver.",
|
|
|
+ help=_("If set to true, CherryPy will be used. Otherwise, Spawning will be used as the webserver."),
|
|
|
type=coerce_bool,
|
|
|
default=False)
|
|
|
|
|
|
HTTP_HOST = Config(
|
|
|
key="http_host",
|
|
|
- help="HTTP Host to bind to",
|
|
|
+ help=_("HTTP Host to bind to"),
|
|
|
type=str,
|
|
|
default="0.0.0.0")
|
|
|
HTTP_PORT = Config(
|
|
|
key="http_port",
|
|
|
- help="HTTP Port to bind to",
|
|
|
+ help=_("HTTP Port to bind to"),
|
|
|
type=int,
|
|
|
default=8888)
|
|
|
SSL_CERTIFICATE = Config(
|
|
|
key="ssl_certificate",
|
|
|
- help="Filename of SSL Certificate",
|
|
|
+ help=_("Filename of SSL Certificate"),
|
|
|
default=None)
|
|
|
SSL_PRIVATE_KEY = Config(
|
|
|
key="ssl_private_key",
|
|
|
- help="Filename of SSL RSA Private Key",
|
|
|
+ help=_("Filename of SSL RSA Private Key"),
|
|
|
default=None)
|
|
|
ENABLE_SERVER = Config(
|
|
|
key="enable_server",
|
|
|
- help="If set to false, runcpserver will not actually start the web server. Used if Apache is being used as a WSGI container.",
|
|
|
+ help=_("If set to false, runcpserver will not actually start the web server. Used if Apache is being used as a WSGI container."),
|
|
|
type=coerce_bool,
|
|
|
default=True)
|
|
|
CHERRYPY_SERVER_THREADS = Config(
|
|
|
key="cherrypy_server_threads",
|
|
|
- help="Number of threads used by the CherryPy web server.",
|
|
|
+ help=_("Number of threads used by the CherryPy web server."),
|
|
|
type=int,
|
|
|
default=10)
|
|
|
SECRET_KEY = Config(
|
|
|
key="secret_key",
|
|
|
- help="Used in hashing algorithms for sessions.",
|
|
|
+ help=_("Used in hashing algorithms for sessions."),
|
|
|
default="")
|
|
|
|
|
|
USER_ACCESS_HISTORY_SIZE = Config(
|
|
|
key="user_access_history_size",
|
|
|
- help="Number of user access to remember per view per user.",
|
|
|
+ help=_("Number of user access to remember per view per user."),
|
|
|
type=int,
|
|
|
default=10)
|
|
|
|
|
|
@@ -90,46 +91,46 @@ def default_from_email():
|
|
|
|
|
|
SMTP = ConfigSection(
|
|
|
key='smtp',
|
|
|
- help='Configuration options for connecting to an external SMTP server',
|
|
|
+ help=_('Configuration options for connecting to an external SMTP server'),
|
|
|
members=dict(
|
|
|
HOST = Config(
|
|
|
key="host",
|
|
|
- help="The SMTP server for email notification delivery",
|
|
|
+ help=_("The SMTP server for email notification delivery"),
|
|
|
type=str,
|
|
|
default="localhost"
|
|
|
),
|
|
|
|
|
|
PORT = Config(
|
|
|
key="port",
|
|
|
- help="The SMTP server port",
|
|
|
+ help=_("The SMTP server port"),
|
|
|
type=int,
|
|
|
default=25
|
|
|
),
|
|
|
|
|
|
USER = Config(
|
|
|
key="user",
|
|
|
- help="The username for the SMTP host",
|
|
|
+ help=_("The username for the SMTP host"),
|
|
|
type=str,
|
|
|
default=""
|
|
|
),
|
|
|
|
|
|
PASSWORD = Config(
|
|
|
key="password",
|
|
|
- help="The password for the SMTP user",
|
|
|
+ help=_("The password for the SMTP user"),
|
|
|
type=str,
|
|
|
default=""
|
|
|
),
|
|
|
|
|
|
USE_TLS = Config(
|
|
|
key="tls",
|
|
|
- help="Whether to use a TLS (secure) connection when talking to the SMTP server",
|
|
|
+ help=_("Whether to use a TLS (secure) connection when talking to the SMTP server"),
|
|
|
type=coerce_bool,
|
|
|
default=False
|
|
|
),
|
|
|
|
|
|
DEFAULT_FROM= Config(
|
|
|
key="default_from_email",
|
|
|
- help="Default email address to use for various automated notification from Hue",
|
|
|
+ help=_("Default email address to use for various automated notification from Hue"),
|
|
|
type=str,
|
|
|
dynamic_default=default_from_email
|
|
|
),
|
|
|
@@ -138,42 +139,42 @@ SMTP = ConfigSection(
|
|
|
|
|
|
DATABASE = ConfigSection(
|
|
|
key='database',
|
|
|
- help="""Configuration options for specifying the Desktop Database.
|
|
|
- For more info, see http://docs.djangoproject.com/en/1.1/ref/settings/#database-engine""",
|
|
|
+ help=_("""Configuration options for specifying the Desktop Database.
|
|
|
+ For more info, see http://docs.djangoproject.com/en/1.1/ref/settings/#database-engine"""),
|
|
|
members=dict(
|
|
|
ENGINE=Config(
|
|
|
key='engine',
|
|
|
- help='Database engine, eg postgresql, mysql, sqlite3, or oracle',
|
|
|
+ help=_('Database engine, eg postgresql, mysql, sqlite3, or oracle'),
|
|
|
type=str,
|
|
|
default='sqlite3',
|
|
|
),
|
|
|
NAME=Config(
|
|
|
key='name',
|
|
|
- help='Database name, or path to DB if using sqlite3',
|
|
|
+ help=_('Database name, or path to DB if using sqlite3'),
|
|
|
type=str,
|
|
|
default=get_desktop_root('desktop.db'),
|
|
|
),
|
|
|
USER=Config(
|
|
|
key='user',
|
|
|
- help='Database username',
|
|
|
+ help=_('Database username'),
|
|
|
type=str,
|
|
|
default='',
|
|
|
),
|
|
|
PASSWORD=Config(
|
|
|
key='password',
|
|
|
- help='Database password',
|
|
|
+ help=_('Database password'),
|
|
|
type=str,
|
|
|
default='',
|
|
|
),
|
|
|
HOST=Config(
|
|
|
key='host',
|
|
|
- help='Database host',
|
|
|
+ help=_('Database host'),
|
|
|
type=str,
|
|
|
default='',
|
|
|
),
|
|
|
PORT=Config(
|
|
|
key='port',
|
|
|
- help='Database port',
|
|
|
+ help=_('Database port'),
|
|
|
type=int,
|
|
|
default=0,
|
|
|
),
|
|
|
@@ -182,34 +183,34 @@ DATABASE = ConfigSection(
|
|
|
|
|
|
KERBEROS = ConfigSection(
|
|
|
key="kerberos",
|
|
|
- help="""Configuration options for specifying Hue's kerberos integration for
|
|
|
- secured Hadoop clusters.""",
|
|
|
+ help=_("""Configuration options for specifying Hue's kerberos integration for
|
|
|
+ secured Hadoop clusters."""),
|
|
|
members=dict(
|
|
|
HUE_KEYTAB=Config(
|
|
|
key='hue_keytab',
|
|
|
- help="Path to a Kerberos keytab file containing Hue's service credentials.",
|
|
|
+ help=_("Path to a Kerberos keytab file containing Hue's service credentials."),
|
|
|
type=str,
|
|
|
default=None),
|
|
|
HUE_PRINCIPAL=Config(
|
|
|
key='hue_principal',
|
|
|
- help="Kerberos principal name for hue. Typically 'hue/hostname.foo.com'",
|
|
|
+ help=_("Kerberos principal name for hue. Typically 'hue/hostname.foo.com'"),
|
|
|
type=str,
|
|
|
default="hue/%s" % socket.getfqdn()),
|
|
|
KEYTAB_REINIT_FREQUENCY=Config(
|
|
|
key='reinit_frequency',
|
|
|
- help="Frequency in seconds with which Hue will renew its keytab",
|
|
|
+ help=_("Frequency in seconds with which Hue will renew its keytab"),
|
|
|
type=int,
|
|
|
default=60*60), #1h
|
|
|
CCACHE_PATH=Config(
|
|
|
key='ccache_path',
|
|
|
- help="Path to keep kerberos credentials cached",
|
|
|
+ help=_("Path to keep kerberos credentials cached"),
|
|
|
private=True,
|
|
|
type=str,
|
|
|
default="/tmp/hue_krb5_ccache",
|
|
|
),
|
|
|
KINIT_PATH=Config(
|
|
|
key='kinit_path',
|
|
|
- help="Path to kerberos 'kinit' command",
|
|
|
+ help=_("Path to kerberos 'kinit' command"),
|
|
|
type=str,
|
|
|
default="kinit", # use PATH!
|
|
|
)
|
|
|
@@ -219,101 +220,101 @@ KERBEROS = ConfigSection(
|
|
|
# See python's documentation for time.tzset for valid values.
|
|
|
TIME_ZONE = Config(
|
|
|
key="time_zone",
|
|
|
- help="Time zone name",
|
|
|
+ help=_("Time zone name"),
|
|
|
type=str,
|
|
|
default=os.environ.get("TZ", "America/Los_Angeles")
|
|
|
)
|
|
|
|
|
|
DEFAULT_SITE_ENCODING = Config(
|
|
|
key='default_site_encoding',
|
|
|
- help='Default system-wide unicode encoding',
|
|
|
+ help=_('Default system-wide unicode encoding'),
|
|
|
type=str,
|
|
|
default='utf-8'
|
|
|
)
|
|
|
|
|
|
SERVER_USER = Config(
|
|
|
key="server_user",
|
|
|
- help="Username to run servers as",
|
|
|
+ help=_("Username to run servers as"),
|
|
|
type=str,
|
|
|
default="hue")
|
|
|
SERVER_GROUP = Config(
|
|
|
key="server_group",
|
|
|
- help="Group to run servers as",
|
|
|
+ help=_("Group to run servers as"),
|
|
|
type=str,
|
|
|
default="hue")
|
|
|
|
|
|
|
|
|
AUTH = ConfigSection(
|
|
|
key="auth",
|
|
|
- help="Configuration options for user authentication into the web application",
|
|
|
+ help=_("Configuration options for user authentication into the web application"),
|
|
|
members=dict(
|
|
|
BACKEND=Config("backend",
|
|
|
default="desktop.auth.backend.AllowFirstUserDjangoBackend",
|
|
|
- help="Authentication backend. Common settings are "
|
|
|
+ help=_("Authentication backend. Common settings are "
|
|
|
"django.contrib.auth.backends.ModelBackend (fully Django backend), " +
|
|
|
"desktop.auth.backend.AllowAllBackend (allows everyone), " +
|
|
|
- "desktop.auth.backend.AllowFirstUserDjangoBackend (relies on Django and user manager, after the first login), "),
|
|
|
+ "desktop.auth.backend.AllowFirstUserDjangoBackend (relies on Django and user manager, after the first login), ")),
|
|
|
USER_AUGMENTOR=Config("user_augmentor",
|
|
|
default="desktop.auth.backend.DefaultUserAugmentor",
|
|
|
- help="Class which defines extra accessor methods for User objects."),
|
|
|
+ help=_("Class which defines extra accessor methods for User objects.")),
|
|
|
))
|
|
|
|
|
|
LDAP = ConfigSection(
|
|
|
key="ldap",
|
|
|
- help="Configuration options for LDAP connectivity",
|
|
|
+ help=_("Configuration options for LDAP connectivity"),
|
|
|
members=dict(
|
|
|
BASE_DN=Config("base_dn",
|
|
|
default=None,
|
|
|
- help="The base LDAP distinguished name to use for LDAP search."),
|
|
|
+ help=_("The base LDAP distinguished name to use for LDAP search.")),
|
|
|
NT_DOMAIN=Config("nt_domain",
|
|
|
default=None,
|
|
|
- help="The NT domain used for LDAP authentication."),
|
|
|
+ help=_("The NT domain used for LDAP authentication.")),
|
|
|
LDAP_URL=Config("ldap_url",
|
|
|
default=None,
|
|
|
- help="The LDAP URL to connect to."),
|
|
|
+ help=_("The LDAP URL to connect to.")),
|
|
|
LDAP_CERT=Config("ldap_cert",
|
|
|
default=None,
|
|
|
- help="The LDAP certificate for authentication over TLS."),
|
|
|
+ help=_("The LDAP certificate for authentication over TLS.")),
|
|
|
LDAP_USERNAME_PATTERN=Config("ldap_username_pattern",
|
|
|
default=None,
|
|
|
- help="A pattern to use for constructing LDAP usernames."),
|
|
|
+ help=_("A pattern to use for constructing LDAP usernames.")),
|
|
|
BIND_DN=Config("bind_dn",
|
|
|
default=None,
|
|
|
- help="The distinguished name to bind as, when importing from LDAP."),
|
|
|
+ help=_("The distinguished name to bind as, when importing from LDAP.")),
|
|
|
BIND_PASSWORD=Config("bind_password",
|
|
|
default=None,
|
|
|
- help="The password for the bind user."),
|
|
|
+ help=_("The password for the bind user.")),
|
|
|
|
|
|
USERS = ConfigSection(
|
|
|
key="users",
|
|
|
- help="Configuration for LDAP user schema and search",
|
|
|
+ help=_("Configuration for LDAP user schema and search"),
|
|
|
members=dict(
|
|
|
USER_FILTER=Config("user_filter",
|
|
|
default="objectclass=*",
|
|
|
- help="A base filter for use when searching for users."),
|
|
|
+ help=_("A base filter for use when searching for users.")),
|
|
|
USER_NAME_ATTR=Config("user_name_attr",
|
|
|
default="sAMAccountName",
|
|
|
- help="The username attribute in the LDAP schema. "
|
|
|
+ help=_("The username attribute in the LDAP schema. "
|
|
|
"Typically, this is 'sAMAccountName' for AD and 'uid' "
|
|
|
- "for other LDAP systems."),
|
|
|
+ "for other LDAP systems.")),
|
|
|
)
|
|
|
),
|
|
|
|
|
|
GROUPS = ConfigSection(
|
|
|
key="groups",
|
|
|
- help="Configuration for LDAP group schema and search",
|
|
|
+ help=_("Configuration for LDAP group schema and search"),
|
|
|
members=dict(
|
|
|
GROUP_FILTER=Config("group_filter",
|
|
|
default="objectclass=*",
|
|
|
- help="A base filter for use when searching for groups."),
|
|
|
+ help=_("A base filter for use when searching for groups.")),
|
|
|
GROUP_NAME_ATTR=Config("group_name_attr",
|
|
|
default="cn",
|
|
|
- help="The group name attribute in the LDAP schema. "
|
|
|
- "Typically, this is 'cn'."),
|
|
|
+ help=_("The group name attribute in the LDAP schema. "
|
|
|
+ "Typically, this is 'cn'.")),
|
|
|
GROUP_MEMBER_ATTR=Config("group_member_attr",
|
|
|
default="member",
|
|
|
- help="The LDAP attribute which specifies the "
|
|
|
- "members of a group."),
|
|
|
+ help=_("The LDAP attribute which specifies the "
|
|
|
+ "members of a group.")),
|
|
|
)
|
|
|
),
|
|
|
))
|
|
|
@@ -322,12 +323,12 @@ LDAP = ConfigSection(
|
|
|
|
|
|
LOCAL_FILESYSTEMS = UnspecifiedConfigSection(
|
|
|
key="local_filesystems",
|
|
|
- help="Paths on the local file system that users should be able to browse",
|
|
|
+ help=_("Paths on the local file system that users should be able to browse"),
|
|
|
each=ConfigSection(
|
|
|
members=dict(
|
|
|
PATH=Config("path",
|
|
|
required=True,
|
|
|
- help="The path on the local FS"))))
|
|
|
+ help=_("The path on the local FS")))))
|
|
|
|
|
|
def default_feedback_url():
|
|
|
"""A version-specific URL."""
|
|
|
@@ -335,36 +336,36 @@ def default_feedback_url():
|
|
|
|
|
|
FEEDBACK_URL = Config(
|
|
|
key="feedback_url",
|
|
|
- help="Link for 'feedback' tab.",
|
|
|
+ help=_("Link for 'feedback' tab."),
|
|
|
type=str,
|
|
|
dynamic_default=default_feedback_url
|
|
|
)
|
|
|
|
|
|
SEND_DBUG_MESSAGES = Config(
|
|
|
key="send_dbug_messages",
|
|
|
- help="Whether to send dbug messages from JavaScript to the server logs.",
|
|
|
+ help=_("Whether to send dbug messages from JavaScript to the server logs."),
|
|
|
type=coerce_bool,
|
|
|
default=False
|
|
|
)
|
|
|
|
|
|
DATABASE_LOGGING = Config(
|
|
|
key="database_logging",
|
|
|
- help="If true, log all database requests.",
|
|
|
+ help=_("If true, log all database requests."),
|
|
|
type=coerce_bool,
|
|
|
default=False)
|
|
|
|
|
|
DJANGO_DEBUG_MODE = Config(
|
|
|
key="django_debug_mode",
|
|
|
- help="Enable or disable django debug mode.",
|
|
|
+ help=_("Enable or disable django debug mode."),
|
|
|
type=coerce_bool,
|
|
|
default=True
|
|
|
)
|
|
|
|
|
|
HTTP_500_DEBUG_MODE = Config(
|
|
|
key='http_500_debug_mode',
|
|
|
- help='Enable or disable debugging information in the 500 internal server error response. '
|
|
|
+ help=_('Enable or disable debugging information in the 500 internal server error response. '
|
|
|
'Note that the debugging information may contain sensitive data. '
|
|
|
- 'If django_debug_mode is True, this is automatically enabled.',
|
|
|
+ 'If django_debug_mode is True, this is automatically enabled.'),
|
|
|
type=coerce_bool,
|
|
|
default=True
|
|
|
)
|
|
|
@@ -380,19 +381,19 @@ def config_validator():
|
|
|
|
|
|
res = [ ]
|
|
|
if not SECRET_KEY.get():
|
|
|
- res.append((SECRET_KEY, "Secret key should be configured as a random string."))
|
|
|
+ res.append((SECRET_KEY, unicode(_("Secret key should be configured as a random string."))))
|
|
|
|
|
|
# Validate SSL setup
|
|
|
if SSL_CERTIFICATE.get():
|
|
|
res.extend(validate_path(SSL_CERTIFICATE, is_dir=False))
|
|
|
if not SSL_PRIVATE_KEY.get():
|
|
|
- res.append((SSL_PRIVATE_KEY, "SSL private key file should be set to enable HTTPS."))
|
|
|
+ res.append((SSL_PRIVATE_KEY, unicode(_("SSL private key file should be set to enable HTTPS."))))
|
|
|
else:
|
|
|
res.extend(validate_path(SSL_PRIVATE_KEY, is_dir=False))
|
|
|
|
|
|
# Validate encoding
|
|
|
if not i18n.validate_encoding(DEFAULT_SITE_ENCODING.get()):
|
|
|
- res.append((DEFAULT_SITE_ENCODING, "Encoding not supported."))
|
|
|
+ res.append((DEFAULT_SITE_ENCODING, unicode(_("Encoding not supported."))))
|
|
|
|
|
|
# Validate kerberos
|
|
|
if KERBEROS.HUE_KEYTAB.get() is not None:
|
|
|
@@ -401,8 +402,8 @@ def config_validator():
|
|
|
kt_stat = os.stat(KERBEROS.HUE_KEYTAB.get())
|
|
|
if stat.S_IMODE(kt_stat.st_mode) & 0077:
|
|
|
res.append((KERBEROS.HUE_KEYTAB,
|
|
|
- "Keytab should have 0600 permissions (has %o)" %
|
|
|
- stat.S_IMODE(kt_stat.st_mode)))
|
|
|
+ unicode(_("Keytab should have 0600 permissions (has %o)") %
|
|
|
+ stat.S_IMODE(kt_stat.st_mode))))
|
|
|
|
|
|
res.extend(validate_path(KERBEROS.KINIT_PATH, is_dir=False))
|
|
|
res.extend(validate_path(KERBEROS.CCACHE_PATH, is_dir=False))
|
|
|
@@ -411,20 +412,20 @@ def config_validator():
|
|
|
LDAP.LDAP_USERNAME_PATTERN.get() is not None:
|
|
|
if LDAP.LDAP_URL.get() is None:
|
|
|
res.append((LDAP.LDAP_URL,
|
|
|
- "LDAP is only partially configured. An LDAP URL must be provided."))
|
|
|
+ unicode(_("LDAP is only partially configured. An LDAP URL must be provided."))))
|
|
|
|
|
|
if LDAP.LDAP_URL.get() is not None:
|
|
|
if LDAP.NT_DOMAIN.get() is None and \
|
|
|
LDAP.LDAP_USERNAME_PATTERN.get() is None:
|
|
|
res.append(LDAP.LDAP_URL,
|
|
|
- "LDAP is only partially configured. An NT Domain or username "
|
|
|
- "search pattern must be provided.")
|
|
|
+ unicode(_("LDAP is only partially configured. An NT Domain or username "
|
|
|
+ "search pattern must be provided.")))
|
|
|
|
|
|
if LDAP.LDAP_USERNAME_PATTERN.get() is not None and \
|
|
|
'<username>' not in LDAP.LDAP_USERNAME_PATTERN.get():
|
|
|
res.append(LDAP.LDAP_USERNAME_PATTERN,
|
|
|
- "The LDAP username pattern should contain the special"
|
|
|
- "<username> replacement string for authentication.")
|
|
|
+ unicode(_("The LDAP username pattern should contain the special"
|
|
|
+ "<username> replacement string for authentication.")))
|
|
|
|
|
|
|
|
|
return res
|