# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from django.utils.translation import ugettext as _, ugettext_lazy as _t from desktop.lib.conf import Config, validate_path SPARK_MASTER = Config( key="spark_master", help=_t( "Address of the Spark master, e.g spark://localhost:7077. If empty use the current configuration. " "Can be overriden in the script too."), default="") SPARK_HOME = Config( key="spark_home", help=_t("Local path to Spark Home on all the nodes of the cluster."), default="/usr/lib/spark") def config_validator(user): res = [] res.extend(validate_path(SPARK_HOME, is_dir=True)) return res
def get_optimizer_password_script(): '''Get default password from secured file''' global OPTIMIZER_AUTH_PASSWORD if OPTIMIZER_AUTH_PASSWORD is None: OPTIMIZER_AUTH_PASSWORD = OPTIMIZER.AUTH_KEY_SECRET_SCRIPT.get() return OPTIMIZER_AUTH_PASSWORD OPTIMIZER = ConfigSection( key='optimizer', help=_t("""Configuration options for Optimizer API"""), members=dict( HOSTNAME=Config( key='hostname', help=_t('Hostname to Optimizer API or compatible service.'), default='navoptapi.us-west-1.optimizer.altus.cloudera.com'), AUTH_KEY_ID=Config( key="auth_key_id", help=_t("The name of the key of the service."), private=False, default=None), AUTH_KEY_SECRET=Config( key="auth_key_secret", help=_t("The private part of the key associated with the auth_key."), private=True, dynamic_default=get_optimizer_password_script), AUTH_KEY_SECRET_SCRIPT=Config( key="auth_key_secret_script", help=_t("Execute this script to produce the auth_key secret. This will be used when `auth_key_secret` is not set."),
import logging import os import sys from desktop.lib.conf import Config if sys.version_info[0] > 2: from django.utils.translation import gettext_lazy as _t else: from django.utils.translation import ugettext_lazy as _t LOG = logging.getLogger(__name__) HOSTNAME = Config( key='hostname', help=_t('Hostname or IP of server.'), type=str, default='localhost', ) PORT = Config( key='port', help=_t('Port the sentry service is running on.'), type=int, default=8038, ) SENTRY_CONF_DIR = Config( key='sentry_conf_dir', help=_t( 'Sentry configuration directory, where sentry-site.xml is located.'), default=os.environ.get("SENTRY_CONF_DIR", '/etc/sentry/conf'))
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from django.utils.translation import ugettext_lazy as _ from desktop.lib.conf import Config ENABLE_NEW_CREATE_TABLE = Config( key="enable_new_create_table", help=_("Flag to turn on the new version of the create table wizard."), type=bool, default=True)
from desktop.conf import default_ssl_validate from desktop.lib.conf import Config, coerce_bool from spark.settings import NICE_NAME from beeswax.conf import get_use_sasl_default if sys.version_info[0] > 2: from django.utils.translation import gettext_lazy as _t, gettext as _ else: from django.utils.translation import ugettext_lazy as _t, ugettext as _ LOG = logging.getLogger(__name__) # Livy LIVY_SERVER_URL = Config(key="livy_server_url", help=_t("The Livy Server URL."), default="") SECURITY_ENABLED = Config( key="security_enabled", help=_t( "Whether Livy requires client to perform Kerberos authentication."), default=False, type=coerce_bool) CSRF_ENABLED = Config( key="csrf_enabled", help=_t("Whether Livy requres client to have CSRF enabled."), default=False, type=coerce_bool)
LOG.warn( "Region, %s, not found in the list of supported regions: %s" % (region, ', '.join(get_locations()))) region = Location.DEFAULT return region AWS_ACCOUNTS = UnspecifiedConfigSection( 'aws_accounts', help=_('One entry for each AWS account'), each=ConfigSection( help=_('Information about single AWS account'), members=dict( ACCESS_KEY_ID=Config(key='access_key_id', type=str, dynamic_default=get_default_access_key_id), ACCESS_KEY_ID_SCRIPT=Config( key='access_key_id_script', default=None, private=True, type=coerce_password_from_script, help=_( "Execute this script to produce the AWS access key ID.")), SECRET_ACCESS_KEY=Config(key='secret_access_key', type=str, private=True, dynamic_default=get_default_secret_key), SECRET_ACCESS_KEY_SCRIPT=Config( key='secret_access_key_script', default=None,
return None f.__doc__ = "Finds %s/%s" % (root, desired_glob) return f def coerce_umask(umask): if len(umask) < 4: umask = "1" + umask return int(umask, 8) UPLOAD_CHUNK_SIZE = Config( key="upload_chunk_size", help="Size, in bytes, of the 'chunks' Django should store into memory and feed into the handler. Default is 64MB.", type=int, default=1024 * 1024 * 64) HDFS_CLUSTERS = UnspecifiedConfigSection( "hdfs_clusters", help="One entry for each HDFS cluster", each=ConfigSection( help="Information about a single HDFS cluster", members=dict( FS_DEFAULTFS=Config("fs_defaultfs", help="The equivalent of fs.defaultFS (aka fs.default.name)", default="hdfs://localhost:8020"), LOGICAL_NAME = Config("logical_name", default="", type=str, help=_t('NameNode logical name.')), WEBHDFS_URL=Config("webhdfs_url",
import sys from desktop.lib.conf import Config, coerce_bool from security.settings import NICE_NAME if sys.version_info[0] > 2: from django.utils.translation import gettext as _, gettext_lazy as _t else: from django.utils.translation import ugettext as _, ugettext_lazy as _t HIVE_V1 = Config( key="hive_v1", help=_t("Use Sentry API V1 for Hive."), default=True, type=coerce_bool) HIVE_V2 = Config( key="hive_v2", help=_t("Use Sentry generic API V2 for Hive."), default=False, type=coerce_bool) SOLR_V2 = Config( key="solr_v2", help=_t("Use Sentry generic API V2 for Solr."), default=True, type=coerce_bool)
return [{ "name": interpreters[i].NAME.get(), "type": i, "interface": interpreters[i].INTERFACE.get(), "options": interpreters[i].OPTIONS.get()} for i in interpreters ] def is_oozie_enabled(): """Oozie needs to be available as it is the backend.""" return len([app for app in appmanager.DESKTOP_MODULES if app.name == 'oozie']) > 0 SHOW_NOTEBOOKS = Config( key="show_notebooks", help=_t("Show the notebook menu or not"), type=coerce_bool, default=True ) INTERPRETERS = UnspecifiedConfigSection( "interpreters", help="One entry for each type of snippet. The first 5 will appear in the wheel.", each=ConfigSection( help=_t("Define the name and how to connect and execute the language."), members=dict( NAME=Config( "name", help=_t("The name of the snippet."), default="SQL", type=str, ),
except: LOG.exception('failed to get zookeeper ensemble') try: from search.conf import SOLR_URL parsed = urlparse(SOLR_URL.get()) return "%s:2181/solr" % (parsed.hostname or 'localhost') except: LOG.exception('failed to get solr url') # Unused BATCH_INDEXER_PATH = Config( key="batch_indexer_path", help=_t("Batch indexer path in HDFS."), type=str, default="/var/lib/search/search-mr-job.jar") CORE_INSTANCE_DIR = Config( key="core_instance_dir", help=_t("Local path to Hue folder where Solr instance directories will be created in non-solrcloud mode."), type=str, default=os.path.join(os.path.dirname(__file__), '../data/collections')) CONFIG_TEMPLATE_PATH = Config( key="config_template_path", help=_t("Default template used at collection creation."), type=str, default=os.path.join(os.path.dirname(__file__), '..', 'data', 'solrconfigs'))
REGION_CACHED = region return region def get_key_expiry(): if 'default' in AWS_ACCOUNTS: return AWS_ACCOUNTS['default'].KEY_EXPIRY.get() else: return 86400 HAS_IAM_DETECTION = Config( help=_('Enable the detection of an IAM role providing the credentials automatically. It can take a few seconds.'), key='has_iam_detection', default=False, type=coerce_bool ) IS_SELF_SIGNING_ENABLED = Config( key='is_self_signing_enabled', help=_('Skip boto and use self signed URL and requests to make the calls to S3. Used for testing the RAZ integration.'), type=coerce_bool, private=True, default=False, ) AWS_ACCOUNTS = UnspecifiedConfigSection( 'aws_accounts', help=_('One entry for each AWS account'), each=ConfigSection(
import os.path from django.utils.translation import ugettext as _, ugettext_lazy as _t from desktop.conf import is_hue4 from desktop.lib.conf import Config, coerce_bool from desktop.lib import paths from liboozie.conf import get_oozie_status from oozie.settings import NICE_NAME DEFINITION_XSLT_DIR = Config( key="definition_xslt_dir", default=os.path.join(os.path.dirname(__file__), "importlib", "xslt"), help=_t("Location on local FS where the xslt files are stored for workflow import."), private=True ) DEFINITION_XSLT2_DIR = Config( key="definition_xslt2_dir", default=os.path.join(os.path.dirname(__file__), "importlib", "xslt2"), help=_t("Location on local FS where the xslt files are stored for workflow import."), private=True ) LOCAL_SAMPLE_DIR = Config( key="local_data_dir", default=os.path.join(os.path.dirname(__file__), "..", "..", "examples"), help=_t("Location on local filesystem where the examples are stored."), private=True
if p.returncode != 0: raise subprocess.CalledProcessError(p.returncode, script) # whitespace may be significant in the password, but most files have a # trailing newline. return stdout.strip('\n') def coerce_timedelta(value): return datetime.timedelta(seconds=int(value)) HTTP_HOST = Config( key="http_host", 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."), type=int, default=8888) HTTP_ALLOWED_METHODS = Config( key="http_allowed_methods", help=_("HTTP methods the server will be allowed to service."), type=coerce_csv, private=True, default=['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT'])
def get_security_default(): '''Get default security value from Hadoop''' from hadoop import cluster # Avoid dependencies conflicts cluster = cluster.get_cluster_conf_for_job_submission() return cluster.SECURITY_ENABLED.get() OPTIMIZER = ConfigSection( key='optimizer', help=_t("""Configuration options for Optimizer API"""), members=dict( API_URL=Config( key='api_url', help=_t( 'Base URL to Optimizer API (e.g. - https://alpha.optimizer.cloudera.com/)' ), default=None), AUTH_KEY=Config(key="auth_key", help=_t("The name of the key of the service."), private=False, default=None), AUTH_KEY_SECRET=Config( key="auth_key_secret", help=_t( "The private part of the key associated with the auth_key."), private=True, default=None), AUTH_KEY_SECRET_SCRIPT=Config( key="auth_key_secret_script", help=_t(
from desktop import appmanager from desktop.conf import is_hue4 from desktop.lib.conf import Config, UnspecifiedConfigSection, ConfigSection,\ coerce_json_dict, coerce_bool, coerce_csv def is_oozie_enabled(): """Oozie needs to be available as it is the backend.""" return len([ app for app in appmanager.DESKTOP_MODULES if app.name == 'oozie' ]) > 0 and is_hue4() SHOW_NOTEBOOKS = Config(key="show_notebooks", help=_t("Show the notebook menu or not"), type=coerce_bool, default=True) def _remove_duplications(a_list): return list(OrderedDict.fromkeys(a_list)) def get_ordered_interpreters(user=None): if not INTERPRETERS.get(): _default_interpreters(user) interpreters = INTERPRETERS.get() interpreters_shown_on_wheel = _remove_duplications( INTERPRETERS_SHOWN_ON_WHEEL.get())
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from django.utils.translation import ugettext_lazy as _t from desktop.lib.conf import Config HOSTNAME=Config( key='hostname', help=_t('Hostname or IP of server.'), type=str, default='localhost', ) PORT=Config( key='port', help=_t('Port the sentry service is running on.'), type=int, default=10001, ) SENTRY_CONF_DIR = Config( key='sentry_conf_dir', help=_t('Sentry configuration directory, where sentry-site.xml is located.'), default=os.environ.get("SENTRY_CONF_DIR", '/etc/sentry/conf') )