Exemplo n.º 1
0
  def configure(self, env):
    import params
    import status_params
    env.set_params(params)
    env.set_params(status_params)
    self.create_zeppelin_log_dir(env)

    # create the pid and zeppelin dirs
    Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
              owner=params.zeppelin_user,
              group=params.zeppelin_group,
              cd_access="a",
              create_parents=True,
              mode=0755
    )
    self.chown_zeppelin_pid_dir(env)

    # write out zeppelin-site.xml
    XmlConfig("zeppelin-site.xml",
              conf_dir=params.conf_dir,
              configurations=params.config['configurations']['zeppelin-config'],
              owner=params.zeppelin_user,
              group=params.zeppelin_group
              )
    # write out zeppelin-env.sh
    env_content = InlineTemplate(params.zeppelin_env_content)
    File(format("{params.conf_dir}/zeppelin-env.sh"), content=env_content,
         owner=params.zeppelin_user, group=params.zeppelin_group)

    # write out shiro.ini
    shiro_ini_content = InlineTemplate(params.shiro_ini_content)
    File(format("{params.conf_dir}/shiro.ini"), content=shiro_ini_content,
         owner=params.zeppelin_user, group=params.zeppelin_group)

    # write out log4j.properties
    File(format("{params.conf_dir}/log4j.properties"), content=params.log4j_properties_content,
         owner=params.zeppelin_user, group=params.zeppelin_group)

    self.create_zeppelin_hdfs_conf_dir(env)
    # copy hive-site.xml only if Spark 1.x is installed
    if 'spark-defaults' in params.config['configurations'] and params.is_hive_installed:
      XmlConfig("hive-site.xml",
              conf_dir=params.external_dependency_conf,
              configurations=params.spark_hive_properties,
              owner=params.zeppelin_user,
              group=params.zeppelin_group,
              mode=0644)

    if len(params.hbase_master_hosts) > 0 and params.is_hbase_installed:
      # copy hbase-site.xml
      XmlConfig("hbase-site.xml",
              conf_dir=params.external_dependency_conf,
              configurations=params.config['configurations']['hbase-site'],
              configuration_attributes=params.config['configuration_attributes']['hbase-site'],
              owner=params.zeppelin_user,
              group=params.zeppelin_group,
              mode=0644
              )
Exemplo n.º 2
0
    def configure(self, env):
        import params
        env.set_params(params)

        File(
            os.path.join(params.conf_dir, "kylin.properties"),
            content=InlineTemplate(params.kylin_properties_template),
            owner=params.kylin_user,
            group=params.kylin_group)

        XmlConfig(
            "kylin_hive_conf.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin_hive_conf'],
            owner=params.kylin_user,
            group=params.kylin_group)
        XmlConfig(
            "kylin_job_conf.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin_job_conf'],
            owner=params.kylin_user,
            group=params.kylin_group)
        XmlConfig(
            "kylin_job_conf_inmem.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']
            ['kylin_job_conf_inmem'],
            owner=params.kylin_user,
            group=params.kylin_group)
        XmlConfig(
            "kylin-kafka-consumer.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']
            ['kylin-kafka-consumer'],
            owner=params.kylin_user,
            group=params.kylin_group)
        File(
            os.path.join(params.conf_dir, "kylin-server-log4j.properties"),
            mode=0644,
            group=params.kylin_group,
            owner=params.kylin_user,
            content=InlineTemplate(params.log4j_server_props))
        File(
            os.path.join(params.conf_dir, "kylin-tools-log4j.properties"),
            mode=0644,
            group=params.kylin_group,
            owner=params.kylin_user,
            content=InlineTemplate(params.log4j_tool_props))
    def test_action_create_xml_config_sorted_by_key(self, time_asctime_mock,
                                                    os_path_isdir_mock,
                                                    os_path_exists_mock,
                                                    create_file_mock,
                                                    ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and writes proper data
    where configurations={"Key":"Value"} are stored in sorted by key order
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        with Environment('/') as env:
            XmlConfig('file.xml',
                      conf_dir='/dir/conf',
                      configurations={
                          "": "",
                          "third": "should be third",
                          "first": "should be first",
                          "z_last": "should be last",
                          "second": "should be second",
                      },
                      configuration_attributes={})

        create_file_mock.assert_called_with(
            '/dir/conf/file.xml',
            u'  <configuration  xmlns:xi="http://www.w3.org/2001/XInclude">\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>first</name>\n      <value>should be first</value>\n    </property>\n    \n    <property>\n      <name>second</name>\n      <value>should be second</value>\n    </property>\n    \n    <property>\n      <name>third</name>\n      <value>should be third</value>\n    </property>\n    \n    <property>\n      <name>z_last</name>\n      <value>should be last</value>\n    </property>\n    \n  </configuration>',
            encoding='UTF-8',
            on_file_created=ANY)
    def test_action_create_simple_xml_config(self, time_asctime_mock,
                                             os_path_isdir_mock,
                                             os_path_exists_mock,
                                             create_file_mock, ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={"Some conf":"Some value"}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        with Environment('/') as env:
            XmlConfig(
                'file.xml',
                conf_dir='/dir/conf',
                configurations={'property1': 'value1'},
                configuration_attributes={'attr': {
                    'property1': 'attr_value'
                }})

        create_file_mock.assert_called_with(
            '/dir/conf/file.xml',
            u'  <configuration  xmlns:xi="http://www.w3.org/2001/XInclude">\n    \n    <property>\n      <name>property1</name>\n      <value>value1</value>\n      <attr>attr_value</attr>\n    </property>\n    \n  </configuration>',
            encoding='UTF-8',
            on_file_created=ANY)
Exemplo n.º 5
0
    def test_action_create_simple_xml_config(self, time_asctime_mock,
                                             os_path_isdir_mock,
                                             os_path_exists_mock, open_mock,
                                             ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={"Some conf":"Some value"}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        result_file = MagicMock()
        open_mock.return_value = result_file

        with Environment('/') as env:
            XmlConfig(
                'file.xml',
                conf_dir='/dir/conf',
                configurations={'property1': 'value1'},
                configuration_attributes={'attr': {
                    'property1': 'attr_value'
                }})

        open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
        result_file.__enter__().write.assert_called_with(
            u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name>property1</name>\n      <value>value1</value>\n      <attr>attr_value</attr>\n    </property>\n    \n  </configuration>\n'
        )
Exemplo n.º 6
0
    def test_action_create_empty_xml_config(self, time_asctime_mock,
                                            os_path_isdir_mock,
                                            os_path_exists_mock, open_mock,
                                            ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        result_file = MagicMock()
        open_mock.return_value = result_file

        with Environment('/') as env:
            XmlConfig('file.xml',
                      conf_dir='/dir/conf',
                      configurations={},
                      configuration_attributes={})

        open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
        result_file.__enter__().write.assert_called_with(
            u'<!--Wed 2014-02-->\n    <configuration>\n    \n  </configuration>\n'
        )
Exemplo n.º 7
0
    def test_action_create_xml_config_sorted_by_key(self, time_asctime_mock,
                                                    os_path_isdir_mock,
                                                    os_path_exists_mock,
                                                    open_mock, ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and writes proper data
    where configurations={"Key":"Value"} are stored in sorted by key order
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        result_file = MagicMock()
        open_mock.return_value = result_file

        with Environment('/') as env:
            XmlConfig('file.xml',
                      conf_dir='/dir/conf',
                      configurations={
                          "": "",
                          "third": "should be third",
                          "first": "should be first",
                          "z_last": "should be last",
                          "second": "should be second",
                      },
                      configuration_attributes={})

        open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
        result_file.__enter__().write.assert_called_with(
            u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>first</name>\n      <value>should be first</value>\n    </property>\n    \n    <property>\n      <name>second</name>\n      <value>should be second</value>\n    </property>\n    \n    <property>\n      <name>third</name>\n      <value>should be third</value>\n    </property>\n    \n    <property>\n      <name>z_last</name>\n      <value>should be last</value>\n    </property>\n    \n  </configuration>\n'
        )
Exemplo n.º 8
0
    def configure(self, env):
        import params
        import status_params
        env.set_params(params)
        env.set_params(status_params)
        self.create_zeppelin_log_dir(env)

        # write out zeppelin-site.xml
        XmlConfig(
            "zeppelin-site.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['zeppelin-config'],
            owner=params.zeppelin_user,
            group=params.zeppelin_group)
        # write out zeppelin-env.sh
        env_content = InlineTemplate(params.zeppelin_env_content)
        File(format("{params.conf_dir}/zeppelin-env.sh"),
             content=env_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out shiro.ini
        shiro_ini_content = InlineTemplate(params.shiro_ini_content)
        File(format("{params.conf_dir}/shiro.ini"),
             content=shiro_ini_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out log4j.properties
        File(format("{params.conf_dir}/log4j.properties"),
             content=params.log4j_properties_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)
Exemplo n.º 9
0
    def test_action_create_xml_config_with_metacharacters(
            self, time_asctime_mock, os_path_isdir_mock, os_path_exists_mock,
            open_mock, ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={"Some conf":"Some metacharacters"}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        result_file = MagicMock()
        open_mock.return_value = result_file

        with Environment('/') as env:
            XmlConfig(
                'file.xml',
                conf_dir='/dir/conf',
                configurations={
                    "": "",
                    "prop.1": "'.'yyyy-MM-dd-HH",
                    "prop.3": "%d{ISO8601} %5p %c{1}:%L - %m%n",
                    "prop.2": "INFO, openjpa",
                    "prop.4": "${oozie.log.dir}/oozie.log",
                    "prop.empty": "",
                },
            )

        open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
        result_file.__enter__().write.assert_called_with(
            u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.empty</name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.3</name>\n      <value>%d{ISO8601} %5p %c{1}:%L - %m%n</value>\n    </property>\n    \n    <property>\n      <name>prop.2</name>\n      <value>INFO, openjpa</value>\n    </property>\n    \n    <property>\n      <name>prop.1</name>\n      <value>&#39;.&#39;yyyy-MM-dd-HH</value>\n    </property>\n    \n    <property>\n      <name>prop.4</name>\n      <value>${oozie.log.dir}/oozie.log</value>\n    </property>\n    \n  </configuration>\n'
        )
Exemplo n.º 10
0
    def test_action_create_arguments(self, os_path_isdir_mock,
                                     os_path_exists_mock, file_mock):

        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False

        with Environment() as env:
            XmlConfig(
                'xmlFile.xml',
                conf_dir='/dir/conf',
                configurations={'property1': 'value1'},
                configuration_attributes={'attr': {
                    'property1': 'attr_value'
                }},
                mode=0755,
                owner="hdfs",
                group="hadoop",
                encoding="Code")

        self.assertEqual(file_mock.call_args[0][0], '/dir/conf/xmlFile.xml')
        call_args = file_mock.call_args[1].copy()
        del call_args['content']
        self.assertEqual(call_args, {
            'owner': 'hdfs',
            'group': 'hadoop',
            'mode': 0755,
            'encoding': 'Code'
        })
Exemplo n.º 11
0
    def configure(self, env):
        import params
        import status_params
        env.set_params(params)
        env.set_params(status_params)
        self.create_zeppelin_log_dir(env)

        # create the pid and zeppelin dirs
        Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
                  owner=params.zeppelin_user,
                  group=params.zeppelin_group,
                  cd_access="a",
                  create_parents=True,
                  mode=0755)
        self.chown_zeppelin_pid_dir(env)

        # write out zeppelin-site.xml
        XmlConfig(
            "zeppelin-site.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['zeppelin-config'],
            owner=params.zeppelin_user,
            group=params.zeppelin_group)
        # write out zeppelin-env.sh
        env_content = InlineTemplate(params.zeppelin_env_content)
        File(format("{params.conf_dir}/zeppelin-env.sh"),
             content=env_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out shiro.ini
        shiro_ini_content = InlineTemplate(params.shiro_ini_content)
        File(format("{params.conf_dir}/shiro.ini"),
             content=shiro_ini_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out log4j.properties
        File(format("{params.conf_dir}/log4j.properties"),
             content=params.log4j_properties_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # copy hive-site.xml only if Spark 1.x is installed
        if 'spark-defaults' in params.config['configurations'] and \
            os.path.exists("/etc/spark/conf/hive-site.xml"):
            File(format("{params.conf_dir}/hive-site.xml"),
                 content=StaticFile("/etc/spark/conf/hive-site.xml"),
                 owner=params.zeppelin_user,
                 group=params.zeppelin_group)

        if len(params.hbase_master_hosts) > 0 and \
            os.path.exists("/etc/hbase/conf/hbase-site.xml"):
            # copy hbase-site.xml
            File(format("{params.conf_dir}/hbase-site.xml"),
                 content=StaticFile("/etc/hbase/conf/hbase-site.xml"),
                 owner=params.zeppelin_user,
                 group=params.zeppelin_group)
Exemplo n.º 12
0
    def test_action_create_xml_config_with_metacharacters(
            self, time_asctime_mock, os_path_isdir_mock, os_path_exists_mock,
            create_file_mock, ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={"Some conf":"Some metacharacters"}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        with Environment('/') as env:
            XmlConfig('file.xml',
                      conf_dir='/dir/conf',
                      configurations={
                          "": "",
                          "prop.1": "'.'yyyy-MM-dd-HH",
                          "prop.3": "%d{ISO8601} %5p %c{1}:%L - %m%n",
                          "prop.2": "INFO, openjpa",
                          "prop.4": "${oozie.log.dir}/oozie.log",
                          "prop.empty": "",
                      },
                      configuration_attributes={
                          "": {
                              "prop.1": "should_not_be_printed",
                              "prop.2": "should_not_be_printed",
                          },
                          "attr1": {
                              "prop.1": "x",
                              "prop.8": "not_existed",
                          },
                          "attr2": {
                              "prop.4": "value4",
                              "prop.3": "value3"
                          },
                          "attr_empty": {},
                          "attr_value_empty": {
                              "prop.4": "",
                              "prop.empty": ""
                          }
                      })

        create_file_mock.assert_called_with(
            '/dir/conf/file.xml',
            u'  <configuration  xmlns:xi="http://www.w3.org/2001/XInclude">\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.1</name>\n      <value>&#39;.&#39;yyyy-MM-dd-HH</value>\n      <attr1>x</attr1>\n    </property>\n    \n    <property>\n      <name>prop.2</name>\n      <value>INFO, openjpa</value>\n    </property>\n    \n    <property>\n      <name>prop.3</name>\n      <value>%d{ISO8601} %5p %c{1}:%L - %m%n</value>\n      <attr2>value3</attr2>\n    </property>\n    \n    <property>\n      <name>prop.4</name>\n      <value>${oozie.log.dir}/oozie.log</value>\n      <attr_value_empty></attr_value_empty>\n      <attr2>value4</attr2>\n    </property>\n    \n    <property>\n      <name>prop.empty</name>\n      <value></value>\n      <attr_value_empty></attr_value_empty>\n    </property>\n    \n  </configuration>',
            encoding='UTF-8',
            on_file_created=ANY)
Exemplo n.º 13
0
    def configure(self, env):
        import params
        import status_params
        env.set_params(params)
        env.set_params(status_params)
        self.create_zeppelin_log_dir(env)

        # write out zeppelin-site.xml
        XmlConfig(
            "zeppelin-site.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['zeppelin-config'],
            owner=params.zeppelin_user,
            group=params.zeppelin_group)
        # write out zeppelin-env.sh
        env_content = InlineTemplate(params.zeppelin_env_content)
        File(format("{params.conf_dir}/zeppelin-env.sh"),
             content=env_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out shiro.ini
        shiro_ini_content = InlineTemplate(params.shiro_ini_content)
        File(format("{params.conf_dir}/shiro.ini"),
             content=shiro_ini_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out log4j.properties
        File(format("{params.conf_dir}/log4j.properties"),
             content=params.log4j_properties_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # copy hive-site.xml only if Spark 1.x is installed
        if 'spark-defaults' in params.config['configurations']:
            File(format("{params.conf_dir}/hive-site.xml"),
                 content=StaticFile("/etc/spark/conf/hive-site.xml"),
                 owner=params.zeppelin_user,
                 group=params.zeppelin_group)

        if len(params.hbase_master_hosts) > 0:
            # copy hbase-site.xml
            File(format("{params.conf_dir}/hbase-site.xml"),
                 content=StaticFile("/etc/hbase/conf/hbase-site.xml"),
                 owner=params.zeppelin_user,
                 group=params.zeppelin_group)
Exemplo n.º 14
0
  def configure(self, env):
    import params
    import status_params
    env.set_params(params)
    env.set_params(status_params)

    # write out zeppelin-site.xml
    XmlConfig("zeppelin-site.xml",
              conf_dir=params.conf_dir,
              configurations=params.config['configurations']['zeppelin-config'],
              owner=params.zeppelin_user,
              group=params.zeppelin_group
              )
    # write out zeppelin-env.sh
    env_content = InlineTemplate(params.zeppelin_env_content)
    File(format("{params.conf_dir}/zeppelin-env.sh"), content=env_content,
         owner=params.zeppelin_user, group=params.zeppelin_group)  # , mode=0777)
Exemplo n.º 15
0
    def test_action_create_empty_xml_config(self, time_asctime_mock,
                                            os_path_isdir_mock,
                                            os_path_exists_mock,
                                            create_file_mock, ensure_mock):
        """
    Tests if 'create' action - creates new non existent xml file and write proper data
    where configurations={}
    """
        os_path_isdir_mock.side_effect = [False, True]
        os_path_exists_mock.return_value = False
        time_asctime_mock.return_value = 'Wed 2014-02'

        with Environment('/') as env:
            XmlConfig('file.xml',
                      conf_dir='/dir/conf',
                      configurations={},
                      configuration_attributes={})

        create_file_mock.assert_called_with(
            '/dir/conf/file.xml',
            u'  <configuration>\n    \n  </configuration>',
            encoding='UTF-8')
Exemplo n.º 16
0
    def configure(self, env):
        import params
        import status_params
        env.set_params(params)
        env.set_params(status_params)
        self.create_zeppelin_log_dir(env)

        # create the pid and zeppelin dirs
        Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
                  owner=params.zeppelin_user,
                  group=params.zeppelin_group,
                  cd_access="a",
                  create_parents=True,
                  mode=0755)
        self.chown_zeppelin_pid_dir(env)

        # write out zeppelin-site.xml
        my_map = {}
        for key, value in params.config['configurations'][
                'zeppelin-config'].iteritems():
            my_map[key] = value
        my_map[
            'zeppelin.server.kerberos.keytab'] = params.zeppelin_kerberos_keytab
        my_map[
            'zeppelin.server.kerberos.principal'] = params.zeppelin_kerberos_principal

        XmlConfig("zeppelin-site.xml",
                  conf_dir=params.conf_dir,
                  configurations=my_map,
                  owner=params.zeppelin_user,
                  group=params.zeppelin_group)
        # write out zeppelin-env.sh
        env_content = InlineTemplate(params.zeppelin_env_content)
        File(format("{params.conf_dir}/zeppelin-env.sh"),
             content=env_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out shiro.ini
        shiro_ini_content = InlineTemplate(params.shiro_ini_content)
        File(format("{params.conf_dir}/shiro.ini"),
             content=shiro_ini_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out log4j.properties
        File(format("{params.conf_dir}/log4j.properties"),
             content=params.log4j_properties_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        self.create_zeppelin_hdfs_conf_dir(env)

        if len(params.hbase_master_hosts) > 0 and params.is_hbase_installed:
            # copy hbase-site.xml
            XmlConfig(
                "hbase-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['hbase-site'],
                configuration_attributes=params.
                config['configurationAttributes']['hbase-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644)

            XmlConfig(
                "hdfs-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['hdfs-site'],
                configuration_attributes=params.
                config['configurationAttributes']['hdfs-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644)

            XmlConfig(
                "core-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['core-site'],
                configuration_attributes=params.
                config['configurationAttributes']['core-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644)
Exemplo n.º 17
0
    def configure(self, env):
        import params
        env.set_params(params)
        self.create_kylin_log_dir(env)
        params.server_mode = 'job'

        # create the pid and kylin dirs
        Directory(
            [params.kylin_pid_dir, params.kylin_dir, params.conf_dir],
            owner=params.kylin_user,
            group=params.kylin_group,
            cd_access="a",
            create_parents=True,
            mode=0755)
        self.chown_kylin_pid_dir(env)

        File(
            os.path.join(params.conf_dir, "kylin.properties"),
            content=InlineTemplate(params.kylin_properties_template),
            owner=params.kylin_user,
            group=params.kylin_group)

        File(
            os.path.join(params.kylin_dir, "bin/check-env.sh"),
            mode=0755,
            content=InlineTemplate(params.kylin_check_env_template),
            owner=params.kylin_user,
            group=params.kylin_group)

        File(
            os.path.join(params.kylin_dir, "bin/kylin-env.sh"),
            mode=0755,
            content=InlineTemplate(params.kylin_env_template),
            owner=params.kylin_user,
            group=params.kylin_group)
        XmlConfig(
            "kylin_hive_conf.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin_hive_conf'],
            owner=params.kylin_user, group=params.kylin_group)
        XmlConfig(
            "kylin_job_conf.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin_job_conf'],
            owner=params.kylin_user, group=params.kylin_group)
        XmlConfig(
            "kylin_job_conf_inmem.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin_job_conf_inmem'],
            owner=params.kylin_user, group=params.kylin_group)
        XmlConfig(
            "kylin-kafka-consumer.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['kylin-kafka-consumer'],
            owner=params.kylin_user, group=params.kylin_group)
        File(
            os.path.join(params.conf_dir, "kylin-server-log4j.properties"),
            mode=0644,
            group=params.kylin_group,
            owner=params.kylin_user,
            content=InlineTemplate(params.log4j_server_props))
        File(
            os.path.join(params.conf_dir, "kylin-tools-log4j.properties"),
            mode=0644,
            group=params.kylin_group,
            owner=params.kylin_user,
            content=InlineTemplate(params.log4j_tool_props))
Exemplo n.º 18
0
    def configure(self, env):
        import params
        import status_params
        env.set_params(params)
        env.set_params(status_params)
        self.create_zeppelin_log_dir(env)

        # create the pid and zeppelin dirs
        Directory([params.zeppelin_pid_dir, params.zeppelin_dir],
                  owner=params.zeppelin_user,
                  group=params.zeppelin_group,
                  cd_access="a",
                  create_parents=True,
                  mode=0755)
        self.chown_zeppelin_pid_dir(env)

        XmlConfig(
            "zeppelin-site.xml",
            conf_dir=params.conf_dir,
            configurations=params.config['configurations']['zeppelin-site'],
            owner=params.zeppelin_user,
            group=params.zeppelin_group)
        # write out zeppelin-env.sh
        env_content = InlineTemplate(params.zeppelin_env_content)
        File(format("{params.conf_dir}/zeppelin-env.sh"),
             content=env_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out shiro.ini
        shiro_ini_content = InlineTemplate(params.shiro_ini_content)
        File(format("{params.conf_dir}/shiro.ini"),
             content=shiro_ini_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        # write out log4j.properties
        File(format("{params.conf_dir}/log4j.properties"),
             content=params.log4j_properties_content,
             owner=params.zeppelin_user,
             group=params.zeppelin_group)

        self.create_zeppelin_hdfs_conf_dir(env)

        generate_logfeeder_input_config(
            'zeppelin',
            Template("input.config-zeppelin.json.j2", extra_imports=[default]))

        if len(params.hbase_master_hosts) > 0 and params.is_hbase_installed:
            # copy hbase-site.xml
            XmlConfig(
                "hbase-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['hbase-site'],
                configuration_attributes=params.
                config['configurationAttributes']['hbase-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644)

            XmlConfig(
                "hdfs-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['hdfs-site'],
                configuration_attributes=params.
                config['configurationAttributes']['hdfs-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644)

            XmlConfig(
                "core-site.xml",
                conf_dir=params.external_dependency_conf,
                configurations=params.config['configurations']['core-site'],
                configuration_attributes=params.
                config['configurationAttributes']['core-site'],
                owner=params.zeppelin_user,
                group=params.zeppelin_group,
                mode=0644,
                xml_include_file=params.
                mount_table_xml_inclusion_file_full_path)

            if params.mount_table_content:
                File(params.mount_table_xml_inclusion_file_full_path,
                     owner=params.zeppelin_user,
                     group=params.zeppelin_group,
                     content=params.mount_table_content,
                     mode=0644)