Python params.config() Examples
The following are 10
code examples of params.config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
params
, or try the search function
.
Example #1
Source File: slave.py From elasticsearch-ambari with MIT License | 5 votes |
def slave(): import params params.path_data = params.path_data.replace('"', '') data_path = params.path_data.replace(' ', '').split(',') data_path[:] = [x.replace('"', '') for x in data_path] directories = [params.log_dir, params.pid_dir, params.conf_dir] directories = directories + data_path Directory(directories, create_parents=True, mode=0755, owner=params.elastic_user, group=params.elastic_user, cd_access="a" ) File("{0}/elastic-env.sh".format(params.conf_dir), owner=params.elastic_user, content=InlineTemplate(params.elastic_env_sh_template) ) configurations = params.config['configurations']['elastic-site'] File("{0}/elasticsearch.yml".format(params.conf_dir), content=Template( "elasticsearch.slave.yaml.j2", configurations=configurations), owner=params.elastic_user, group=params.elastic_user ) print "Master sysconfig: /etc/sysconfig/elasticsearch" File(format("/etc/sysconfig/elasticsearch"), owner="root", group="root", content=InlineTemplate(params.sysconfig_template) )
Example #2
Source File: airflow_setup.py From ambari-airflow-mpack with Apache License 2.0 | 5 votes |
def airflow_configure(env): import params env.set_params(params) airflow_config_file = "" airflow_config = airflow_generate_config_for_section({ "core" : params.config['configurations']['airflow-core-site'], "cli" : params.config['configurations']['airflow-cli-site'], "api" : params.config['configurations']['airflow-api-site'], "operators" : params.config['configurations']['airflow-operators-site'], "webserver" : params.config['configurations']['airflow-webserver-site'], "email" : params.config['configurations']['airflow-email-site'], "smtp" : params.config['configurations']['airflow-smtp-site'], "celery" : params.config['configurations']['airflow-celery-site'], "dask" : params.config['configurations']['airflow-dask-site'], "scheduler" : params.config['configurations']['airflow-scheduler-site'], "ldap" : params.config['configurations']['airflow-ldap-site'], "mesos" : params.config['configurations']['airflow-mesos-site'], "kerberos" : params.config['configurations']['airflow-kerberos-site'], "github_enterprise" : params.config['configurations']['airflow-githubenterprise-site'], "admin" : params.config['configurations']['airflow-admin-site'], "lineage" : params.config['configurations']['airflow-lineage-site'], "atlas" : params.config['configurations']['airflow-atlas-site'], "hive" : params.config['configurations']['airflow-hive-site'], "celery_broker_transport_options" : params.config['configurations']['airflow-celerybrokertransportoptions-site'], "elasticsearch" : params.config['configurations']['airflow-elasticsearch-site'], "kubernetes" : params.config['configurations']['airflow-kubernetes-site'], "kubernetes_secrets" : params.config['configurations']['airflow-kubernetessecrets-site'] }) for section, value in airflow_config.items(): airflow_config_file += format("[{section}]\n{value}\n") with open(params.airflow_home + "/airflow.cfg", 'w') as configFile: configFile.write(airflow_config_file) configFile.close()
Example #3
Source File: drill.py From ambari-drill-service with Apache License 2.0 | 5 votes |
def configure(self, env, isInstall=False): import params env.set_params(params) drill_override_content=InlineTemplate(params.drill_override_content) drill_env_content=InlineTemplate(params.drill_env_content) if isInstall: Execute('chown -R ' + params.drill_user + ':' + params.drill_group + ' ' + params.drill_install_dir) File(params.drill_install_dir + '/apache-drill-1.6.0/conf/drill-override.conf', content=drill_override_content, owner=params.drill_user, group=params.drill_group) File(params.drill_install_dir + '/apache-drill-1.6.0/conf/drill-env.sh', content=drill_env_content, owner=params.drill_user, group=params.drill_group) XmlConfig("hdfs-site.xml", conf_dir=params.drill_install_dir + '/apache-drill-1.6.0/conf', configurations=params.config['configurations']['hdfs-site'], configuration_attributes=params.config['configuration_attributes']['hdfs-site'], owner=params.drill_user, group=params.drill_group, mode=0644) XmlConfig("core-site.xml", conf_dir=params.drill_install_dir + '/apache-drill-1.6.0/conf', configurations=params.config['configurations']['core-site'], configuration_attributes=params.config['configuration_attributes']['core-site'], owner=params.drill_user, group=params.drill_group, mode=0644) Execute('hdfs dfs -mkdir -p ' + params.sys_store_provider_zk_blobroot, user='hdfs') Execute('hdfs dfs -chown -R ' + params.drill_user + ':' + params.drill_group + ' ' + params.sys_store_provider_zk_blobroot, user='hdfs')
Example #4
Source File: master.py From ambari-elasticsearch-service with Apache License 2.0 | 5 votes |
def configure(self, env): # Import properties defined in -config.xml file from the params class import params # This allows us to access the params.elastic_pid_file property as # format('{elastic_pid_file}') env.set_params(params) configurations = params.config['configurations']['elastic-config'] File(format("{elastic_conf_dir}/elasticsearch.yml"), content=Template("elasticsearch.yml.j2", configurations=configurations), owner=params.elastic_user, group=params.elastic_group ) # Install HEAD and HQ puglins - these plugins are not currently supported by ES 5.x #cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin install mobz/elasticserach-head") #Execute(cmd) # Attempt to remove X-Pack plugin cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin remove x-pack") Execute(cmd) # Install X-Pack plugin cmd = format("{elastic_base_dir}/bin/elasticsearch-plugin install x-pack") Execute(cmd) # Ensure all files owned by elasticsearch user cmd = format("chown -R {elastic_user}:{elastic_group} {elastic_base_dir}") Execute(cmd) Execute('echo "Configuration complete"')
Example #5
Source File: master.py From ambari-elasticsearch-service with Apache License 2.0 | 5 votes |
def stop(self, env): # Import properties defined in -config.xml file from the params class import params # Import properties defined in -env.xml file from the status_params class import status_params # This allows us to access the params.elastic_pid_file property as # format('{elastic_pid_file}') env.set_params(params) # Stop Elasticsearch kill_process(params.elastic_pid_file, params.elastic_user, params.elastic_log_dir) #cmd = format("kill `cat {elastic_pid_file}`") #Execute(cmd, user=params.elastic_user, only_if=format("test -f {elastic_pid_file}"))
Example #6
Source File: master.py From ambari-elasticsearch-service with Apache License 2.0 | 5 votes |
def start(self, env): # Import properties defined in -config.xml file from the params class import params # This allows us to access the params.elastic_pid_file property as # format('{elastic_pid_file}') env.set_params(params) # Configure Elasticsearch self.configure(env) # Start Elasticsearch cmd = format("{elastic_base_dir}/bin/elasticsearch -d -p {elastic_pid_file}") Execute(cmd, user=params.elastic_user)
Example #7
Source File: elastic.py From ambari-elasticsearch-service with Apache License 2.0 | 5 votes |
def elastic(): import params params.path_data = params.path_data.replace('"','') data_path = params.path_data.replace(' ','').split(',') data_path[:]=[x.replace('"','') for x in data_path] directories = [params.log_dir, params.pid_dir, params.conf_dir] directories = directories+data_path; Directory(directories, owner=params.elastic_user, group=params.elastic_user, recursive=True ) File(format("{conf_dir}/elastic-env.sh"), owner=params.elastic_user, content=InlineTemplate(params.elastic_env_sh_template) ) configurations = params.config['configurations']['elastic-site'] File(format("{conf_dir}/elasticsearch.yml"), content=Template( "elasticsearch.master.yaml.j2", configurations = configurations), owner=params.elastic_user, group=params.elastic_user ) File(format("/etc/sysconfig/elasticsearch"), content=Template( "elasticsearch.sysconfig.j2", configurations = configurations), owner="root", group="root" )
Example #8
Source File: slave.py From ambari-elasticsearch-service with Apache License 2.0 | 5 votes |
def slave(): import params params.path_data = params.path_data.replace('"','') data_path = params.path_data.replace(' ','').split(',') data_path[:]=[x.replace('"','') for x in data_path] directories = [params.log_dir, params.pid_dir, params.conf_dir] directories = directories+data_path; Directory(directories, owner=params.elastic_user, group=params.elastic_user, recursive=True ) File(format("{conf_dir}/elastic-env.sh"), owner=params.elastic_user, content=InlineTemplate(params.elastic_env_sh_template) ) configurations = params.config['configurations']['elastic-site'] File(format("{conf_dir}/elasticsearch.yml"), content=Template( "elasticsearch.slave.yaml.j2", configurations = configurations), owner=params.elastic_user, group=params.elastic_user ) File(format("/etc/sysconfig/elasticsearch"), content=Template( "elasticsearch.sysconfig.j2", configurations = configurations), owner="root", group="root" )
Example #9
Source File: elastic.py From elasticsearch-ambari with MIT License | 4 votes |
def elastic(): print "INSIDE THE %s" % __file__ import params params.path_data = params.path_data.replace('"', '') data_path = params.path_data.replace(' ', '').split(',') data_path[:] = [x.replace('"', '') for x in data_path] directories = [params.log_dir, params.pid_dir, params.conf_dir] directories = directories + data_path Directory(directories, create_parents=True, # recursive=True, mode=0755, owner=params.elastic_user, group=params.elastic_user ) print "Master env: ""{0}/elastic-env.sh".format(params.conf_dir) File("{0}/elastic-env.sh".format(params.conf_dir), owner=params.elastic_user, content=InlineTemplate(params.elastic_env_sh_template) ) configurations = params.config['configurations']['elastic-site'] print "Master yml: ""{0}/elasticsearch.yml".format(params.conf_dir) File("{0}/elasticsearch.yml".format(params.conf_dir), content=Template( "elasticsearch.master.yaml.j2", configurations=configurations), owner=params.elastic_user, group=params.elastic_user ) print "Master sysconfig: /etc/sysconfig/elasticsearch" File(format("/etc/sysconfig/elasticsearch"), owner="root", group="root", content=InlineTemplate(params.sysconfig_template) )
Example #10
Source File: master.py From ambari-elasticsearch-service with Apache License 2.0 | 4 votes |
def install(self, env): # Import properties defined in -config.xml file from the params class import params # This allows us to access the params.elastic_pid_file property as # format('{elastic_pid_file}') env.set_params(params) # Install dependent packages self.install_packages(env) # Create user and group for Elasticsearch if they don't exist try: grp.getgrnam(params.elastic_group) except KeyError: Group(group_name=params.elastic_group) try: pwd.getpwnam(params.elastic_user) except KeyError: User(username=params.elastic_user, gid=params.elastic_group, groups=[params.elastic_group], ignore_failures=True ) # Create Elasticsearch directories Directory([params.elastic_base_dir, params.elastic_log_dir, params.elastic_pid_dir], mode=0755, cd_access='a', owner=params.elastic_user, group=params.elastic_group, create_parents=True ) # Create empty Elasticsearch install log File(params.elastic_install_log, mode=0644, owner=params.elastic_user, group=params.elastic_group, content='' ) # Download Elasticsearch cmd = format("cd {elastic_base_dir}; wget {elastic_download} -O elasticsearch.tar.gz -a {elastic_install_log}") Execute(cmd, user=params.elastic_user) # Install Elasticsearch cmd = format("cd {elastic_base_dir}; tar -xf elasticsearch.tar.gz --strip-components=1") Execute(cmd, user=params.elastic_user) # Ensure all files owned by elasticsearch user cmd = format("chown -R {elastic_user}:{elastic_group} {elastic_base_dir}") Execute(cmd) # Remove Elasticsearch installation file cmd = format("cd {elastic_base_dir}; rm elasticsearch.tar.gz") Execute(cmd, user=params.elastic_user) Execute('echo "Install complete"')