def test_render(self):
     foo = conf_f.HadoopXML('foo')
     expected = {'ke1': 'value1', 'key2': 'value2'}
     foo._config_dict = expected
     actual = foo.render()
     bar = conf_f.HadoopXML('bar')
     bar.parse(actual)
     self.assertEqual(expected, bar._config_dict)
Exemple #2
0
    def get_config_files(self, cluster_context, configs, instance=None):
        hive_default = 'plugins/mapr/services/hive/resources/hive-default.xml'
        hive_site = bcf.HadoopXML("hive-site.xml")
        hive_site.remote_path = self.conf_dir(cluster_context)
        if instance:
            hive_site.fetch(instance)
        hive_site.parse(files.get_file_text(hive_default, 'sahara_plugins'))
        hive_site.add_properties(self._get_hive_site_props(cluster_context))
        sentry_host = cluster_context.get_instance(sentry.SENTRY)
        if sentry_host:
            sentry_mode = cluster_context._get_cluster_config_value(
                sentry.Sentry().SENTRY_STORAGE_MODE)
            ui_name = sentry.Sentry().ui_name
            sentry_version = cluster_context.get_chosen_service_version(
                ui_name)
            sentry_service = cluster_context. \
                _find_service_instance(ui_name, sentry_version)
            if sentry_service.supports(self, sentry_mode):
                sentry_default = 'plugins/mapr/services/hive/resources/' \
                                 'sentry-default.xml'
                sentry_db = \
                    'plugins/mapr/services/hive/resources/sentry-db.xml'
                hive_site.parse(
                    files.get_file_text(sentry_default, 'sahara_plugins'))
                hive_site.add_property(
                    'hive.sentry.conf.url', 'file://%s/sentry-site.xml' %
                    sentry_service.conf_dir(cluster_context))
                if sentry_mode == sentry.DB_STORAGE_SENTRY_MODE:
                    hive_site.parse(
                        files.get_file_text(sentry_db, 'sahara_plugins'))

        return [hive_site]
    def get_config_files(self, cluster_context, configs, instance=None):
        core_site = bcf.HadoopXML("core-site.xml")
        core_site.remote_path = self.conf_dir(cluster_context)
        if instance:
            core_site.fetch(instance)
        core_site.add_properties(self._get_core_site_props(cluster_context))

        mapred_site = bcf.HadoopXML("mapred-site.xml")
        mapred_site.remote_path = self.conf_dir(cluster_context)
        if instance:
            mapred_site.fetch(instance)
        mapred_site.load_properties(configs)
        mapred_site.add_properties(
            self._get_mapred_site_props(cluster_context))

        return [core_site, mapred_site]
 def get_config_files(self, cluster_context, configs, instance=None):
     hbase_site = bcf.HadoopXML("hbase-site.xml")
     hbase_site.remote_path = self.conf_dir(cluster_context)
     if instance:
         hbase_site.fetch(instance)
     hbase_site.load_properties(configs)
     return [hbase_site]
Exemple #5
0
 def get_config_files(self, cluster_context, configs, instance=None):
     oozie_site = bcf.HadoopXML("oozie-site.xml")
     oozie_site.remote_path = self.conf_dir(cluster_context)
     if instance:
         oozie_site.fetch(instance)
     oozie_site.load_properties(configs)
     oozie_site.add_properties(self._get_oozie_site_props(cluster_context))
     return [oozie_site]
 def test_add_property(self):
     foo = conf_f.HadoopXML('foo')
     self.assertEqual(foo._config_dict, {})
     foo.add_property('key1', 'value1')
     self.assertEqual(foo._config_dict, {'key1': 'value1'})
     foo.add_property('key2', 'value2')
     expected = {'key1': 'value1', 'key2': 'value2'}
     self.assertEqual(expected, foo._config_dict)
 def get_config_files(self, cluster_context, configs, instance=None):
     sentry_default = \
         'plugins/mapr/services/sentry/resources/sentry-default.xml'
     global_policy_template = \
         'plugins/mapr/services/sentry/resources/global-policy.ini'
     sentry_site = cf.HadoopXML('sentry-site.xml')
     sentry_site.remote_path = self.conf_dir(cluster_context)
     if instance:
         sentry_site.fetch(instance)
     sentry_site.load_properties(configs)
     sentry_mode = configs[self.SENTRY_STORAGE_MODE.name]
     sentry_site.parse(utils.get_file_text(sentry_default,
                                           'sahara_plugins'))
     sentry_site.add_properties(
         self._get_sentry_site_props(cluster_context, sentry_mode))
     global_policy = cf.TemplateFile('global-policy.ini')
     global_policy.remote_path = self.conf_dir(cluster_context)
     global_policy.parse(
         utils.get_file_text(global_policy_template, 'sahara_plugins'))
     return [sentry_site, global_policy]
 def test_get_config_value(self):
     foo = conf_f.HadoopXML('foo')
     foo._config_dict = {'foo': 'bar'}
     self.assertEqual('bar', foo._get_config_value('foo'))
     self.assertIsNone(foo._get_config_value('bar'))
 def test_parse(self):
     foo = conf_f.HadoopXML('foo')
     foo.parse(self.content)
     expected = {'key1': 'value1', 'key2': 'value2'}
     self.assertEqual(expected, foo._config_dict)
 def test_remote_path(self):
     foo = conf_f.HadoopXML('foo')
     foo.remote_path = '/bar'
     self.assertEqual('/bar/foo', foo.remote_path)