当前位置: 首页>>代码示例>>Python>>正文


Python params.config方法代码示例

本文整理汇总了Python中params.config方法的典型用法代码示例。如果您正苦于以下问题:Python params.config方法的具体用法?Python params.config怎么用?Python params.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在params的用法示例。


在下文中一共展示了params.config方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: configure

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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"') 
开发者ID:Jaraxal,项目名称:ambari-elasticsearch-service,代码行数:36,代码来源:master.py

示例2: slave

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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)
         ) 
开发者ID:teamsoo,项目名称:elasticsearch-ambari,代码行数:41,代码来源:slave.py

示例3: airflow_configure

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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() 
开发者ID:miho120,项目名称:ambari-airflow-mpack,代码行数:39,代码来源:airflow_setup.py

示例4: configure

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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') 
开发者ID:dvergari,项目名称:ambari-drill-service,代码行数:30,代码来源:drill.py

示例5: stop

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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}")) 
开发者ID:Jaraxal,项目名称:ambari-elasticsearch-service,代码行数:17,代码来源:master.py

示例6: start

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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) 
开发者ID:Jaraxal,项目名称:ambari-elasticsearch-service,代码行数:16,代码来源:master.py

示例7: elastic

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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"
    ) 
开发者ID:Symantec,项目名称:ambari-elasticsearch-service,代码行数:40,代码来源:elastic.py

示例8: slave

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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"
    ) 
开发者ID:Symantec,项目名称:ambari-elasticsearch-service,代码行数:40,代码来源:slave.py

示例9: elastic

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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)
         ) 
开发者ID:teamsoo,项目名称:elasticsearch-ambari,代码行数:44,代码来源:elastic.py

示例10: install

# 需要导入模块: import params [as 别名]
# 或者: from params import config [as 别名]
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"') 
开发者ID:Jaraxal,项目名称:ambari-elasticsearch-service,代码行数:58,代码来源:master.py


注:本文中的params.config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。