You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2017/08/10 10:27:07 UTC
[01/50] [abbrv] ambari git commit: AMBARI-21581 - Replace Hard Coded
conf-select Structures (jonathanhurley)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-logsearch-ui 0256fb7f7 -> f50c17b98
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
index f074036..4aa18de 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_client.py
@@ -197,19 +197,9 @@ class TestZookeeperClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'zookeeper-client', version), sudo=True)
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'zookeeper', '--stack-version', '2.3.0.0-3242', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'zookeeper', '--stack-version', '2.3.0.0-3242', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
index bc58e56..3cbfbd6 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
@@ -284,22 +284,10 @@ class TestZookeeperServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalledIgnoreEarlier('Link', ('/etc/zookeeper/conf'), to='/etc/zookeeper/conf.backup')
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'zookeeper-server', version), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'zookeeper', '--stack-version', '2.3.0.0-3242', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'zookeeper', '--stack-version', '2.3.0.0-3242', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
self.assertNoMoreResources()
@patch.object(resource_management.libraries.functions, "get_unique_id_and_date")
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
index caef738..f1da837 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
@@ -19,15 +19,26 @@ limitations under the License.
'''
import json
-from mock.mock import MagicMock, call, patch
+from mock.mock import MagicMock, patch
from stacks.utils.RMFTestCase import *
+from resource_management.core.logger import Logger
from resource_management.libraries.functions import conf_select
+from resource_management.libraries.script import Script
@patch("os.path.exists", new = MagicMock(return_value=True))
@patch("os.path.isfile", new = MagicMock(return_value=False))
class TestHookAfterInstall(RMFTestCase):
CONFIG_OVERRIDES = {"serviceName":"HIVE", "role":"HIVE_SERVER"}
+ def setUp(self):
+ Logger.initialize_logger()
+
+ Script.config = dict()
+ Script.config.update( { "configurations" : { "cluster-env" : {} }, "hostLevelParams": {} } )
+ Script.config["configurations"]["cluster-env"]["stack_packages"] = RMFTestCase.get_stack_packages()
+ Script.config["hostLevelParams"] = { "stack_name" : "HDP" }
+
+
def test_hook_default(self):
self.executeScript("2.0.6/hooks/after-INSTALL/scripts/hook.py",
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_client.py b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_client.py
index dcc649d..9de2156 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_client.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_client.py
@@ -126,18 +126,8 @@ class TestFalconClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'falcon-client', version), sudo=True,)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'falcon', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'falcon', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
index a7e6a1e..2c877c8 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
@@ -470,7 +470,6 @@ class TestFalconServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute',
@@ -487,12 +486,3 @@ class TestFalconServer(RMFTestCase):
action = ['delete'],
)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'falcon', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'falcon', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
index e3ed890..630ac3b 100644
--- a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
@@ -443,22 +443,12 @@ class TestHiveMetastore(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hive/conf'), to='/usr/hdp/current/hive-client/conf')
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hive-metastore', version), sudo=True,)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
def test_pre_upgrade_restart_ims(self):
"""
@@ -558,11 +548,8 @@ class TestHiveMetastore(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- # conf-select, hdp-select BEFORE upgrade schema calls
- self.assertResourceCalled('Link', ('/etc/hive/conf'), to='/usr/hdp/current/hive-client/conf')
self.assertResourceCalled('Execute', ('ambari-python-wrap',
'/usr/bin/hdp-select',
'set',
@@ -768,11 +755,8 @@ class TestHiveMetastore(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hive/conf'), to='/usr/hdp/current/hive-client/conf')
-
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hive-metastore', version), sudo=True,)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py
index 608b156..220b422 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py
@@ -167,16 +167,6 @@ class TestStormDrpcServer(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
index ab5da22..a2f2e5e 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
@@ -305,18 +305,7 @@ class TestStormNimbus(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
self.assertResourceCalled("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-nimbus', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py
index efa50c8..df978b9 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus_prod.py
@@ -141,18 +141,7 @@ class TestStormNimbus(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
self.assertResourceCalled("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-nimbus', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor.py
index 116597b..0232b45 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor.py
@@ -206,17 +206,7 @@ class TestStormSupervisor(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
self.assertResourceCalled("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-supervisor', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor_prod.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor_prod.py
index 46221a9..f995d89 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor_prod.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_supervisor_prod.py
@@ -184,18 +184,7 @@ class TestStormSupervisor(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
self.assertResourceCalled("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-supervisor', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
index 985c754..ee81eed 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
@@ -236,16 +236,6 @@ class TestStormUiServer(TestStormBase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'storm-client', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'storm', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py b/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
index bd7567a..fad99f6 100644
--- a/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
+++ b/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
@@ -110,26 +110,11 @@ class TestTezClient(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True)
self.assertNoMoreResources()
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(2, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'tez', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'tez', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
def test_stack_upgrade_save_new_config(self):
config_file = self.get_src_folder()+"/test/python/stacks/2.1/configs/client-upgrade.json"
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py b/ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py
index ad2d25f..b352920 100644
--- a/ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py
+++ b/ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py
@@ -284,17 +284,7 @@ class TestAppTimelineServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-yarn-timelineserver', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/ACCUMULO/test_accumulo_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/ACCUMULO/test_accumulo_client.py b/ambari-server/src/test/python/stacks/2.2/ACCUMULO/test_accumulo_client.py
index 3ffd0a9..41bc815 100644
--- a/ambari-server/src/test/python/stacks/2.2/ACCUMULO/test_accumulo_client.py
+++ b/ambari-server/src/test/python/stacks/2.2/ACCUMULO/test_accumulo_client.py
@@ -68,18 +68,7 @@ class TestAccumuloClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'accumulo-client', version), sudo=True,)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'accumulo', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'accumulo', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py b/ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py
index 477830e..7433dd3 100644
--- a/ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py
+++ b/ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py
@@ -158,20 +158,9 @@ class TestKafkaBroker(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'kafka-broker', version), sudo=True,)
- self.assertResourceCalled("Link", "/etc/kafka/conf", to="/usr/hdp/current/kafka-broker/conf")
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'kafka', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'kafka', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
index 32b5d70..8cdbb2e 100644
--- a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
+++ b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
@@ -179,7 +179,6 @@ class TestKnoxGateway(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalled('Execute', ('tar',
@@ -191,14 +190,6 @@ class TestKnoxGateway(RMFTestCase):
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'knox-server', version),sudo = True)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
@patch("os.remove")
@patch("os.path.exists")
@@ -228,7 +219,6 @@ class TestKnoxGateway(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalled('Execute', ('tar',
@@ -243,14 +233,6 @@ class TestKnoxGateway(RMFTestCase):
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
@patch("os.remove")
@patch("os.path.exists")
@@ -311,14 +293,6 @@ class TestKnoxGateway(RMFTestCase):
)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'knox', '--stack-version', version, '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
'''
@patch("os.path.islink")
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_admin.py b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_admin.py
index 961be84..2936258 100644
--- a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_admin.py
+++ b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_admin.py
@@ -222,16 +222,6 @@ class TestRangerAdmin(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'ranger-admin', '2.3.0.0-1234'), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'ranger-admin', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'ranger-admin', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
index f0aee10..4c5ce0a 100644
--- a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
+++ b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
@@ -144,7 +144,6 @@ class TestRangerUsersync(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (1, None), (0, None)],
mocks_dict = mocks_dict)
self.assertTrue(setup_usersync_mock.called)
@@ -153,14 +152,6 @@ class TestRangerUsersync(RMFTestCase):
sudo = True)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'ranger-usersync', '2.3.0.0-1234'), sudo=True)
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'ranger-usersync', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'ranger-usersync', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
def assert_configure_default(self):
self.assertResourceCalled('PropertiesFile', '/usr/hdp/current/ranger-usersync/install.properties',
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
index d4dcc48..3583016 100644
--- a/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
+++ b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
@@ -193,26 +193,9 @@ class TestSliderClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'slider-client', '2.3.0.0-1234'), sudo=True)
self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', '2.3.0.0-1234'), sudo=True)
- self.assertResourceCalled('Link', '/etc/hadoop/conf', to='/usr/hdp/current/hadoop-client/conf')
self.assertNoMoreResources()
-
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(2, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'slider', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'slider', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py b/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
index b87f8fc..40c9d47 100644
--- a/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
+++ b/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
@@ -339,17 +339,7 @@ class TestJobHistoryServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'spark-historyserver', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'spark', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'spark', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py b/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
index 3fe59ad..b4535cd 100644
--- a/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
+++ b/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
@@ -168,20 +168,11 @@ class TestSparkClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'spark-client', version), sudo=True)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'spark', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'spark', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
def test_stack_upgrade_save_new_config(self):
config_file = self.get_src_folder()+"/test/python/stacks/2.2/configs/default.json"
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py b/ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py
index d445d74..2eeec46 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_conf_select.py
@@ -22,6 +22,7 @@ from mock.mock import patch, MagicMock
from stacks.utils.RMFTestCase import *
from resource_management.core.logger import Logger
from resource_management.libraries.functions import conf_select
+from resource_management.libraries.script import Script
class TestConfSelect(RMFTestCase):
@@ -33,6 +34,12 @@ class TestConfSelect(RMFTestCase):
self.env = Environment(test_mode=True)
self.env.__enter__()
+ Script.config = dict()
+ Script.config.update( { "configurations" : { "cluster-env" : {} }, "hostLevelParams": {} } )
+ Script.config["configurations"]["cluster-env"]["stack_packages"] = RMFTestCase.get_stack_packages()
+ Script.config["hostLevelParams"] = { "stack_name" : "HDP" }
+
+
def tearDown(self):
self.env.__exit__(None,None,None)
@@ -82,9 +89,11 @@ class TestConfSelect(RMFTestCase):
Tests that a bad enum throws an exception.
:return:
"""
+ packages = conf_select.get_package_dirs()
+
try:
conf_select.convert_conf_directories_to_symlinks("hadoop", "2.3.0.0-1234",
- conf_select._PACKAGE_DIRS["hadoop"], link_to = "INVALID")
+ packages["hadoop"], link_to = "INVALID")
raise Exception("Expected failure when supplying a bad enum for link_to")
except:
pass
@@ -125,15 +134,16 @@ class TestConfSelect(RMFTestCase):
return False
+ packages = conf_select.get_package_dirs()
+
path_mock.side_effect = path_mock_call
islink_mock.side_effect = islink_mock_call
shell_call_mock.side_effect = mock_call
- conf_select.convert_conf_directories_to_symlinks("hadoop", "2.3.0.0-1234", conf_select._PACKAGE_DIRS["hadoop"])
+ conf_select.convert_conf_directories_to_symlinks("hadoop", "2.3.0.0-1234", packages["hadoop"])
- self.assertEqual(pprint.pformat(self.env.resource_list),
- "[Execute[('cp', '-R', '-p', '/etc/hadoop/conf', '/etc/hadoop/conf.backup')],\n "
- "Directory['/etc/hadoop/conf'],\n "
- "Link['/etc/hadoop/conf']]")
+ self.assertEqual(pprint.pformat(self.env.resource_list[0]), "Execute[('cp', '-R', '-p', u'/etc/hadoop/conf', u'/etc/hadoop/conf.backup')]")
+ self.assertEqual(pprint.pformat(self.env.resource_list[1]), "Directory['/etc/hadoop/conf']")
+ self.assertEqual(pprint.pformat(self.env.resource_list[2]), "Link['/etc/hadoop/conf']")
@patch.object(os.path, "exists", new = MagicMock(return_value = True))
@@ -147,8 +157,10 @@ class TestConfSelect(RMFTestCase):
Tests that conf-select symlinking can detect a wrong directory
:return:
"""
+ packages = conf_select.get_package_dirs()
+
conf_select.convert_conf_directories_to_symlinks("hadoop", "2.3.0.0-1234",
- conf_select._PACKAGE_DIRS["hadoop"])
+ packages["hadoop"])
self.assertEqual(pprint.pformat(self.env.resource_list),
"[Link['/etc/hadoop/conf'], Link['/etc/hadoop/conf']]")
@@ -161,7 +173,9 @@ class TestConfSelect(RMFTestCase):
Tests that conf-select symlinking does nothing if the directory doesn't exist
:return:
"""
+ packages = conf_select.get_package_dirs()
+
conf_select.convert_conf_directories_to_symlinks("hadoop", "2.3.0.0-1234",
- conf_select._PACKAGE_DIRS["hadoop"], link_to = conf_select.DIRECTORY_TYPE_BACKUP)
+ packages["hadoop"], link_to = conf_select.DIRECTORY_TYPE_BACKUP)
self.assertEqual(pprint.pformat(self.env.resource_list), "[]")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
index 9286b7a..96a2e9f 100644
--- a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
+++ b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
@@ -104,7 +104,6 @@ class TestMahoutClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = itertools.cycle([(0, None, '')]),
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'mahout-client', '2.3.0.0-1234'),sudo = True)
@@ -113,15 +112,4 @@ class TestMahoutClient(RMFTestCase):
import sys
self.assertEquals("/usr/hdp/2.3.0.0-1234/hadoop/conf",
- sys.modules["params"].hadoop_conf_dir)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'mahout', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'mahout', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
+ sys.modules["params"].hadoop_conf_dir)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py b/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
index ddd1ab3..f0a89a9 100644
--- a/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
@@ -185,17 +185,7 @@ class TestSparkThriftServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'spark-thriftserver', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'spark', '--stack-version', '2.3.2.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'spark', '--stack-version', '2.3.2.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
index e48c8c7..7c61e80 100644
--- a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
+++ b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
@@ -109,8 +109,8 @@ class RMFTestCase(TestCase):
if "stack_features" not in self.config_dict["configurations"]["cluster-env"]:
self.config_dict["configurations"]["cluster-env"]["stack_features"] = RMFTestCase.get_stack_features()
- if "stack_select_packages" not in self.config_dict["configurations"]["cluster-env"]:
- self.config_dict["configurations"]["cluster-env"]["stack_select_packages"] = RMFTestCase.get_stack_select_packages()
+ if "stack_packages" not in self.config_dict["configurations"]["cluster-env"]:
+ self.config_dict["configurations"]["cluster-env"]["stack_packages"] = RMFTestCase.get_stack_packages()
if config_overrides:
for key, value in config_overrides.iteritems():
@@ -195,12 +195,12 @@ class RMFTestCase(TestCase):
return f.read()
@staticmethod
- def get_stack_select_packages():
+ def get_stack_packages():
"""
- Read stack_select_packages config property from resources/stacks/HDP/2.0.6/properties/stack_features.json
+ Read stack_packages config property from resources/stacks/HDP/2.0.6/properties/stack_packages.json
"""
- stack_features_file = os.path.join(RMFTestCase.get_src_folder(), PATH_TO_STACKS, "2.0.6", "properties", "stack_select_packages.json")
- with open(stack_features_file, "r") as f:
+ stack_packages_file = os.path.join(RMFTestCase.get_src_folder(), PATH_TO_STACKS, "2.0.6", "properties", "stack_packages.json")
+ with open(stack_packages_file, "r") as f:
return f.read()
@staticmethod
[19/50] [abbrv] ambari git commit: AMBARI-21660 Stack selection page
does not load the HDP stacks. (ababiichuk)
Posted by ab...@apache.org.
AMBARI-21660 Stack selection page does not load the HDP stacks. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4cd96576
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4cd96576
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4cd96576
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 4cd96576ed5cab53a271b4892d548002c33fb2e7
Parents: 2d1ac66
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Aug 4 15:05:39 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Aug 4 15:05:39 2017 +0300
----------------------------------------------------------------------
.../app/controllers/wizard/step1_controller.js | 2 +
ambari-web/app/routes/installer.js | 4 +-
ambari-web/app/templates/wizard/step1.hbs | 326 ++++++++++---------
ambari-web/app/views/wizard/step1_view.js | 2 +-
.../test/controllers/wizard/step1_test.js | 2 +
ambari-web/test/views/wizard/step1_view_test.js | 2 +-
6 files changed, 182 insertions(+), 156 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/controllers/wizard/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step1_controller.js b/ambari-web/app/controllers/wizard/step1_controller.js
index 22456af..c137d96 100644
--- a/ambari-web/app/controllers/wizard/step1_controller.js
+++ b/ambari-web/app/controllers/wizard/step1_controller.js
@@ -136,6 +136,8 @@ App.WizardStep1Controller = Em.Controller.extend({
*/
selectedStackType: Em.computed.findBy('availableStackTypes', 'isSelected', true),
+ isLoadingComplete: Em.computed.equal('wizardController.loadStacksRequestsCounter', 0),
+
/**
* Load selected file to current page content
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/routes/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/installer.js b/ambari-web/app/routes/installer.js
index eae03a7..ec8f1b9 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -149,9 +149,11 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
connectOutlets: function (router) {
console.time('step1 connectOutlets');
var self = this;
- var controller = router.get('installerController');
+ var controller = router.get('installerController'),
+ wizardStep1Controller = router.get('wizardStep1Controller');
controller.setCurrentStep('1');
controller.loadAllPriorSteps().done(function () {
+ wizardStep1Controller.set('wizardController', controller);
controller.connectOutlet('wizardStep1', controller.get('content'));
self.scrollTop();
console.timeEnd('step1 connectOutlets');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs
index 5faf056..6b15e65 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -21,121 +21,136 @@
<div class="panel panel-default">
<div class="panel-body">
- {{! left tabs }}
- <div class="tabs-menu">
- <ul class="nav nav-tabs" {{QAAttr "stack-tabs"}}>
- {{#each stack in availableStackTypes}}
- <li {{bindAttr class="stack.isSelected:active"}} {{QAAttr "stack-tab"}}><a {{QAAttr "stack-link-{stack.stackName}"}} {{action "selectRepoInList" stack target="controller"}} href="#">{{stack.stackName}}</a></li>
- {{/each}}
- </ul>
- </div>
- <div class="stacks-options">
- <div class="details-panel">
- <div class="btn-group" {{QAAttr "select-version"}}>
- <button type="button" data-toggle="dropdown" class="btn dropdown-toggle btn-default" {{QAAttr "select-version-button"}}>{{controller.selectedStack.displayName}} <span class="caret"></span></button>
- <ul class="dropdown-menu">
- {{#each stack in selectedStackType.stacks}}
- <li>
- {{!view view.stackRadioButton stackBinding="stack"}}
- <a href="#" {{action "changeVersion" stack target="controller"}} {{QAAttr "{stack.displayName}"}}>{{stack.displayName}}
- {{#if stack.stackDefault}}
- ({{t installer.step1.changeVersion.defaultVersion}})
- {{/if}}
- </a>
- </li>
- {{/each}}
- <li><a href="#" {{action "uploadVdf" target="controller"}} {{QAAttr "add-new-version"}}>{{t installer.step1.addVersion}} ...</a></li>
- </ul>
- </div>
- <div class="version-contents-section">
- {{#unless servicesForSelectedStack}}
- <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div>
- {{/unless}}
- <table class="table table-hover">
- <tbody>
+ {{#if isLoadingComplete}}
+ {{! left tabs }}
+ <div class="tabs-menu">
+ <ul class="nav nav-tabs" {{QAAttr "stack-tabs"}}>
+ {{#each stack in availableStackTypes}}
+ <li {{bindAttr class="stack.isSelected:active"}} {{QAAttr "stack-tab"}}>
+ <a {{QAAttr "stack-link-{stack.stackName}"}} {{action "selectRepoInList" stack target="controller"}}
+ href="#">{{stack.stackName}}</a></li>
+ {{/each}}
+ </ul>
+ </div>
+ <div class="stacks-options">
+ <div class="details-panel">
+ <div class="btn-group" {{QAAttr "select-version"}}>
+ <button type="button" data-toggle="dropdown"
+ class="btn dropdown-toggle btn-default" {{QAAttr "select-version-button"}}>{{controller.selectedStack.displayName}}
+ <span class="caret"></span></button>
+ <ul class="dropdown-menu">
+ {{#each stack in selectedStackType.stacks}}
+ <li>
+ {{!view view.stackRadioButton stackBinding="stack"}}
+ <a
+ href="#" {{action "changeVersion" stack target="controller"}} {{QAAttr "{stack.displayName}"}}>{{stack.displayName}}
+ {{#if stack.stackDefault}}
+ ({{t installer.step1.changeVersion.defaultVersion}})
+ {{/if}}
+ </a>
+ </li>
+ {{/each}}
+ <li><a
+ href="#" {{action "uploadVdf" target="controller"}} {{QAAttr "add-new-version"}}>{{t installer.step1.addVersion}}
+ ...</a></li>
+ </ul>
+ </div>
+ <div class="version-contents-section">
+ {{#unless servicesForSelectedStack}}
+ <div class="alert alert-info"
+ role="alert">{{t installer.step1.useLocalRepo.infoForm.content.empty}}</div>
+ {{/unless}}
+ <table class="table table-hover">
+ <tbody>
{{#each service in servicesForSelectedStack}}
<tr>
<td class="col-md-4">{{service.displayName}}</td>
<td class="col-md-8">{{service.latestVersion}}</td>
</tr>
{{/each}}
- </tbody>
- </table>
+ </tbody>
+ </table>
+ </div>
</div>
</div>
- </div>
- {{! left tabs end }}
+ {{! left tabs end }}
- {{#if App.router.nextBtnClickInProgress}}
- {{view App.SpinnerView}}
- {{else}}
- <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate>
+ {{#if App.router.nextBtnClickInProgress}}
+ {{view App.SpinnerView}}
+ {{else}}
+ <form id="repoVersionInfoForm" class="form-horizontal" role="form" name="localVersionInfoForm" novalidate>
- <div class="panel panel-default repos-panel">
- <div class="step-title">
- <p>{{t common.repositories}}</p>
- </div>
- <p class="step-description">{{t installer.step1.repo.body}}</p>
- <div class="panel-body version-contents-body">
- <div class="row radio-group">
- {{! Public Repository radio }}
- <div {{bindAttr class=":col-sm-4 :radio :big-radio :public-radio :wizard-plain-text"}}>
- {{view view.usePublicRepoRadioButton classNames="display-inline-block" labelIdentifier="use-public-repo"}}
- {{#if stackRepoUpdateLinkExists}}
- {{#if networkIssuesExist}}
- <a id="public-disabled-link" class="display-inline-block" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a>
- {{/if}}
- {{/if}}
+ <div class="panel panel-default repos-panel">
+ <div class="step-title">
+ <p>{{t common.repositories}}</p>
</div>
- {{!--Local repo radio--}}
- {{view view.useLocalRepoRadioButton classNames="radio big-radio col-sm-4" labelIdentifier="use-local-repo"}}
- </div>
- <div class="alert alert-info" role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div>
- {{#if view.showWarning}}
- <div class="alert alert-warning" {{QAAttr "step1-warning"}}>{{t installer.step1.attentionNeeded}}</div>
- {{/if}}
+ <p class="step-description">{{t installer.step1.repo.body}}</p>
+ <div class="panel-body version-contents-body">
+ <div class="row radio-group">
+ {{! Public Repository radio }}
+ <div {{bindAttr class=":col-sm-4 :radio :big-radio :public-radio :wizard-plain-text"}}>
+ {{view view.usePublicRepoRadioButton classNames="display-inline-block" labelIdentifier="use-public-repo"}}
+ {{#if stackRepoUpdateLinkExists}}
+ {{#if networkIssuesExist}}
+ <a id="public-disabled-link"
+ class="display-inline-block" {{action "openPublicOptionDisabledWindow" target="view"}}>{{t installer.step1.selectUseRepoOptions.public.networkLost}}</a>
+ {{/if}}
+ {{/if}}
+ </div>
+ {{!--Local repo radio--}}
+ {{view view.useLocalRepoRadioButton classNames="radio big-radio col-sm-4" labelIdentifier="use-local-repo"}}
+ </div>
+ <div class="alert alert-info"
+ role="alert">{{t installer.step1.useLocalRepo.infoForm.alert.baseUrl}}</div>
+ {{#if view.showWarning}}
+ <div
+ class="alert alert-warning" {{QAAttr "step1-warning"}}>{{t installer.step1.attentionNeeded}}</div>
+ {{/if}}
- {{! OSes and Repositories }}
- <div class="row">
- <div class="table-controls row col-sm-12 pull-right">
- <div class="col-sm-12">
- {{! Add OS }}
- <div class="btn-group pull-right">
- <button
- type="button" {{bindAttr data-original-title="view.addOsButtonTooltip" class=":btn :btn-default :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}}
- {{QAAttr "add-os-button"}}
- data-toggle="dropdown">
- <i class="glyphicon glyphicon-plus"></i> {{t common.add}} <span class="caret"></span>
- </button>
- <ul class="dropdown-menu">
- {{#each operatingSystem in selectedStack.operatingSystems}}
- {{#unless operatingSystem.isSelected}}
- <li><a {{action "addOS" operatingSystem target="controller"}} {{QAAttr "add-os-{operatingSystem.osType}"}}>{{operatingSystem.osType}}</a></li>
- {{/unless}}
- {{/each}}
- </ul>
+ {{! OSes and Repositories }}
+ <div class="row">
+ <div class="table-controls row col-sm-12 pull-right">
+ <div class="col-sm-12">
+ {{! Add OS }}
+ <div class="btn-group pull-right">
+ <button
+ type="button" {{bindAttr data-original-title="view.addOsButtonTooltip" class=":btn :btn-default :dropdown-toggle :add-os-button view.isAddOsButtonDisabled:disabled"}}
+ {{QAAttr "add-os-button"}}
+ data-toggle="dropdown">
+ <i class="glyphicon glyphicon-plus"></i> {{t common.add}} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each operatingSystem in selectedStack.operatingSystems}}
+ {{#unless operatingSystem.isSelected}}
+ <li>
+ <a {{action "addOS" operatingSystem target="controller"}} {{QAAttr "add-os-{operatingSystem.osType}"}}>{{operatingSystem.osType}}</a>
+ </li>
+ {{/unless}}
+ {{/each}}
+ </ul>
+ </div>
+ {{! Add OS END}}
+ </div>
</div>
- {{! Add OS END}}
</div>
- </div>
- </div>
- <table class="table table-hover">
- <thead>
- <tr>
- <th class="col-sm-2">{{t common.os}}</th>
- <th class="col-sm-3">{{t common.name}}</th>
- <th class="col-sm-6">{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</th>
- <th class="col-sm-1"></th>
- </tr>
- </thead>
- <tbody>
- {{#each operatingSystem in selectedStack.operatingSystems}}
- {{#if operatingSystem.isSelected}}
- <tr {{QAAttr "os-wrapper"}}>
- <td class="col-sm-2" {{QAAttr "os-type-label"}}>{{operatingSystem.osType}}</td>
- <td class="col-sm-9" colspan="2">
- <table class="table table-condensed no-borders inner-table" {{QAAttr "{operatingSystem.osType}"}}>
- <tbody>
+ <table class="table table-hover">
+ <thead>
+ <tr>
+ <th class="col-sm-2">{{t common.os}}</th>
+ <th class="col-sm-3">{{t common.name}}</th>
+ <th class="col-sm-6">{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</th>
+ <th class="col-sm-1"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each operatingSystem in selectedStack.operatingSystems}}
+ {{#if operatingSystem.isSelected}}
+ <tr {{QAAttr "os-wrapper"}}>
+ <td class="col-sm-2" {{QAAttr "os-type-label"}}>{{operatingSystem.osType}}</td>
+ <td class="col-sm-9" colspan="2">
+ <table
+ class="table table-condensed no-borders inner-table" {{QAAttr "{operatingSystem.osType}"}}>
+ <tbody>
{{#each repository in operatingSystem.repositories}}
<tr {{QAAttr "{repository.repoName}"}}>
<td class="col-sm-3">{{repository.repoId}}</td>
@@ -161,63 +176,68 @@
</div>
</td>
</tr>
- {{/each}}
- </tbody>
- </table>
- </td>
- <td class="col-sm-1">
- <a class="action remove-icon" href="#" {{action "removeOS" operatingSystem target="view"}} {{QAAttr "remove-icon"}}>
- <span class="icon icon-minus"></span>
+ {{/each}}
+ </tbody>
+ </table>
+ </td>
+ <td class="col-sm-1">
+ <a class="action remove-icon"
+ href="#" {{action "removeOS" operatingSystem target="view"}} {{QAAttr "remove-icon"}}>
+ <span class="icon icon-minus"></span>
{{t common.remove}}
- </a>
- </td>
- </tr>
- {{/if}}
- {{/each}}
- </tbody>
- </table>
- {{! OSes and Repositories END }}
+ </a>
+ </td>
+ </tr>
+ {{/if}}
+ {{/each}}
+ </tbody>
+ </table>
+ {{! OSes and Repositories END }}
- {{! Skip Repository Base URL validation }}
- <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>
- {{#view App.CheckboxView
- labelTranslate="installer.step1.advancedRepo.skipValidation.message"
- labelClassNamesBinding="controller.selectedStack.useRedhatSatellite:disabled"
- checkedBinding="skipValidationChecked"
- disabledBinding="controller.selectedStack.useRedhatSatellite"
- labelIdentifier="skip-validation"
- }}
- <i class="glyphicon glyphicon-question-sign" rel="skip-validation-tooltip"
- data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.skipValidation.tooltip"}}>
- </i>
- {{/view}}
- <div class="clearfix"></div>
- </div>
- {{! Skip Repository Base URL validation END }}
+ {{! Skip Repository Base URL validation }}
+ <div id="skip-validation" {{bindAttr class="controller.selectedStack.useRedhatSatellite:disabled"}}>
+ {{#view App.CheckboxView
+ labelTranslate="installer.step1.advancedRepo.skipValidation.message"
+ labelClassNamesBinding="controller.selectedStack.useRedhatSatellite:disabled"
+ checkedBinding="skipValidationChecked"
+ disabledBinding="controller.selectedStack.useRedhatSatellite"
+ labelIdentifier="skip-validation"
+ }}
+ <i class="glyphicon glyphicon-question-sign" rel="skip-validation-tooltip"
+ data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.skipValidation.tooltip"}}>
+ </i>
+ {{/view}}
+ <div class="clearfix"></div>
+ </div>
+ {{! Skip Repository Base URL validation END }}
- {{! Use RedHat Satellite/Spacewalk }}
- <div id="use-redhat" class="checkbox">
- {{#view view.redhatCheckBoxView
- classNames="use-redhat-checkbox"
- }}
- <label {{bindAttr for="view.checkboxId" class=":redhat-label :display-inline-block controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}>
- {{t installer.step1.advancedRepo.useRedhatSatellite.message}}
- </label>
- <i class="glyphicon glyphicon-question-sign" rel="use-redhat-tooltip"
- data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}>
- </i>
- {{/view}}
+ {{! Use RedHat Satellite/Spacewalk }}
+ <div id="use-redhat" class="checkbox">
+ {{#view view.redhatCheckBoxView
+ classNames="use-redhat-checkbox"
+ }}
+ <label {{bindAttr for="view.checkboxId" class=":redhat-label :display-inline-block controller.selectedStack.usePublicRepo:disabled" data-original-title="view.redhatDisabledTooltip"}}>
+ {{t installer.step1.advancedRepo.useRedhatSatellite.message}}
+ </label>
+ <i class="glyphicon glyphicon-question-sign" rel="use-redhat-tooltip"
+ data-toggle="tooltip" {{translateAttr data-original-title="installer.step1.advancedRepo.useRedhatSatellite.tooltip"}}>
+ </i>
+ {{/view}}
+ </div>
+ {{! Use RedHat Satellite/Spacewalk END }}
+ </div>
</div>
- {{! Use RedHat Satellite/Spacewalk END }}
+ </form>
+ {{/if}}
+ {{#if view.invalidUrlExist}}
+ <div class="alert alert-warning">
+ {{t installer.step1.invalidURLAttention}}
+ <a
+ href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a>
</div>
- </div>
- </form>
- {{/if}}
- {{#if view.invalidUrlExist}}
- <div class="alert alert-warning">
- {{t installer.step1.invalidURLAttention}}
- <a href="javascript:void(null)" {{action "retryRepoUrls" target="view"}}>{{t installer.step1.retryRepoUrls}}</a>
- </div>
+ {{/if}}
+ {{else}}
+ {{view App.SpinnerView}}
{{/if}}
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 9ab4fde..a12c0c7 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -80,7 +80,7 @@ App.WizardStep1View = Em.View.extend({
*
* @type {bool}
*/
- isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress'),
+ isSubmitDisabled: Em.computed.or('invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete'),
/**
* Show warning message flag
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/test/controllers/wizard/step1_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step1_test.js b/ambari-web/test/controllers/wizard/step1_test.js
index 296fe50..88cb231 100644
--- a/ambari-web/test/controllers/wizard/step1_test.js
+++ b/ambari-web/test/controllers/wizard/step1_test.js
@@ -76,6 +76,8 @@ describe('App.WizardStep1Controller', function () {
App.TestAliases.testAsComputedEveryBy(getController(), 'networkIssuesExist', 'content.stacks', 'stackDefault', true);
+ App.TestAliases.testAsComputedEqual(getController(), 'isLoadingComplete', 'wizardController.loadStacksRequestsCounter', 0);
+
describe('#usePublicRepo', function () {
beforeEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4cd96576/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js
index edf8e0c..12ce412 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -35,7 +35,7 @@ describe('App.WizardStep1View', function () {
App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'controller.selectedStack.operatingSystems', 'isSelected', false);
- App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress']);
+ App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'isNoOsFilled', 'controller.content.isCheckInProgress', 'App.router.btnClickInProgress', '!controller.isLoadingComplete']);
App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', 'INVALID');
[43/50] [abbrv] ambari git commit: AMBARI-21677 - Upgrade Pre-Checks
Should Take PATCH/SERVICE Types Into Account (jonathanhurley)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
index e3e14d5..ec91e48 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
@@ -22,28 +22,45 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/* Tests for RangerAuditDbCheck */
-
+@RunWith(MockitoJUnitRunner.class)
public class RangerAuditDbCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final RangerAuditDbCheck rangerAuditDbCheck = new RangerAuditDbCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
rangerAuditDbCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -53,24 +70,31 @@ public class RangerAuditDbCheckTest {
};
Configuration config = Mockito.mock(Configuration.class);
rangerAuditDbCheck.config = config;
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("RANGER", service);
+ m_services.put("RANGER", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(rangerAuditDbCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- services.remove("RANGER");
- Assert.assertFalse(rangerAuditDbCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ Assert.assertTrue(rangerAuditDbCheck.isApplicable(request));
+
+ m_services.remove("RANGER");
+ Assert.assertFalse(rangerAuditDbCheck.isApplicable(request));
}
@Test
@@ -107,5 +131,5 @@ public class RangerAuditDbCheckTest {
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
-
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
index c69c4e5..cfffb8f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
@@ -22,7 +22,6 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
@@ -35,18 +34,24 @@ import java.util.Map;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.controller.internal.URLStreamProvider;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -86,8 +91,21 @@ public class RangerPasswordCheckTest {
private RangerPasswordCheck m_rpc = null;
private URLStreamProvider m_streamProvider = EasyMock.createMock(URLStreamProvider.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
public void setup() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
m_configMap.put("policymgr_external_url", RANGER_URL);
m_configMap.put("admin_username", "admin");
m_configMap.put("admin_password", "pass");
@@ -129,43 +147,32 @@ public class RangerPasswordCheckTest {
EasyMock.reset(m_streamProvider);
PowerMockito.whenNew(URLStreamProvider.class).withAnyArguments().thenReturn(m_streamProvider);
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testApplicable() throws Exception {
final Service service = EasyMock.createMock(Service.class);
-
- Map<String, Service> services = new HashMap<>();
- services.put("RANGER", service);
+ m_services.put("RANGER", service);
expect(service.getDesiredStackId()).andReturn(new StackId("HDP-2.3")).anyTimes();
Cluster cluster = m_clusters.getCluster("cluster");
EasyMock.reset(cluster);
- expect(cluster.getServices()).andReturn(services).anyTimes();
+ expect(cluster.getServices()).andReturn(m_services).anyTimes();
expect(cluster.getService("RANGER")).andReturn(service).atLeastOnce();
replay(cluster, service);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-2.3"));
- assertTrue(m_rpc.isApplicable(request));
-
- request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-2.2"));
- assertFalse(m_rpc.isApplicable(request));
-
- EasyMock.reset(cluster, service);
- expect(cluster.getServices()).andReturn(services).anyTimes();
- expect(cluster.getService("RANGER")).andReturn(service).atLeastOnce();
- expect(service.getDesiredStackId()).andReturn(new StackId("WILDSTACK-2.0")).anyTimes();
- replay(cluster, service);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-2.2"));
assertTrue(m_rpc.isApplicable(request));
-
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
index 327faf9..af016b0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
@@ -22,29 +22,47 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/* Test for RangerSSLConfigCheck */
+@RunWith(MockitoJUnitRunner.class)
public class RangerSSLConfigCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final RangerSSLConfigCheck rangerSSLConfigCheck = new RangerSSLConfigCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
rangerSSLConfigCheck.clustersProvider = new Provider<Clusters>() {
@Override
public Clusters get() {
@@ -53,25 +71,31 @@ public class RangerSSLConfigCheckTest {
};
Configuration config = Mockito.mock(Configuration.class);
rangerSSLConfigCheck.config = config;
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("RANGER", service);
+ m_services.put("RANGER", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(rangerSSLConfigCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- services.remove("RANGER");
- Assert.assertFalse(rangerSSLConfigCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ Assert.assertTrue(rangerSSLConfigCheck.isApplicable(request));
+ m_services.remove("RANGER");
+ Assert.assertFalse(rangerSSLConfigCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
index ce9a68c..5d0ca5f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
@@ -25,17 +25,23 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -43,14 +49,26 @@ import com.google.inject.Provider;
* Unit tests for SecondaryNamenodeDeletedCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class SecondaryNamenodeDeletedCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final HostComponentStateDAO hostComponentStateDAO = Mockito.mock(HostComponentStateDAO.class);
private final SecondaryNamenodeDeletedCheck secondaryNamenodeDeletedCheck = new SecondaryNamenodeDeletedCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
secondaryNamenodeDeletedCheck.clustersProvider = new Provider<Clusters>() {
@Override
public Clusters get() {
@@ -68,31 +86,40 @@ public class SecondaryNamenodeDeletedCheckTest {
secondaryNamenodeDeletedCheck.hostComponentStateDao = hostComponentStateDAO;
Configuration config = Mockito.mock(Configuration.class);
secondaryNamenodeDeletedCheck.config = config;
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("HDFS", service);
+ m_services.put("HDFS", service);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(secondaryNamenodeDeletedCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Assert.assertTrue(secondaryNamenodeDeletedCheck.isApplicable(request));
+
+ request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- PrereqCheckRequest req = new PrereqCheckRequest("cluster");
- req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
- Assert.assertFalse(secondaryNamenodeDeletedCheck.isApplicable(req));
+ request.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
+ Assert.assertFalse(secondaryNamenodeDeletedCheck.isApplicable(request));
- req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS);
- Assert.assertTrue(secondaryNamenodeDeletedCheck.isApplicable(req));
+ request.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS);
+ Assert.assertTrue(secondaryNamenodeDeletedCheck.isApplicable(request));
- services.remove("HDFS");
- Assert.assertFalse(secondaryNamenodeDeletedCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("HDFS");
+ Assert.assertFalse(secondaryNamenodeDeletedCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
index 55c622e..1df3ed6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java
@@ -124,12 +124,13 @@ public class ServicePresenceCheckTest {
Mockito.when(cluster.getServices()).thenReturn(services);
Map<String, String> checkProperties = new HashMap<>();
- checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
- checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService");
+ checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME, "Atlas, OldService");
+ checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME, "Atlas2, NewService");
PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
- Mockito.when(prerequisiteCheckConfig.getCheckProperties(
- m_check.getClass().getName())).thenReturn(checkProperties);
+ Mockito.when(
+ prerequisiteCheckConfig.getCheckProperties(m_check.getClass().getName())).thenReturn(
+ checkProperties);
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
@@ -151,7 +152,7 @@ public class ServicePresenceCheckTest {
Mockito.when(cluster.getServices()).thenReturn(services);
Map<String, String> checkProperties = new HashMap<>();
- checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldService");
+ checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME, "OldService");
PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
Mockito.when(prerequisiteCheckConfig.getCheckProperties(
@@ -178,9 +179,9 @@ public class ServicePresenceCheckTest {
Map<String, String> checkProperties = new HashMap<>();
checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"MyServiceOne, MyServiceTwo");
- checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Atlas, OldService");
+ checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME, "Atlas, OldService");
checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService");
- checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"RemovedService");
+ checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME, "RemovedService");
PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
Mockito.when(prerequisiteCheckConfig.getCheckProperties(
@@ -206,7 +207,7 @@ public class ServicePresenceCheckTest {
Map<String, String> checkProperties = new HashMap<>();
checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, MyService");
- checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"OldService");
+ checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME, "OldService");
checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"NewService");
PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
@@ -236,7 +237,7 @@ public class ServicePresenceCheckTest {
Map<String, String> checkProperties = new HashMap<>();
checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, HDFS");
- checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME,"Storm, Ranger");
+ checkProperties.put(ServicePresenceCheck.REPLACED_SERVICES_PROPERTY_NAME, "Storm, Ranger");
checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Storm2, Ranger2");
PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class);
@@ -250,4 +251,4 @@ public class ServicePresenceCheckTest {
m_check.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
index 636cafe..6577651 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
@@ -18,6 +18,8 @@
package org.apache.ambari.server.checks;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
@@ -28,12 +30,17 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -41,18 +48,33 @@ import com.google.inject.Provider;
* Unit tests for ServicesMaintenanceModeCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesMaintenanceModeCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
+ m_services.clear();
+
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
@@ -96,12 +118,16 @@ public class ServicesMaintenanceModeCheckTest {
// We don't bother checking service desired state as it's performed by a separate check
Mockito.when(service.getDesiredState()).thenReturn(State.UNKNOWN);
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
- servicesMaintenanceModeCheck.perform(check, new PrereqCheckRequest("cluster"));
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ servicesMaintenanceModeCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
Mockito.when(service.getDesiredState()).thenReturn(State.STARTED);
check = new PrerequisiteCheck(null, null);
- servicesMaintenanceModeCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesMaintenanceModeCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
index f6ad846..a8569cc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
@@ -22,18 +22,24 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -41,13 +47,25 @@ import com.google.inject.Provider;
* Unit tests for ServicesMapReduceDistributedCacheCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesMapReduceDistributedCacheCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final ServicesMapReduceDistributedCacheCheck servicesMapReduceDistributedCacheCheck = new ServicesMapReduceDistributedCacheCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
servicesMapReduceDistributedCacheCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -57,32 +75,40 @@ public class ServicesMapReduceDistributedCacheCheckTest {
};
Configuration config = Mockito.mock(Configuration.class);
servicesMapReduceDistributedCacheCheck.config = config;
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("YARN", service);
+ m_services.put("YARN", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
- Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(request));
- PrereqCheckRequest req = new PrereqCheckRequest("cluster");
- req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
- Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(req));
+ request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS);
- Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(req));
+ request.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
+ Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(request));
+ request.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.PASS);
+ Assert.assertTrue(servicesMapReduceDistributedCacheCheck.isApplicable(request));
- services.remove("YARN");
- Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("YARN");
+ Assert.assertFalse(servicesMapReduceDistributedCacheCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
index a2a74bd..c7e8fd6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
@@ -23,17 +23,23 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -41,13 +47,25 @@ import com.google.inject.Provider;
* Unit tests for ServicesNamenodeHighAvailabilityCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesNamenodeHighAvailabilityCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final ServicesNamenodeHighAvailabilityCheck servicesNamenodeHighAvailabilityCheck = new ServicesNamenodeHighAvailabilityCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
servicesNamenodeHighAvailabilityCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -57,24 +75,31 @@ public class ServicesNamenodeHighAvailabilityCheckTest {
};
Configuration config = Mockito.mock(Configuration.class);
servicesNamenodeHighAvailabilityCheck.config = config;
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("HDFS", service);
+ m_services.put("HDFS", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(servicesNamenodeHighAvailabilityCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Assert.assertTrue(servicesNamenodeHighAvailabilityCheck.isApplicable(request));
- services.remove("HDFS");
- Assert.assertFalse(servicesNamenodeHighAvailabilityCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("HDFS");
+ Assert.assertFalse(servicesNamenodeHighAvailabilityCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
index d0aad2f..545caf3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
@@ -27,21 +27,24 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
-import org.apache.ambari.server.state.RepositoryType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -49,26 +52,35 @@ import com.google.inject.Provider;
* Unit tests for ServicesNamenodeTruncateCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesNamenodeTruncateCheckTest {
private Clusters m_clusters = EasyMock.createMock(Clusters.class);
private ServicesNamenodeTruncateCheck m_check = new ServicesNamenodeTruncateCheck();
private final Map<String, String> m_configMap = new HashMap<>();
- private RepositoryVersionDAO m_repositoryVersionDAO = EasyMock.createMock(RepositoryVersionDAO.class);
- final RepositoryVersionEntity repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
@Before
public void setup() throws Exception {
Cluster cluster = EasyMock.createMock(Cluster.class);
Config config = EasyMock.createMock(Config.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("HDFS", service);
+ m_services.clear();
+ m_services.put("HDFS", service);
- expect(cluster.getServices()).andReturn(services).anyTimes();
+ expect(cluster.getServices()).andReturn(m_services).anyTimes();
expect(config.getProperties()).andReturn(m_configMap).anyTimes();
expect(cluster.getService("HDFS")).andReturn(service);
expect(cluster.getDesiredConfigByType("hdfs-site")).andReturn(config).anyTimes();
@@ -87,20 +99,12 @@ public class ServicesNamenodeTruncateCheckTest {
}
};
- m_check.repositoryVersionDaoProvider = new Provider<RepositoryVersionDAO>() {
- @Override
- public RepositoryVersionDAO get() {
- return m_repositoryVersionDAO;
- }
- };
-
- RepositoryVersionEntity rve = EasyMock.createMock(RepositoryVersionEntity.class);
- expect(rve.getType()).andReturn(RepositoryType.STANDARD).anyTimes();
- expect(m_repositoryVersionDAO.findByStackNameAndVersion(EasyMock.anyString(), EasyMock.anyString())).andReturn(rve).anyTimes();
- replay(m_repositoryVersionDAO, rve);
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("HDP-2.2.0.0");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2.0"));
- Mockito.when(repositoryVersion.getVersion()).thenReturn("HDP-2.2.0.0");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2.0"));
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@@ -109,7 +113,7 @@ public class ServicesNamenodeTruncateCheckTest {
PrereqCheckRequest checkRequest = new PrereqCheckRequest("c1");
checkRequest.setSourceStackId(new StackId("HDP", "2.2"));
- checkRequest.setTargetRepositoryVersion(repositoryVersion);
+ checkRequest.setTargetRepositoryVersion(m_repositoryVersion);
Assert.assertTrue(m_check.isApplicable(checkRequest));
}
@@ -125,9 +129,9 @@ public class ServicesNamenodeTruncateCheckTest {
m_configMap.put("dfs.allow.truncate", "true");
request.setSourceStackId(new StackId("HDP-2.2.4.2"));
- Mockito.when(repositoryVersion.getVersion()).thenReturn("2.2.8.4");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2.8.4"));
- request.setTargetRepositoryVersion(repositoryVersion);
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.8.4");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2.8.4"));
+ request.setTargetRepositoryVersion(m_repositoryVersion);
check = new PrerequisiteCheck(null, null);
m_check.perform(check, request);
@@ -142,9 +146,9 @@ public class ServicesNamenodeTruncateCheckTest {
m_configMap.put("dfs.allow.truncate", "true");
request.setSourceStackId(new StackId("HDP-2.2.4.2"));
- Mockito.when(repositoryVersion.getVersion()).thenReturn("2.3.8.4");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3.8.4"));
- request.setTargetRepositoryVersion(repositoryVersion);
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.3.8.4");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3.8.4"));
+ request.setTargetRepositoryVersion(m_repositoryVersion);
check = new PrerequisiteCheck(null, null);
m_check.perform(check, request);
@@ -155,4 +159,4 @@ public class ServicesNamenodeTruncateCheckTest {
m_check.perform(check, request);
assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
index 3eaf890..96eefc1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
@@ -22,18 +22,24 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -41,13 +47,25 @@ import com.google.inject.Provider;
* Unit tests for ServicesTezDistributedCacheCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesTezDistributedCacheCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final ServicesTezDistributedCacheCheck servicesTezDistributedCacheCheck = new ServicesTezDistributedCacheCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
servicesTezDistributedCacheCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -58,24 +76,31 @@ public class ServicesTezDistributedCacheCheckTest {
Configuration config = Mockito.mock(Configuration.class);
servicesTezDistributedCacheCheck.config = config;
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("TEZ", service);
+ m_services.put("TEZ", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- Assert.assertTrue(servicesTezDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ Assert.assertTrue(servicesTezDistributedCacheCheck.isApplicable(request));
PrereqCheckRequest req = new PrereqCheckRequest("cluster");
+ req.setTargetRepositoryVersion(m_repositoryVersion);
+
req.addResult(CheckDescription.SERVICES_NAMENODE_HA, PrereqCheckStatus.FAIL);
Assert.assertFalse(servicesTezDistributedCacheCheck.isApplicable(req));
@@ -83,8 +108,8 @@ public class ServicesTezDistributedCacheCheckTest {
Assert.assertTrue(servicesTezDistributedCacheCheck.isApplicable(req));
- services.remove("TEZ");
- Assert.assertFalse(servicesTezDistributedCacheCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("TEZ");
+ Assert.assertFalse(servicesTezDistributedCacheCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
index ba0f701..a851919 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
@@ -37,13 +37,17 @@ import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
@@ -63,15 +67,31 @@ public class ServicesUpCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private AmbariMetaInfo ambariMetaInfo = Mockito.mock(AmbariMetaInfo.class);
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ m_services.clear();
+
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
@@ -129,24 +149,28 @@ public class ServicesUpCheckTest {
final Service tezService = Mockito.mock(Service.class);
final Service amsService = Mockito.mock(Service.class);
- HashMap<String, Service> clusterServices = new HashMap<>();
- clusterServices.put("HDFS", hdfsService);
- clusterServices.put("TEZ", tezService);
- clusterServices.put("AMBARI_METRICS", amsService);
+ m_services.put("HDFS", hdfsService);
+ m_services.put("TEZ", tezService);
+ m_services.put("AMBARI_METRICS", amsService);
Mockito.when(hdfsService.getName()).thenReturn("HDFS");
Mockito.when(tezService.getName()).thenReturn("TEZ");
Mockito.when(amsService.getName()).thenReturn("AMBARI_METRICS");
+ StackId stackId = new StackId("HDP", "2.2");
+ Mockito.when(hdfsService.getDesiredStackId()).thenReturn(stackId);
+ Mockito.when(tezService.getDesiredStackId()).thenReturn(stackId);
+ Mockito.when(amsService.getDesiredStackId()).thenReturn(stackId);
+
Mockito.when(hdfsService.isClientOnlyService()).thenReturn(false);
Mockito.when(tezService.isClientOnlyService()).thenReturn(true);
Mockito.when(amsService.isClientOnlyService()).thenReturn(false);
- Mockito.when(hdfsService.getDesiredStackId()).thenReturn(new StackId("HDP", "2.2"));
- Mockito.when(tezService.getDesiredStackId()).thenReturn(new StackId("HDP", "2.2"));
- Mockito.when(amsService.getDesiredStackId()).thenReturn(new StackId("HDP", "2.2"));
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
- Mockito.when(cluster.getServices()).thenReturn(clusterServices);
+ Mockito.when(cluster.getService("HDFS")).thenReturn(hdfsService);
+ Mockito.when(cluster.getService("TEZ")).thenReturn(tezService);
+ Mockito.when(cluster.getService("AMBARI_METRICS")).thenReturn(amsService);
Mockito.when(ambariMetaInfo.getComponent(Mockito.anyString(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString())).thenAnswer(new Answer<ComponentInfo>() {
@@ -264,8 +288,11 @@ public class ServicesUpCheckTest {
Mockito.when(hcs.getCurrentState()).thenReturn(State.STARTED);
}
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 2. Change some desired states to STARTED, should still pass
@@ -273,7 +300,7 @@ public class ServicesUpCheckTest {
Mockito.when(hcsDataNode1.getDesiredState()).thenReturn(State.STARTED);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 3. Ensure that ZKFC and AMS are ignored even if their current state is not STARTED
@@ -282,7 +309,7 @@ public class ServicesUpCheckTest {
Mockito.when(hcsMetricsMonitor.getCurrentState()).thenReturn(State.INSTALLED);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 4. Change HDFS current states to INSTALLED, should fail.
@@ -290,14 +317,14 @@ public class ServicesUpCheckTest {
Mockito.when(hcsDataNode1.getCurrentState()).thenReturn(State.INSTALLED);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
// Case 5. Change HDFS master to STARTED, but one slave to INSTALLED, should pass (2/3 are up).
Mockito.when(hcsNameNode.getCurrentState()).thenReturn(State.STARTED);
Mockito.when(hcsDataNode1.getCurrentState()).thenReturn(State.INSTALLED);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 6. Change HDFS master to STARTED, but 2 slaves to INSTALLED, should fail (2/3 are down)
@@ -305,7 +332,7 @@ public class ServicesUpCheckTest {
Mockito.when(hcsDataNode1.getCurrentState()).thenReturn(State.INSTALLED);
Mockito.when(hcsDataNode2.getCurrentState()).thenReturn(State.INSTALLED);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
Assert.assertTrue(check.getFailReason().indexOf("50%") > -1);
@@ -313,7 +340,7 @@ public class ServicesUpCheckTest {
Mockito.when(host1.getMaintenanceState(Mockito.anyLong())).thenReturn(MaintenanceState.ON);
Mockito.when(host3.getMaintenanceState(Mockito.anyLong())).thenReturn(MaintenanceState.ON);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// put everything back to normal, then fail NN
@@ -324,13 +351,13 @@ public class ServicesUpCheckTest {
Mockito.when(host3.getMaintenanceState(Mockito.anyLong())).thenReturn(MaintenanceState.OFF);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
// put NN into MM; should still fail since it's a master
Mockito.when(host1.getMaintenanceState(Mockito.anyLong())).thenReturn(MaintenanceState.ON);
check = new PrerequisiteCheck(null, null);
- servicesUpCheck.perform(check, new PrereqCheckRequest("cluster"));
+ servicesUpCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
index 439710f..331223d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
@@ -23,17 +23,23 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -41,13 +47,26 @@ import com.google.inject.Provider;
* Unit tests for ServicesYarnWorkPreservingCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class ServicesYarnWorkPreservingCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final ServicesYarnWorkPreservingCheck servicesYarnWorkPreservingCheck = new ServicesYarnWorkPreservingCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+
@Before
- public void setup() {
+ public void setup() throws Exception {
servicesYarnWorkPreservingCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -57,24 +76,29 @@ public class ServicesYarnWorkPreservingCheckTest {
};
Configuration config = Mockito.mock(Configuration.class);
servicesYarnWorkPreservingCheck.config = config;
+
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("YARN", service);
+ m_services.put("YARN", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(servicesYarnWorkPreservingCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+ Assert.assertTrue(servicesYarnWorkPreservingCheck.isApplicable(request));
- services.remove("YARN");
- Assert.assertFalse(servicesYarnWorkPreservingCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("YARN");
+ Assert.assertFalse(servicesYarnWorkPreservingCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
index 39089f3..1441256 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
@@ -21,28 +21,56 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/**
* Tests {@link StormShutdownWarning}.
*/
+@RunWith(MockitoJUnitRunner.class)
public class StormShutdownWarningTest extends EasyMockSupport {
private final String m_clusterName = "c1";
private final Clusters m_clusters = niceMock(Clusters.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
+ }
+
/**
* @throws Exception
*/
@@ -60,18 +88,18 @@ public class StormShutdownWarningTest extends EasyMockSupport {
final Cluster cluster = niceMock(Cluster.class);
final Service hive = niceMock(Service.class);
- final Map<String, Service> services = new HashMap<>();
- services.put("STORM", hive);
+ m_services.put("STORM", hive);
EasyMock.expect(cluster.getClusterId()).andReturn(1L).anyTimes();
EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(new StackId("HDP", "2.3")).anyTimes();
- EasyMock.expect(cluster.getServices()).andReturn(services).atLeastOnce();
+ EasyMock.expect(cluster.getServices()).andReturn(m_services).anyTimes();
EasyMock.expect(m_clusters.getCluster(m_clusterName)).andReturn(cluster).atLeastOnce();
PrereqCheckRequest request = niceMock(PrereqCheckRequest.class);
- EasyMock.expect(request.getClusterName()).andReturn(m_clusterName);
- EasyMock.expect(request.getUpgradeType()).andReturn(UpgradeType.ROLLING);
+ EasyMock.expect(request.getClusterName()).andReturn(m_clusterName).anyTimes();
+ EasyMock.expect(request.getUpgradeType()).andReturn(UpgradeType.ROLLING).anyTimes();
+ EasyMock.expect(request.getTargetRepositoryVersion()).andReturn(m_repositoryVersion).anyTimes();
replayAll();
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
index 5cb666b..5de4b2a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
@@ -56,7 +56,7 @@ public class YarnTimelineServerStatePreservingCheckTest {
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
m_check.clustersProvider = new Provider<Clusters>() {
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
index a25ad08..fc3a133 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
@@ -19,34 +19,30 @@
package org.apache.ambari.server.state;
import java.util.ArrayList;
-import java.util.LinkedList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ClusterNotFoundException;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.checks.AbstractCheckDescriptor;
import org.apache.ambari.server.checks.CheckDescription;
-import org.apache.ambari.server.checks.ServicesUpCheck;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
-import org.apache.ambari.server.orm.dao.HostVersionDAO;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
-import org.apache.ambari.server.orm.dao.UpgradeDAO;
-import org.apache.ambari.server.state.stack.OsFamily;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
-import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
import org.easymock.EasyMock;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
+import org.mockito.runners.MockitoJUnitRunner;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.util.Providers;
+import com.google.inject.Provider;
import junit.framework.Assert;
@@ -55,9 +51,41 @@ import junit.framework.Assert;
* Tests the {@link CheckHelper} class
* Makes sure that people don't forget to add new checks to registry.
*/
-
+@RunWith(MockitoJUnitRunner.class)
public class CheckHelperTest {
+ private final Clusters clusters = Mockito.mock(Clusters.class);
+
+ private MockCheck m_mockCheck;
+
+ private CheckDescription m_mockCheckDescription = Mockito.mock(CheckDescription.class);
+
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ @Mock
+ private Object m_mockPerform;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ m_mockCheck = new MockCheck();
+
+ Mockito.when(m_mockPerform.toString()).thenReturn("Perform!");
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
+ }
+
/**
* Sunny case when applicable.
*/
@@ -66,17 +94,15 @@ public class CheckHelperTest {
final CheckHelper helper = new CheckHelper();
Configuration configuration = EasyMock.createNiceMock(Configuration.class);
List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
- AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
EasyMock.expect(configuration.isUpgradePrecheckBypass()).andReturn(false);
- descriptor.perform(EasyMock.<PrerequisiteCheck> anyObject(), EasyMock.<PrereqCheckRequest> anyObject());
- EasyMock.expectLastCall().times(1);
- EasyMock.expect(descriptor.isApplicable(EasyMock.<PrereqCheckRequest> anyObject())).andReturn(true);
- EasyMock.replay(descriptor, configuration);
- updateChecksRegistry.add(descriptor);
-
- helper.performChecks(new PrereqCheckRequest("cluster"), updateChecksRegistry, configuration);
- EasyMock.verify(descriptor);
+ EasyMock.replay(configuration);
+ updateChecksRegistry.add(m_mockCheck);
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ helper.performChecks(request, updateChecksRegistry, configuration);
+
+ Assert.assertEquals(PrereqCheckStatus.PASS, request.getResult(m_mockCheckDescription));
}
/**
@@ -84,16 +110,28 @@ public class CheckHelperTest {
*/
@Test
public void testPreUpgradeCheckNotApplicable() throws Exception {
+ final Cluster cluster = Mockito.mock(Cluster.class);
+ final Service service = Mockito.mock(Service.class);
+
+ m_services.put("KAFKA", service);
+
+ Mockito.when(cluster.getServices()).thenReturn(new HashMap<String, Service>());
+ Mockito.when(cluster.getClusterId()).thenReturn(1L);
+ Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
+
final CheckHelper helper = new CheckHelper();
Configuration configuration = EasyMock.createNiceMock(Configuration.class);
List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
- AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
+
EasyMock.expect(configuration.isUpgradePrecheckBypass()).andReturn(false);
- EasyMock.expect(descriptor.isApplicable(EasyMock.<PrereqCheckRequest> anyObject())).andReturn(false);
- EasyMock.replay(descriptor, configuration);
- updateChecksRegistry.add(descriptor);
- helper.performChecks(new PrereqCheckRequest("cluster"), updateChecksRegistry, configuration);
- EasyMock.verify(descriptor);
+ EasyMock.replay(configuration);
+ updateChecksRegistry.add(m_mockCheck);
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ helper.performChecks(request, updateChecksRegistry, configuration);
+
+
+ Assert.assertEquals(null, request.getResult(m_mockCheckDescription));
}
/**
@@ -102,20 +140,20 @@ public class CheckHelperTest {
@Test
public void testPreUpgradeCheckThrowsException() throws Exception {
final CheckHelper helper = new CheckHelper();
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
- AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
Configuration configuration = EasyMock.createNiceMock(Configuration.class);
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
EasyMock.expect(configuration.isUpgradePrecheckBypass()).andReturn(false);
- descriptor.perform(EasyMock.<PrerequisiteCheck> anyObject(), EasyMock.<PrereqCheckRequest> anyObject());
- EasyMock.expectLastCall().andThrow(new AmbariException("error"));
- EasyMock.expect(descriptor.isApplicable(EasyMock.<PrereqCheckRequest> anyObject())).andReturn(true);
- EasyMock.expect(descriptor.getDescription()).andReturn(CheckDescription.HOSTS_HEARTBEAT).anyTimes();
- EasyMock.replay(descriptor, configuration);
- updateChecksRegistry.add(descriptor);
- final List<PrerequisiteCheck> upgradeChecks = helper.performChecks(new PrereqCheckRequest("cluster"), updateChecksRegistry, configuration);
- EasyMock.verify(descriptor);
- Assert.assertEquals(PrereqCheckStatus.FAIL, upgradeChecks.get(0).getStatus());
+ EasyMock.replay(configuration);
+ updateChecksRegistry.add(m_mockCheck);
+
+ // this will cause an exception
+ Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ helper.performChecks(request, updateChecksRegistry, configuration);
+
+ Assert.assertEquals(PrereqCheckStatus.FAIL, request.getResult(m_mockCheckDescription));
}
/**
@@ -123,98 +161,80 @@ public class CheckHelperTest {
*/
@Test
public void testPreUpgradeCheckBypassesFailure() throws Exception {
- // This mock class extends CheckHelper and overrides the getPrerequisiteChecks method in order to return
- // a PrerequisiteCheck object whose status is FAIL.
- final CheckHelperMock helper = new CheckHelperMock();
+ final CheckHelper helper = new CheckHelper();
Configuration configuration = EasyMock.createNiceMock(Configuration.class);
List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
- PrereqCheckRequest checkRequest = EasyMock.createNiceMock(PrereqCheckRequest.class);
EasyMock.expect(configuration.isUpgradePrecheckBypass()).andReturn(true);
- EasyMock.expect(checkRequest.getClusterName()).andReturn("c1").anyTimes();
- EasyMock.replay(checkRequest, configuration);
+ EasyMock.replay(configuration);
+ updateChecksRegistry.add(m_mockCheck);
+
+ // this will cause an exception, triggering the bypass
+ Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
- final List<PrerequisiteCheck> upgradeChecks = helper.performChecks(checkRequest, updateChecksRegistry, configuration);
- Assert.assertEquals(1, upgradeChecks.size());
- Assert.assertEquals(PrereqCheckStatus.BYPASS, upgradeChecks.get(0).getStatus());
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ helper.performChecks(request, updateChecksRegistry, configuration);
+
+ Assert.assertEquals(PrereqCheckStatus.BYPASS, request.getResult(m_mockCheckDescription));
}
@Test
public void testPreUpgradeCheckClusterMissing() throws Exception {
- final Clusters clusters = Mockito.mock(Clusters.class);
+ final Cluster cluster = Mockito.mock(Cluster.class);
+ final Service service = Mockito.mock(Service.class);
+
+ m_services.put("KAFKA", service);
+
+ Mockito.when(cluster.getServices()).thenReturn(new HashMap<String, Service>());
+ Mockito.when(cluster.getClusterId()).thenReturn(1L);
+
+ Mockito.when(clusters.getCluster(Mockito.anyString())).thenReturn(cluster);
+
+ final CheckHelper helper = new CheckHelper();
Configuration configuration = EasyMock.createNiceMock(Configuration.class);
- Mockito.when(clusters.getCluster(Mockito.anyString())).thenAnswer(new Answer<Cluster>() {
- @Override
- public Cluster answer(InvocationOnMock invocation) throws Throwable {
- final String clusterName = invocation.getArguments()[0].toString();
- if (clusterName.equals("existing")) {
- return Mockito.mock(Cluster.class);
- } else {
- throw new ClusterNotFoundException(clusterName);
- }
- }
- });
-
- final OsFamily osFamily = Mockito.mock(OsFamily.class);
-
- final Injector injector = Guice.createInjector(new AbstractModule() {
-
- @Override
- protected void configure() {
- bind(Clusters.class).toInstance(clusters);
- bind(HostVersionDAO.class).toProvider(Providers.<HostVersionDAO>of(null));
- bind(UpgradeDAO.class).toProvider(Providers.<UpgradeDAO>of(null));
- bind(RepositoryVersionDAO.class).toProvider(Providers.<RepositoryVersionDAO>of(null));
- bind(RepositoryVersionHelper.class).toProvider(Providers.<RepositoryVersionHelper>of(null));
- bind(AmbariMetaInfo.class).toProvider(Providers.<AmbariMetaInfo>of(null));
- bind(ServicesUpCheck.class).toInstance(new ServicesUpCheck());
- bind(OsFamily.class).toInstance(osFamily);
- }
- });
-
- final CheckHelper helper = injector.getInstance(CheckHelper.class);
List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
EasyMock.expect(configuration.isUpgradePrecheckBypass()).andReturn(false);
-
EasyMock.replay(configuration);
+ updateChecksRegistry.add(m_mockCheck);
- // mocked Cluster has no services, so the check should always be PASS
- updateChecksRegistry.add(injector.getInstance(ServicesUpCheck.class));
- List<PrerequisiteCheck> upgradeChecks = helper.performChecks(new PrereqCheckRequest("existing"), updateChecksRegistry, configuration);
- Assert.assertEquals(PrereqCheckStatus.PASS, upgradeChecks.get(0).getStatus());
- upgradeChecks = helper.performChecks(new PrereqCheckRequest("non-existing"), updateChecksRegistry, configuration);
- Assert.assertEquals(PrereqCheckStatus.FAIL, upgradeChecks.get(0).getStatus());
- //non existing cluster is an expected error
- Assert.assertTrue(!upgradeChecks.get(0).getFailReason().equals("Unexpected server error happened"));
- }
+ // this will cause an exception, triggering the fail
+ Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
- class CheckHelperMock extends CheckHelper {
- @Override
- public List<DescriptorPreCheck> getApplicablePrerequisiteChecks(PrereqCheckRequest request,
- List<AbstractCheckDescriptor> checksRegistry) {
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
- List<DescriptorPreCheck> applicablePreChecks = new LinkedList<>();
+ helper.performChecks(request, updateChecksRegistry, configuration);
- try {
- CheckDescription description = CheckDescription.SERVICES_UP;
- PrerequisiteCheck check = new PrerequisiteCheck(description, "c1");
- check.setStatus(PrereqCheckStatus.FAIL);
+ Assert.assertEquals(PrereqCheckStatus.FAIL, request.getResult(m_mockCheckDescription));
+ }
- AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
- EasyMock.expect(descriptor.isApplicable(EasyMock.<PrereqCheckRequest>anyObject())).andReturn(true);
- EasyMock.expect(descriptor.getDescription()).andReturn(description).anyTimes();
+ class MockCheck extends AbstractCheckDescriptor {
- // Allow bypassing failures
- EasyMock.replay(descriptor);
+ protected MockCheck() {
+ super(m_mockCheckDescription);
- applicablePreChecks.add(new DescriptorPreCheck(descriptor, check));
- } catch (AmbariException e) {
- ;
- }
+ clustersProvider = new Provider<Clusters>() {
- return applicablePreChecks;
+ @Override
+ public Clusters get() {
+ return clusters;
+ }
+ };
}
- }
-}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getApplicableServices() {
+ return m_services.keySet();
+ }
+
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
+ m_mockPerform.toString();
+ }
+ }
+}
\ No newline at end of file
[45/50] [abbrv] ambari git commit: AMBARI-21677 - Upgrade Pre-Checks
Should Take PATCH/SERVICE Types Into Account (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21677 - Upgrade Pre-Checks Should Take PATCH/SERVICE Types Into Account (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/108ad9b4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/108ad9b4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/108ad9b4
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 108ad9b4a0d154abcfff9e4fe5fd965ae81d62e5
Parents: b4de620
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Aug 7 23:46:47 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Aug 9 14:01:29 2017 -0400
----------------------------------------------------------------------
.../server/checks/AbstractCheckDescriptor.java | 252 ++++++++-----
.../server/checks/AtlasPresenceCheck.java | 13 +-
.../server/checks/AutoStartDisabledCheck.java | 11 +
.../ambari/server/checks/CheckDescription.java | 53 +--
.../server/checks/ClientRetryPropertyCheck.java | 8 +-
.../checks/ComponentsExistInRepoCheck.java | 140 ++++++++
.../checks/ComponentsInstallationCheck.java | 5 +-
.../server/checks/ConfigurationMergeCheck.java | 3 +-
.../ambari/server/checks/HealthCheck.java | 3 +-
.../HiveDynamicServiceDiscoveryCheck.java | 15 +-
.../checks/HiveMultipleMetastoreCheck.java | 7 +-
.../server/checks/HiveNotRollingWarning.java | 11 +-
.../checks/HostsMasterMaintenanceCheck.java | 17 +-
.../checks/HostsRepositoryVersionCheck.java | 60 +---
.../server/checks/InstallPackagesCheck.java | 18 +-
.../server/checks/KafkaKerberosCheck.java | 10 +-
...apReduce2JobHistoryStatePreservingCheck.java | 7 +-
.../server/checks/RangerAuditDbCheck.java | 10 +-
.../server/checks/RangerPasswordCheck.java | 29 +-
.../server/checks/RangerSSLConfigCheck.java | 7 +-
.../checks/SecondaryNamenodeDeletedCheck.java | 24 +-
.../server/checks/ServicePresenceCheck.java | 4 +-
.../checks/ServicesMaintenanceModeCheck.java | 11 +-
.../ServicesMapReduceDistributedCacheCheck.java | 27 +-
.../ServicesNamenodeHighAvailabilityCheck.java | 11 +-
.../checks/ServicesNamenodeTruncateCheck.java | 26 +-
.../ServicesTezDistributedCacheCheck.java | 25 +-
.../ambari/server/checks/ServicesUpCheck.java | 11 +-
.../checks/ServicesYarnWorkPreservingCheck.java | 7 +-
.../server/checks/StormShutdownWarning.java | 11 +-
.../checks/YarnRMHighAvailabilityCheck.java | 8 +-
.../YarnTimelineServerStatePreservingCheck.java | 99 ++++--
.../server/controller/PrereqCheckRequest.java | 21 --
.../apache/ambari/server/state/CheckHelper.java | 4 +-
.../2.0.6/hooks/before-START/scripts/params.py | 7 +-
.../3.0/hooks/before-START/scripts/params.py | 7 +-
.../checks/AbstractCheckDescriptorTest.java | 317 +++++++++--------
.../checks/ClientRetryPropertyCheckTest.java | 48 +--
.../checks/ComponentExistsInRepoCheckTest.java | 352 +++++++++++++++++++
.../checks/ComponentsInstallationCheckTest.java | 50 ++-
.../HiveDynamicServiceDiscoveryCheckTest.java | 2 +-
.../checks/HiveMultipleMetastoreCheckTest.java | 31 +-
.../checks/HiveNotRollingWarningTest.java | 39 +-
.../server/checks/HostsHeartbeatCheckTest.java | 2 +-
.../checks/HostsMasterMaintenanceCheckTest.java | 72 ++--
.../checks/HostsRepositoryVersionCheckTest.java | 76 ++--
.../server/checks/InstallPackagesCheckTest.java | 2 +-
.../server/checks/KafkaKerberosCheckTest.java | 39 +-
...duce2JobHistoryStatePreservingCheckTest.java | 37 +-
.../server/checks/RangerAuditDbCheckTest.java | 42 ++-
.../server/checks/RangerPasswordCheckTest.java | 47 +--
.../server/checks/RangerSSLConfigCheckTest.java | 38 +-
.../SecondaryNamenodeDeletedCheckTest.java | 51 ++-
.../server/checks/ServicePresenceCheckTest.java | 21 +-
.../ServicesMaintenanceModeCheckTest.java | 34 +-
...vicesMapReduceDistributedCacheCheckTest.java | 50 ++-
...rvicesNamenodeHighAvailabilityCheckTest.java | 39 +-
.../ServicesNamenodeTruncateCheckTest.java | 60 ++--
.../ServicesTezDistributedCacheCheckTest.java | 39 +-
.../server/checks/ServicesUpCheckTest.java | 67 ++--
.../ServicesYarnWorkPreservingCheckTest.java | 38 +-
.../server/checks/StormShutdownWarningTest.java | 38 +-
...nTimelineServerStatePreservingCheckTest.java | 2 +-
.../ambari/server/state/CheckHelperTest.java | 246 +++++++------
64 files changed, 1960 insertions(+), 901 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
index bda2c07..4eae3aa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
@@ -17,13 +17,12 @@
*/
package org.apache.ambari.server.checks;
+import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.ambari.annotations.Experimental;
-import org.apache.ambari.annotations.ExperimentalFeature;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
@@ -36,19 +35,20 @@ import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
-import org.apache.ambari.server.state.RepositoryType;
-import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrereqCheckType;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack;
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -62,7 +62,7 @@ public abstract class AbstractCheckDescriptor {
protected static final String DEFAULT = "default";
@Inject
- Provider<Clusters> clustersProvider;
+ protected Provider<Clusters> clustersProvider;
@Inject
Provider<HostVersionDAO> hostVersionDaoProvider;
@@ -94,75 +94,54 @@ public abstract class AbstractCheckDescriptor {
}
/**
- * Tests if the prerequisite check is applicable to given cluster. This
- * method's default logic is to ensure that the cluster stack source and
- * target are compatible with the prerequisite check. When overridding this
- * method, call {@code super#isApplicable(PrereqCheckRequest)}.
+ * Gets the set of services that this check is associated with. If the check
+ * is not associated with a particular service, then this should be an empty
+ * set.
*
- * @param request
- * prerequisite check request
- * @return true if check should be performed
+ * @return a set of services which will determine whether this check is
+ * applicable.
+ */
+ public Set<String> getApplicableServices() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Gets any additional qualifications which an upgrade check should run in
+ * order to determine if it's applicable to the upgrade.
*
- * @throws org.apache.ambari.server.AmbariException
- * if server error happens
+ * @return a list of qualifications, or an empty list.
*/
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- // this is default behaviour
- return true;
+ public List<CheckQualification> getQualifications() {
+ return Collections.emptyList();
}
/**
- * Same like {@code isApplicable(PrereqCheckRequest request)}, but with service presence check
+ * Tests if the prerequisite check is applicable to given upgrade request. If
+ * a check requires some extra processing
+ *
* @param request
* prerequisite check request
- * @param requiredServices
- * set of services, which need to be present to allow check execution
- * @param requiredAll
- * require all services in the list or at least one need to present
* @return true if check should be performed
+ *
* @throws org.apache.ambari.server.AmbariException
* if server error happens
*/
- @Experimental(feature = ExperimentalFeature.PATCH_UPGRADES)
- public boolean isApplicable(PrereqCheckRequest request, List<String> requiredServices, boolean requiredAll) throws AmbariException {
- final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
- Set<String> services = cluster.getServices().keySet();
-
- // default return value depends on assign inside check block
- boolean serviceFound = requiredAll && !requiredServices.isEmpty();
-
- for (String service : requiredServices) {
- if ( services.contains(service) && !requiredAll) {
- serviceFound = true;
- break;
- } else if (!services.contains(service) && requiredAll) {
- serviceFound = false;
- break;
- }
- }
-
- // !!! service is found and deployed - now check if it is part of the VDF
- if (serviceFound && null != request.getTargetStackId()) {
- String stackName = request.getTargetStackId().getStackName();
- RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().
- findByStackNameAndVersion(stackName, request.getTargetVersion());
-
- if (RepositoryType.STANDARD != rve.getType()) {
- try {
- Set<String> availableServices = rve.getRepositoryXml().getAvailableServiceNames();
-
- if (!CollectionUtils.containsAny(availableServices, requiredServices)) {
- serviceFound = false;
- }
- } catch (Exception e) {
- LOG.warn("Could not parse xml for %s", request.getTargetVersion(), e);
- }
+ public final boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+ List<CheckQualification> qualifications = Lists.<CheckQualification> newArrayList(
+ new ServiceQualification());
+
+ // add any others from the concrete check
+ qualifications.addAll(getQualifications());
+ for (CheckQualification qualification : qualifications) {
+ if (!qualification.isApplicable(request)) {
+ return false;
}
}
- return serviceFound;
+ return true;
}
+
/**
* Executes check against given cluster.
*
@@ -198,7 +177,8 @@ public abstract class AbstractCheckDescriptor {
* @param request the request
* @return the failure string
*/
- protected String getFailReason(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) {
+ protected String getFailReason(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
return getFailReason(DEFAULT, prerequisiteCheck, request);
}
@@ -233,15 +213,6 @@ public abstract class AbstractCheckDescriptor {
return properties.get(propertyName);
}
- protected Cluster getCluster(PrereqCheckRequest request) throws AmbariException {
- String clusterName = request.getClusterName();
- if (null != clusterName) {
- return clustersProvider.get().getCluster(clusterName);
- }
-
- return null;
- }
-
/**
* Gets the fail reason
* @param key the failure text key
@@ -249,12 +220,13 @@ public abstract class AbstractCheckDescriptor {
* @param request the request
* @return the failure string
*/
- protected String getFailReason(String key,
- PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) {
+ protected String getFailReason(String key, PrerequisiteCheck prerequisiteCheck,
+ PrereqCheckRequest request) throws AmbariException {
String fail = m_description.getFail(key);
- if (fail.contains("{{version}}") && null != request.getTargetVersion()) {
- fail = fail.replace("{{version}}", request.getTargetVersion());
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+ if (fail.contains("{{version}}") && null != repositoryVersion) {
+ fail = fail.replace("{{version}}", repositoryVersion.getVersion());
}
if (fail.contains("{{fails}}")) {
@@ -265,26 +237,21 @@ public abstract class AbstractCheckDescriptor {
Clusters clusters = clustersProvider.get();
AmbariMetaInfo metaInfo = ambariMetaInfo.get();
- try {
- Cluster c = clusters.getCluster(request.getClusterName());
-
- LinkedHashSet<String> displays = new LinkedHashSet<>();
-
- for (Service service : c.getServices().values()) {
- if (names.contains(service.getName())) {
- try {
- ServiceInfo serviceInfo = metaInfo.getService(service);
- displays.add(serviceInfo.getDisplayName());
- } catch (Exception e) {
- displays.add(service.getName());
- }
- }
+ Cluster c = clusters.getCluster(request.getClusterName());
+ Map<String, ServiceInfo> services = metaInfo.getServices(
+ c.getDesiredStackVersion().getStackName(),
+ c.getDesiredStackVersion().getStackVersion());
+
+ LinkedHashSet<String> displays = new LinkedHashSet<>();
+ for (String name : names) {
+ if (services.containsKey(name)) {
+ displays.add(services.get(name).getDisplayName());
+ } else {
+ displays.add(name);
}
- names = displays;
-
- } catch (Exception e) {
- LOG.warn("Could not load service info map");
}
+ names = displays;
+
}
fail = fail.replace("{{fails}}", formatEntityList(names));
@@ -293,7 +260,6 @@ public abstract class AbstractCheckDescriptor {
return fail;
}
-
/**
* Formats lists of given entities to human readable form:
* [entity1] -> {entity1} {noun}
@@ -335,4 +301,106 @@ public abstract class AbstractCheckDescriptor {
return false;
}
-}
+ /**
+ * Gets the services participating in the upgrade from the VDF.
+ *
+ * @param request
+ * the upgrade check request.
+ * @return the services participating in the upgrade, which can either be all
+ * of the cluster's services or a subset based on repository type.
+ */
+ final Set<String> getServicesInUpgrade(PrereqCheckRequest request) throws AmbariException {
+ final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+
+ // the check is scoped to some services, so determine if any of those
+ // services are included in this upgrade
+ try {
+ VersionDefinitionXml vdf = repositoryVersion.getRepositoryXml();
+ ClusterVersionSummary clusterVersionSummary = vdf.getClusterSummary(cluster);
+ return clusterVersionSummary.getAvailableServiceNames();
+ } catch (Exception exception) {
+ throw new AmbariException("Unable to run upgrade checks because of an invalid VDF",
+ exception);
+ }
+ }
+
+ /**
+ * The {@link CheckQualification} interface is used to provide multiple
+ * different qualifications against which an upgrade check is determined to be
+ * applicable to the upgrade.
+ */
+ interface CheckQualification {
+
+ /**
+ * Gets whether the upgrade check meets this qualification and should
+ * therefore be run before the upgrade.
+ *
+ * @param request
+ * @return
+ * @throws AmbariException
+ */
+ boolean isApplicable(PrereqCheckRequest request) throws AmbariException;
+ }
+
+ /**
+ * The {@link ServiceQualification} class is used to determine if the
+ * service(s) associated with an upgraade check are both installed in the
+ * cluster and included in thr upgrade.
+ * <p/>
+ * If a service is installed but not included in the upgrade (for example of
+ * the upgrade is a patch upgrade), then the check should not qualify to run.
+ */
+ final class ServiceQualification implements CheckQualification {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+
+ Set<String> applicableServices = getApplicableServices();
+
+ // if the check is not scoped to any particular service, then it passes
+ // this qualification
+ if (applicableServices.isEmpty()) {
+ return true;
+ }
+
+ Set<String> servicesForUpgrade = getServicesInUpgrade(request);
+
+ for (String serviceInUpgrade : servicesForUpgrade) {
+ if (applicableServices.contains(serviceInUpgrade)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ /**
+ * The {@link PriorCheckQualification} class is used to determine if a prior check has run.
+ */
+ final class PriorCheckQualification implements CheckQualification {
+
+ private final CheckDescription m_checkDescription;
+
+ public PriorCheckQualification(CheckDescription checkDescription) {
+ m_checkDescription = checkDescription;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+ PrereqCheckStatus checkStatus = request.getResult(m_checkDescription);
+ if (null != checkStatus && checkStatus == PrereqCheckStatus.FAIL) {
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/AtlasPresenceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AtlasPresenceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AtlasPresenceCheck.java
index 617ffa0..035116a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AtlasPresenceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AtlasPresenceCheck.java
@@ -17,15 +17,14 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -36,16 +35,18 @@ import com.google.inject.Singleton;
@UpgradeCheck(group = UpgradeCheckGroup.DEFAULT)
public class AtlasPresenceCheck extends AbstractCheckDescriptor{
- private static final Logger LOG = LoggerFactory.getLogger(AtlasPresenceCheck.class);
private static final String serviceName = "ATLAS";
public AtlasPresenceCheck(){
super(CheckDescription.ATLAS_SERVICE_PRESENCE_CHECK);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList(serviceName), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet(serviceName);
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/AutoStartDisabledCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AutoStartDisabledCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AutoStartDisabledCheck.java
index c41ad20..6b0698e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AutoStartDisabledCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AutoStartDisabledCheck.java
@@ -17,6 +17,9 @@
*/
package org.apache.ambari.server.checks;
+import java.util.Collections;
+import java.util.Set;
+
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
@@ -52,6 +55,14 @@ public class AutoStartDisabledCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
+ public Set<String> getApplicableServices() {
+ return Collections.emptySet();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
String autoStartEnabled = getProperty(request, CLUSTER_ENV_TYPE, RECOVERY_ENABLED_KEY);
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index 3f63117..4fd37dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -86,9 +86,7 @@ public class CheckDescription {
"All hosts should have target version installed",
new ImmutableMap.Builder<String, String>()
.put(AbstractCheckDescriptor.DEFAULT,
- "The following hosts must have version {{version}} installed: {{fails}}.")
- .put(HostsRepositoryVersionCheck.KEY_NO_REPO_VERSION,
- "Repository version {{version}} does not exist.").build());
+ "The following hosts must have version {{version}} installed: {{fails}}.").build());
public static CheckDescription SECONDARY_NAMENODE_MUST_BE_DELETED = new CheckDescription("SECONDARY_NAMENODE_MUST_BE_DELETED",
PrereqCheckType.HOST,
@@ -272,20 +270,17 @@ public class CheckDescription {
"After upgrading, Atlas can be reinstalled").build());
public static CheckDescription SERVICE_PRESENCE_CHECK = new CheckDescription("SERVICE_PRESENCE_CHECK",
- PrereqCheckType.SERVICE,
- "Service Is Not Supported For Upgrades",
- new ImmutableMap.Builder<String, String>()
- .put(AbstractCheckDescriptor.DEFAULT,
- "The %s service is currently installed on the cluster. " +
- "This service does not support upgrades and must be removed before the upgrade can continue. " +
- "After upgrading, %s can be reinstalled")
- .put(ServicePresenceCheck.KEY_SERVICE_REMOVED,
- "The %s service is currently installed on the cluster. " +
- "This service is removed from the new release and must be removed before the upgrade can continue.")
- .put(ServicePresenceCheck.KEY_SERVICE_REPLACED,
- "The %s service is currently installed on the cluster. " +
- "This service is removed from the new release and must be removed before the upgrade can continue. " +
- "After upgrading, %s can be installed as the replacement.").build());
+ PrereqCheckType.SERVICE,
+ "Service Is Not Supported For Upgrades",
+ new ImmutableMap.Builder<String, String>()
+ .put(AbstractCheckDescriptor.DEFAULT,
+ "The %s service is currently installed on the cluster. " +
+ "This service does not support upgrades and must be removed before the upgrade can continue. " +
+ "After upgrading, %s can be reinstalled")
+ .put(ServicePresenceCheck.KEY_SERVICE_REMOVED,
+ "The %s service is currently installed on the cluster. " +
+ "This service is removed from the new release and must be removed before the upgrade can continue. " +
+ "After upgrading, %s can be installed").build());
public static CheckDescription RANGER_SERVICE_AUDIT_DB_CHECK = new CheckDescription("RANGER_SERVICE_AUDIT_DB_CHECK",
PrereqCheckType.SERVICE,
@@ -328,9 +323,23 @@ public class CheckDescription {
PrereqCheckType.SERVICE,
"Change Ranger SSL configuration path for Keystore and Truststore.",
new ImmutableMap.Builder<String, String>()
- .put(AbstractCheckDescriptor.DEFAULT,
- "As Ranger is SSL enabled, Ranger SSL configurations will need to be changed from default value of /etc/ranger/*/conf folder to /etc/ranger/security. " +
- "Since the certificates/keystores/truststores in this path may affect the upgrade/downgrade process, it is recommended to manually move the certificates/keystores/truststores out of the conf folders and change the appropriate config values before proceeding.").build());
+ .put(AbstractCheckDescriptor.DEFAULT,
+ "As Ranger is SSL enabled, Ranger SSL configurations will need to be changed from default value of /etc/ranger/*/conf folder to /etc/ranger/security. " +
+ "Since the certificates/keystores/truststores in this path may affect the upgrade/downgrade process, it is recommended to manually move the certificates/keystores/truststores out of the conf folders and change the appropriate config values before proceeding.").build());
+
+ public static CheckDescription JAVA_VERSION = new CheckDescription("JAVA_VERSION",
+ PrereqCheckType.CLUSTER,
+ "Verify Java version requirement",
+ new ImmutableMap.Builder<String, String>()
+ .put(AbstractCheckDescriptor.DEFAULT, "Ambari requires JDK with minimum version %s. Reconfigure Ambari with a JDK that meets the version requirement.")
+ .build());
+
+ public static CheckDescription COMPONENTS_EXIST_IN_TARGET_REPO = new CheckDescription("COMPONENTS_EXIST_IN_TARGET_REPO",
+ PrereqCheckType.CLUSTER,
+ "Verify Cluster Components Exist In Target Repository",
+ new ImmutableMap.Builder<String, String>()
+ .put(AbstractCheckDescriptor.DEFAULT, "The following components do not exist in the target repository's stack. They must be removed from the cluster before upgrading.")
+ .build());
private String m_name;
private PrereqCheckType m_type;
@@ -371,4 +380,4 @@ public class CheckDescription {
public String getFail(String key) {
return m_fails.containsKey(key) ? m_fails.get(key) : "";
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java
index 714731d..f26202d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java
@@ -18,9 +18,9 @@
package org.apache.ambari.server.checks;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -31,6 +31,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.apache.commons.lang.StringUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -58,10 +59,11 @@ public class ClientRetryPropertyCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("HDFS", "HIVE", "OOZIE"), false);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HDFS", "HIVE", "OOZIE");
}
+
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsExistInRepoCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsExistInRepoCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsExistInRepoCheck.java
new file mode 100644
index 0000000..6949257
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsExistInRepoCheck.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.checks;
+
+import java.text.MessageFormat;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.StackAccessException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
+import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.commons.lang.StringUtils;
+
+import com.google.inject.Singleton;
+
+/**
+ * The {@link ComponentsExistInRepoCheck} is used to determine if any of the
+ * components scheduled for upgrade do not exist in the target repository or
+ * stack.
+ */
+@Singleton
+@UpgradeCheck(
+ group = UpgradeCheckGroup.TOPOLOGY,
+ required = { UpgradeType.ROLLING, UpgradeType.NON_ROLLING, UpgradeType.HOST_ORDERED })
+public class ComponentsExistInRepoCheck extends AbstractCheckDescriptor {
+
+ /**
+ * Constructor.
+ */
+ public ComponentsExistInRepoCheck() {
+ super(CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO);
+ }
+
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
+ final String clusterName = request.getClusterName();
+ final Cluster cluster = clustersProvider.get().getCluster(clusterName);
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+
+ StackId sourceStack = request.getSourceStackId();
+ StackId targetStack = repositoryVersion.getStackId();
+
+ Set<String> failedServices = new TreeSet<>();
+ Set<String> failedComponents = new TreeSet<>();
+
+ Set<String> servicesInUpgrade = getServicesInUpgrade(request);
+ for (String serviceName : servicesInUpgrade) {
+ try {
+ ServiceInfo serviceInfo = ambariMetaInfo.get().getService(targetStack.getStackName(),
+ targetStack.getStackVersion(), serviceName);
+
+ if (serviceInfo.isDeleted() || !serviceInfo.isValid()) {
+ failedServices.add(serviceName);
+ continue;
+ }
+
+ Service service = cluster.getService(serviceName);
+ Map<String, ServiceComponent> componentsInUpgrade = service.getServiceComponents();
+ for (String componentName : componentsInUpgrade.keySet()) {
+ try {
+ ComponentInfo componentInfo = ambariMetaInfo.get().getComponent(
+ targetStack.getStackName(), targetStack.getStackVersion(), serviceName,
+ componentName);
+
+ // if this component isn't included in the upgrade, then skip it
+ if (!componentInfo.isVersionAdvertised()) {
+ continue;
+ }
+
+ if (componentInfo.isDeleted()) {
+ failedComponents.add(componentName);
+ }
+
+ } catch (StackAccessException stackAccessException) {
+ failedComponents.add(componentName);
+ }
+ }
+ } catch (StackAccessException stackAccessException) {
+ failedServices.add(serviceName);
+ }
+ }
+
+ if( failedServices.isEmpty() && failedComponents.isEmpty() ){
+ prerequisiteCheck.setStatus(PrereqCheckStatus.PASS);
+ return;
+ }
+
+ LinkedHashSet<String> failedOn = new LinkedHashSet<>();
+ failedOn.addAll(failedServices);
+ failedOn.addAll(failedComponents);
+
+ prerequisiteCheck.setFailedOn(failedOn);
+ prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+
+ String message = "The following {0} exist in {1} but are not included in {2}. They must be removed before upgrading.";
+ String messageFragment = "";
+ if (!failedServices.isEmpty()) {
+ messageFragment = "services";
+ }
+
+ if( !failedComponents.isEmpty() ){
+ if(!StringUtils.isEmpty(messageFragment)){
+ messageFragment += " and ";
+ }
+
+ messageFragment += "components";
+ }
+
+ message = MessageFormat.format(message, messageFragment, sourceStack, targetStack);
+ prerequisiteCheck.setFailReason(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java
index 988fc78..ce7ec64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java
@@ -66,8 +66,9 @@ public class ComponentsInstallationCheck extends AbstractCheckDescriptor {
// Preq-req check should fail if any service component is in INSTALL_FAILED state
Set<String> installFailedHostComponents = new HashSet<>();
- for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
- final Service service = serviceEntry.getValue();
+ Set<String> servicesInUpgrade = getServicesInUpgrade(request);
+ for (String serviceName : servicesInUpgrade) {
+ final Service service = cluster.getService(serviceName);
// Skip service if it is in maintenance mode
if (service.getMaintenanceState() != MaintenanceState.ON) {
Map<String, ServiceComponent> serviceComponents = service.getServiceComponents();
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java
index 48c652f..75730d8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java
@@ -63,8 +63,7 @@ public class ConfigurationMergeCheck extends AbstractCheckDescriptor {
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
throws AmbariException {
- String stackName = request.getTargetStackId().getStackName();
- RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().findByStackNameAndVersion(stackName, request.getTargetVersion());
+ RepositoryVersionEntity rve = request.getTargetRepositoryVersion();
Map<String, Map<String, ThreeWayValue>> changes =
m_mergeHelper.getConflicts(request.getClusterName(), rve.getStackId());
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java
index b804f8b..f08be16 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java
@@ -99,7 +99,8 @@ public class HealthCheck extends AbstractCheckDescriptor {
prerequisiteCheck.getFailedOn().add(clusterName);
prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING);
String failReason = getFailReason(prerequisiteCheck, request);
- prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n")));
+ prerequisiteCheck.setFailReason(
+ String.format(failReason, StringUtils.join(errorMessages, System.lineSeparator())));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
index ed7a49a..34e5bfd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java
@@ -18,12 +18,14 @@
package org.apache.ambari.server.checks;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
@@ -31,6 +33,7 @@ import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.apache.ambari.server.utils.VersionUtils;
import org.apache.commons.lang.StringUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -60,8 +63,8 @@ public class HiveDynamicServiceDiscoveryCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("HIVE"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HIVE");
}
/**
@@ -109,9 +112,11 @@ public class HiveDynamicServiceDiscoveryCheck extends AbstractCheckDescriptor {
String minStackName = minStack[0];
String minStackVersion = minStack[1];
if (minStackName.equals(request.getSourceStackId().getStackName())) {
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+ StackId targetStackId = repositoryVersion.getStackId();
if (VersionUtils.compareVersions(request.getSourceStackId().getStackVersion(), minStackVersion) < 0
- && VersionUtils.compareVersions(request.getTargetStackId().getStackVersion(), minStackVersion) < 0
- && VersionUtils.compareVersions(request.getSourceStackId().getStackVersion(), request.getTargetStackId().getStackVersion()) < 0) {
+ && VersionUtils.compareVersions(targetStackId.getStackVersion(), minStackVersion) < 0
+ && VersionUtils.compareVersions(request.getSourceStackId().getStackVersion(), targetStackId.getStackVersion()) < 0) {
checkStatus = PrereqCheckStatus.WARNING;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
index ea20a55..e876696 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheck.java
@@ -17,8 +17,8 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ServiceComponentNotFoundException;
@@ -30,6 +30,7 @@ import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -51,8 +52,8 @@ public class HiveMultipleMetastoreCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("HIVE"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HIVE");
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveNotRollingWarning.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveNotRollingWarning.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveNotRollingWarning.java
index 2b1c62e..8e862c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveNotRollingWarning.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveNotRollingWarning.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -25,6 +25,7 @@ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -52,14 +53,10 @@ public class HiveNotRollingWarning extends AbstractCheckDescriptor {
/**
* {@inheritDoc}
- * <p/>
- * This check is only applicable if Hive is installed and the upgrade type is
- * {@link UpgradeType#ROLLING}.
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- boolean isApplicable = super.isApplicable(request, Arrays.asList("HIVE"), true);
- return isApplicable && request.getUpgradeType() == UpgradeType.ROLLING;
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HIVE");
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
index 1c59d2e..5094843 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java
@@ -23,6 +23,7 @@ import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.MaintenanceState;
@@ -58,11 +59,6 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
}
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request) && request.getTargetVersion() != null;
- }
-
- @Override
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
final String clusterName = request.getClusterName();
final Cluster cluster = clustersProvider.get().getCluster(clusterName);
@@ -70,13 +66,18 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
final Set<String> hostsWithMasterComponent = new HashSet<>();
// TODO AMBARI-12698, need to pass the upgrade pack to use in the request, or at least the type.
- final String upgradePackName = repositoryVersionHelper.get().getUpgradePackageName(stackId.getStackName(), stackId.getStackVersion(), request.getTargetVersion(), null);
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+
+ final String upgradePackName = repositoryVersionHelper.get().getUpgradePackageName(
+ stackId.getStackName(), stackId.getStackVersion(), repositoryVersion.getVersion(), null);
+
if (upgradePackName == null) {
prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
String fail = getFailReason(KEY_NO_UPGRADE_NAME, prerequisiteCheck, request);
prerequisiteCheck.setFailReason(String.format(fail, stackId.getStackName(), stackId.getStackVersion()));
return;
}
+
final UpgradePack upgradePack = ambariMetaInfo.get().getUpgradePacks(stackId.getStackName(), stackId.getStackVersion()).get(upgradePackName);
if (upgradePack == null) {
prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
@@ -84,10 +85,12 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
prerequisiteCheck.setFailReason(String.format(fail, upgradePackName));
return;
}
+
final Set<String> componentsFromUpgradePack = new HashSet<>();
for (Map<String, ProcessingComponent> task: upgradePack.getTasks().values()) {
componentsFromUpgradePack.addAll(task.keySet());
}
+
for (Service service: cluster.getServices().values()) {
for (ServiceComponent serviceComponent: service.getServiceComponents().values()) {
if (serviceComponent.isMasterComponent() && componentsFromUpgradePack.contains(serviceComponent.getName())) {
@@ -95,6 +98,7 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
}
}
}
+
final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
for (Map.Entry<String, Host> hostEntry : clusterHosts.entrySet()) {
final Host host = hostEntry.getValue();
@@ -102,6 +106,7 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor {
prerequisiteCheck.getFailedOn().add(host.getHostName());
}
}
+
if (!prerequisiteCheck.getFailedOn().isEmpty()) {
prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request));
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
index f83c39b..ae36c65 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheck.java
@@ -25,7 +25,6 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.orm.entities.HostVersionEntity;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.orm.entities.StackEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.MaintenanceState;
@@ -49,8 +48,6 @@ import com.google.inject.Singleton;
required = { UpgradeType.ROLLING, UpgradeType.NON_ROLLING, UpgradeType.HOST_ORDERED })
public class HostsRepositoryVersionCheck extends AbstractCheckDescriptor {
- static final String KEY_NO_REPO_VERSION = "no_repo_version";
-
/**
* Constructor.
*/
@@ -59,17 +56,11 @@ public class HostsRepositoryVersionCheck extends AbstractCheckDescriptor {
}
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request) && request.getTargetVersion() != null;
- }
-
- @Override
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
throws AmbariException {
final String clusterName = request.getClusterName();
final Cluster cluster = clustersProvider.get().getCluster(clusterName);
final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
- final StackId stackId = request.getSourceStackId();
for (Host host : clusterHosts.values()) {
// hosts in MM will produce a warning if they do not have the repo version
@@ -78,48 +69,19 @@ public class HostsRepositoryVersionCheck extends AbstractCheckDescriptor {
continue;
}
- if (null != request.getTargetVersion()) {
- boolean found = false;
-
- Set<RepositoryVersionState> allowed = EnumSet.of(RepositoryVersionState.INSTALLED,
- RepositoryVersionState.NOT_REQUIRED);
- if (request.isRevert()) {
- allowed.add(RepositoryVersionState.CURRENT);
- }
-
- for (HostVersionEntity hve : hostVersionDaoProvider.get().findByHost(host.getHostName())) {
-
- if (hve.getRepositoryVersion().getVersion().equals(request.getTargetVersion())
- && allowed.contains(hve.getState())) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- prerequisiteCheck.getFailedOn().add(host.getHostName());
- }
- } else {
- final RepositoryVersionEntity repositoryVersion = repositoryVersionDaoProvider.get().findByStackAndVersion(
- stackId, request.getTargetVersion());
- if (repositoryVersion == null) {
- prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
- prerequisiteCheck.setFailReason(
- getFailReason(KEY_NO_REPO_VERSION, prerequisiteCheck, request));
- prerequisiteCheck.getFailedOn().addAll(clusterHosts.keySet());
- return;
- }
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+ StackId repositoryStackId = repositoryVersion.getStackId();
- StackEntity repositoryStackEntity = repositoryVersion.getStack();
- StackId repositoryStackId = new StackId(repositoryStackEntity.getStackName(),
- repositoryStackEntity.getStackVersion());
+ // get the host version entity for this host and repository
+ final HostVersionEntity hostVersion = hostVersionDaoProvider.get().findByClusterStackVersionAndHost(
+ clusterName, repositoryStackId, repositoryVersion.getVersion(), host.getHostName());
- final HostVersionEntity hostVersion = hostVersionDaoProvider.get().findByClusterStackVersionAndHost(
- clusterName, repositoryStackId, repositoryVersion.getVersion(), host.getHostName());
+ // the repo needs to either be installed or not required
+ Set<RepositoryVersionState> okStates = EnumSet.of(RepositoryVersionState.INSTALLED,
+ RepositoryVersionState.NOT_REQUIRED);
- if (hostVersion == null || hostVersion.getState() != RepositoryVersionState.INSTALLED) {
- prerequisiteCheck.getFailedOn().add(host.getHostName());
- }
+ if (hostVersion == null || !okStates.contains(hostVersion.getState())) {
+ prerequisiteCheck.getFailedOn().add(host.getHostName());
}
}
@@ -128,4 +90,4 @@ public class HostsRepositoryVersionCheck extends AbstractCheckDescriptor {
prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request));
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
index 7c84e5c..3e02572 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
@@ -59,16 +59,15 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor {
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
final String clusterName = request.getClusterName();
final Cluster cluster = clustersProvider.get().getCluster(clusterName);
- final StackId targetStackId = request.getTargetStackId();
- final String stackName = targetStackId.getStackName();
- final String repoVersion = request.getTargetVersion();
+ RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
- final RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().findByStackNameAndVersion(stackName, request.getTargetVersion());
- if (StringUtils.isBlank(rve.getVersion()) || !rve.getVersion().matches("^\\d+(\\.\\d+)*\\-\\d+$")) {
+ final StackId targetStackId = repositoryVersion.getStackId();
+
+ if (!repositoryVersion.getVersion().matches("^\\d+(\\.\\d+)*\\-\\d+$")) {
String message = MessageFormat.format("The Repository Version {0} for Stack {1} must contain a \"-\" followed by a build number. " +
"Make sure that another registered repository does not have the same repo URL or " +
- "shares the same build number. Next, try reinstalling the Repository Version.", rve.getVersion(), rve.getStackVersion());
- prerequisiteCheck.getFailedOn().add("Repository Version " + rve.getVersion());
+ "shares the same build number. Next, try reinstalling the Repository Version.", repositoryVersion.getVersion(), repositoryVersion.getStackVersion());
+ prerequisiteCheck.getFailedOn().add("Repository Version " + repositoryVersion.getVersion());
prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
prerequisiteCheck.setFailReason(message);
return;
@@ -79,7 +78,7 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor {
for (Host host : cluster.getHosts()) {
if (host.getMaintenanceState(cluster.getClusterId()) != MaintenanceState.ON) {
for (HostVersionEntity hve : hostVersionDaoProvider.get().findByHost(host.getHostName())) {
- if (hve.getRepositoryVersion().getVersion().equals(request.getTargetVersion())
+ if (StringUtils.equals(hve.getRepositoryVersion().getVersion(), repositoryVersion.getVersion())
&& hve.getState() == RepositoryVersionState.INSTALL_FAILED) {
failedHosts.add(host.getHostName());
}
@@ -91,7 +90,8 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor {
String message = MessageFormat.format("Hosts in cluster [{0},{1},{2},{3}] are in INSTALL_FAILED state because " +
"Install Packages had failed. Please re-run Install Packages, if necessary place following hosts " +
"in Maintenance mode: {4}", cluster.getClusterName(), targetStackId.getStackName(),
- targetStackId.getStackVersion(), repoVersion, StringUtils.join(failedHosts, ", "));
+ targetStackId.getStackVersion(), repositoryVersion.getVersion(),
+ StringUtils.join(failedHosts, ", "));
prerequisiteCheck.setFailedOn(new LinkedHashSet<>(failedHosts));
prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
prerequisiteCheck.setFailReason(message);
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaKerberosCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaKerberosCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaKerberosCheck.java
index 69721d9..724feab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaKerberosCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/KafkaKerberosCheck.java
@@ -18,7 +18,7 @@
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -47,9 +48,12 @@ public class KafkaKerberosCheck extends AbstractCheckDescriptor {
super(CheckDescription.KAFKA_KERBEROS_CHECK);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList(KAFKA_SERVICE), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet(KAFKA_SERVICE);
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
index 8ab3c11..2015be3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java
@@ -18,8 +18,8 @@
package org.apache.ambari.server.checks;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.commons.lang.StringUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -57,8 +58,8 @@ public class MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescr
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("MAPREDUCE2"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("MAPREDUCE2");
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerAuditDbCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerAuditDbCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerAuditDbCheck.java
index 8d1abdb..e5f0257 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerAuditDbCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerAuditDbCheck.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -26,6 +26,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -42,9 +43,12 @@ public class RangerAuditDbCheck extends AbstractCheckDescriptor{
super(CheckDescription.RANGER_SERVICE_AUDIT_DB_CHECK);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList(serviceName), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet(serviceName);
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
index 4a36be0..79f52d7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerPasswordCheck.java
@@ -27,22 +27,21 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
import org.apache.ambari.server.controller.internal.URLStreamProvider;
-import org.apache.ambari.server.state.Service;
-import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
-import org.apache.ambari.server.utils.VersionUtils;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.inject.Singleton;
@@ -74,25 +73,11 @@ public class RangerPasswordCheck extends AbstractCheckDescriptor {
}
/**
- * Verifies that the check can be run. If the stack is HDP and 2.3 or higher, allow
- * this to run. If the stack is not HDP, the check should run.
+ * {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- if (!super.isApplicable(request, Arrays.asList("RANGER"), true)) {
- return false;
- }
-
- Service service = getCluster(request).getService("RANGER");
-
- StackId stackId = service.getDesiredStackId();
- if (stackId.getStackName().equals("HDP")) {
- String sourceVersion = request.getSourceStackId().getStackVersion();
-
- return VersionUtils.compareVersions(sourceVersion, "2.3.0.0") >= 0;
- }
-
- return true;
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("RANGER");
}
@Override
@@ -293,7 +278,7 @@ public class RangerPasswordCheck extends AbstractCheckDescriptor {
*/
private boolean checkRangerUser(URLStreamProvider streamProvider, String rangerUserUrl,
String username, String password, String userToSearch, PrerequisiteCheck check,
- PrereqCheckRequest request, List<String> warnReasons) {
+ PrereqCheckRequest request, List<String> warnReasons) throws AmbariException {
String url = String.format("%s?name=%s", rangerUserUrl, userToSearch);
@@ -390,4 +375,4 @@ public class RangerPasswordCheck extends AbstractCheckDescriptor {
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerSSLConfigCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerSSLConfigCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerSSLConfigCheck.java
index 2014ff7..540fd3e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerSSLConfigCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/RangerSSLConfigCheck.java
@@ -18,7 +18,7 @@
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
@@ -54,8 +55,8 @@ public class RangerSSLConfigCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList(serviceName), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet(serviceName);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
index 543df26..e83b118 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java
@@ -33,6 +33,7 @@ import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -53,18 +54,21 @@ public class SecondaryNamenodeDeletedCheck extends AbstractCheckDescriptor {
super(CheckDescription.SECONDARY_NAMENODE_MUST_BE_DELETED);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- if (!super.isApplicable(request, Arrays.asList(HDFS_SERVICE_NAME), true)) {
- return false;
- }
-
- PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA);
- if (null != ha && ha == PrereqCheckStatus.FAIL) {
- return false;
- }
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet(HDFS_SERVICE_NAME);
+ }
- return true;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<CheckQualification> getQualifications() {
+ return Arrays.<CheckQualification> asList(
+ new PriorCheckQualification(CheckDescription.SERVICES_NAMENODE_HA));
}
// TODO AMBARI-12698, there are 2 ways to filter the prechecks.
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
index 950ca11..d5d84f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
@@ -109,7 +109,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
for(String service: removedServices){
if (installedServices.contains(service.toUpperCase())){
prerequisiteCheck.getFailedOn().add(service);
- String msg = String.format(reason, service);
+ String msg = String.format(reason, service, service);
failReasons.add(msg);
}
}
@@ -159,7 +159,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
+ * @return service names
+ * */
private List<String> getRemovedServices(PrereqCheckRequest request){
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME);
if (null != value){
String[] services = value.split(",");
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
index 08f4fd8..aa7b6db 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheck.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -49,10 +49,11 @@ public class ServicesMaintenanceModeCheck extends AbstractCheckDescriptor {
@Override
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
- final String clusterName = request.getClusterName();
- final Cluster cluster = clustersProvider.get().getCluster(clusterName);
- for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
- final Service service = serviceEntry.getValue();
+ final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+ Set<String> servicesInUpgrade = getServicesInUpgrade(request);
+
+ for (String serviceName : servicesInUpgrade) {
+ final Service service = cluster.getService(serviceName);
if (!service.isClientOnlyService() && service.getMaintenanceState() == MaintenanceState.ON) {
prerequisiteCheck.getFailedOn().add(service.getName());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
index 3fd55b7..ab7e798 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -32,6 +33,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
import org.apache.commons.lang.StringUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -47,20 +49,21 @@ public class ServicesMapReduceDistributedCacheCheck extends AbstractCheckDescrip
static final String DFS_PROTOCOLS_REGEX_PROPERTY_NAME = "dfs-protocols-regex";
static final String DFS_PROTOCOLS_REGEX_DEFAULT = "^([^:]*dfs|wasb|ecs):.*";
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request)
- throws AmbariException {
-
- if (!super.isApplicable(request, Arrays.asList("YARN"), true)) {
- return false;
- }
-
- PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA);
- if (null != ha && ha == PrereqCheckStatus.FAIL) {
- return false;
- }
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("YARN");
+ }
- return true;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<CheckQualification> getQualifications() {
+ return Arrays.<CheckQualification> asList(
+ new PriorCheckQualification(CheckDescription.SERVICES_NAMENODE_HA));
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
index 67999e8..ecd88ed 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheck.java
@@ -17,8 +17,8 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -28,6 +28,7 @@ import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -44,11 +45,15 @@ public class ServicesNamenodeHighAvailabilityCheck extends AbstractCheckDescript
super(CheckDescription.SERVICES_NAMENODE_HA);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("HDFS"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HDFS");
}
+
@Override
public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
final String clusterName = request.getClusterName();
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
index 269de82..ce1b4bf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheck.java
@@ -18,6 +18,8 @@
package org.apache.ambari.server.checks;
import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -26,6 +28,7 @@ import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -42,18 +45,21 @@ public class ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor {
super(CheckDescription.SERVICES_NAMENODE_TRUNCATE);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- if (!super.isApplicable(request, Arrays.asList("HDFS"), true)) {
- return false;
- }
-
- PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA);
- if (null != ha && ha == PrereqCheckStatus.FAIL) {
- return false;
- }
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("HDFS");
+ }
- return true;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<CheckQualification> getQualifications() {
+ return Arrays.<CheckQualification> asList(
+ new PriorCheckQualification(CheckDescription.SERVICES_NAMENODE_HA));
}
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
index a564957..cb0c9ae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -32,6 +33,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
import org.apache.commons.lang.StringUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -49,18 +51,21 @@ public class ServicesTezDistributedCacheCheck extends AbstractCheckDescriptor {
static final String DFS_PROTOCOLS_REGEX_PROPERTY_NAME = "dfs-protocols-regex";
static final String DFS_PROTOCOLS_REGEX_DEFAULT = "^([^:]*dfs|wasb|ecs):.*";
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- if (!super.isApplicable(request, Arrays.asList("TEZ"), true)) {
- return false;
- }
-
- PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA);
- if (null != ha && ha == PrereqCheckStatus.FAIL) {
- return false;
- }
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("TEZ");
+ }
- return true;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<CheckQualification> getQualifications() {
+ return Arrays.<CheckQualification> asList(
+ new PriorCheckQualification(CheckDescription.SERVICES_NAMENODE_HA));
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
index 6b03249..c9f3cc3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java
@@ -91,9 +91,9 @@ public class ServicesUpCheck extends AbstractCheckDescriptor {
List<String> errorMessages = new ArrayList<>();
Set<String> failedServiceNames = new HashSet<>();
- for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
- final Service service = serviceEntry.getValue();
- StackId stackId = service.getDesiredStackId();
+ Set<String> servicesInUpgrade = getServicesInUpgrade(request);
+ for (String serviceName : servicesInUpgrade) {
+ final Service service = cluster.getService(serviceName);
// Ignore services like Tez that are clientOnly.
if (service.isClientOnlyService()) {
@@ -131,6 +131,7 @@ public class ServicesUpCheck extends AbstractCheckDescriptor {
// non-master, "true" slaves with cardinality 1+
boolean checkThreshold = false;
if (!serviceComponent.isMasterComponent()) {
+ StackId stackId = service.getDesiredStackId();
ComponentInfo componentInfo = ambariMetaInfo.get().getComponent(stackId.getStackName(),
stackId.getStackVersion(), serviceComponent.getServiceName(),
serviceComponent.getName());
@@ -194,6 +195,8 @@ public class ServicesUpCheck extends AbstractCheckDescriptor {
* purposes of this check. Component type, maintenance mode, and state are
* taken into account.
*
+ * @param clusters
+ * the clusters instance
* @param cluster
* the cluster
* @param serviceComponent
@@ -225,4 +228,4 @@ public class ServicesUpCheck extends AbstractCheckDescriptor {
return false;
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
index 8c73fa9..0b102a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheck.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -25,6 +25,7 @@ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.commons.lang.BooleanUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -45,8 +46,8 @@ public class ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("YARN"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("YARN");
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/StormShutdownWarning.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/StormShutdownWarning.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/StormShutdownWarning.java
index b5435f1..067cd80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/StormShutdownWarning.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/StormShutdownWarning.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -25,6 +25,7 @@ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -50,14 +51,10 @@ public class StormShutdownWarning extends AbstractCheckDescriptor {
/**
* {@inheritDoc}
- * <p/>
- * This check is only applicable if Storm is installed and the upgrade type is
- * {@link UpgradeType#ROLLING}.
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- boolean isApplicable = super.isApplicable(request, Arrays.asList("STORM"), true);
- return isApplicable && request.getUpgradeType() == UpgradeType.ROLLING;
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("STORM");
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
index 6206dd3..e0d3df7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnRMHighAvailabilityCheck.java
@@ -17,7 +17,7 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -25,6 +25,7 @@ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.commons.lang.BooleanUtils;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -46,10 +47,9 @@ public class YarnRMHighAvailabilityCheck extends AbstractCheckDescriptor {
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- return super.isApplicable(request, Arrays.asList("YARN"), true);
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("YARN");
}
-
/**
* {@inheritDoc}
*/
[30/50] [abbrv] ambari git commit: AMBARI-21670. Log Search cleanup:
all configurations should be spring managed (oleewere)
Posted by ab...@apache.org.
AMBARI-21670. Log Search cleanup: all configurations should be spring managed (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/555f241c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/555f241c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/555f241c
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 555f241cf0cf4e8830ce78f069ecca152802410f
Parents: f01c32e
Author: oleewere <ol...@gmail.com>
Authored: Mon Aug 7 21:12:53 2017 +0200
Committer: oleewere <ol...@gmail.com>
Committed: Mon Aug 7 21:28:42 2017 +0200
----------------------------------------------------------------------
.../ambari-logsearch-logfeeder/build.properties | 2 +-
.../ambari-logsearch-server/build.properties | 2 +-
.../ambari-logsearch-server/pom.xml | 427 ++++---------------
ambari-logsearch/ambari-logsearch-server/run.sh | 6 +-
.../org/apache/ambari/logsearch/LogSearch.java | 181 +-------
.../logsearch/common/ExternalServerClient.java | 24 +-
.../logsearch/common/LogSearchConstants.java | 2 +-
.../logsearch/common/PropertiesHelper.java | 124 ------
.../logsearch/common/XMLPropertiesHelper.java | 79 ----
.../ambari/logsearch/conf/ApiDocConfig.java | 4 +-
.../logsearch/conf/ApplicationConfig.java | 2 -
.../conf/LogSearchConfigMapHolder.java | 61 +++
.../logsearch/conf/LogSearchHttpConfig.java | 83 ++++
.../conf/LogSearchJerseyResourceConfig.java | 37 ++
.../logsearch/conf/LogSearchServletConfig.java | 95 +++++
.../logsearch/conf/LogSearchSpnegoConfig.java | 173 ++++++++
.../logsearch/conf/LogSearchSslConfig.java | 86 ++++
.../ambari/logsearch/conf/SecurityConfig.java | 3 +
.../conf/StaticResourceConfiguration.java | 49 +++
.../configurer/LogSearchConfigConfigurer.java | 10 +-
.../logsearch/configurer/SslConfigurer.java | 363 ++++++++++++++++
.../apache/ambari/logsearch/util/SSLUtil.java | 388 -----------------
.../apache/ambari/logsearch/util/WebUtil.java | 65 ---
.../LogsearchKRBAuthenticationFilter.java | 107 +----
.../web/listener/LogSearchSessionListener.java | 4 +-
.../logsearch/web/security/LdapProperties.java | 365 ----------------
.../web/security/LdapPropertyName.java | 58 ---
.../ambari/logsearch/web/security/LdapUtil.java | 115 -----
...LogsearchAbstractAuthenticationProvider.java | 2 +-
.../LogsearchAuthenticationProvider.java | 4 -
.../LogsearchLdapAuthenticationProvider.java | 187 --------
.../LogsearchLdapBindAuthenticator.java | 46 --
.../src/main/resources/default.properties | 1 -
.../src/main/resources/log4j.xml | 118 ++---
.../src/main/resources/logsearch-admin-site.xml | 116 -----
.../src/main/resources/logsearch.properties | 6 +-
.../src/main/resources/swagger/swagger.html | 36 +-
.../src/main/scripts/run.sh | 3 +-
.../LogsearchAuthenticationProviderTest.java | 68 +--
...LogsearchLdapAuthenticationProviderTest.java | 61 ---
.../ambari-logsearch-web/build.properties | 2 +-
ambari-logsearch/ambari-logsearch-web/pom.xml | 4 +-
ambari-logsearch/docker/logsearch-docker.sh | 4 +-
.../docker/test-config/logsearch/log4j.xml | 35 +-
.../test-config/logsearch/logsearch-env.sh | 5 +-
.../logsearch/logsearch-https.properties | 1 +
.../LoggingRequestHelperFactoryImpl.java | 19 +-
.../server/upgrade/UpgradeCatalog300.java | 28 +-
.../common-services/LOGSEARCH/0.5.0/alerts.json | 6 +-
.../0.5.0/configuration/logsearch-env.xml | 14 -
.../configuration/logsearch-properties.xml | 21 +
.../LOGSEARCH/0.5.0/package/scripts/params.py | 13 +-
.../0.5.0/properties/logsearch-env.sh.j2 | 2 -
.../LOGSEARCH/0.5.0/quicklinks/quicklinks.json | 10 +-
.../LoggingRequestHelperFactoryImplTest.java | 10 +-
.../stacks/2.4/LOGSEARCH/test_logsearch.py | 2 +
.../test/python/stacks/2.4/configs/default.json | 5 +-
.../configs/services/logsearch_properties.js | 97 +++--
58 files changed, 1339 insertions(+), 2502 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/build.properties b/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
index 46979e5..013ba2e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
@@ -15,4 +15,4 @@ app.pkg.dir=${app.work.dir}/pkg
app.dev.war.dir=${app.work.dir}/webapps/logsearch
app.war.name=logsearch.war
-app.target.dir=${builddir}/target/classes/webapps/app
\ No newline at end of file
+app.target.dir=${builddir}/target/classes/static
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/build.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/build.properties b/ambari-logsearch/ambari-logsearch-server/build.properties
index 1cd118a..4e49489 100644
--- a/ambari-logsearch/ambari-logsearch-server/build.properties
+++ b/ambari-logsearch/ambari-logsearch-server/build.properties
@@ -20,4 +20,4 @@ app.pkg.dir=${app.work.dir}/pkg
app.dev.war.dir=${app.work.dir}/webapps/logsearch
app.war.name=logsearch.war
-app.target.dir=${builddir}/target/classes/webapps/app
\ No newline at end of file
+app.target.dir=${builddir}/target/classes/static
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml
index 4db1f61..c0ae16e 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -27,17 +27,17 @@
<url>http://maven.apache.org</url>
<name>Ambari Logsearch Server</name>
<properties>
- <spring.version>4.2.5.RELEASE</spring.version>
- <spring.security.version>4.0.4.RELEASE</spring.security.version>
+ <spring.version>4.3.10.RELEASE</spring.version>
+ <spring.security.version>4.2.3.RELEASE</spring.security.version>
<spring.ldap.version>2.0.4.RELEASE</spring.ldap.version>
- <jersey.version>2.23.2</jersey.version>
- <jetty-version>9.2.11.v20150529</jetty-version>
- <swagger.version>1.5.8</swagger.version>
+ <jersey.version>2.25.1</jersey.version>
+ <jetty.version>9.4.6.v20170531</jetty.version>
+ <swagger.version>1.5.16</swagger.version>
<spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version>
<jjwt.version>0.6.0</jjwt.version>
+ <spring-boot.version>1.5.6.RELEASE</spring-boot.version>
</properties>
<profiles>
- <!-- Dev Profile Start -->
<profile>
<id>dev</id>
<activation>
@@ -67,24 +67,18 @@
<target>${jdk.version}</target>
</configuration>
</plugin>
- <!-- Exec main class plugin -->
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
- <goal>java</goal>
+ <goal>repackage</goal>
</goals>
</execution>
</executions>
- <configuration>
- <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
- <!-- <arguments> <argument></argument> </arguments> -->
- </configuration>
</plugin>
- <!-- copy-dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -103,7 +97,7 @@
<artifactId>ambari-logsearch-web</artifactId>
<version>${project.version}</version>
<outputDirectory>${project.build.outputDirectory}/</outputDirectory>
- <includes>webapps/**</includes>
+ <includes>static/**</includes>
</artifactItem>
</artifactItems>
</configuration>
@@ -126,8 +120,6 @@
</execution>
</executions>
</plugin>
- <!-- - -->
- <!-- ant pacakge -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
@@ -137,7 +129,6 @@
<phase>package</phase>
<configuration>
<target>
- <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> -->
<ant antfile="build.xml">
<target name="package"/>
</ant>
@@ -168,243 +159,6 @@
</execution>
</executions>
</plugin>
- <!-- /ant package -->
- </plugins>
- </build>
- </profile>
- <!-- Dev Profile End -->
- <!-- Production Profile Start -->
- <profile>
- <id>production</id>
- <build>
- <finalName>LogSearch</finalName>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.0</version>
- <configuration>
- <source>${jdk.version}</source>
- <target>${jdk.version}</target>
- </configuration>
- </plugin>
- <!-- Exec main class plugin -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- <executions>
- <execution>
- <goals>
- <goal>java</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
- <!-- <arguments> <argument></argument> </arguments> -->
- </configuration>
- </plugin>
- <!-- copy-dependencies -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <artifactItems>*</artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <outputDirectory>${basedir}/target/libs</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- - -->
- <!-- ant pacakge -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <target>
- <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath" /> -->
- <ant antfile="build.xml">
- <target name="package"/>
- </ant>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <!-- <execution>
- <id>Packag Install</id>
- <phase>generate-resources</phase>
- <configuration>
- <target>
- <exec executable="npm">
- <arg value="install" />
- </exec>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>Js Packaging</id>
- <phase>generate-resources</phase>
- <configuration>
- <target>
- <exec executable="gulp">
- <arg value="minify-css" />
- </exec>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution> -->
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/*</exclude>
- </excludes>
- </configuration>
- <executions>
- <execution>
- <phase>test</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <!-- Production Profile End -->
- <profile>
- <id>skipMinify</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <finalName>LogSearch</finalName>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.0</version>
- <configuration>
- <source>${jdk.version}</source>
- <target>${jdk.version}</target>
- </configuration>
- </plugin>
- <!-- Exec main class plugin -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- <executions>
- <execution>
- <goals>
- <goal>java</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <mainClass>org.apache.ambari.logsearch.LogSearch</mainClass>
- <!-- <arguments> <argument></argument> </arguments> -->
- </configuration>
- </plugin>
- <!-- copy-dependencies -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <artifactItems>*</artifactItems>
- <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
- <outputDirectory>${basedir}/target/libs</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- - -->
- <!-- ant pacakge -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>package</phase>
- <configuration>
- <target>
- <!-- <taskdef resource="build.properties" classpathref="maven.plugin.classpath"
- /> -->
- <ant antfile="build.xml">
- <target name="package"/>
- </ant>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</profile>
@@ -455,62 +209,88 @@
</dependency>
<dependency>
- <groupId>org.springframework.ldap</groupId>
- <artifactId>spring-ldap-core</artifactId>
- <version>${spring.ldap.version}</version>
+ <groupId>org.springframework.security.kerberos</groupId>
+ <artifactId>spring-security-kerberos-core</artifactId>
+ <version>1.0.1.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-ldap</artifactId>
- <version>${spring.security.version}</version>
+ <groupId>org.springframework.security.kerberos</groupId>
+ <artifactId>spring-security-kerberos-web</artifactId>
+ <version>1.0.1.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-spring3</artifactId>
- <version>2.23.2</version>
+ <groupId>org.springframework.security.kerberos</groupId>
+ <artifactId>spring-security-kerberos-client</artifactId>
+ <version>1.0.1.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot.version}</version>
<exclusions>
<exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.connectors</groupId>
- <artifactId>jersey-apache-connector</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j</artifactId>
+ <version>1.3.8.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jettison</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-freemarker</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jackson</artifactId>
+ <artifactId>jersey-media-json-jettison</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
- <version>${jersey.version}</version>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ <version>20.0</version>
</dependency>
+
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
- <dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr.version}</version>
@@ -582,6 +362,10 @@
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</exclusion>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -624,6 +408,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
+ <exclusion>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -645,68 +433,6 @@
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework.security.kerberos</groupId>
- <artifactId>spring-security-kerberos-core</artifactId>
- <version>1.0.1.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security.kerberos</groupId>
- <artifactId>spring-security-kerberos-web</artifactId>
- <version>1.0.1.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security.kerberos</groupId>
- <artifactId>spring-security-kerberos-client</artifactId>
- <version>1.0.1.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty-version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-annotations</artifactId>
- <version>${jetty-version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.4</version>
@@ -753,11 +479,6 @@
<version>${spring.version}</version>
</dependency>
<dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>2.3.20</version>
- </dependency>
- <dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/run.sh b/ambari-logsearch/ambari-logsearch-server/run.sh
index ea89947..765fe6c 100755
--- a/ambari-logsearch/ambari-logsearch-server/run.sh
+++ b/ambari-logsearch/ambari-logsearch-server/run.sh
@@ -17,8 +17,4 @@ echo "
███████╗╚██████╔╝╚██████╔╝ ███████║███████╗██║ ██║██║ ██║╚██████╗██║ ██║
╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
"
-cd ..
-mvn clean compile package -Pdev
-cd ambari-logsearch-server
-#mvn exec:java -Pdev
-java -cp target/libs/*:target/classes/ org.apache.ambari.logsearch.LogSearch
+mvn spring-boot:run
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index b1517df..39343c7 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -18,169 +18,30 @@
*/
package org.apache.ambari.logsearch;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.EnumSet;
-
-import org.apache.ambari.logsearch.common.ManageStartEndTime;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.conf.ApplicationConfig;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.ambari.logsearch.util.SSLUtil;
-import org.apache.ambari.logsearch.util.WebUtil;
-import org.apache.ambari.logsearch.web.listener.LogSearchSessionListener;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.server.handler.HandlerList;
-import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.resource.ResourceCollection;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.request.RequestContextListener;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-import org.springframework.web.filter.DelegatingFilterProxy;
-
-import javax.servlet.DispatcherType;
-
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
-
-public class LogSearch {
- private static final Logger LOG = LoggerFactory.getLogger(LogSearch.class);
-
- @LogSearchPropertyDescription(
- name = "logsearch.protocol",
- description = "Log Search Protocol (http or https)",
- examples = {"http", "https"},
- defaultValue = "http",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String LOGSEARCH_PROTOCOL_PROP = "logsearch.protocol";
- private static final String HTTPS_PROTOCOL = "https";
- private static final String HTTP_PROTOCOL = "http";
- private static final String HTTPS_PORT = "61889";
- private static final String HTTP_PORT = "61888";
-
- private static final String ROOT_CONTEXT = "/";
- private static final Integer SESSION_TIMEOUT = 60 * 30;
-
- public static void main(String[] argv) {
- LogSearch logSearch = new LogSearch();
- ManageStartEndTime.manage();
- try {
- logSearch.run(argv);
- } catch (Throwable e) {
- LOG.error("Error running logsearch server", e);
- }
+import org.springframework.boot.Banner;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.system.ApplicationPidFileWriter;
+
+@SpringBootApplication(
+ scanBasePackages = {"org.apache.ambari.logsearch"},
+ exclude = {
+ RepositoryRestMvcAutoConfiguration.class,
+ WebMvcAutoConfiguration.class
}
+)
+public class LogSearch {
- public void run(String[] argv) throws Exception {
- SSLUtil.ensureStorePasswords();
- SSLUtil.loadKeystore();
-
- Server server = buildSever(argv);
- HandlerList handlers = new HandlerList();
- handlers.addHandler(createSwaggerContext());
- handlers.addHandler(createBaseWebappContext());
-
- server.setHandler(handlers);
- server.start();
-
- LOG.debug("============================Server Dump=======================================");
- LOG.debug(server.dump());
- LOG.debug("==============================================================================");
- server.join();
- }
-
- public Server buildSever(String argv[]) {
- Server server = new Server();
- boolean portSpecified = argv.length > 0;
- String protcolProperty = PropertiesHelper.getProperty(LOGSEARCH_PROTOCOL_PROP,HTTP_PROTOCOL);
- HttpConfiguration httpConfiguration = new HttpConfiguration();
- httpConfiguration.setRequestHeaderSize(65535);
- if (StringUtils.isEmpty(protcolProperty)) {
- protcolProperty = HTTP_PROTOCOL;
- }
- String port = null;
- if (HTTPS_PROTOCOL.equals(protcolProperty) && SSLUtil.isKeyStoreSpecified()) {
- LOG.info("Building https server...........");
- port = portSpecified ? argv[0] : HTTPS_PORT;
- WebUtil.checkPort(Integer.parseInt(port));
- httpConfiguration.addCustomizer(new SecureRequestCustomizer());
- SslContextFactory sslContextFactory = SSLUtil.getSslContextFactory();
- ServerConnector sslConnector = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory, "http/1.1"),
- new HttpConnectionFactory(httpConfiguration));
- sslConnector.setPort(Integer.parseInt(port));
- server.setConnectors(new Connector[] { sslConnector });
- } else {
- LOG.info("Building http server...........");
- port = portSpecified ? argv[0] : HTTP_PORT;
- WebUtil.checkPort(Integer.parseInt(port));
- ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
- connector.setPort(Integer.parseInt(port));
- server.setConnectors(new Connector[] { connector });
- }
- URI logsearchURI = URI.create(String.format("%s://0.0.0.0:%s", protcolProperty, port));
- LOG.info("Starting logsearch server URI=" + logsearchURI);
- return server;
- }
-
- private WebAppContext createBaseWebappContext() throws MalformedURLException {
- URI webResourceBase = WebUtil.findWebResourceBase();
- WebAppContext context = new WebAppContext();
- context.setBaseResource(Resource.newResource(webResourceBase));
- context.setContextPath(ROOT_CONTEXT);
- context.setParentLoaderPriority(true);
- context.addEventListener(new LogSearchSessionListener());
-
- // Configure Spring
- context.addEventListener(new ContextLoaderListener());
- context.addEventListener(new RequestContextListener());
- context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));
- context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
- context.setInitParameter("contextConfigLocation", ApplicationConfig.class.getName());
-
- // Configure Jersey
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*");
- jerseyServlet.setInitOrder(1);
- jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.logsearch.rest");
-
- context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
- context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(LOGSEARCH_SESSION_ID);
+ public static void main(String[] args) {
- return context;
+ String pidFile = System.getenv("PID_FILE") == null ? "logsearch.pid" : System.getenv("PID_FILE");
+ new SpringApplicationBuilder(LogSearch.class)
+ .bannerMode(Banner.Mode.OFF)
+ .listeners(new ApplicationPidFileWriter(pidFile))
+ .web(true)
+ .run(args);
}
- private ServletContextHandler createSwaggerContext() throws URISyntaxException {
- ResourceHandler resourceHandler = new ResourceHandler();
- ResourceCollection resources = new ResourceCollection(new String[] {
- LogSearch.class.getClassLoader()
- .getResource("META-INF/resources/webjars/swagger-ui/2.1.0")
- .toURI().toString(),
- LogSearch.class.getClassLoader()
- .getResource("swagger")
- .toURI().toString()
- });
- resourceHandler.setBaseResource(resources);
- resourceHandler.setWelcomeFiles(new String[]{"swagger.html"}); // rewrite index.html from swagger-ui webjar
- ServletContextHandler context = new ServletContextHandler();
- context.setContextPath("/docs/");
- context.setHandler(resourceHandler);
- return context;
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
index df00c15..c6a1379 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/ExternalServerClient.java
@@ -25,7 +25,7 @@ import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.apache.ambari.logsearch.util.SSLUtil;
+import org.apache.ambari.logsearch.configurer.SslConfigurer;
import org.apache.commons.httpclient.auth.InvalidCredentialsException;
import org.apache.log4j.Logger;
import org.glassfish.jersey.client.JerseyClient;
@@ -38,15 +38,11 @@ import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
@Named
public class ExternalServerClient {
+ @Inject
+ private SslConfigurer sslConfigurer;
+
private static Logger LOG = Logger.getLogger(ExternalServerClient.class);
- private static final ThreadLocal<JerseyClient> localJerseyClient = new ThreadLocal<JerseyClient>() {
- @Override
- protected JerseyClient initialValue() {
- return SSLUtil.isKeyStoreSpecified() ?
- new JerseyClientBuilder().sslContext(SSLUtil.getSSLContext()).build() :
- JerseyClientBuilder.createClient();
- }
- };
+ private ThreadLocal<JerseyClient> localJerseyClient;
@Inject
private AuthPropsConfig authPropsConfig;
@@ -55,6 +51,16 @@ public class ExternalServerClient {
* Send GET request to an external server
*/
public Object sendGETRequest(String loginUrl, Class<?> klass, String username, String password) throws Exception {
+ if (localJerseyClient == null) {
+ localJerseyClient = new ThreadLocal<JerseyClient>() {
+ @Override
+ protected JerseyClient initialValue() {
+ return sslConfigurer.isKeyStoreSpecified() ?
+ new JerseyClientBuilder().sslContext(sslConfigurer.getSSLContext()).build() :
+ JerseyClientBuilder.createClient();
+ }
+ };
+ }
String url = authPropsConfig.getExternalAuthHostUrl() + loginUrl;
JerseyClient client = localJerseyClient.get();
HttpAuthenticationFeature authFeature = HttpAuthenticationFeature.basicBuilder()
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index a018dda..c316346 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -21,8 +21,8 @@ package org.apache.ambari.logsearch.common;
public class LogSearchConstants {
+ public static final String LOGSEARCH_APPLICATION_NAME = "logsearch";
public static final String LOGSEARCH_PROPERTIES_FILE = "logsearch.properties";
-
public static final String LOGSEARCH_SESSION_ID = "LOGSEARCHSESSIONID";
// Log Levels
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
deleted file mode 100644
index 3505fe2..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/PropertiesHelper.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.common;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
-
-public class PropertiesHelper extends PropertyPlaceholderConfigurer {
- private static final Logger logger = LoggerFactory.getLogger(PropertiesHelper.class);
-
- private static final String LOGSEARCH_PROP_FILE="logsearch.properties";
-
- private static Map<String, String> propertiesMap;
- public static Map<String, String> getProperties() {
- return propertiesMap;
- }
-
- private PropertiesHelper() {
- }
-
- static {
- propertiesMap = new HashMap<String, String>();
- Properties properties = new Properties();
- URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(LOGSEARCH_PROP_FILE);
- FileInputStream fileInputStream = null;
- try {
- File file = new File(fileCompleteUrl.toURI());
- fileInputStream = new FileInputStream(file.getAbsoluteFile());
- properties.load(fileInputStream);
- } catch (IOException | URISyntaxException e) {
- logger.error("error loading prop for protocol config",e);
- } finally {
- if (fileInputStream != null) {
- try {
- fileInputStream.close();
- } catch (IOException e) {
- }
- }
- }
- for (String key : properties.stringPropertyNames()) {
- String value = properties.getProperty(key);
- propertiesMap.put(key, value);
- }
- }
-
- @Override
- protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException {
- super.processProperties(beanFactory, props);
-
- propertiesMap = new HashMap<String, String>();
-
- // First add the system properties
- Set<Object> keySet = System.getProperties().keySet();
- for (Object key : keySet) {
- String keyStr = key.toString();
- propertiesMap.put(keyStr, System.getProperties().getProperty(keyStr).trim());
- }
-
- // add our properties now
- keySet = props.keySet();
- for (Object key : keySet) {
- String keyStr = key.toString();
- propertiesMap.put(keyStr, props.getProperty(keyStr).trim());
- }
- }
-
- public static String getProperty(String key, String defaultValue) {
- if (key == null) {
- return null;
- }
- String rtrnVal = propertiesMap.get(key);
- if (rtrnVal == null) {
- rtrnVal = defaultValue;
- }
- return rtrnVal;
- }
-
- public static String getProperty(String key) {
- if (key == null) {
- return null;
- }
- return propertiesMap.get(key);
- }
-
- public static boolean getBooleanProperty(String key, boolean defaultValue) {
- if (key == null) {
- return defaultValue;
- }
- String value = getProperty(key);
- if (value == null) {
- return defaultValue;
- }
- return Boolean.parseBoolean(value);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java
deleted file mode 100644
index 690a60f..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/common/XMLPropertiesHelper.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.logsearch.common;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.log4j.Logger;
-import org.springframework.util.DefaultPropertiesPersister;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class XMLPropertiesHelper extends DefaultPropertiesPersister {
- private static Logger logger = Logger.getLogger(XMLPropertiesHelper.class);
-
- public XMLPropertiesHelper() {
- }
-
- @Override
- public void loadFromXml(Properties properties, InputStream inputStream)
- throws IOException {
- try {
- DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
- xmlDocumentBuilderFactory.setIgnoringComments(true);
- xmlDocumentBuilderFactory.setNamespaceAware(true);
- DocumentBuilder xmlDocumentBuilder = xmlDocumentBuilderFactory.newDocumentBuilder();
- Document xmlDocument = xmlDocumentBuilder.parse(inputStream);
- if (xmlDocument != null) {
- xmlDocument.getDocumentElement().normalize();
- NodeList nList = xmlDocument.getElementsByTagName("property");
- if (nList != null) {
- for (int temp = 0; temp < nList.getLength(); temp++) {
- Node nNode = nList.item(temp);
- if (nNode.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) nNode;
- String propertyName = "";
- String propertyValue = "";
- if (eElement.getElementsByTagName("name") != null && eElement.getElementsByTagName("name").item(0) != null) {
- propertyName = eElement.getElementsByTagName("name").item(0).getTextContent().trim();
- }
- if (eElement.getElementsByTagName("value") != null && eElement.getElementsByTagName("value").item(0) != null) {
- propertyValue = eElement.getElementsByTagName("value").item(0).getTextContent().trim();
- }
- if (propertyName != null && !propertyName.isEmpty()) {
- properties.put(propertyName, propertyValue);
- }
- }
- }
- }
- }
- } catch (Exception e) {
- logger.error("Error loading xml properties ", e);
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
index 1e61f22..2658bcb 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApiDocConfig.java
@@ -23,6 +23,7 @@ import io.swagger.jaxrs.listing.SwaggerSerializers;
import io.swagger.models.Info;
import io.swagger.models.License;
+import org.apache.ambari.logsearch.rest.ServiceLogsResource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -34,7 +35,6 @@ public class ApiDocConfig {
private static final String TITLE = "Log Search REST API";
private static final String LICENSE = "Apache 2.0";
private static final String LICENSE_URL = "http://www.apache.org/licenses/LICENSE-2.0.html";
- private static final String RESOURCE_PACKAGE = "org.apache.ambari.logsearch.rest";
private static final String BASE_PATH = "/api/v1";
@Bean
@@ -53,7 +53,7 @@ public class ApiDocConfig {
beanConfig.setLicenseUrl(LICENSE_URL);
beanConfig.setScan(true);
beanConfig.setVersion(VERSION);
- beanConfig.setResourcePackage(RESOURCE_PACKAGE);
+ beanConfig.setResourcePackage(ServiceLogsResource.class.getPackage().getName());
License license = new License();
license.setName(LICENSE);
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
index 756252d..3d30c2a 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/ApplicationConfig.java
@@ -20,7 +20,6 @@ package org.apache.ambari.logsearch.conf;
import freemarker.template.TemplateException;
import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.ConversionServiceFactoryBean;
@@ -32,7 +31,6 @@ import java.io.IOException;
import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
@Configuration
-@ComponentScan("org.apache.ambari.logsearch")
@PropertySource(value = {"classpath:default.properties", "classpath:"+ LOGSEARCH_PROPERTIES_FILE})
public class ApplicationConfig {
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java
new file mode 100644
index 0000000..29d60b2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchConfigMapHolder.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.PropertySource;
+import org.springframework.web.context.support.StandardServletEnvironment;
+
+import javax.inject.Inject;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchConfigMapHolder {
+
+ @Inject
+ private Environment environment;
+
+ private Map<String, String> logsearchProperties = new HashMap<>();
+
+ public Map<String, String> getLogsearchProperties() {
+ if (logsearchProperties.isEmpty()) {
+ PropertySource propertySource = ((StandardServletEnvironment) environment)
+ .getPropertySources().get("class path resource [" + LOGSEARCH_PROPERTIES_FILE + "]");
+ setLogsearchProperties(stringifyValues(((MapPropertySource) propertySource).getSource()));
+ }
+ return logsearchProperties;
+ }
+
+ public void setLogsearchProperties(Map<String, String> logsearchProperties) {
+ this.logsearchProperties = logsearchProperties;
+ }
+
+ private Map<String, String> stringifyValues(Map<String, Object> vars) {
+ return vars.entrySet()
+ .stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> (String) e.getValue()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java
new file mode 100644
index 0000000..4a7280d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchHttpConfig.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchHttpConfig {
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.http.port",
+ description = "Log Search http port",
+ examples = {"61888", "8888"},
+ defaultValue = "61888",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.http.port:61888}")
+ private int httpPort;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.https.port",
+ description = "Log Search https port",
+ examples = {"61889", "8889"},
+ defaultValue = "61889",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.https.port:61889}")
+ private int httpsPort;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.protocol",
+ description = "Log Search Protocol (http or https)",
+ examples = {"http", "https"},
+ defaultValue = "http",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.protocol:http}")
+ private String protocol;
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public int getHttpPort() {
+ return httpPort;
+ }
+
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
+ }
+
+ public int getHttpsPort() {
+ return httpsPort;
+ }
+
+ public void setHttpsPort(int httpsPort) {
+ this.httpsPort = httpsPort;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java
new file mode 100644
index 0000000..c420a24
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchJerseyResourceConfig.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.rest.ServiceLogsResource;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+
+import javax.ws.rs.ApplicationPath;
+
+@ApplicationPath("/api/v1")
+public class LogSearchJerseyResourceConfig extends ResourceConfig {
+
+ public LogSearchJerseyResourceConfig() {
+ packages(ServiceLogsResource.class.getPackage().getName());
+ register(JacksonFeature.class);
+ property(ServletProperties.FILTER_FORWARD_ON_404, true);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java
new file mode 100644
index 0000000..a7a27da
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchServletConfig.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.configurer.SslConfigurer;
+import org.apache.ambari.logsearch.web.listener.LogSearchSessionListener;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.inject.Inject;
+import javax.servlet.http.HttpSessionListener;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_APPLICATION_NAME;
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
+
+@Configuration
+public class LogSearchServletConfig {
+
+ private static final Integer SESSION_TIMEOUT = 60 * 30;
+
+ @Inject
+ private ServerProperties serverProperties;
+
+ @Inject
+ private LogSearchHttpConfig logSearchHttpConfig;
+
+ @Inject
+ private SslConfigurer sslConfigurer;
+
+ @Bean
+ public HttpSessionListener httpSessionListener() {
+ return new LogSearchSessionListener();
+ }
+
+ @Bean
+ public ServletRegistrationBean jerseyServlet() {
+ ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), "/api/v1/*");
+ registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, LogSearchJerseyResourceConfig.class.getName());
+ return registration;
+ }
+
+ @Bean
+ public EmbeddedServletContainerFactory containerFactory() {
+ final JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory = new JettyEmbeddedServletContainerFactory() {
+ @Override
+ protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(Server server) {
+ return new JettyEmbeddedServletContainer(server);
+ }
+ };
+ jettyEmbeddedServletContainerFactory.setSessionTimeout(SESSION_TIMEOUT);
+ serverProperties.getSession().getCookie().setName(LOGSEARCH_SESSION_ID);
+ serverProperties.setDisplayName(LOGSEARCH_APPLICATION_NAME);
+ if ("https".equals(logSearchHttpConfig.getProtocol())) {
+ sslConfigurer.ensureStorePasswords();
+ sslConfigurer.loadKeystore();
+ jettyEmbeddedServletContainerFactory.addServerCustomizers((JettyServerCustomizer) server -> {
+ SslContextFactory sslContextFactory = sslConfigurer.getSslContextFactory();
+ ServerConnector sslConnector = new ServerConnector(server, sslContextFactory);
+ sslConnector.setPort(logSearchHttpConfig.getHttpsPort());
+ server.setConnectors(new Connector[]{sslConnector});
+ });
+ } else {
+ jettyEmbeddedServletContainerFactory.setPort(logSearchHttpConfig.getHttpPort());
+ }
+ return jettyEmbeddedServletContainerFactory;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java
new file mode 100644
index 0000000..16326a6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSpnegoConfig.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchSpnegoConfig {
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.hadoop.security.auth_to_local",
+ description = "Rules that will be applied on authentication names and map them into local usernames.",
+ examples = {"RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//", "DEFAULT"},
+ defaultValue = "DEFAULT",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.hadoop.security.auth_to_local:DEFAULT}")
+ private String nameRules;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.admin.kerberos.token.valid.seconds",
+ description = "Kerberos token validity in seconds.",
+ examples = {"30"},
+ defaultValue = "30",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.admin.kerberos.token.valid.seconds:30}")
+ private String tokenValid;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.admin.kerberos.cookie.domain",
+ description = "Domain for Kerberos cookie.",
+ examples = {"c6401.ambari.apache.org", "localhost"},
+ defaultValue = "localhost",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.admin.kerberos.cookie.domain:localhost}")
+ private String cookieDomain;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.admin.kerberos.cookie.path",
+ description = "Cookie path of the kerberos cookie",
+ examples = {"/"},
+ defaultValue = "/",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.admin.kerberos.cookie.path:/}")
+ private String cookiePath;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.spnego.kerberos.principal",
+ description = "Principal for SPNEGO authentication for Http requests",
+ examples = {"myuser@EXAMPLE.COM"},
+ defaultValue = "",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.spnego.kerberos.principal:}")
+ private String principal;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.spnego.kerberos.keytab",
+ description = "Keytab for SPNEGO authentication for Http requests.",
+ examples = {"/etc/security/keytabs/mykeytab.keytab"},
+ defaultValue = "",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.spnego.kerberos.keytab:}")
+ private String keyTab;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.spnego.kerberos.host",
+ description = "",
+ examples = {"c6401.ambari.apache.org", "localhost"},
+ defaultValue = "localhost",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.spnego.kerberos.host:localhost}")
+ private String hostName;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.spnego.kerberos.enabled",
+ description = "Enable SPNEGO based authentication for Log Search Server.",
+ examples = {"true", "false"},
+ defaultValue = "false",
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.spnego.kerberos.enabled:false}")
+ private boolean kerberosEnabled;
+
+ public String getNameRules() {
+ return nameRules;
+ }
+
+ public void setNameRules(String nameRules) {
+ this.nameRules = nameRules;
+ }
+
+ public String getTokenValid() {
+ return tokenValid;
+ }
+
+ public void setTokenValid(String tokenValid) {
+ this.tokenValid = tokenValid;
+ }
+
+ public String getCookieDomain() {
+ return cookieDomain;
+ }
+
+ public void setCookieDomain(String cookieDomain) {
+ this.cookieDomain = cookieDomain;
+ }
+
+ public String getCookiePath() {
+ return cookiePath;
+ }
+
+ public void setCookiePath(String cookiePath) {
+ this.cookiePath = cookiePath;
+ }
+
+ public String getPrincipal() {
+ return principal;
+ }
+
+ public void setPrincipal(String principal) {
+ this.principal = principal;
+ }
+
+ public String getKeyTab() {
+ return keyTab;
+ }
+
+ public void setKeyTab(String keyTab) {
+ this.keyTab = keyTab;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public boolean isKerberosEnabled() {
+ return kerberosEnabled;
+ }
+
+ public void setKerberosEnabled(boolean kerberosEnabled) {
+ this.kerberosEnabled = kerberosEnabled;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java
new file mode 100644
index 0000000..afa2293
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/LogSearchSslConfig.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
+
+@Configuration
+public class LogSearchSslConfig {
+
+ public static final String LOGSEARCH_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
+ public static final String LOGSEARCH_CERT_DEFAULT_ALGORITHM = "sha256WithRSA";
+ public static final String CREDENTIAL_STORE_PROVIDER_PATH = "hadoop.security.credential.provider.path";
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.cert.algorithm",
+ description = "Algorithm to generate certificates for SSL (if needed).",
+ examples = {"sha256WithRSA"},
+ defaultValue = LOGSEARCH_CERT_DEFAULT_ALGORITHM,
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.cert.algorithm:" + LOGSEARCH_CERT_DEFAULT_ALGORITHM + "}")
+ private String certAlgorithm;
+
+ @LogSearchPropertyDescription(
+ name = "logsearch.cert.folder.location",
+ description = "Folder where the generated certificates (SSL) will be located. Make sure the user of Log Search Server can access it.",
+ examples = {"/etc/mypath/keys"},
+ defaultValue = LOGSEARCH_CERT_DEFAULT_FOLDER,
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${logsearch.cert.folder.location:" + LOGSEARCH_CERT_DEFAULT_FOLDER + "}")
+ private String certFolder;
+
+ @LogSearchPropertyDescription(
+ name = CREDENTIAL_STORE_PROVIDER_PATH,
+ description = "Path to interrogate for protected credentials. (see: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/CredentialProviderAPI.html)",
+ examples = {"localjceks://file/home/mypath/my.jceks"},
+ sources = {LOGSEARCH_PROPERTIES_FILE}
+ )
+ @Value("${hadoop.security.credential.provider.path:}")
+ private String credentialStoreProviderPath;
+
+ public String getCertAlgorithm() {
+ return certAlgorithm;
+ }
+
+ public void setCertAlgorithm(String certAlgorithm) {
+ this.certAlgorithm = certAlgorithm;
+ }
+
+ public String getCertFolder() {
+ return certFolder;
+ }
+
+ public void setCertFolder(String certFolder) {
+ this.certFolder = certFolder;
+ }
+
+ public String getCredentialStoreProviderPath() {
+ return credentialStoreProviderPath;
+ }
+
+ public void setCredentialStoreProviderPath(String credentialStoreProviderPath) {
+ this.credentialStoreProviderPath = credentialStoreProviderPath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
index 5207dd0..2758388 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
@@ -190,6 +190,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public RequestMatcher requestMatcher() {
List<RequestMatcher> matchers = Lists.newArrayList();
+ matchers.add(new AntPathRequestMatcher("/docs/**"));
+ matchers.add(new AntPathRequestMatcher("/swagger-ui/**"));
+ matchers.add(new AntPathRequestMatcher("/swagger.html"));
matchers.add(new AntPathRequestMatcher("/login.html"));
matchers.add(new AntPathRequestMatcher("/logout.html"));
matchers.add(new AntPathRequestMatcher("/styles/**"));
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java
new file mode 100644
index 0000000..bf03aa7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/conf/StaticResourceConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.logsearch.conf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@EnableWebMvc
+@Configuration
+public class StaticResourceConfiguration extends WebMvcConfigurerAdapter {
+
+ private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
+ "classpath:/static/", "classpath:/swagger/","classpath:META-INF/resources/webjars/"
+ };
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/**")
+ .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
+ }
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry) {
+ registry.addViewController("/").setViewName(
+ "forward:/index.html");
+ registry.addViewController("/docs").setViewName(
+ "forward:/swagger.html");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
index 23b7430..baf5adb 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
@@ -23,7 +23,7 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
+import org.apache.ambari.logsearch.conf.LogSearchConfigMapHolder;
import org.apache.ambari.logsearch.conf.global.LogSearchConfigState;
import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
@@ -44,7 +44,10 @@ public class LogSearchConfigConfigurer implements Configurer {
@Inject
private LogSearchConfigState logSearchConfigState;
-
+
+ @Inject
+ private LogSearchConfigMapHolder logSearchConfigMapHolder;
+
@PostConstruct
@Override
public void start() {
@@ -54,7 +57,7 @@ public class LogSearchConfigConfigurer implements Configurer {
logger.info("Started thread to set up log search config");
while (true) {
try {
- logSearchConfig = LogSearchConfigFactory.createLogSearchConfigServer(PropertiesHelper.getProperties(),
+ logSearchConfig = LogSearchConfigFactory.createLogSearchConfigServer(logSearchConfigMapHolder.getLogsearchProperties(),
LogSearchConfigServerZK.class);
logSearchConfigState.setLogSearchConfigAvailable(true);
break;
@@ -68,4 +71,5 @@ public class LogSearchConfigConfigurer implements Configurer {
setupThread.setDaemon(true);
setupThread.start();
}
+
}
[25/50] [abbrv] ambari git commit: AMBARI-21636 Fix
atlas.rest.address property when Atlas is in HA for Atlas-hive hook. (atkach)
Posted by ab...@apache.org.
AMBARI-21636 Fix atlas.rest.address property when Atlas is in HA for Atlas-hive hook. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/58827ad3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/58827ad3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/58827ad3
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 58827ad307f68e2db6f649987a4feae7885944d5
Parents: afa1b48
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Aug 7 14:40:57 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Aug 7 14:40:57 2017 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 69 ++++++++++++++++++++
1 file changed, 69 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/58827ad3/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 382b09d..20b14ee 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -110,6 +110,11 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
configTagsCallbackName: 'loadStormConfigs',
configsCallbackName: 'onLoadStormConfigs'
},
+ 'ATLAS_SERVER': {
+ deletePropertyName: 'deleteAtlasServer',
+ hostPropertyName: 'atlasServer',
+ configsCallbackName: 'onLoadAtlasConfigs'
+ },
'RANGER_KMS_SERVER': {
deletePropertyName: 'deleteRangerKMSServer',
hostPropertyName: 'rangerKMSServerHost',
@@ -1117,6 +1122,52 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
},
+ onLoadAtlasConfigs: function(data) {
+ var atlasServer = this.get('atlasServer'),
+ atlasServerHosts = this.getAtlasServerHosts(),
+ configs = {},
+ attributes = {},
+ propertiesToChange = this.get('allPropertiesToChange');
+
+ this.saveLoadedConfigs(data);
+ data.items.forEach(function (item) {
+ configs[item.type] = item.properties;
+ attributes[item.type] = item.properties_attributes || {};
+ }, this);
+
+ var atlasAddresses = configs['application-properties']['atlas.rest.address'];
+ var hostMask = atlasAddresses.split(',')[0].replace(/([https|http]*\:\/\/)(.*?)(:[0-9]+)/, '$1{hostname}$3');
+ var atlasAddressesRecommended = atlasServerHosts.map(function(hostName) {
+ return hostMask.replace('{hostname}', hostName);
+ }).join(',');
+ configs['application-properties']['atlas.rest.address'] = atlasAddressesRecommended;
+ if (this.get('isReconfigureRequired') && atlasAddresses !== atlasAddressesRecommended) {
+ var service = App.config.get('serviceByConfigTypeMap')['application-properties'];
+ propertiesToChange.pushObject({
+ propertyFileName: 'application-properties',
+ propertyName: 'atlas.rest.address',
+ serviceDisplayName: service && service.get('displayName'),
+ initialValue: atlasAddresses,
+ recommendedValue: atlasAddressesRecommended
+ });
+ }
+ var groups = [
+ {
+ properties: {
+ 'application-properties': configs['application-properties']
+ },
+ properties_attributes: {
+ 'application-properties': attributes['application-properties']
+ }
+ }
+ ];
+ if (this.get('isReconfigureRequired')) {
+ this.setConfigsChanges(groups);
+ } else {
+ this.saveConfigsBatch(groups, 'ATLAS_SERVER', atlasServer);
+ }
+ },
+
/**
* Success callback for load configs request
* @param {object} data
@@ -1592,6 +1643,24 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
return stormNimbusHosts.sort();
},
+ getAtlasServerHosts: function () {
+ var
+ atlasServerHosts = App.HostComponent.find().filterProperty('componentName', 'ATLAS_SERVER').mapProperty('hostName'),
+ atlasServer = this.get('atlasServer');
+
+ if (!!atlasServer) {
+ atlasServerHosts.push(atlasServer);
+ this.set('atlasServer', '');
+ }
+
+ if (this.get('fromDeleteHost') || this.get('deleteAtlasServer')) {
+ this.set('deleteAtlasServer', false);
+ this.set('fromDeleteHost', false);
+ return atlasServerHosts.without(this.get('content.hostName'));
+ }
+ return atlasServerHosts.sort();
+ },
+
/**
* Send command to server to resfresh configs of selected component
* @param {object} event
[46/50] [abbrv] ambari git commit: AMBARI-21695. Problem in starting
accumulo in upgraded cluster (IOP-HDP). (swagle)
Posted by ab...@apache.org.
AMBARI-21695. Problem in starting accumulo in upgraded cluster (IOP-HDP). (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3136abed
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3136abed
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3136abed
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 3136abed153856c1672e502d71a407abe211828f
Parents: 108ad9b
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Aug 9 15:49:15 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Aug 9 15:49:15 2017 -0700
----------------------------------------------------------------------
.../metadata/CachedRoleCommandOrderProvider.java | 9 ++++++++-
.../upgrades/FinalizeUpgradeAction.java | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3136abed/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
index c6315a7..0a5d301 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
@@ -21,6 +21,7 @@ package org.apache.ambari.server.metadata;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.state.Cluster;
@@ -46,7 +47,7 @@ public class CachedRoleCommandOrderProvider implements RoleCommandOrderProvider
@Inject
private Clusters clusters;
- private Map<Integer, RoleCommandOrder> rcoMap = new HashMap<>();
+ private Map<Integer, RoleCommandOrder> rcoMap = new ConcurrentHashMap<>();
@Inject
public CachedRoleCommandOrderProvider() {
@@ -124,4 +125,10 @@ public class CachedRoleCommandOrderProvider implements RoleCommandOrderProvider
return rco;
}
+ /**
+ * Clear all entries - used after an upgrade
+ */
+ public void clearRoleCommandOrderCache() {
+ rcoMap.clear();
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3136abed/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index 9d70546..8471d7b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -35,6 +35,8 @@ import org.apache.ambari.server.agent.CommandReport;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.events.StackUpgradeFinishEvent;
import org.apache.ambari.server.events.publishers.VersionEventPublisher;
+import org.apache.ambari.server.metadata.CachedRoleCommandOrderProvider;
+import org.apache.ambari.server.metadata.RoleCommandOrderProvider;
import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
import org.apache.ambari.server.orm.dao.HostVersionDAO;
import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
@@ -93,6 +95,9 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
}
}
+ @Inject
+ private RoleCommandOrderProvider roleCommandOrderProvider;
+
/**
* Execution path for upgrade.
* @return the command report
@@ -197,6 +202,12 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
// Reset upgrade state
cluster.setUpgradeEntity(null);
+ // Clear any cached RCO data after version upgrade
+ if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+ CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+ cachedRcoProvider.clearRoleCommandOrderCache();
+ }
+
// the upgrade is done!
versionEventPublisher.publish(new StackUpgradeFinishEvent(cluster));
@@ -319,6 +330,12 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
// Reset upgrade state
cluster.setUpgradeEntity(null);
+ // Clear any cached RCO data after version upgrade
+ if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+ CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+ cachedRcoProvider.clearRoleCommandOrderCache();
+ }
+
message = String.format("The downgrade from %s has completed.", downgradeFromVersion);
outSB.append(message).append(System.lineSeparator());
[44/50] [abbrv] ambari git commit: AMBARI-21677 - Upgrade Pre-Checks
Should Take PATCH/SERVICE Types Into Account (jonathanhurley)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
index ba4b61e..f41b34c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheck.java
@@ -17,8 +17,9 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Arrays;
+import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
@@ -30,6 +31,8 @@ import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
import org.apache.ambari.server.utils.VersionUtils;
import org.apache.commons.lang.BooleanUtils;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -55,43 +58,16 @@ public class YarnTimelineServerStatePreservingCheck extends AbstractCheckDescrip
* {@inheritDoc}
*/
@Override
- public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
- if (!super.isApplicable(request, Arrays.asList("YARN"), true)) {
- return false;
- }
-
- final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
-
- String minApplicableStackVersion = null;
- PrerequisiteCheckConfig prerequisiteCheckConfig = request.getPrerequisiteCheckConfig();
- Map<String, String> checkProperties = null;
- if(prerequisiteCheckConfig != null) {
- checkProperties = prerequisiteCheckConfig.getCheckProperties(this.getClass().getName());
- }
- if(checkProperties != null && checkProperties.containsKey(MIN_APPLICABLE_STACK_VERSION_PROPERTY_NAME)) {
- minApplicableStackVersion = checkProperties.get(MIN_APPLICABLE_STACK_VERSION_PROPERTY_NAME);
- }
-
- // Due to the introduction of YARN Timeline state recovery only from certain
- // stack-versions onwards, this check is not applicable to earlier versions
- // of the stack.
- // Applicable only if min-applicable-stack-version config property is not defined, or
- // version equals or exceeds the configured version.
- if(minApplicableStackVersion != null && !minApplicableStackVersion.isEmpty()) {
- String[] minStack = minApplicableStackVersion.split("-");
- if(minStack.length == 2) {
- String minStackName = minStack[0];
- String minStackVersion = minStack[1];
- Service yarnService = cluster.getService("YARN");
- String stackName = yarnService.getDesiredStackId().getStackName();
- if (minStackName.equals(stackName)) {
- String currentRepositoryVersion = yarnService.getDesiredRepositoryVersion().getVersion();
- return VersionUtils.compareVersions(currentRepositoryVersion, minStackVersion) >= 0;
- }
- }
- }
+ public Set<String> getApplicableServices() {
+ return Sets.newHashSet("YARN");
+ }
- return true;
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<CheckQualification> getQualifications() {
+ return Lists.<CheckQualification> newArrayList(new YarnTimelineServerMinVersionQualification());
}
/**
@@ -108,4 +84,53 @@ public class YarnTimelineServerStatePreservingCheck extends AbstractCheckDescrip
prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request));
}
}
+
+ /**
+ * The {@link YarnTimelineServerMinVersionQualification} is used to determine
+ * if the ATS component needs to have the
+ * {@value #MIN_APPLICABLE_STACK_VERSION_PROPERTY_NAME} set.
+ */
+ private class YarnTimelineServerMinVersionQualification implements CheckQualification {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+ final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
+
+ String minApplicableStackVersion = null;
+ PrerequisiteCheckConfig prerequisiteCheckConfig = request.getPrerequisiteCheckConfig();
+ Map<String, String> checkProperties = null;
+ if(prerequisiteCheckConfig != null) {
+ checkProperties = prerequisiteCheckConfig.getCheckProperties(this.getClass().getName());
+ }
+
+ if(checkProperties != null && checkProperties.containsKey(MIN_APPLICABLE_STACK_VERSION_PROPERTY_NAME)) {
+ minApplicableStackVersion = checkProperties.get(MIN_APPLICABLE_STACK_VERSION_PROPERTY_NAME);
+ }
+
+ // Due to the introduction of YARN Timeline state recovery only from certain
+ // stack-versions onwards, this check is not applicable to earlier versions
+ // of the stack.
+ // Applicable only if min-applicable-stack-version config property is not defined, or
+ // version equals or exceeds the configured version.
+ if(minApplicableStackVersion != null && !minApplicableStackVersion.isEmpty()) {
+ String[] minStack = minApplicableStackVersion.split("-");
+ if(minStack.length == 2) {
+ String minStackName = minStack[0];
+ String minStackVersion = minStack[1];
+ Service yarnService = cluster.getService("YARN");
+ String stackName = yarnService.getDesiredStackId().getStackName();
+ if (minStackName.equals(stackName)) {
+ String currentRepositoryVersion = yarnService.getDesiredRepositoryVersion().getVersion();
+ return VersionUtils.compareVersions(currentRepositoryVersion, minStackVersion) >= 0;
+ }
+ }
+ }
+
+ return true;
+
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
index f0a8df1..6d9f655 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java
@@ -64,14 +64,6 @@ public class PrereqCheckRequest {
return m_upgradeType;
}
- public String getTargetVersion() {
- if (null == m_targetRepositoryVersion) {
- return null;
- }
-
- return m_targetRepositoryVersion.getVersion();
- }
-
/**
* Sets the result of a check.
* @param description the description
@@ -110,19 +102,6 @@ public class PrereqCheckRequest {
}
/**
- * Gets the target stack of the upgrade.
- *
- * @return the targetStackId
- */
- public StackId getTargetStackId() {
- if (null == m_targetRepositoryVersion) {
- return null;
- }
-
- return m_targetRepositoryVersion.getStackId();
- }
-
- /**
* Gets the target repository of the upgrade.
*
* @return the target repository.
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
index 8cf3afd..7fe3256 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/CheckHelper.java
@@ -73,7 +73,9 @@ public class CheckHelper {
applicablePreChecks.add(new DescriptorPreCheck(checkDescriptor, prerequisiteCheck));
}
} catch (Exception ex) {
- LOG.error("Check " + checkDescriptor.getDescription().name() + " failed", ex);
+ LOG.error(
+ "Unable to determine whether the pre-upgrade check {} is applicable to this upgrade",
+ checkDescriptor.getDescription().name(), ex);
}
}
return applicablePreChecks;
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index 2449d66..c8880ae 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -337,12 +337,11 @@ if dfs_ha_enabled:
namenode_rpc = nn_host
pass
pass
-elif 'dfs.namenode.rpc-address' in config['configurations']['hdfs-site']:
- namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
else:
- namenode_rpc = default_fs
+ namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', default_fs)
-if namenode_rpc:
+# if HDFS is not installed in the cluster, then don't try to access namenode_rpc
+if "core-site" in config['configurations'] and namenode_rpc:
port_str = namenode_rpc.split(':')[-1].strip()
try:
nn_rpc_client_port = int(port_str)
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
index ecbb6a4..d70030d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
@@ -311,12 +311,11 @@ if dfs_ha_enabled:
namenode_rpc = nn_host
pass
pass
-elif 'dfs.namenode.rpc-address' in config['configurations']['hdfs-site']:
- namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
else:
- namenode_rpc = default_fs
+ namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', default_fs)
-if namenode_rpc:
+# if HDFS is not installed in the cluster, then don't try to access namenode_rpc
+if "core-site" in config['configurations'] and namenode_rpc:
port_str = namenode_rpc.split(':')[-1].strip()
try:
nn_rpc_client_port = int(port_str)
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
index 9fbd012..1b87b30 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
@@ -17,125 +17,58 @@
*/
package org.apache.ambari.server.checks;
-import static org.easymock.EasyMock.anyLong;
import static org.easymock.EasyMock.anyString;
import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.RepositoryType;
import org.apache.ambari.server.state.Service;
-import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckType;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.hadoop.metrics2.sink.relocated.google.common.collect.Sets;
import org.easymock.EasyMock;
-import org.junit.Assert;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Before;
import org.junit.Test;
import com.google.inject.Provider;
+import junit.framework.Assert;
+
/**
* Unit tests for AbstractCheckDescriptor
*/
-public class AbstractCheckDescriptorTest {
- final private Clusters clusters = EasyMock.createNiceMock(Clusters.class);
- private final RepositoryVersionDAO repositoryVersionDao = EasyMock.createNiceMock(RepositoryVersionDAO.class);
-
- @UpgradeCheck(
- group = UpgradeCheckGroup.DEFAULT,
- order = 1.0f,
- required = { UpgradeType.ROLLING, UpgradeType.NON_ROLLING, UpgradeType.HOST_ORDERED })
- private class TestCheckImpl extends AbstractCheckDescriptor {
- private PrereqCheckType m_type;
-
- TestCheckImpl(PrereqCheckType type) {
- super(null);
- m_type = type;
-
- clustersProvider = new Provider<Clusters>() {
- @Override
- public Clusters get() {
- return clusters;
- }
- };
-
- repositoryVersionDaoProvider = new Provider<RepositoryVersionDAO>() {
- @Override
- public RepositoryVersionDAO get() {
- return repositoryVersionDao;
- }
- };
- }
-
- @Override
- public PrereqCheckType getType() {
- return m_type;
- }
-
- @Override
- public void perform(PrerequisiteCheck prerequisiteCheck,
- PrereqCheckRequest request) throws AmbariException {
- }
- }
-
- @UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f, required = { UpgradeType.ROLLING })
- private class RollingTestCheckImpl extends AbstractCheckDescriptor {
- private PrereqCheckType m_type;
-
- RollingTestCheckImpl(PrereqCheckType type) {
- super(null);
- m_type = type;
-
- clustersProvider = new Provider<Clusters>() {
- @Override
- public Clusters get() {
- return clusters;
- }
- };
- }
-
- @Override
- public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
- throws AmbariException {
- }
- }
+public class AbstractCheckDescriptorTest extends EasyMockSupport {
+ @Mock
+ private Clusters clusters;
- @UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f)
- private class NotRequiredCheckTest extends AbstractCheckDescriptor {
- private PrereqCheckType m_type;
-
- NotRequiredCheckTest(PrereqCheckType type) {
- super(null);
- m_type = type;
+ /**
+ * Used to mock out what services will be provided to us by the VDF/cluster.
+ */
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
- clustersProvider = new Provider<Clusters>() {
- @Override
- public Clusters get() {
- return clusters;
- }
- };
- }
+ /**
+ *
+ */
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
- @Override
- public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
- throws AmbariException {
- }
+ @Before
+ public void setup() throws Exception {
+ injectMocks(this);
}
@Test
@@ -169,7 +102,7 @@ public class AbstractCheckDescriptorTest {
@Test
public void testIsApplicable() throws Exception{
final String clusterName = "c1";
- final Cluster cluster = EasyMock.createMock(Cluster.class);
+ final Cluster cluster = createMock(Cluster.class);
Map<String, Service> services = new HashMap<String, Service>(){{
@@ -178,88 +111,88 @@ public class AbstractCheckDescriptorTest {
put("SERVICE3", null);
}};
+ Set<String> oneServiceList = Sets.newHashSet("SERVICE1");
+ Set<String> atLeastOneServiceList = Sets.newHashSet("SERVICE1", "MISSING_SERVICE");
+ Set<String> allServicesList = Sets.newHashSet("SERVICE1", "SERVICE2");
+ Set<String> missingServiceList = Sets.newHashSet("MISSING_SERVICE");
+
expect(clusters.getCluster(anyString())).andReturn(cluster).atLeastOnce();
expect(cluster.getServices()).andReturn(services).atLeastOnce();
- replay(clusters, cluster);
-
- AbstractCheckDescriptor check = new TestCheckImpl(PrereqCheckType.SERVICE);
- PrereqCheckRequest request = new PrereqCheckRequest(clusterName, UpgradeType.ROLLING);
-
- List<String> oneServiceList = Arrays.asList("SERVICE1");
+ RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+ expect(repositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).atLeastOnce();
+ expect(m_vdfXml.getClusterSummary(EasyMock.anyObject(Cluster.class))).andReturn(
+ m_clusterVersionSummary).atLeastOnce();
- List<String> atLeastOneServiceList = Arrays.asList("SERVICE1", "NON_EXISTED_SERVICE");
+ expect(m_clusterVersionSummary.getAvailableServiceNames()).andReturn(
+ allServicesList).atLeastOnce();
- List<String> allServicesList = Arrays.asList("SERVICE1", "SERVICE2");
- List<String> nonExistedList = Arrays.asList("NON_EXISTED_SERVICE");
+ replayAll();
+ TestCheckImpl check = new TestCheckImpl(PrereqCheckType.SERVICE);
+ PrereqCheckRequest request = new PrereqCheckRequest(clusterName, UpgradeType.ROLLING);
+ request.setTargetRepositoryVersion(repositoryVersion);
// case, where we need at least one service to be present
- Assert.assertEquals(true, check.isApplicable(request, oneServiceList, false));
- Assert.assertEquals(true, check.isApplicable(request, atLeastOneServiceList, false));
+ check.setApplicableServices(oneServiceList);
+ Assert.assertTrue(check.isApplicable(request));
- // case, where all services need to be present
- Assert.assertEquals(false, check.isApplicable(request,atLeastOneServiceList, true));
- Assert.assertEquals(true, check.isApplicable(request, allServicesList, true));
+ check.setApplicableServices(atLeastOneServiceList);
+ Assert.assertTrue(check.isApplicable(request));
- // Case with empty list of the required services
- Assert.assertEquals(false, check.isApplicable(request, new ArrayList<String>(), true));
- Assert.assertEquals(false, check.isApplicable(request, new ArrayList<String>(), false));
-
- // Case with non existed services
- Assert.assertEquals(false, check.isApplicable(request, nonExistedList, false));
- Assert.assertEquals(false, check.isApplicable(request, nonExistedList, true));
+ check.setApplicableServices(missingServiceList);
+ Assert.assertFalse(check.isApplicable(request));
}
+ /**
+ * Tests that even though the services are installed, the check doesn't match
+ * since it's for a service not in the PATCH.
+ *
+ * @throws Exception
+ */
@Test
- public void testIsApplicableWithVDF() throws Exception{
+ public void testIsApplicableForPatch() throws Exception {
final String clusterName = "c1";
- final Cluster cluster = EasyMock.createMock(Cluster.class);
+ final Cluster cluster = createMock(Cluster.class);
- Map<String, Service> services = new HashMap<String, Service>(){{
- put("SERVICE1", null);
- put("SERVICE2", null);
- put("SERVICE3", null);
- }};
+ Map<String, Service> services = new HashMap<String, Service>() {
+ {
+ put("SERVICE1", null);
+ put("SERVICE2", null);
+ put("SERVICE3", null);
+ }
+ };
+
+ Set<String> oneServiceList = Sets.newHashSet("SERVICE1");
expect(clusters.getCluster(anyString())).andReturn(cluster).atLeastOnce();
expect(cluster.getServices()).andReturn(services).atLeastOnce();
- RepositoryVersionEntity repoVersion = EasyMock.createMock(RepositoryVersionEntity.class);
- VersionDefinitionXml repoXml = EasyMock.createMock(VersionDefinitionXml.class);
- expect(repoVersion.getType()).andReturn(RepositoryType.PATCH).atLeastOnce();
- expect(repoVersion.getRepositoryXml()).andReturn(repoXml).atLeastOnce();
- expect(repoVersion.getStackId()).andReturn(new StackId("HDP-2.5")).atLeastOnce();
- expect(repoVersion.getVersion()).andReturn("2.5.0.0-1234").atLeastOnce();
- expect(repoXml.getAvailableServiceNames()).andReturn(Collections.singleton("SERVICE2")).atLeastOnce();
+ RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+ expect(repositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).atLeastOnce();
+ expect(m_vdfXml.getClusterSummary(EasyMock.anyObject(Cluster.class))).andReturn(
+ m_clusterVersionSummary).atLeastOnce();
- expect(repositoryVersionDao.findByPK(anyLong())).andReturn(repoVersion).atLeastOnce();
+ // the cluster summary will only return 1 service for the upgrade, even
+ // though this cluster has 2 services installed
+ expect(m_clusterVersionSummary.getAvailableServiceNames()).andReturn(
+ oneServiceList).atLeastOnce();
- expect(repositoryVersionDao.findByStackNameAndVersion(anyString(), anyString())).andReturn(
- repoVersion).atLeastOnce();
+ replayAll();
- replay(clusters, cluster, repositoryVersionDao, repoVersion, repoXml);
-
- AbstractCheckDescriptor check = new TestCheckImpl(PrereqCheckType.SERVICE);
+ TestCheckImpl check = new TestCheckImpl(PrereqCheckType.SERVICE);
PrereqCheckRequest request = new PrereqCheckRequest(clusterName, UpgradeType.ROLLING);
- request.setTargetRepositoryVersion(repoVersion);
-
- List<String> allServicesList = Arrays.asList("SERVICE1", "SERVICE2");
-
- // SERVICE2 is the only thing in VDF
- Assert.assertEquals(true, check.isApplicable(request, allServicesList, false));
+ request.setTargetRepositoryVersion(repositoryVersion);
- List<String> oneServicesList = Arrays.asList("SERVICE1");
+ // since the check is for SERVICE2, it should not match even though its
+ // installed since the repository is only for SERVICE1
+ check.setApplicableServices(Sets.newHashSet("SERVICE2"));
+ Assert.assertFalse(check.isApplicable(request));
- // SERVICE2 is the only thing in VDF, a check for only SERVICE1 fail
- Assert.assertEquals(false, check.isApplicable(request, oneServicesList, false));
-
- // a VDF without available services is technically invalid, so expect any passed services to return false
- reset(repoXml);
- expect(repoXml.getAvailableServiceNames()).andReturn(Collections.<String>emptySet()).atLeastOnce();
- replay(repoXml);
- Assert.assertEquals(false, check.isApplicable(request, allServicesList, false));
+ // ok, so now change the check to match against SERVICE1
+ check.setApplicableServices(Sets.newHashSet("SERVICE1"));
+ Assert.assertTrue(check.isApplicable(request));
}
/**
@@ -284,4 +217,90 @@ public class AbstractCheckDescriptorTest {
Assert.assertTrue(requiredCheck.isRequired(UpgradeType.HOST_ORDERED));
}
-}
+ @UpgradeCheck(
+ group = UpgradeCheckGroup.DEFAULT,
+ order = 1.0f,
+ required = { UpgradeType.ROLLING, UpgradeType.NON_ROLLING, UpgradeType.HOST_ORDERED })
+ private class TestCheckImpl extends AbstractCheckDescriptor {
+ private PrereqCheckType m_type;
+ private Set<String> m_applicableServices = Sets.newHashSet();
+
+ TestCheckImpl(PrereqCheckType type) {
+ super(null);
+ m_type = type;
+
+ clustersProvider = new Provider<Clusters>() {
+ @Override
+ public Clusters get() {
+ return clusters;
+ }
+ };
+ }
+
+ @Override
+ public PrereqCheckType getType() {
+ return m_type;
+ }
+
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getApplicableServices() {
+ return m_applicableServices;
+ }
+
+ void setApplicableServices(Set<String> applicableServices) {
+ m_applicableServices = applicableServices;
+ }
+ }
+
+ @UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f, required = { UpgradeType.ROLLING })
+ private class RollingTestCheckImpl extends AbstractCheckDescriptor {
+ private PrereqCheckType m_type;
+
+ RollingTestCheckImpl(PrereqCheckType type) {
+ super(null);
+ m_type = type;
+
+ clustersProvider = new Provider<Clusters>() {
+ @Override
+ public Clusters get() {
+ return clusters;
+ }
+ };
+ }
+
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
+ }
+ }
+
+ @UpgradeCheck(group = UpgradeCheckGroup.DEFAULT, order = 1.0f)
+ private class NotRequiredCheckTest extends AbstractCheckDescriptor {
+ private PrereqCheckType m_type;
+
+ NotRequiredCheckTest(PrereqCheckType type) {
+ super(null);
+ m_type = type;
+
+ clustersProvider = new Provider<Clusters>() {
+ @Override
+ public Clusters get() {
+ return clusters;
+ }
+ };
+ }
+
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request)
+ throws AmbariException {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
index 46a00b8..ecc3165 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
@@ -22,7 +22,6 @@ import java.util.Map;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.PrereqCheckRequest;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -30,32 +29,45 @@ import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/**
* Tests for {@link ClientRetryPropertyCheckTest}
*/
+@RunWith(MockitoJUnitRunner.class)
public class ClientRetryPropertyCheckTest {
private final Clusters m_clusters = Mockito.mock(Clusters.class);
private final ClientRetryPropertyCheck m_check = new ClientRetryPropertyCheck();
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
- private final RepositoryVersionDAO repositoryVersionDAO = Mockito.mock(
- RepositoryVersionDAO.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
m_check.clustersProvider = new Provider<Clusters>() {
@Override
@@ -68,6 +80,11 @@ public class ClientRetryPropertyCheckTest {
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.3.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3"));
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
/**
@@ -79,8 +96,7 @@ public class ClientRetryPropertyCheckTest {
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster);
- Map<String, Service> services = new HashMap<>();
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
request.setTargetRepositoryVersion(m_repositoryVersion);
@@ -88,23 +104,13 @@ public class ClientRetryPropertyCheckTest {
// nothing installed
Assert.assertFalse(m_check.isApplicable(request));
- m_check.repositoryVersionDaoProvider = new Provider<RepositoryVersionDAO>() {
- @Override
- public RepositoryVersionDAO get() {
- return repositoryVersionDAO;
- }
- };
-
- Mockito.when(repositoryVersionDAO.findByStackNameAndVersion(Mockito.anyString(),
- Mockito.anyString())).thenReturn(m_repositoryVersion);
-
// HDFS installed
- services.put("HDFS", Mockito.mock(Service.class));
+ m_services.put("HDFS", Mockito.mock(Service.class));
Assert.assertTrue(m_check.isApplicable(request));
// OOZIE installed
- services.clear();
- services.put("OOZIE", Mockito.mock(Service.class));
+ m_services.clear();
+ m_services.put("OOZIE", Mockito.mock(Service.class));
Assert.assertTrue(m_check.isApplicable(request));
}
@@ -182,4 +188,4 @@ public class ClientRetryPropertyCheckTest {
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
new file mode 100644
index 0000000..ede1daa
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
@@ -0,0 +1,352 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.checks;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.expect;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.server.StackAccessException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
+import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.commons.lang.StringUtils;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.inject.Provider;
+
+/**
+ * Tests for {@link ComponentsExistInRepoCheck}
+ */
+public class ComponentExistsInRepoCheckTest extends EasyMockSupport {
+
+ private final ComponentsExistInRepoCheck m_check = new ComponentsExistInRepoCheck();
+
+ @Mock
+ private Clusters m_clusters;
+
+ @Mock
+ private Cluster m_cluster;
+
+ // pick two stacks which have different services
+ private final StackId SOURCE_STACK = new StackId("HDP", "0.1");
+ private final StackId TARGET_STACK = new StackId("HDP", "2.2.0");
+
+ private final Map<String, Service> CLUSTER_SERVICES = new HashMap<>();
+ private final Map<String, ServiceComponent> FOO_SERVICE_COMPONENTS = new HashMap<>();
+ private final Map<String, ServiceComponent> ZK_SERVICE_COMPONENTS = new HashMap<>();
+
+ @Mock
+ private AmbariMetaInfo m_ambariMetaInfo;
+
+ @Mock
+ private Service m_fooService;
+
+ @Mock
+ private Service m_zookeeperService;
+
+ @Mock
+ private ServiceInfo m_fooInfo;
+
+ @Mock
+ private ServiceInfo m_zookeeperInfo;
+
+ @Mock
+ private ComponentInfo m_fooComponentInfo;
+
+ @Mock
+ private ComponentInfo m_zookeeperServerInfo;
+
+ @Mock
+ private ServiceComponent m_fooComponent;
+
+ @Mock
+ private ServiceComponent m_zookeeperServer;
+
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ @Before
+ public void before() throws Exception {
+
+ EasyMockSupport.injectMocks(this);
+
+ m_check.clustersProvider = new Provider<Clusters>() {
+ @Override
+ public Clusters get() {
+ return m_clusters;
+ }
+ };
+
+ m_check.ambariMetaInfo = new Provider<AmbariMetaInfo>() {
+ @Override
+ public AmbariMetaInfo get() {
+ return m_ambariMetaInfo;
+ }
+ };
+
+ expect(m_cluster.getServices()).andReturn(CLUSTER_SERVICES).atLeastOnce();
+ expect(m_cluster.getService("ZOOKEEPER")).andReturn(m_zookeeperService).anyTimes();
+ expect(m_cluster.getService("FOO_SERVICE")).andReturn(m_fooService).anyTimes();
+
+ expect(m_clusters.getCluster((String) anyObject())).andReturn(m_cluster).anyTimes();
+
+ ZK_SERVICE_COMPONENTS.put("ZOOKEEPER_SERVER", m_zookeeperServer);
+ FOO_SERVICE_COMPONENTS.put("FOO_COMPONENT", m_fooComponent);
+
+ expect(m_zookeeperService.getServiceComponents()).andReturn(ZK_SERVICE_COMPONENTS).anyTimes();
+ expect(m_fooService.getServiceComponents()).andReturn(FOO_SERVICE_COMPONENTS).anyTimes();
+
+ expect(m_zookeeperInfo.getComponentByName("ZOOKEEPER_SERVER")).andReturn(
+ m_zookeeperServerInfo).anyTimes();
+
+ expect(m_fooInfo.getComponentByName("FOO_COMPONENT")).andReturn(m_fooComponentInfo).anyTimes();
+
+ expect(m_ambariMetaInfo.getService(TARGET_STACK.getStackName(), TARGET_STACK.getStackVersion(),
+ "ZOOKEEPER")).andReturn(m_zookeeperInfo).anyTimes();
+
+ expect(m_ambariMetaInfo.getComponent(TARGET_STACK.getStackName(),
+ TARGET_STACK.getStackVersion(), "ZOOKEEPER", "ZOOKEEPER_SERVER")).andReturn(
+ m_zookeeperServerInfo).anyTimes();
+
+ expect(m_repositoryVersion.getStackId()).andReturn(TARGET_STACK).anyTimes();
+ expect(m_repositoryVersion.getVersion()).andReturn("2.2.0").anyTimes();
+
+ expect(m_repositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).anyTimes();
+ expect(m_vdfXml.getClusterSummary(anyObject(Cluster.class))).andReturn(m_clusterVersionSummary).anyTimes();
+ expect(m_clusterVersionSummary.getAvailableServiceNames()).andReturn(CLUSTER_SERVICES.keySet()).anyTimes();
+
+ }
+
+ /**
+ * Tests that the check passes when services and components exist.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckPassesWhenServicAndComponentsExist() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("ZOOKEEPER", m_zookeeperService);
+ expect(m_zookeeperInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperInfo.isDeleted()).andReturn(false).atLeastOnce();
+ expect(m_zookeeperServerInfo.isVersionAdvertised()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperServerInfo.isDeleted()).andReturn(false).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
+ Assert.assertTrue(StringUtils.isBlank(check.getFailReason()));
+ }
+
+ /**
+ * Tests that the check passes when a service doesn't exist but isn't
+ * advertising its version.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckPassesWhenComponentNotAdvertisingVersion() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("FOO_SERVICE", m_fooService);
+
+ expect(m_ambariMetaInfo.getService(TARGET_STACK.getStackName(), TARGET_STACK.getStackVersion(),
+ "FOO_SERVICE")).andReturn(m_fooInfo).anyTimes();
+
+ expect(m_ambariMetaInfo.getComponent(TARGET_STACK.getStackName(),
+ TARGET_STACK.getStackVersion(), "FOO_SERVICE", "FOO_COMPONENT")).andReturn(
+ m_fooComponentInfo).atLeastOnce();
+
+ expect(m_fooInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_fooInfo.isDeleted()).andReturn(false).atLeastOnce();
+ expect(m_fooComponentInfo.isVersionAdvertised()).andReturn(false).atLeastOnce();
+ expect(m_fooComponentInfo.isDeleted()).andReturn(true).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
+ Assert.assertTrue(StringUtils.isBlank(check.getFailReason()));
+ }
+
+ /**
+ * Tests that the check fails when the service exists but was deleted.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckFailsWhenServiceExistsButIsDeleted() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("ZOOKEEPER", m_zookeeperService);
+ expect(m_zookeeperInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperInfo.isDeleted()).andReturn(true).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+ Assert.assertTrue(check.getFailedOn().contains("ZOOKEEPER"));
+ }
+
+ /**
+ * Tests that the check fails when the component exists but what deleted.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckFailsWhenComponentExistsButIsDeleted() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("ZOOKEEPER", m_zookeeperService);
+ expect(m_zookeeperInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperInfo.isDeleted()).andReturn(false).atLeastOnce();
+ expect(m_zookeeperServerInfo.isVersionAdvertised()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperServerInfo.isDeleted()).andReturn(true).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+ Assert.assertTrue(check.getFailedOn().contains("ZOOKEEPER_SERVER"));
+ }
+
+ /**
+ * Tests that the check fails when the component exists but what deleted.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckFailsWhenServiceIsMissing() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(
+ CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("ZOOKEEPER", m_zookeeperService);
+ CLUSTER_SERVICES.put("FOO_SERVICE", m_fooService);
+
+ expect(m_ambariMetaInfo.getService(TARGET_STACK.getStackName(), TARGET_STACK.getStackVersion(),
+ "FOO_SERVICE")).andThrow(new StackAccessException(""));
+
+ expect(m_zookeeperInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperInfo.isDeleted()).andReturn(false).atLeastOnce();
+ expect(m_zookeeperServerInfo.isVersionAdvertised()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperServerInfo.isDeleted()).andReturn(false).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+ Assert.assertTrue(check.getFailedOn().contains("FOO_SERVICE"));
+ }
+
+ /**
+ * Tests that the check fails when the component exists but what deleted.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCheckFailsWhenComponentIsMissing() throws Exception {
+ PrerequisiteCheck check = new PrerequisiteCheck(
+ CheckDescription.COMPONENTS_EXIST_IN_TARGET_REPO, "c1");
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setSourceStackId(SOURCE_STACK);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ CLUSTER_SERVICES.put("FOO_SERVICE", m_fooService);
+
+ expect(m_ambariMetaInfo.getService(TARGET_STACK.getStackName(), TARGET_STACK.getStackVersion(),
+ "FOO_SERVICE")).andReturn(m_fooInfo).anyTimes();
+
+ expect(m_ambariMetaInfo.getComponent(TARGET_STACK.getStackName(),
+ TARGET_STACK.getStackVersion(), "FOO_SERVICE", "FOO_COMPONENT")).andThrow(
+ new StackAccessException(""));
+
+ expect(m_zookeeperInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperInfo.isDeleted()).andReturn(false).atLeastOnce();
+ expect(m_zookeeperServerInfo.isVersionAdvertised()).andReturn(true).atLeastOnce();
+ expect(m_zookeeperServerInfo.isDeleted()).andReturn(false).atLeastOnce();
+
+ expect(m_fooInfo.isValid()).andReturn(true).atLeastOnce();
+ expect(m_fooInfo.isDeleted()).andReturn(false).atLeastOnce();
+
+ replayAll();
+
+ Assert.assertTrue(m_check.isApplicable(request));
+
+ m_check.perform(check, request);
+
+ Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+ Assert.assertTrue(check.getFailedOn().contains("FOO_COMPONENT"));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
index ef833b0..4ae33f8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
@@ -37,13 +37,17 @@ import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
@@ -63,15 +67,30 @@ public class ComponentsInstallationCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private AmbariMetaInfo ambariMetaInfo = Mockito.mock(AmbariMetaInfo.class);
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ m_services.clear();
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
@@ -118,10 +137,9 @@ public class ComponentsInstallationCheckTest {
Mockito.when(tezService.getMaintenanceState()).thenReturn(MaintenanceState.OFF);
Mockito.when(amsService.getMaintenanceState()).thenReturn(MaintenanceState.OFF);
- HashMap<String, Service> clusterServices = new HashMap<>();
- clusterServices.put("HDFS", hdfsService);
- clusterServices.put("TEZ", tezService);
- clusterServices.put("AMBARI_METRICS", amsService);
+ m_services.put("HDFS", hdfsService);
+ m_services.put("TEZ", tezService);
+ m_services.put("AMBARI_METRICS", amsService);
Mockito.when(hdfsService.getName()).thenReturn("HDFS");
Mockito.when(tezService.getName()).thenReturn("TEZ");
@@ -131,7 +149,11 @@ public class ComponentsInstallationCheckTest {
Mockito.when(tezService.isClientOnlyService()).thenReturn(true);
Mockito.when(amsService.isClientOnlyService()).thenReturn(false);
- Mockito.when(cluster.getServices()).thenReturn(clusterServices);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
+
+ Mockito.when(cluster.getService("HDFS")).thenReturn(hdfsService);
+ Mockito.when(cluster.getService("TEZ")).thenReturn(tezService);
+ Mockito.when(cluster.getService("AMBARI_METRICS")).thenReturn(amsService);
Mockito.when(ambariMetaInfo.getComponent(Mockito.anyString(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString())).thenAnswer(new Answer<ComponentInfo>() {
@@ -260,22 +282,26 @@ public class ComponentsInstallationCheckTest {
Mockito.when(hcs.getDesiredState()).thenReturn(State.INSTALLED);
Mockito.when(hcs.getCurrentState()).thenReturn(State.STARTED);
}
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
Mockito.when(hcsTezClient.getCurrentState()).thenReturn(State.INSTALLED);
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
- componentsInstallationCheck.perform(check, new PrereqCheckRequest("cluster"));
+ componentsInstallationCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 2. Ensure that AMS is ignored even if their current state is not INSTALLED
Mockito.when(hcsMetricsCollector.getCurrentState()).thenReturn(State.INSTALL_FAILED);
Mockito.when(hcsMetricsMonitor.getCurrentState()).thenReturn(State.INSTALL_FAILED);
check = new PrerequisiteCheck(null, null);
- componentsInstallationCheck.perform(check, new PrereqCheckRequest("cluster"));
+ componentsInstallationCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 3: Change TEZ client state to INSTALL_FAILED, should fail
Mockito.when(hcsTezClient.getCurrentState()).thenReturn(State.INSTALL_FAILED);
check = new PrerequisiteCheck(null, null);
- componentsInstallationCheck.perform(check, new PrereqCheckRequest("cluster"));
+ componentsInstallationCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
Assert.assertTrue(check.getFailReason().indexOf("Service components in INSTALL_FAILED state") > -1);
@@ -283,7 +309,7 @@ public class ComponentsInstallationCheckTest {
Mockito.when(tezService.getMaintenanceState()).thenReturn(MaintenanceState.ON);
Mockito.when(hcsTezClient.getCurrentState()).thenReturn(State.INSTALL_FAILED);
check = new PrerequisiteCheck(null, null);
- componentsInstallationCheck.perform(check, new PrereqCheckRequest("cluster"));
+ componentsInstallationCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
// Case 5: Change TEZ client state to INSTALL_FAILED and place host2 in Maintenance mode, should succeed
@@ -291,7 +317,7 @@ public class ComponentsInstallationCheckTest {
Mockito.when(host2.getMaintenanceState(1L)).thenReturn(MaintenanceState.ON);
Mockito.when(hcsTezClient.getCurrentState()).thenReturn(State.INSTALL_FAILED);
check = new PrerequisiteCheck(null, null);
- componentsInstallationCheck.perform(check, new PrereqCheckRequest("cluster"));
+ componentsInstallationCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
index 14fab7c..606d4b7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java
@@ -52,7 +52,7 @@ public class HiveDynamicServiceDiscoveryCheckTest {
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
m_check.clustersProvider = new Provider<Clusters>() {
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
index 7a6748b..3dfe2f8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
@@ -31,31 +31,46 @@ import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/**
* Tests {@link HiveMultipleMetastoreCheck}
*/
+@RunWith(MockitoJUnitRunner.class)
public class HiveMultipleMetastoreCheckTest {
private final Clusters m_clusters = Mockito.mock(Clusters.class);
private final HiveMultipleMetastoreCheck m_check = new HiveMultipleMetastoreCheck();
private final RepositoryVersionDAO repositoryVersionDAO = Mockito.mock(
RepositoryVersionDAO.class);
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
m_check.clustersProvider = new Provider<Clusters>() {
@Override
@@ -68,6 +83,11 @@ public class HiveMultipleMetastoreCheckTest {
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
/**
@@ -81,10 +101,9 @@ public class HiveMultipleMetastoreCheckTest {
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster);
- Map<String, Service> services = new HashMap<>();
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
- services.put("HDFS", Mockito.mock(Service.class));
+ m_services.put("HDFS", Mockito.mock(Service.class));
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
request.setTargetRepositoryVersion(m_repositoryVersion);
@@ -93,7 +112,7 @@ public class HiveMultipleMetastoreCheckTest {
Assert.assertFalse(m_check.isApplicable(request));
// install HIVE
- services.put("HIVE", Mockito.mock(Service.class));
+ m_services.put("HIVE", Mockito.mock(Service.class));
m_check.repositoryVersionDaoProvider = new Provider<RepositoryVersionDAO>() {
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
index 665d6ec..3b0c900 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
@@ -21,28 +21,57 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/**
* Tests {@link HiveNotRollingWarning}.
*/
+@RunWith(MockitoJUnitRunner.class)
public class HiveNotRollingWarningTest extends EasyMockSupport {
private final String m_clusterName = "c1";
private final Clusters m_clusters = niceMock(Clusters.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
+ }
+
+
/**
* @throws Exception
*/
@@ -60,18 +89,18 @@ public class HiveNotRollingWarningTest extends EasyMockSupport {
final Cluster cluster = niceMock(Cluster.class);
final Service hive = niceMock(Service.class);
- final Map<String, Service> services = new HashMap<>();
- services.put("HIVE", hive);
+ m_services.put("HIVE", hive);
EasyMock.expect(cluster.getClusterId()).andReturn(1L).anyTimes();
EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(new StackId("HDP", "2.3")).anyTimes();
- EasyMock.expect(cluster.getServices()).andReturn(services).atLeastOnce();
+ EasyMock.expect(cluster.getServices()).andReturn(m_services).anyTimes();
EasyMock.expect(m_clusters.getCluster(m_clusterName)).andReturn(cluster).atLeastOnce();
PrereqCheckRequest request = niceMock(PrereqCheckRequest.class);
- EasyMock.expect(request.getClusterName()).andReturn(m_clusterName);
- EasyMock.expect(request.getUpgradeType()).andReturn(UpgradeType.ROLLING);
+ EasyMock.expect(request.getClusterName()).andReturn(m_clusterName).anyTimes();
+ EasyMock.expect(request.getUpgradeType()).andReturn(UpgradeType.ROLLING).anyTimes();
+ EasyMock.expect(request.getTargetRepositoryVersion()).andReturn(m_repositoryVersion).atLeastOnce();
replayAll();
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
index a15f9c1..daf2e4c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
@@ -52,7 +52,7 @@ public class HostsHeartbeatCheckTest {
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
index 6399166..0cc3e73 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
@@ -30,6 +30,8 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack;
@@ -37,8 +39,12 @@ import org.apache.ambari.server.state.stack.UpgradePack.ProcessingComponent;
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -46,22 +52,39 @@ import com.google.inject.Provider;
* Unit tests for HostsMasterMaintenanceCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class HostsMasterMaintenanceCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final RepositoryVersionDAO repositoryVersionDAO = Mockito.mock(RepositoryVersionDAO.class);
private final RepositoryVersionHelper repositoryVersionHelper = Mockito.mock(RepositoryVersionHelper.class);
private final AmbariMetaInfo ambariMetaInfo = Mockito.mock(AmbariMetaInfo.class);
- final RepositoryVersionEntity repositoryVersion = Mockito.mock(
- RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
+ }
@Test
public void testIsApplicable() throws Exception {
- Mockito.when(repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
final PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setTargetRepositoryVersion(repositoryVersion);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
HostsMasterMaintenanceCheck hmmc = new HostsMasterMaintenanceCheck();
Configuration config = Mockito.mock(Configuration.class);
hmmc.config = config;
@@ -71,19 +94,13 @@ public class HostsMasterMaintenanceCheckTest {
HostsMasterMaintenanceCheck hmmc2 = new HostsMasterMaintenanceCheck();
hmmc2.config = config;
Assert.assertTrue(hmmc2.isApplicable(request));
- request.setTargetRepositoryVersion(repositoryVersion);
-
- // reset the mock
- Mockito.reset(repositoryVersion);
-
- hmmc2.config = config;
- Assert.assertFalse(hmmc2.isApplicable(request));
+ request.setTargetRepositoryVersion(m_repositoryVersion);
}
@Test
public void testPerform() throws Exception {
- Mockito.when(repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
final String upgradePackName = "upgrade_pack";
final HostsMasterMaintenanceCheck hostsMasterMaintenanceCheck = new HostsMasterMaintenanceCheck();
@@ -120,21 +137,22 @@ public class HostsMasterMaintenanceCheckTest {
Mockito.when(repositoryVersionHelper.getUpgradePackageName(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), (UpgradeType) Mockito.anyObject())).thenReturn(null);
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
- PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-1.0"));
- request.setTargetRepositoryVersion(repositoryVersion);
- hostsMasterMaintenanceCheck.perform(check, request);
+ PrereqCheckRequest checkRequest = new PrereqCheckRequest("cluster");
+ checkRequest.setSourceStackId(new StackId("HDP-1.0"));
+ checkRequest.setTargetRepositoryVersion(m_repositoryVersion);
+
+ hostsMasterMaintenanceCheck.perform(check, checkRequest);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
Mockito.when(repositoryVersionHelper.getUpgradePackageName(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), (UpgradeType) Mockito.anyObject())).thenReturn(upgradePackName);
Mockito.when(ambariMetaInfo.getUpgradePacks(Mockito.anyString(), Mockito.anyString())).thenReturn(new HashMap<String, UpgradePack>());
check = new PrerequisiteCheck(null, null);
- request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-1.0"));
- request.setTargetRepositoryVersion(repositoryVersion);
+ checkRequest = new PrereqCheckRequest("cluster");
+ checkRequest.setSourceStackId(new StackId("HDP-1.0"));
+ checkRequest.setTargetRepositoryVersion(m_repositoryVersion);
- hostsMasterMaintenanceCheck.perform(check, request);
+ hostsMasterMaintenanceCheck.perform(check, checkRequest);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
final Map<String, UpgradePack> upgradePacks = new HashMap<>();
@@ -147,11 +165,11 @@ public class HostsMasterMaintenanceCheckTest {
Mockito.when(clusters.getHostsForCluster(Mockito.anyString())).thenReturn(new HashMap<String, Host>());
check = new PrerequisiteCheck(null, null);
- request = new PrereqCheckRequest("cluster");
- request.setSourceStackId(new StackId("HDP-1.0"));
- request.setTargetRepositoryVersion(repositoryVersion);
+ checkRequest = new PrereqCheckRequest("cluster");
+ checkRequest.setSourceStackId(new StackId("HDP-1.0"));
+ checkRequest.setTargetRepositoryVersion(m_repositoryVersion);
- hostsMasterMaintenanceCheck.perform(check, request);
+ hostsMasterMaintenanceCheck.perform(check, checkRequest);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
index 67e8dfa..5539618 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
@@ -17,7 +17,6 @@
*/
package org.apache.ambari.server.checks;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -33,13 +32,19 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.MaintenanceState;
import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
@@ -47,23 +52,38 @@ import com.google.inject.Provider;
* Unit tests for HostsRepositoryVersionCheck
*
*/
+@RunWith(MockitoJUnitRunner.class)
public class HostsRepositoryVersionCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final HostVersionDAO hostVersionDAO = Mockito.mock(HostVersionDAO.class);
private final RepositoryVersionDAO repositoryVersionDAO = Mockito.mock(RepositoryVersionDAO.class);
- final RepositoryVersionEntity repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
@Before
- public void setup() {
- Mockito.when(repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
- Mockito.when(repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
+ public void setup() throws Exception {
+ m_services.clear();
+
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
+ Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setTargetRepositoryVersion(repositoryVersion);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
HostsRepositoryVersionCheck hrvc = new HostsRepositoryVersionCheck();
Configuration config = Mockito.mock(Configuration.class);
hrvc.config = config;
@@ -72,13 +92,6 @@ public class HostsRepositoryVersionCheckTest {
HostsRepositoryVersionCheck hrvc2 = new HostsRepositoryVersionCheck();
hrvc2.config = config;
Assert.assertTrue(hrvc2.isApplicable(request));
-
- Mockito.reset(repositoryVersion);
- request.setTargetRepositoryVersion(repositoryVersion);
-
- HostsMasterMaintenanceCheck hmmc2 = new HostsMasterMaintenanceCheck();
- hmmc2.config = config;
- Assert.assertFalse(hmmc2.isApplicable(request));
}
@Test
@@ -131,7 +144,7 @@ public class HostsRepositoryVersionCheckTest {
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
PrereqCheckRequest checkRequest = new PrereqCheckRequest("cluster");
- checkRequest.setTargetRepositoryVersion(repositoryVersion);
+ checkRequest.setTargetRepositoryVersion(m_repositoryVersion);
hostsRepositoryVersionCheck.perform(check, checkRequest);
Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
@@ -201,22 +214,29 @@ public class HostsRepositoryVersionCheckTest {
Mockito.when(host1.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
Mockito.when(host2.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
Mockito.when(host3.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
+
+ Mockito.when(host1.getHostName()).thenReturn("host1");
+ Mockito.when(host2.getHostName()).thenReturn("host2");
+ Mockito.when(host3.getHostName()).thenReturn("host3");
+
hosts.put("host1", host1);
hosts.put("host2", host2);
hosts.put("host3", host3);
Mockito.when(clusters.getHostsForCluster("cluster")).thenReturn(hosts);
HostVersionEntity hve = new HostVersionEntity();
- hve.setRepositoryVersion(repositoryVersion);
+ hve.setRepositoryVersion(m_repositoryVersion);
hve.setState(RepositoryVersionState.INSTALLED);
- Mockito.when(
- hostVersionDAO.findByHost(Mockito.anyString())).thenReturn(
- Collections.singletonList(hve));
+ for (String hostName : hosts.keySet()) {
+ Mockito.when(hostVersionDAO.findByClusterStackVersionAndHost("cluster",
+ m_repositoryVersion.getStackId(), m_repositoryVersion.getVersion(), hostName)).thenReturn(
+ hve);
+ }
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setTargetRepositoryVersion(repositoryVersion);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
hostsRepositoryVersionCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
@@ -256,22 +276,30 @@ public class HostsRepositoryVersionCheckTest {
Mockito.when(host1.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
Mockito.when(host2.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
Mockito.when(host3.getMaintenanceState(1L)).thenReturn(MaintenanceState.OFF);
+
+ Mockito.when(host1.getHostName()).thenReturn("host1");
+ Mockito.when(host2.getHostName()).thenReturn("host2");
+ Mockito.when(host3.getHostName()).thenReturn("host3");
+
hosts.put("host1", host1);
hosts.put("host2", host2);
hosts.put("host3", host3);
Mockito.when(clusters.getHostsForCluster("cluster")).thenReturn(hosts);
HostVersionEntity hve = new HostVersionEntity();
- hve.setRepositoryVersion(repositoryVersion);
+ hve.setRepositoryVersion(m_repositoryVersion);
hve.setState(RepositoryVersionState.NOT_REQUIRED);
- Mockito.when(
- hostVersionDAO.findByHost(Mockito.anyString())).thenReturn(
- Collections.singletonList(hve));
+ for (String hostName : hosts.keySet()) {
+ Mockito.when(hostVersionDAO.findByClusterStackVersionAndHost("cluster",
+ m_repositoryVersion.getStackId(), m_repositoryVersion.getVersion(), hostName)).thenReturn(
+ hve);
+ }
PrerequisiteCheck check = new PrerequisiteCheck(null, null);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
- request.setTargetRepositoryVersion(repositoryVersion);
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
hostsRepositoryVersionCheck.perform(check, request);
Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
index 9d623ec..cdfbb0a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
@@ -72,7 +72,7 @@ public class InstallPackagesCheckTest {
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
Mockito.when(m_repositoryVersion.getVersion()).thenReturn(repositoryVersion);
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(targetStackId);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
index 41962f9..9a95c42 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
@@ -21,26 +21,44 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
+@RunWith(MockitoJUnitRunner.class)
public class KafkaKerberosCheckTest {
private final Clusters clusters = Mockito.mock(Clusters.class);
private final KafkaKerberosCheck kafkaKerberosCheck = new KafkaKerberosCheck();
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
kafkaKerberosCheck.clustersProvider = new Provider<Clusters>() {
@Override
@@ -48,24 +66,31 @@ public class KafkaKerberosCheckTest {
return clusters;
}
};
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
@Test
public void testIsApplicable() throws Exception {
final Cluster cluster = Mockito.mock(Cluster.class);
- final Map<String, Service> services = new HashMap<>();
final Service service = Mockito.mock(Service.class);
- services.put("KAFKA", service);
+ m_services.put("KAFKA", service);
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
- Assert.assertTrue(kafkaKerberosCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Assert.assertTrue(kafkaKerberosCheck.isApplicable(request));
- services.remove("KAFKA");
- Assert.assertFalse(kafkaKerberosCheck.isApplicable(new PrereqCheckRequest("cluster")));
+ m_services.remove("KAFKA");
+ Assert.assertFalse(kafkaKerberosCheck.isApplicable(request));
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/108ad9b4/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
index 32ecc26..096781c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
@@ -31,31 +31,46 @@ import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.RepositoryType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
import com.google.inject.Provider;
/**
* Tests for {@link org.apache.ambari.server.checks.MapReduce2JobHistoryStatePreservingCheckTest}
*/
+@RunWith(MockitoJUnitRunner.class)
public class MapReduce2JobHistoryStatePreservingCheckTest {
private final Clusters m_clusters = Mockito.mock(Clusters.class);
private final RepositoryVersionDAO m_repositoryVersionDao = Mockito.mock(RepositoryVersionDAO.class);
private final MapReduce2JobHistoryStatePreservingCheck m_check = new MapReduce2JobHistoryStatePreservingCheck();
- final RepositoryVersionEntity m_repositoryVersion = Mockito.mock(RepositoryVersionEntity.class);
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
/**
*
*/
@Before
- public void setup() {
+ public void setup() throws Exception {
m_check.clustersProvider = new Provider<Clusters>() {
@Override
@@ -80,6 +95,11 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.3.1.1-1234");
Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3"));
+
+ m_services.clear();
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
}
/**
@@ -92,8 +112,7 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster);
Mockito.when(cluster.getCurrentStackVersion()).thenReturn(new StackId("HDP-2.3"));
- Map<String, Service> services = new HashMap<>();
- Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
PrereqCheckRequest request = new PrereqCheckRequest("cluster");
request.setSourceStackId(new StackId("HDP", "2.3.0.0"));
@@ -103,7 +122,7 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
Assert.assertFalse(m_check.isApplicable(request));
// MAPREDUCE2 installed
- services.put("MAPREDUCE2", Mockito.mock(Service.class));
+ m_services.put("MAPREDUCE2", Mockito.mock(Service.class));
Assert.assertTrue(m_check.isApplicable(request));
}
@@ -157,11 +176,15 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
}
});
Mockito.when(cluster.getCurrentStackVersion()).thenReturn(new StackId("MYSTACK-12.2"));
- RepositoryVersionEntity repositoryVersionEntity = Mockito.mock(RepositoryVersionEntity.class);
Mockito.when(m_clusters.getCluster("c1")).thenReturn(cluster);
PrereqCheckRequest request = new PrereqCheckRequest("c1");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.0.0.1");
+
+ // MAPREDUCE2 installed
+ m_services.put("MAPREDUCE2", Mockito.mock(Service.class));
- Mockito.when(repositoryVersionEntity.getVersion()).thenReturn("2.0.0.1");
boolean isApplicable = m_check.isApplicable(request);
Assert.assertTrue(isApplicable);
}
[39/50] [abbrv] ambari git commit: AMBARI-21691 Config Group filter
does not reflect all the config groups in the list. (atkach)
Posted by ab...@apache.org.
AMBARI-21691 Config Group filter does not reflect all the config groups in the list. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c9ced876
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c9ced876
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c9ced876
Branch: refs/heads/branch-feature-logsearch-ui
Commit: c9ced876800a36ba09959370d17a228f31d1018d
Parents: 5442231
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Aug 9 16:16:08 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Aug 9 16:16:08 2017 +0300
----------------------------------------------------------------------
ambari-web/app/mixins/common/table_server_view_mixin.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c9ced876/ambari-web/app/mixins/common/table_server_view_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/table_server_view_mixin.js b/ambari-web/app/mixins/common/table_server_view_mixin.js
index a4e6db7..9695579 100644
--- a/ambari-web/app/mixins/common/table_server_view_mixin.js
+++ b/ambari-web/app/mixins/common/table_server_view_mixin.js
@@ -58,7 +58,7 @@ App.TableServerViewMixin = Em.Mixin.create({
return content.sort(function (a, b) {
return a.get('index') - b.get('index');
});
- }.property('filteredContent'),
+ }.property('filteredContent.length'),
/**
* compute applied filter and run content update from server
[38/50] [abbrv] ambari git commit: AMBARI-21642. Add hadoop LZO jars
if installed in the cluster for DRUID. (Slim Bouguerra via Swapan Shridhar)
Posted by ab...@apache.org.
AMBARI-21642. Add hadoop LZO jars if installed in the cluster for DRUID. (Slim Bouguerra via Swapan Shridhar)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5442231e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5442231e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5442231e
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 5442231e4e8e517f1e47f4c177cbe5799e8f96b8
Parents: ea2c432
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Tue Aug 8 16:14:31 2017 -0700
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Tue Aug 8 16:14:31 2017 -0700
----------------------------------------------------------------------
.../DRUID/0.9.2/package/scripts/druid.py | 6 ++++++
.../DRUID/0.9.2/package/scripts/params.py | 13 +++++++++++++
2 files changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5442231e/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
index cc02519..4e1ced1 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
@@ -113,6 +113,12 @@ def druid(upgrade_type=None, nodeType=None):
node_jvm_opts=druid_env_config[format('druid.{node_type_lowercase}.jvm.opts')])
)
Logger.info(format("Created druid-{node_type_lowercase} jvm.config"))
+ # Handling hadoop Lzo jars if enable and node type is hadoop related eg Overlords and MMs
+ if params.lzo_enabled and len(params.lzo_packages) > 0 and (
+ node_type == 'middleManager' or node_type == 'overlord'):
+ Logger.info(
+ format("Copying hadoop lzo jars from {hadoop_lib_home} to {hadoop_dependencies_dir}/hadoop-client/*/"))
+ Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {hadoop_dependencies_dir}/hadoop-client/*/'))
# All druid nodes have dependency on hdfs_client
ensure_hadoop_directories()
http://git-wip-us.apache.org/repos/asf/ambari/blob/5442231e/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
index d47e604..9e766cd 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from ambari_commons import OSCheck
+from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -26,6 +27,7 @@ from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import format
from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
from resource_management.libraries.functions.default import default
+from ambari_commons.constants import AMBARI_SUDO_BINARY
import status_params
@@ -50,10 +52,14 @@ stack_name = default("/hostLevelParams/stack_name", None)
# stack version
stack_version = default("/commandParams/version", None)
+# un-formatted stack version
+stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
+
# default role to coordinator needed for service checks
component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "DRUID_COORDINATOR")
hostname = config['hostname']
+sudo = AMBARI_SUDO_BINARY
# default druid parameters
druid_home = format("{stack_root}/current/{component_directory}")
@@ -230,3 +236,10 @@ if not len(druid_router_hosts) == 0:
druid_router_host = druid_router_hosts[0]
druid_coordinator_port = config['configurations']['druid-coordinator']['druid.port']
druid_router_port = config['configurations']['druid-router']['druid.port']
+
+# Create current Hadoop Clients Libs
+stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
+io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
+lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
+lzo_packages = get_lzo_packages(stack_version_unformatted)
+hadoop_lib_home = stack_root + '/' + stack_version + '/hadoop'
[08/50] [abbrv] ambari git commit: AMBARI-21497 Conflicts in the
ambari config groups. (atkach)
Posted by ab...@apache.org.
AMBARI-21497 Conflicts in the ambari config groups. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b17225df
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b17225df
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b17225df
Branch: refs/heads/branch-feature-logsearch-ui
Commit: b17225df413ee0f6e562769963df864c69a02821
Parents: 9e91639
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Aug 3 11:35:30 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Aug 3 11:35:30 2017 +0300
----------------------------------------------------------------------
.../app/mixins/common/configs/configs_saver.js | 12 ++++++++++-
.../mixins/common/configs/enhanced_configs.js | 13 +++++++++++-
.../mixins/common/configs/configs_saver_test.js | 21 ++++++++++++++++++++
.../common/configs/enhanced_configs_test.js | 13 +++++++++++-
4 files changed, 56 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b17225df/ambari-web/app/mixins/common/configs/configs_saver.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js
index 4a4163e..dafee79 100644
--- a/ambari-web/app/mixins/common/configs/configs_saver.js
+++ b/ambari-web/app/mixins/common/configs/configs_saver.js
@@ -135,7 +135,7 @@ App.ConfigsSaverMixin = Em.Mixin.create({
if (configGroup && !configGroup.get('isDefault')) {
var overriddenConfigs = this.getConfigsForGroup(configs, configGroup.get('name'));
- if (Em.isArray(overriddenConfigs)) {
+ if (Em.isArray(overriddenConfigs) && this.isOverriddenConfigsModified(overriddenConfigs)) {
var successCallback = this.get('content.serviceName') === serviceName ? 'putConfigGroupChangesSuccess' : null;
this.saveGroup(overriddenConfigs, configGroup, this.get('serviceConfigVersionNote'), successCallback);
}
@@ -143,6 +143,16 @@ App.ConfigsSaverMixin = Em.Mixin.create({
}, this);
},
+ /**
+ * @param {Array} overriddenConfigs
+ * @returns {boolean}
+ */
+ isOverriddenConfigsModified: function(overriddenConfigs) {
+ return overriddenConfigs.some(function(config) {
+ return config.get('savedValue') !== config.get('value');
+ });
+ },
+
saveConfigsForDefaultGroup: function() {
var data = [];
this.get('stepConfigs').forEach(function(stepConfig) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b17225df/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index a5af407..f870fc6 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -448,7 +448,7 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
var configForGroup = recommendations['config-groups'][0];
this.get('stepConfigs').forEach(function(stepConfig) {
var configGroup = this.getGroupForService(stepConfig.get('serviceName'));
- if (configGroup) {
+ if (configGroup && this.isConfigGroupAffected(configForGroup.hosts, configGroup.get('hosts'))) {
this.updateOverridesByRecommendations(configForGroup.configurations, stepConfig.get('configs'), changedConfigs, configGroup);
this.updateOverridesByRecommendations(configForGroup.dependent_configurations, stepConfig.get('configs'), changedConfigs, configGroup);
this.toggleProperty('forceUpdateBoundaries');
@@ -456,6 +456,17 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
}, this);
},
+
+ /**
+ * determine whether hosts of group affected by config modifications
+ * @param {Array} affectedHosts
+ * @param {Array} groupHosts
+ * @returns {boolean}
+ */
+ isConfigGroupAffected: function(affectedHosts, groupHosts) {
+ return _.intersection(affectedHosts, groupHosts).length > 0;
+ },
+
/**
* method to show popup with dependent configs
* @method showChangedDependentConfigs
http://git-wip-us.apache.org/repos/asf/ambari/blob/b17225df/ambari-web/test/mixins/common/configs/configs_saver_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/configs_saver_test.js b/ambari-web/test/mixins/common/configs/configs_saver_test.js
index 7815938..e8e03ea 100644
--- a/ambari-web/test/mixins/common/configs/configs_saver_test.js
+++ b/ambari-web/test/mixins/common/configs/configs_saver_test.js
@@ -408,12 +408,14 @@ describe('App.ConfigsSaverMixin', function() {
this.mockGroup = sinon.stub(mixin, 'getGroupFromModel');
this.mockConfigs = sinon.stub(mixin, 'getConfigsForGroup');
sinon.stub(mixin, 'saveGroup');
+ sinon.stub(mixin, 'isOverriddenConfigsModified').returns(true);
});
afterEach(function() {
this.mockGroup.restore();
this.mockConfigs.restore();
mixin.saveGroup.restore();
+ mixin.isOverriddenConfigsModified.restore();
});
it("configGroup is null", function() {
@@ -1190,5 +1192,24 @@ describe('App.ConfigsSaverMixin', function() {
});
});
+ describe('#isOverriddenConfigsModified', function() {
+ it('no configs modified', function() {
+ expect(mixin.isOverriddenConfigsModified([
+ Em.Object.create({
+ savedValue: '1',
+ value: '1'
+ })
+ ])).to.be.false;
+ });
+ it('one config modified', function() {
+ expect(mixin.isOverriddenConfigsModified([
+ Em.Object.create({
+ savedValue: '1',
+ value: '2'
+ })
+ ])).to.be.true;
+ });
+ });
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b17225df/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
index 999ed8c..98f3182 100644
--- a/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
+++ b/ambari-web/test/mixins/common/configs/enhanced_configs_test.js
@@ -1061,11 +1061,13 @@ describe('App.EnhancedConfigsMixin', function () {
this.mock = sinon.stub(mixin, 'getGroupForService');
sinon.stub(mixin, 'updateOverridesByRecommendations');
sinon.stub(mixin, 'toggleProperty');
+ sinon.stub(mixin, 'isConfigGroupAffected').returns(true);
mixin.set('stepConfigs', [Em.Object.create()]);
});
afterEach(function() {
this.mock.restore();
+ mixin.isConfigGroupAffected.restore();
mixin.updateOverridesByRecommendations.restore();
mixin.toggleProperty.restore();
});
@@ -1077,7 +1079,7 @@ describe('App.EnhancedConfigsMixin', function () {
});
it("updateOverridesByRecommendations should be called", function() {
- this.mock.returns({});
+ this.mock.returns(Em.Object.create());
mixin.saveConfigGroupsRecommendations({'config-groups': [{}]});
expect(mixin.updateOverridesByRecommendations.calledTwice).to.be.true;
expect(mixin.toggleProperty.calledWith('forceUpdateBoundaries')).to.be.true;
@@ -1456,5 +1458,14 @@ describe('App.EnhancedConfigsMixin', function () {
expect(mixin.filterRequiredChanges(recommendations)).to.be.eql(recommendations);
});
});
+
+ describe('#isConfigGroupAffected', function() {
+ it('groups have no shared hosts', function() {
+ expect(mixin.isConfigGroupAffected(['host1'], ['host2'])).to.be.false;
+ });
+ it('groups have shared hosts', function() {
+ expect(mixin.isConfigGroupAffected(['host1'], ['host2', 'host1'])).to.be.true;
+ });
+ });
});
[49/50] [abbrv] ambari git commit: AMBARI-21699 Log Search UI:
implement histogram for service logs. (ababiichuk)
Posted by ab...@apache.org.
AMBARI-21699 Log Search UI: implement histogram for service logs. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/af5f5d23
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/af5f5d23
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/af5f5d23
Branch: refs/heads/branch-feature-logsearch-ui
Commit: af5f5d23d29f97344cb44085d649a702d02f1882
Parents: 0256fb7
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Aug 10 13:22:25 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Aug 10 13:22:25 2017 +0300
----------------------------------------------------------------------
.../ambari-logsearch-web-new/package.json | 3 +
.../src/app/app.module.ts | 10 +-
...service-logs-histogram-query-params.class.ts | 33 ++
.../logs-container.component.html | 19 +
.../logs-container.component.less | 25 ++
.../logs-container.component.spec.ts | 84 ++++
.../logs-container/logs-container.component.ts | 160 +++++++
.../logs-list/logs-list.component.html | 10 +-
.../logs-list/logs-list.component.less | 176 ++++----
.../components/logs-list/logs-list.component.ts | 80 +---
.../main-container.component.html | 2 +-
.../time-histogram.component.html | 18 +
.../time-histogram.component.less | 29 ++
.../time-histogram.component.spec.ts | 53 +++
.../time-histogram/time-histogram.component.ts | 161 ++++++++
.../src/app/mock-data.ts | 22 +-
.../src/app/models/store.model.ts | 2 +-
.../src/app/services/filtering.service.ts | 82 ++--
.../src/app/services/http-client.service.ts | 5 +
.../app/services/storage/bar-graphs.service.ts | 32 --
.../app/services/storage/reducers.service.ts | 4 +-
.../service-logs-histogram-data.service.ts | 32 ++
.../services/storage/service-logs.service.ts | 1 -
.../ambari-logsearch-web-new/yarn.lock | 412 ++++++++++++++++++-
24 files changed, 1190 insertions(+), 265 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/package.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/package.json b/ambari-logsearch/ambari-logsearch-web-new/package.json
index 847787b..b4902a3 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/package.json
+++ b/ambari-logsearch/ambari-logsearch-web-new/package.json
@@ -27,6 +27,7 @@
"angular2-moment": "^1.4.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
+ "d3": "^4.10.0",
"font-awesome": "^4.7.0",
"jquery": "^1.12.4",
"moment": "^2.18.1",
@@ -38,7 +39,9 @@
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
+ "@types/d3": "^4.10.0",
"@types/jasmine": "2.5.38",
+ "@types/jquery": "^1.10.33",
"@types/moment": "^2.13.0",
"@types/moment-timezone": "^0.2.34",
"@types/node": "~6.0.60",
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts
index 503aa46..f81e75b 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/app.module.ts
@@ -38,7 +38,7 @@ import {AppSettingsService} from '@app/services/storage/app-settings.service';
import {AppStateService} from '@app/services/storage/app-state.service';
import {AuditLogsService} from '@app/services/storage/audit-logs.service';
import {ServiceLogsService} from '@app/services/storage/service-logs.service';
-import {BarGraphsService} from '@app/services/storage/bar-graphs.service';
+import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service';
import {GraphsService} from '@app/services/storage/graphs.service';
import {NodesService} from '@app/services/storage/nodes.service';
import {UserConfigsService} from '@app/services/storage/user-configs.service';
@@ -62,6 +62,8 @@ import {LogsListComponent} from '@app/components/logs-list/logs-list.component';
import {DropdownButtonComponent} from '@app/components/dropdown-button/dropdown-button.component';
import {PaginationComponent} from '@app/components/pagination/pagination.component';
import {PaginationControlsComponent} from '@app/components/pagination-controls/pagination-controls.component';
+import {TimeHistogramComponent} from '@app/components/time-histogram/time-histogram.component';
+import {LogsContainerComponent} from '@app/components/logs-container/logs-container.component';
export function HttpLoaderFactory(http: Http) {
// adding 'static' parameter to step over mock data request
@@ -99,7 +101,9 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
LogsListComponent,
DropdownButtonComponent,
PaginationComponent,
- PaginationControlsComponent
+ PaginationControlsComponent,
+ TimeHistogramComponent,
+ LogsContainerComponent
],
imports: [
BrowserModule,
@@ -127,7 +131,7 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
AppStateService,
AuditLogsService,
ServiceLogsService,
- BarGraphsService,
+ ServiceLogsHistogramDataService,
GraphsService,
NodesService,
UserConfigsService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/classes/queries/service-logs-histogram-query-params.class.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/classes/queries/service-logs-histogram-query-params.class.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/classes/queries/service-logs-histogram-query-params.class.ts
new file mode 100644
index 0000000..bbb520a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/classes/queries/service-logs-histogram-query-params.class.ts
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {QueryParams} from '@app/classes/queries/query-params.class';
+
+export const defaultParams = {
+ unit: '+1HOUR'
+};
+
+export class ServiceLogsHistogramQueryParams extends QueryParams {
+ constructor(options: ServiceLogsHistogramQueryParams) {
+ const finalParams = Object.assign({}, defaultParams, options);
+ super(finalParams);
+ }
+ from: string;
+ to: string;
+ unit?: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html
new file mode 100644
index 0000000..a7dabe8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.html
@@ -0,0 +1,19 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+-->
+
+<time-histogram class="col-md-12" [data]="histogramData" [customOptions]="histogramOptions"></time-histogram>
+<logs-list [logs]="logs | async" [totalCount]="totalCount"></logs-list>
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less
new file mode 100644
index 0000000..60082d6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.less
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+@import '../variables';
+
+:host {
+ display: block;
+ overflow: hidden;
+ padding-top: @block-margin-top;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts
new file mode 100644
index 0000000..7792fa9
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.spec.ts
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {StoreModule} from '@ngrx/store';
+import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
+import {ClustersService, clusters} from '@app/services/storage/clusters.service';
+import {ComponentsService, components} from '@app/services/storage/components.service';
+import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
+import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
+import {HttpClientService} from '@app/services/http-client.service';
+import {FilteringService} from '@app/services/filtering.service';
+import {UtilsService} from '@app/services/utils.service';
+
+import {LogsContainerComponent} from './logs-container.component';
+
+describe('LogsContainerComponent', () => {
+ const httpClient = {
+ get: () => {
+ return {
+ subscribe: () => {
+ }
+ };
+ }
+ };
+ let component: LogsContainerComponent;
+ let fixture: ComponentFixture<LogsContainerComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [LogsContainerComponent],
+ imports: [
+ StoreModule.provideStore({
+ appSettings,
+ clusters,
+ components,
+ serviceLogs,
+ serviceLogsHistogramData
+ })
+ ],
+ providers: [
+ {
+ provide: HttpClientService,
+ useValue: httpClient
+ },
+ AppSettingsService,
+ ClustersService,
+ ComponentsService,
+ ServiceLogsService,
+ ServiceLogsHistogramDataService,
+ FilteringService,
+ UtilsService
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(LogsContainerComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts
new file mode 100644
index 0000000..5823846
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-container/logs-container.component.ts
@@ -0,0 +1,160 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {Component, OnInit, Input} from '@angular/core';
+import {FormGroup} from '@angular/forms';
+import 'rxjs/add/operator/map';
+import {HttpClientService} from '@app/services/http-client.service';
+import {FilteringService} from '@app/services/filtering.service';
+import {ServiceLogsService} from '@app/services/storage/service-logs.service';
+import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service';
+
+@Component({
+ selector: 'logs-container',
+ templateUrl: './logs-container.component.html',
+ styleUrls: ['./logs-container.component.less']
+})
+export class LogsContainerComponent implements OnInit {
+
+ constructor(private httpClient: HttpClientService, private serviceLogsStorage: ServiceLogsService, private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private filtering: FilteringService) {
+ this.serviceLogsHistogramStorage.getAll().subscribe(data => {
+ let histogramData = {};
+ data.forEach(type => {
+ const name = type.name;
+ type.dataCount.forEach(entry => {
+ const timeStamp = new Date(entry.name).valueOf();
+ if (!histogramData[timeStamp]) {
+ let initialValue = {};
+ Object.keys(this.histogramOptions.keysWithColors).forEach(key => initialValue[key] = 0);
+ histogramData[timeStamp] = initialValue;
+ }
+ histogramData[timeStamp][name] = Number(entry.value);
+ });
+ });
+ this.histogramData = histogramData;
+ });
+ }
+
+ ngOnInit() {
+ this.loadLogs();
+ this.filtersForm.valueChanges.subscribe(() => {
+ this.loadLogs();
+ });
+ }
+
+ @Input()
+ private logsArrayId: string;
+
+ totalCount: number = 0;
+
+ private readonly listFilters = {
+ clusters: ['clusters'],
+ text: ['iMessage'],
+ timeRange: ['end_time', 'start_time'],
+ components: ['component_name'],
+ levels: ['level'],
+ sorting: ['sortType', 'sortBy'],
+ pageSize: ['pageSize'],
+ page: ['page']
+ };
+
+ private readonly histogramFilters = {
+ timeRange: ['to', 'from']
+ };
+
+ logs = this.serviceLogsStorage.getAll().map(logs => logs.map(log => {
+ return {
+ type: log.type,
+ level: log.level,
+ className: log.level.toLowerCase(),
+ message: log.log_message,
+ time: log.logtime
+ };
+ }));
+
+ histogramData: any;
+
+ readonly histogramOptions = {
+ keysWithColors: {
+ WARN: '#FF8916',
+ ERROR: '#E81D1D',
+ FATAL: '#830A0A',
+ INFO: '#2577B5',
+ DEBUG: '#65E8FF',
+ TRACE: '#888',
+ UNKNOWN: '#BDBDBD'
+ }
+ };
+
+ private get filtersForm(): FormGroup {
+ return this.filtering.filtersForm;
+ }
+
+ private loadLogs(): void {
+ this.httpClient.get(this.logsArrayId, this.getParams('listFilters')).subscribe(response => {
+ const jsonResponse = response.json();
+ this.serviceLogsStorage.clear();
+ if (jsonResponse) {
+ const logs = jsonResponse.logList,
+ count = jsonResponse.totalCount || 0;
+ if (logs) {
+ this.serviceLogsStorage.addInstances(logs);
+ }
+ this.totalCount = count;
+ }
+ });
+ this.httpClient.get('serviceLogsHistogram', this.getParams('histogramFilters')).subscribe(response => {
+ const jsonResponse = response.json();
+ this.serviceLogsHistogramStorage.clear();
+ if (jsonResponse) {
+ const histogramData = jsonResponse.graphData;
+ if (histogramData) {
+ this.serviceLogsHistogramStorage.addInstances(histogramData);
+ }
+ }
+ });
+ }
+
+ private getParams(filtersMapName: string): any {
+ let params = {};
+ Object.keys(this[filtersMapName]).forEach(key => {
+ const inputValue = this.filtersForm.getRawValue()[key],
+ paramNames = this[filtersMapName][key];
+ paramNames.forEach(paramName => {
+ let value;
+ const valueGetter = this.filtering.valueGetters[paramName];
+ if (valueGetter) {
+ if (paramName === 'start_time') {
+ value = valueGetter(inputValue, params['end_time']);
+ } else if (paramName === 'from') {
+ value = valueGetter(inputValue, params['to']);
+ } else {
+ value = valueGetter(inputValue);
+ }
+ } else {
+ value = inputValue;
+ }
+ if (value != null && value !== '') {
+ params[paramName] = value;
+ }
+ });
+ }, this);
+ return params;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html
index 4c84b9c..e9b3c67 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.html
@@ -15,17 +15,17 @@
limitations under the License.
-->
-<form *ngIf="(logs | async).length" [formGroup]="filtersForm">
+<form *ngIf="logs.length" [formGroup]="filtersForm" class="pull-right">
<filter-dropdown [label]="filters.sorting.label" formControlName="sorting" [options]="filters.sorting.options"
[defaultLabel]="filters.sorting.defaultLabel" isRightAlign="true"></filter-dropdown>
</form>
-<div class="col-md-12 text-center" *ngIf="(logs | async).length">
+<div class="col-md-12 text-center" *ngIf="logs.length">
<div class="logs-header">
<div class="col-md-1">{{'logs.status' | translate}}</div>
<div class="col-md-11">{{'logs.details' | translate}}</div>
</div>
</div>
-<accordion-panel *ngFor="let log of logs | async; let i = index" [toggleId]="'details-' + i" class="col-md-12">
+<accordion-panel *ngFor="let log of logs; let i = index" [toggleId]="'details-' + i" class="col-md-12">
<ng-template>
<div [ngClass]="'hexagon ' + log.className"></div>
<div [ngClass]="'col-md-1 log-status ' + log.className">{{log.level}}</div>
@@ -43,5 +43,5 @@
</div>
</ng-template>
</accordion-panel>
-<pagination class="col-md-12" *ngIf="(logs | async).length" [totalCount]="totalCount" [filtersForm]="filtersForm"
- [filterInstance]="filters.pageSize" [currentCount]="(logs | async).length"></pagination>
+<pagination class="col-md-12" *ngIf="logs.length" [totalCount]="totalCount" [filtersForm]="filtersForm"
+ [filterInstance]="filters.pageSize" [currentCount]="logs.length"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less
index 76c16a5..63c0354 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.less
@@ -17,125 +17,119 @@
@import '../variables';
-:host {
- display: block;
+.logs-header {
+ // TODO get rid of magic numbers, base on actual design
+ margin: 10px 0;
+ padding: 5px 0;
+ background-color: @list-header-background-color; // TODO implement actual color
overflow: hidden;
- padding-top: @block-margin-top;
+ text-transform: uppercase;
+}
- .logs-header {
- // TODO get rid of magic numbers, base on actual design
- margin: 10px 0;
- padding: 5px 0;
- background-color: @list-header-background-color; // TODO implement actual color
- overflow: hidden;
- text-transform: uppercase;
- }
+/deep/ filter-dropdown {
+ justify-content: flex-end;
+}
+
+.hexagon {
+ // TODO get rid of magic numbers, base on actual design
+ left: -7.5px;
- /deep/ filter-dropdown {
- justify-content: flex-end;
+ &.fatal {
+ .common-hexagon(15px, @fatal-color);
}
- .hexagon {
- // TODO get rid of magic numbers, base on actual design
- left: -7.5px;
+ &.error {
+ .common-hexagon(15px, @error-color);
+ }
- &.fatal {
- .common-hexagon(15px, @fatal-color);
- }
+ &.warn {
+ .common-hexagon(15px, @warning-color);
+ }
- &.error {
- .common-hexagon(15px, @error-color);
- }
+ &.info {
+ .common-hexagon(15px, @info-color);
+ }
- &.warn {
- .common-hexagon(15px, @warning-color);
- }
+ &.debug {
+ .common-hexagon(15px, @debug-color);
+ }
- &.info {
- .common-hexagon(15px, @info-color);
- }
+ &.trace {
+ .common-hexagon(15px, @trace-color);
+ }
- &.debug {
- .common-hexagon(15px, @debug-color);
- }
+ &.unknown {
+ .common-hexagon(15px, @unknown-color);
+ }
+}
- &.trace {
- .common-hexagon(15px, @trace-color);
- }
+.log-status {
+ text-transform: uppercase;
- &.unknown {
- .common-hexagon(15px, @unknown-color);
- }
+ &.fatal {
+ color: @fatal-color;
}
- .log-status {
- text-transform: uppercase;
+ &.error {
+ color: @error-color;
+ }
- &.fatal {
- color: @fatal-color;
- }
+ &.warn {
+ color: @warning-color;
+ }
- &.error {
- color: @error-color;
- }
+ &.info {
+ color: @info-color;
+ }
- &.warn {
- color: @warning-color;
- }
+ &.debug {
+ color: @debug-color;
+ }
- &.info {
- color: @info-color;
- }
+ &.trace {
+ color: @trace-color;
+ }
- &.debug {
- color: @debug-color;
- }
+ &.unknown {
+ color: @unknown-color;
+ }
+}
- &.trace {
- color: @trace-color;
- }
+.log-type {
+ color: @link-color;
+}
- &.unknown {
- color: @unknown-color;
- }
- }
+.log-time {
+ color: @grey-color;
+}
- .log-type {
- color: @link-color;
- }
+.log-content-wrapper {
+ position: relative;
- .log-time {
- color: @grey-color;
+ // TODO get rid of magic numbers, base on actual design
+ .log-content {
+ overflow: hidden;
+ max-height: @default-line-height * 2em;
+ padding-right: 65px;
+ white-space: pre-wrap;
}
- .log-content-wrapper {
- position: relative;
+ .log-actions {
+ position: absolute;
+ right: 40px;
+ top: 0;
+ border: @input-border;
- // TODO get rid of magic numbers, base on actual design
- .log-content {
- overflow: hidden;
- max-height: @default-line-height * 2em;
- padding-right: 65px;
- white-space: pre-wrap;
+ &.collapsing + .log-content, &.collapse.in + .log-content {
+ min-height: 6em;
+ max-height: none;
+ overflow-x: auto;
}
- .log-actions {
- position: absolute;
- right: 40px;
- top: 0;
- border: @input-border;
-
- &.collapsing + .log-content, &.collapse.in + .log-content {
- min-height: 6em;
- max-height: none;
- overflow-x: auto;
- }
-
- .action-icon {
- .clickable-item;
- display: block;
- padding: 5px;
- }
+ .action-icon {
+ .clickable-item;
+ display: block;
+ padding: 5px;
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts
index 7427fc1..27b5021 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/logs-list/logs-list.component.ts
@@ -15,11 +15,9 @@
* limitations under the License.
*/
-import {Component, OnInit, Input} from '@angular/core';
+import {Component, Input} from '@angular/core';
import {FormGroup} from '@angular/forms';
import 'rxjs/add/operator/map';
-import {HttpClientService} from '@app/services/http-client.service';
-import {ServiceLogsService} from '@app/services/storage/service-logs.service';
import {FilteringService} from '@app/services/filtering.service';
@Component({
@@ -27,46 +25,19 @@ import {FilteringService} from '@app/services/filtering.service';
templateUrl: './logs-list.component.html',
styleUrls: ['./logs-list.component.less']
})
-export class LogsListComponent implements OnInit {
+export class LogsListComponent {
- constructor(private httpClient: HttpClientService, private serviceLogsStorage: ServiceLogsService, private filtering: FilteringService) {
- }
-
- ngOnInit() {
- this.loadLogs();
- this.filtersForm.valueChanges.subscribe(() => {
- this.loadLogs();
- });
+ constructor(private filtering: FilteringService) {
}
@Input()
- private logsArrayId: string;
+ logs: any[] = [];
+ @Input()
totalCount: number = 0;
timeFormat: string = 'DD/MM/YYYY HH:mm:ss';
- private readonly usedFilters = {
- clusters: ['clusters'],
- text: ['iMessage'],
- timeRange: ['end_time', 'start_time'],
- components: ['component_name'],
- levels: ['level'],
- sorting: ['sortType', 'sortBy'],
- pageSize: ['pageSize'],
- page: ['page']
- };
-
- logs = this.serviceLogsStorage.getAll().map(logs => logs.map(log => {
- return {
- type: log.type,
- level: log.level,
- className: log.level.toLowerCase(),
- message: log.log_message,
- time: log.logtime
- };
- }));
-
get timeZone(): string {
return this.filtering.timeZone;
}
@@ -79,45 +50,4 @@ export class LogsListComponent implements OnInit {
return this.filtering.filtersForm;
}
- private loadLogs(): void {
- this.httpClient.get(this.logsArrayId, this.getParams()).subscribe(response => {
- const jsonResponse = response.json();
- this.serviceLogsStorage.clear();
- if (jsonResponse) {
- const logs = jsonResponse.logList,
- count = jsonResponse.totalCount || 0;
- if (logs) {
- const logs = response.json().logList;
- this.serviceLogsStorage.addInstances(logs);
- }
- this.totalCount = count;
- }
- });
- }
-
- private getParams(): any {
- let params = {};
- Object.keys(this.usedFilters).forEach(key => {
- const inputValue = this.filtersForm.getRawValue()[key],
- paramNames = this.usedFilters[key];
- paramNames.forEach(paramName => {
- let value;
- const valueGetter = this.filtering.valueGetters[paramName];
- if (valueGetter) {
- if (paramName === 'start_time') {
- value = valueGetter(inputValue, params['end_time']);
- } else {
- value = valueGetter(inputValue);
- }
- } else {
- value = inputValue;
- }
- if (value != null && value !== '') {
- params[paramName] = value;
- }
- });
- }, this);
- return params;
- }
-
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html
index 42a8fbf..f4cf47a 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/main-container/main-container.component.html
@@ -21,4 +21,4 @@
</div>
<login-form *ngIf="!isInitialLoading && !isAuthorized"></login-form>
<filters-panel *ngIf="isAuthorized" class="row"></filters-panel>
-<logs-list *ngIf="isAuthorized" [logsArrayId]="'serviceLogs'"></logs-list>
+<logs-container *ngIf="isAuthorized" logsArrayId="serviceLogs"></logs-container>
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html
new file mode 100644
index 0000000..299e46e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.html
@@ -0,0 +1,18 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+-->
+
+<div #container></div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less
new file mode 100644
index 0000000..58882ff
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.less
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+/deep/ .axis {
+ .domain {
+ display: none;
+ }
+
+ .tick {
+ line {
+ display: none;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts
new file mode 100644
index 0000000..d2f6e3a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.spec.ts
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {StoreModule} from '@ngrx/store';
+import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
+
+import {TimeHistogramComponent} from './time-histogram.component';
+
+describe('TimeHistogramComponent', () => {
+ let component: TimeHistogramComponent;
+ let fixture: ComponentFixture<TimeHistogramComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [TimeHistogramComponent],
+ imports: [
+ StoreModule.provideStore({
+ appSettings
+ })
+ ],
+ providers: [
+ AppSettingsService
+ ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TimeHistogramComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts
new file mode 100644
index 0000000..485c4cc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/components/time-histogram/time-histogram.component.ts
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {Component, OnInit, AfterViewInit, OnChanges, Input, ViewChild, ElementRef} from '@angular/core';
+import * as d3 from 'd3';
+import * as moment from 'moment-timezone';
+import {AppSettingsService} from '@app/services/storage/app-settings.service';
+
+@Component({
+ selector: 'time-histogram',
+ templateUrl: './time-histogram.component.html',
+ styleUrls: ['./time-histogram.component.less']
+})
+export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges {
+
+ constructor(private appSettings: AppSettingsService) {
+ this.appSettings.getParameter('timeZone').subscribe(value => {
+ this.timeZone = value;
+ this.createHistogram();
+ });
+ }
+
+ ngOnInit() {
+ Object.assign(this.options, this.defaultOptions, this.customOptions);
+ }
+
+ ngAfterViewInit() {
+ this.htmlElement = this.element.nativeElement;
+ this.host = d3.select(this.htmlElement);
+ }
+
+ ngOnChanges() {
+ this.createHistogram();
+ }
+
+ @ViewChild('container')
+ element: ElementRef;
+
+ @Input()
+ customOptions: any;
+
+ @Input()
+ data: any;
+
+ private readonly defaultOptions = {
+ margin: {
+ top: 20,
+ right: 20,
+ bottom: 40,
+ left: 50
+ },
+ height: 200,
+ tickPadding: 10,
+ columnWidth: 20
+ };
+
+ private options: any = {};
+
+ private timeZone: string;
+
+ private host;
+
+ private svg;
+
+ private width;
+
+ private xScale;
+
+ private yScale;
+
+ private colorScale;
+
+ private xAxis;
+
+ private yAxis;
+
+ private htmlElement: HTMLElement;
+
+ histogram: any;
+
+ private createHistogram(): void {
+ if (this.host) {
+ this.setup();
+ this.buildSVG();
+ this.populate();
+ }
+ }
+
+ private setup(): void {
+ const margin = this.options.margin,
+ keysWithColors = this.options.keysWithColors,
+ keys = Object.keys(keysWithColors),
+ colors = keys.reduce((array, key) => [...array, keysWithColors[key]], []);
+ this.width = this.htmlElement.clientWidth - margin.left - margin.right;
+ this.xScale = d3.scaleTime().range([0, this.width]);
+ this.yScale = d3.scaleLinear().range([this.options.height, 0]);
+ this.colorScale = d3.scaleOrdinal(colors);
+ }
+
+ private buildSVG(): void {
+ const margin = this.options.margin;
+ this.host.html('');
+ this.svg = this.host.append('svg').attr('width', this.width + margin.left + margin.right)
+ .attr('height', this.options.height + margin.top + margin.bottom).append('g')
+ .attr('transform', `translate(${margin.left},${margin.top})`);
+ }
+
+ private drawXAxis(): void {
+ this.xAxis = d3.axisBottom(this.xScale)
+ .tickFormat(tick => moment(tick).tz(this.timeZone).format('MM/DD HH:mm'))
+ .tickPadding(this.options.tickPadding);
+ this.svg.append('g').attr('class', 'axis').attr('transform', `translate(0,${this.options.height})`).call(this.xAxis);
+ }
+
+ private drawYAxis(): void {
+ this.yAxis = d3.axisLeft(this.yScale).tickFormat((tick: number) => {
+ if (Number.isInteger(tick)) {
+ return tick.toFixed(0);
+ } else {
+ return;
+ }
+ }).tickPadding(this.options.tickPadding);
+ this.svg.append('g').attr('class', 'axis').call(this.yAxis).append('text');
+ }
+
+ private populate(): void {
+ const keys = Object.keys(this.options.keysWithColors),
+ data = this.data,
+ timeStamps = Object.keys(data),
+ formattedData = timeStamps.map(timeStamp => Object.assign({
+ timeStamp: timeStamp
+ }, data[timeStamp])),
+ layers = (d3.stack().keys(keys)(formattedData)),
+ columnWidth = this.options.columnWidth;
+ this.xScale.domain(d3.extent(formattedData, item => item.timeStamp));
+ this.yScale.domain([0, d3.max(formattedData, item => keys.reduce((sum, key) => sum + item[key], 0))]);
+ this.drawXAxis();
+ this.drawYAxis();
+ const layer = this.svg.selectAll().data(d3.transpose<any>(layers)).enter().append('g');
+ layer.selectAll().data(item => item).enter().append('rect')
+ .attr('x', item => this.xScale(item.data.timeStamp) - columnWidth / 2).attr('y', item => this.yScale(item[1]))
+ .attr('height', item => this.yScale(item[0]) - this.yScale(item[1])).attr('width', columnWidth.toString())
+ .style('fill', (item, index) => this.colorScale(index));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts
index 3d04122..ecac362 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/mock-data.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import * as moment from 'moment-timezone';
+import * as moment from 'moment';
export const mockData = {
login: {},
@@ -564,28 +564,28 @@ export const mockData = {
{
dataCount: [
{
- name: 'n12',
- value: 1000
+ name: moment().toISOString(),
+ value: '1000'
},
{
- name: 'n13',
- value: 2000
+ name: moment().add(1, 'h').toISOString(),
+ value: '2000'
}
],
- name: 'graph6'
+ name: 'ERROR'
},
{
dataCount: [
{
- name: 'n14',
- value: 700
+ name: moment().toISOString(),
+ value: '700'
},
{
- name: 'n15',
- value: 900
+ name: moment().add(1, 'h').toISOString(),
+ value: '900'
}
],
- name: 'graph7'
+ name: 'WARN'
}
]
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts
index 190ab7e..fce72d7 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/models/store.model.ts
@@ -42,7 +42,7 @@ export interface AppStore {
appState: AppState;
auditLogs: AuditLog[];
serviceLogs: ServiceLog[];
- barGraphs: BarGraph[];
+ serviceLogsHistogramData: BarGraph[];
graphs: Graph[];
nodes: Node[];
userConfigs: UserConfig[];
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/filtering.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/filtering.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/filtering.service.ts
index c317076..009b263 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/filtering.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/filtering.service.ts
@@ -276,46 +276,52 @@ export class FilteringService {
filtersForm = new FormGroup(this.filtersFormItems);
- readonly valueGetters = {
- end_time: value => {
- let time;
- if (value) {
- switch (value.type) {
- case 'LAST':
- time = moment();
- break;
- case 'CURRENT':
- time = moment().tz(this.timeZone).endOf(value.unit);
- break;
- case 'PAST':
- time = moment().tz(this.timeZone).startOf(value.unit).millisecond(-1);
- break;
- default:
- break;
- }
+ private getStartTime(value: any, current: string): string {
+ let time;
+ if (value) {
+ const endTime = moment(moment(current).valueOf());
+ switch (value.type) {
+ case 'LAST':
+ time = endTime.subtract(value.interval, value.unit);
+ break;
+ case 'CURRENT':
+ time = moment().tz(this.timeZone).startOf(value.unit);
+ break;
+ case 'PAST':
+ time = endTime.startOf(value.unit);
+ break;
+ default:
+ break;
}
- return time ? time.toISOString() : '';
- },
- start_time: (value, current) => {
- let time;
- if (value) {
- const endTime = moment(moment(current).valueOf());
- switch (value.type) {
- case 'LAST':
- time = endTime.subtract(value.interval, value.unit);
- break;
- case 'CURRENT':
- time = moment().tz(this.timeZone).startOf(value.unit);
- break;
- case 'PAST':
- time = endTime.startOf(value.unit);
- break;
- default:
- break;
- }
+ }
+ return time ? time.toISOString() : '';
+ }
+
+ private getEndTime(value: any): string {
+ let time;
+ if (value) {
+ switch (value.type) {
+ case 'LAST':
+ time = moment();
+ break;
+ case 'CURRENT':
+ time = moment().tz(this.timeZone).endOf(value.unit);
+ break;
+ case 'PAST':
+ time = moment().tz(this.timeZone).startOf(value.unit).millisecond(-1);
+ break;
+ default:
+ break;
}
- return time ? time.toISOString() : '';
- },
+ }
+ return time ? time.toISOString() : '';
+ }
+
+ readonly valueGetters = {
+ end_time: this.getEndTime.bind(this),
+ start_time: this.getStartTime.bind(this),
+ to: this.getEndTime.bind(this),
+ from: this.getStartTime.bind(this),
sortType: value => value && value.type,
sortBy: value => value && value.key,
page: value => value == null ? value : value.toString()
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
index 0d06899..260b920 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/http-client.service.ts
@@ -22,6 +22,7 @@ import 'rxjs/add/operator/first';
import {Http, XHRBackend, Request, RequestOptions, RequestOptionsArgs, Response, Headers, URLSearchParams} from '@angular/http';
import {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params.class';
import {ServiceLogsQueryParams} from '@app/classes/queries/service-logs-query-params.class';
+import {ServiceLogsHistogramQueryParams} from '@app/classes/queries/service-logs-histogram-query-params.class';
import {AppStateService} from '@app/services/storage/app-state.service';
@Injectable()
@@ -45,6 +46,10 @@ export class HttpClientService extends Http {
url: 'service/logs',
params: opts => new ServiceLogsQueryParams(opts)
},
+ serviceLogsHistogram: {
+ url: 'service/logs/histogram',
+ params: opts => new ServiceLogsHistogramQueryParams(opts)
+ },
components: {
url: 'service/logs/components'
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts
deleted file mode 100644
index e9a3cb7..0000000
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/bar-graphs.service.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-import {Injectable} from '@angular/core';
-import {Store} from '@ngrx/store';
-import {AppStore, CollectionModelService, getCollectionReducer} from '@app/models/store.model';
-
-export const modelName = 'barGraphs';
-
-@Injectable()
-export class BarGraphsService extends CollectionModelService {
- constructor(store: Store<AppStore>) {
- super(modelName, store);
- }
-}
-
-export const barGraphs = getCollectionReducer(modelName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/reducers.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/reducers.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/reducers.service.ts
index 6665901..3c92c75 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/reducers.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/reducers.service.ts
@@ -20,13 +20,13 @@ import {combineReducers} from '@ngrx/store';
import {appSettings} from '@app/services/storage/app-settings.service';
import {appState} from '@app/services/storage/app-state.service';
import {auditLogs} from '@app/services/storage/audit-logs.service';
-import {barGraphs} from '@app/services/storage/bar-graphs.service';
import {clusters} from '@app/services/storage/clusters.service';
import {components} from '@app/services/storage/components.service';
import {filters} from '@app/services/storage/filters.service';
import {graphs} from '@app/services/storage/graphs.service';
import {nodes} from '@app/services/storage/nodes.service';
import {serviceLogs} from '@app/services/storage/service-logs.service';
+import {serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
import {userConfigs} from '@app/services/storage/user-configs.service';
export const reducers = {
@@ -34,7 +34,7 @@ export const reducers = {
appState,
auditLogs,
serviceLogs,
- barGraphs,
+ serviceLogsHistogramData,
graphs,
nodes,
userConfigs,
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs-histogram-data.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs-histogram-data.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs-histogram-data.service.ts
new file mode 100644
index 0000000..0573247
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs-histogram-data.service.ts
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+import {Injectable} from '@angular/core';
+import {Store} from '@ngrx/store';
+import {AppStore, CollectionModelService, getCollectionReducer} from '@app/models/store.model';
+
+export const modelName = 'serviceLogsHistogramData';
+
+@Injectable()
+export class ServiceLogsHistogramDataService extends CollectionModelService {
+ constructor(store: Store<AppStore>) {
+ super(modelName, store);
+ }
+}
+
+export const serviceLogsHistogramData = getCollectionReducer(modelName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts
index 24c3776..529a390 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web-new/src/app/services/storage/service-logs.service.ts
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-
import {Injectable} from '@angular/core';
import {Store} from '@ngrx/store';
import {AppStore, CollectionModelService, getCollectionReducer} from '@app/models/store.model';
http://git-wip-us.apache.org/repos/asf/ambari/blob/af5f5d23/ambari-logsearch/ambari-logsearch-web-new/yarn.lock
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web-new/yarn.lock b/ambari-logsearch/ambari-logsearch-web-new/yarn.lock
index 6e592a7..291b489 100644
--- a/ambari-logsearch/ambari-logsearch-web-new/yarn.lock
+++ b/ambari-logsearch/ambari-logsearch-web-new/yarn.lock
@@ -141,10 +141,194 @@
version "0.0.3"
resolved "https://registry.yarnpkg.com/@ngx-translate/http-loader/-/http-loader-0.0.3.tgz#8346c8d2d6f630254601029668f17abe2afe8a9b"
+"@types/d3-array@*":
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-1.2.0.tgz#9b1fc3202fc1a9f7da0f2873bd38b443137a9d34"
+
+"@types/d3-axis@*":
+ version "1.0.9"
+ resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-1.0.9.tgz#62ce7bc8d04354298cda57f3f1d1f856ad69b89a"
+ dependencies:
+ "@types/d3-selection" "*"
+
+"@types/d3-brush@*":
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-1.0.7.tgz#05c30440f4d537fd23f976b0e6c4ba223001ef45"
+ dependencies:
+ "@types/d3-selection" "*"
+
+"@types/d3-chord@*":
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-1.0.6.tgz#0589eb97a3191f4edaf17b7bde498462890ce1ec"
+
+"@types/d3-collection@*":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-collection/-/d3-collection-1.0.5.tgz#bb1f3aa97cdc8d881645541b9d6cf87edfee9bc3"
+
+"@types/d3-color@*":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-1.0.5.tgz#cad755f0fc6de7b70fa6e5e08afa81ef4c2248de"
+
+"@types/d3-dispatch@*":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-1.0.5.tgz#f1f9187b538ecb05157569d8dc2f70dfb04f1b52"
+
+"@types/d3-drag@*":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-1.1.0.tgz#9105e35ca58aa0c4783f3ce83082bcb24ccb6960"
+ dependencies:
+ "@types/d3-selection" "*"
+
+"@types/d3-dsv@*":
+ version "1.0.30"
+ resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-1.0.30.tgz#78e0dddde4283566f463e51551a97a63c170d5a8"
+
+"@types/d3-ease@*":
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-1.0.7.tgz#93a301868be9e15061f3d44343b1ab3f8acb6f09"
+
+"@types/d3-force@*":
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-1.0.7.tgz#8e3c533697143ebb70275d56840206e8ba789185"
+
+"@types/d3-format@*":
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-1.2.0.tgz#3e128efc9e6dd09df8fd21f1d981ab68e140a8a2"
+
+"@types/d3-geo@*":
+ version "1.6.3"
+ resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-1.6.3.tgz#21b501d1fe224d88877f39f84cb8c9dd8aa1bf28"
+ dependencies:
+ "@types/geojson" "*"
+
+"@types/d3-hierarchy@*":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-1.1.0.tgz#50f1ee052840638035cbdd4acab1fc3470905907"
+
+"@types/d3-interpolate@*":
+ version "1.1.6"
+ resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-1.1.6.tgz#64041b15c9c032c348da1b22baabc59fa4d16136"
+ dependencies:
+ "@types/d3-color" "*"
+
+"@types/d3-path@*":
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-1.0.6.tgz#c1a7d2dc07b295fdd1c84dabe4404df991b48693"
+
+"@types/d3-polygon@*":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-1.0.5.tgz#35ad54ed84c39d7e9f1252b6535be600be6cace2"
+
+"@types/d3-quadtree@*":
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-1.0.5.tgz#1ce1e659eae4530df0cb127f297f1741a367a82e"
+
+"@types/d3-queue@*":
+ version "3.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-queue/-/d3-queue-3.0.5.tgz#3e4cbe2aff61db6a0b2b8c4800299e4ec6acc850"
+
+"@types/d3-random@*":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-1.1.0.tgz#2dd08f1159c70719270e4a7c834af85c8b88d2c3"
+
+"@types/d3-request@*":
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/@types/d3-request/-/d3-request-1.0.2.tgz#db9db8154f47816584706c6e6f702be66f22f4be"
+ dependencies:
+ "@types/d3-dsv" "*"
+
+"@types/d3-scale@*":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-1.0.10.tgz#8c5c1dca54a159eed042b46719dbb3bdb7e8c842"
+ dependencies:
+ "@types/d3-time" "*"
+
+"@types/d3-selection@*":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-1.1.0.tgz#59b88f10d2cff7d9ffd7fe986b3aaef3de048224"
+
+"@types/d3-shape@*":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-1.2.1.tgz#cac2d9f0122f173220c32c8c152dc42ee9349df2"
+ dependencies:
+ "@types/d3-path" "*"
+
+"@types/d3-time-format@*":
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-2.0.5.tgz#1d4c5ba77ed5352b10c7fce062c883382f1e16e0"
+
+"@types/d3-time@*":
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-1.0.7.tgz#4266d7c9be15fa81256a88d1d052d61cd8dc572c"
+
+"@types/d3-timer@*":
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-1.0.6.tgz#786d4e20731adf03af2c5df6c86fe29667fe429b"
+
+"@types/d3-transition@*":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-1.1.0.tgz#74475d4a8f8a0944a517d5ef861970cc30287e40"
+ dependencies:
+ "@types/d3-selection" "*"
+
+"@types/d3-voronoi@*":
+ version "1.1.6"
+ resolved "https://registry.yarnpkg.com/@types/d3-voronoi/-/d3-voronoi-1.1.6.tgz#b52252c1d61972e7c751135890aea112d5dadc6d"
+
+"@types/d3-zoom@*":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-1.5.0.tgz#21f690b25a8419fd1bcc95ac629cefdfb462c70f"
+ dependencies:
+ "@types/d3-interpolate" "*"
+ "@types/d3-selection" "*"
+
+"@types/d3@^4.10.0":
+ version "4.10.0"
+ resolved "https://registry.yarnpkg.com/@types/d3/-/d3-4.10.0.tgz#721d8f984ba4bc192b1c1aca3834b31cc31fa9d3"
+ dependencies:
+ "@types/d3-array" "*"
+ "@types/d3-axis" "*"
+ "@types/d3-brush" "*"
+ "@types/d3-chord" "*"
+ "@types/d3-collection" "*"
+ "@types/d3-color" "*"
+ "@types/d3-dispatch" "*"
+ "@types/d3-drag" "*"
+ "@types/d3-dsv" "*"
+ "@types/d3-ease" "*"
+ "@types/d3-force" "*"
+ "@types/d3-format" "*"
+ "@types/d3-geo" "*"
+ "@types/d3-hierarchy" "*"
+ "@types/d3-interpolate" "*"
+ "@types/d3-path" "*"
+ "@types/d3-polygon" "*"
+ "@types/d3-quadtree" "*"
+ "@types/d3-queue" "*"
+ "@types/d3-random" "*"
+ "@types/d3-request" "*"
+ "@types/d3-scale" "*"
+ "@types/d3-selection" "*"
+ "@types/d3-shape" "*"
+ "@types/d3-time" "*"
+ "@types/d3-time-format" "*"
+ "@types/d3-timer" "*"
+ "@types/d3-transition" "*"
+ "@types/d3-voronoi" "*"
+ "@types/d3-zoom" "*"
+
+"@types/geojson@*":
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-1.0.2.tgz#b02d10ab028e2928ac592a051aaa4981a1941d03"
+
"@types/jasmine@2.5.38":
version "2.5.38"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.38.tgz#a4379124c4921d4e21de54ec74669c9e9b356717"
+"@types/jquery@^1.10.33":
+ version "1.10.33"
+ resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-1.10.33.tgz#6c4c279f8d06839b184950432e880e0a469a64a1"
+
"@types/moment-timezone@^0.2.34":
version "0.2.34"
resolved "https://registry.yarnpkg.com/@types/moment-timezone/-/moment-timezone-0.2.34.tgz#948e0aff82742a31dd63714d1aac9616bc375053"
@@ -956,7 +1140,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
dependencies:
delayed-stream "~1.0.0"
-commander@2.9.x, commander@~2.9.0:
+commander@2, commander@2.9.x, commander@~2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
dependencies:
@@ -1253,6 +1437,216 @@ custom-event@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425"
+d3-array@1, d3-array@1.2.0, d3-array@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.0.tgz#147d269720e174c4057a7f42be8b0f3f2ba53108"
+
+d3-axis@1.0.8:
+ version "1.0.8"
+ resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-1.0.8.tgz#31a705a0b535e65759de14173a31933137f18efa"
+
+d3-brush@1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-1.0.4.tgz#00c2f238019f24f6c0a194a26d41a1530ffe7bc4"
+ dependencies:
+ d3-dispatch "1"
+ d3-drag "1"
+ d3-interpolate "1"
+ d3-selection "1"
+ d3-transition "1"
+
+d3-chord@1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-1.0.4.tgz#7dec4f0ba886f713fe111c45f763414f6f74ca2c"
+ dependencies:
+ d3-array "1"
+ d3-path "1"
+
+d3-collection@1, d3-collection@1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.4.tgz#342dfd12837c90974f33f1cc0a785aea570dcdc2"
+
+d3-color@1, d3-color@1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.0.3.tgz#bc7643fca8e53a8347e2fbdaffa236796b58509b"
+
+d3-dispatch@1, d3-dispatch@1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.3.tgz#46e1491eaa9b58c358fce5be4e8bed626e7871f8"
+
+d3-drag@1, d3-drag@1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-1.1.1.tgz#b5155304433b18ba38726b2184d0098e820dc64b"
+ dependencies:
+ d3-dispatch "1"
+ d3-selection "1"
+
+d3-dsv@1, d3-dsv@1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.5.tgz#419f7db47f628789fc3fdb636e678449d0821136"
+ dependencies:
+ commander "2"
+ iconv-lite "0.4"
+ rw "1"
+
+d3-ease@1, d3-ease@1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-1.0.3.tgz#68bfbc349338a380c44d8acc4fbc3304aa2d8c0e"
+
+d3-force@1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-1.0.6.tgz#ea7e1b7730e2664cd314f594d6718c57cc132b79"
+ dependencies:
+ d3-collection "1"
+ d3-dispatch "1"
+ d3-quadtree "1"
+ d3-timer "1"
+
+d3-format@1, d3-format@1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.2.0.tgz#6b480baa886885d4651dc248a8f4ac9da16db07a"
+
+d3-geo@1.6.4:
+ version "1.6.4"
+ resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.6.4.tgz#f20e1e461cb1845f5a8be55ab6f876542a7e3199"
+ dependencies:
+ d3-array "1"
+
+d3-hierarchy@1.1.5:
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.5.tgz#a1c845c42f84a206bcf1c01c01098ea4ddaa7a26"
+
+d3-interpolate@1, d3-interpolate@1.1.5:
+ version "1.1.5"
+ resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.1.5.tgz#69e099ff39214716e563c9aec3ea9d1ea4b8a79f"
+ dependencies:
+ d3-color "1"
+
+d3-path@1, d3-path@1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.5.tgz#241eb1849bd9e9e8021c0d0a799f8a0e8e441764"
+
+d3-polygon@1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-1.0.3.tgz#16888e9026460933f2b179652ad378224d382c62"
+
+d3-quadtree@1, d3-quadtree@1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.3.tgz#ac7987e3e23fe805a990f28e1b50d38fcb822438"
+
+d3-queue@3.0.7:
+ version "3.0.7"
+ resolved "https://registry.yarnpkg.com/d3-queue/-/d3-queue-3.0.7.tgz#c93a2e54b417c0959129d7d73f6cf7d4292e7618"
+
+d3-random@1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.0.tgz#6642e506c6fa3a648595d2b2469788a8d12529d3"
+
+d3-request@1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/d3-request/-/d3-request-1.0.5.tgz#4daae946d1dd0d57dfe01f022956354958d51f23"
+ dependencies:
+ d3-collection "1"
+ d3-dispatch "1"
+ d3-dsv "1"
+ xmlhttprequest "1"
+
+d3-scale@1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.6.tgz#bce19da80d3a0cf422c9543ae3322086220b34ed"
+ dependencies:
+ d3-array "^1.2.0"
+ d3-collection "1"
+ d3-color "1"
+ d3-format "1"
+ d3-interpolate "1"
+ d3-time "1"
+ d3-time-format "2"
+
+d3-selection@1, d3-selection@1.1.0, d3-selection@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.1.0.tgz#1998684896488f839ca0372123da34f1d318809c"
+
+d3-shape@1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.2.0.tgz#45d01538f064bafd05ea3d6d2cb748fd8c41f777"
+ dependencies:
+ d3-path "1"
+
+d3-time-format@2, d3-time-format@2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.0.5.tgz#9d7780204f7c9119c9170b1a56db4de9a8af972e"
+ dependencies:
+ d3-time "1"
+
+d3-time@1, d3-time@1.0.7:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.7.tgz#94caf6edbb7879bb809d0d1f7572bc48482f7270"
+
+d3-timer@1, d3-timer@1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.6.tgz#4044bf15d7025c06ce7d1149f73cd07b54dbd784"
+
+d3-transition@1, d3-transition@1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-1.1.0.tgz#cfc85c74e5239324290546623572990560c3966f"
+ dependencies:
+ d3-color "1"
+ d3-dispatch "1"
+ d3-ease "1"
+ d3-interpolate "1"
+ d3-selection "^1.1.0"
+ d3-timer "1"
+
+d3-voronoi@1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.2.tgz#1687667e8f13a2d158c80c1480c5a29cb0d8973c"
+
+d3-zoom@1.5.0:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-1.5.0.tgz#8417de9a077f98f9ce83b1998efb8ee12b4db26e"
+ dependencies:
+ d3-dispatch "1"
+ d3-drag "1"
+ d3-interpolate "1"
+ d3-selection "1"
+ d3-transition "1"
+
+d3@^4.10.0:
+ version "4.10.0"
+ resolved "https://registry.yarnpkg.com/d3/-/d3-4.10.0.tgz#0bcca3a3b614e2fd45b1b5bd0b9164d57352a862"
+ dependencies:
+ d3-array "1.2.0"
+ d3-axis "1.0.8"
+ d3-brush "1.0.4"
+ d3-chord "1.0.4"
+ d3-collection "1.0.4"
+ d3-color "1.0.3"
+ d3-dispatch "1.0.3"
+ d3-drag "1.1.1"
+ d3-dsv "1.0.5"
+ d3-ease "1.0.3"
+ d3-force "1.0.6"
+ d3-format "1.2.0"
+ d3-geo "1.6.4"
+ d3-hierarchy "1.1.5"
+ d3-interpolate "1.1.5"
+ d3-path "1.0.5"
+ d3-polygon "1.0.3"
+ d3-quadtree "1.0.3"
+ d3-queue "3.0.7"
+ d3-random "1.1.0"
+ d3-request "1.0.5"
+ d3-scale "1.0.6"
+ d3-selection "1.1.0"
+ d3-shape "1.2.0"
+ d3-time "1.0.7"
+ d3-time-format "2.0.5"
+ d3-timer "1.0.6"
+ d3-transition "1.1.0"
+ d3-voronoi "1.1.2"
+ d3-zoom "1.5.0"
+
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@@ -2212,14 +2606,14 @@ https-proxy-agent@^1.0.0:
debug "2"
extend "3"
+iconv-lite@0.4, iconv-lite@^0.4.17:
+ version "0.4.17"
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
+
iconv-lite@0.4.15:
version "0.4.15"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
-iconv-lite@^0.4.17:
- version "0.4.17"
- resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d"
-
icss-replace-symbols@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
@@ -4177,6 +4571,10 @@ run-async@^2.2.0:
dependencies:
is-promise "^2.1.0"
+rw@1:
+ version "1.3.3"
+ resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4"
+
rx@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
@@ -5276,6 +5674,10 @@ xmlhttprequest-ssl@1.5.3:
version "1.5.3"
resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz#185a888c04eca46c3e4070d99f7b49de3528992d"
+xmlhttprequest@1:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"
+
xtend@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
[27/50] [abbrv] ambari git commit: AMBARI-21671. Expose via API
whether a service will participate in an upgrade (ncole)
Posted by ab...@apache.org.
AMBARI-21671. Expose via API whether a service will participate in an upgrade (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f01c32ed
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f01c32ed
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f01c32ed
Branch: refs/heads/branch-feature-logsearch-ui
Commit: f01c32ed4c9e7ef0068aec741de5371e280ebccb
Parents: 153e03a
Author: Nate Cole <nc...@hortonworks.com>
Authored: Mon Aug 7 10:38:50 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Mon Aug 7 11:11:48 2017 -0400
----------------------------------------------------------------------
.../ClusterStackVersionResourceProvider.java | 22 +++-
.../org/apache/ambari/server/state/Service.java | 2 +
.../apache/ambari/server/state/ServiceImpl.java | 10 +-
.../state/repository/ClusterVersionSummary.java | 56 ++++++++
.../state/repository/ServiceVersionSummary.java | 79 ++++++++++++
.../state/repository/VersionDefinitionXml.java | 127 ++++++++++++++-----
.../state/repository/VersionDefinitionTest.java | 55 +++++++-
.../resources/version_definition_test_maint.xml | 2 +-
.../version_definition_test_maint_partial.xml | 54 ++++++++
9 files changed, 371 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 9ecea95..979124e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -75,6 +75,7 @@ import org.apache.ambari.server.state.RepositoryVersionState;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.ServiceOsSpecific;
import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
import org.apache.ambari.server.utils.StageUtils;
@@ -104,6 +105,8 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
protected static final String CLUSTER_STACK_VERSION_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "version");
protected static final String CLUSTER_STACK_VERSION_STATE_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "state");
protected static final String CLUSTER_STACK_VERSION_HOST_STATES_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "host_states");
+ protected static final String CLUSTER_STACK_VERSION_REPO_SUMMARY_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "repository_summary");
+
protected static final String CLUSTER_STACK_VERSION_REPOSITORY_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "repository_version");
protected static final String CLUSTER_STACK_VERSION_STAGE_SUCCESS_FACTOR = PropertyHelper.getPropertyId("ClusterStackVersions", "success_factor");
@@ -143,7 +146,8 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
CLUSTER_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID, CLUSTER_STACK_VERSION_STACK_PROPERTY_ID,
CLUSTER_STACK_VERSION_VERSION_PROPERTY_ID, CLUSTER_STACK_VERSION_HOST_STATES_PROPERTY_ID,
CLUSTER_STACK_VERSION_STATE_PROPERTY_ID, CLUSTER_STACK_VERSION_REPOSITORY_VERSION_PROPERTY_ID,
- CLUSTER_STACK_VERSION_STAGE_SUCCESS_FACTOR, CLUSTER_STACK_VERSION_FORCE);
+ CLUSTER_STACK_VERSION_STAGE_SUCCESS_FACTOR,
+ CLUSTER_STACK_VERSION_FORCE, CLUSTER_STACK_VERSION_REPO_SUMMARY_PROPERTY_ID);
private static Map<Type, String> keyPropertyIds = ImmutableMap.<Type, String> builder()
.put(Type.Cluster, CLUSTER_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID)
@@ -264,8 +268,21 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
allStates.add(hostVersionEntity.getState());
}
+ ClusterVersionSummary versionSummary = null;
+ try {
+ VersionDefinitionXml vdf = repositoryVersion.getRepositoryXml();
+
+ versionSummary = vdf.getClusterSummary(cluster);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(
+ String.format("Version %s is backed by a version definition, but it could not be parsed", repositoryVersion.getVersion()), e);
+ }
+
setResourceProperty(resource, CLUSTER_STACK_VERSION_CLUSTER_NAME_PROPERTY_ID, clusterName, requestedIds);
setResourceProperty(resource, CLUSTER_STACK_VERSION_HOST_STATES_PROPERTY_ID, hostStates, requestedIds);
+ setResourceProperty(resource, CLUSTER_STACK_VERSION_REPO_SUMMARY_PROPERTY_ID, versionSummary, requestedIds);
+
+
setResourceProperty(resource, CLUSTER_STACK_VERSION_ID_PROPERTY_ID, repositoryVersion.getId(), requestedIds);
setResourceProperty(resource, CLUSTER_STACK_VERSION_STACK_PROPERTY_ID, repoVersionStackId.getStackName(), requestedIds);
setResourceProperty(resource, CLUSTER_STACK_VERSION_VERSION_PROPERTY_ID, repoVersionStackId.getStackVersion(), requestedIds);
@@ -536,7 +553,8 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
// !!! limit the serviceNames to those that are detailed for the repository.
// TODO packages don't have component granularity
if (RepositoryType.STANDARD != repoVersionEnt.getType()) {
- serviceNames.addAll(desiredVersionDefinition.getAvailableServiceNames());
+ ClusterVersionSummary clusterSummary = desiredVersionDefinition.getClusterSummary(cluster);
+ serviceNames.addAll(clusterSummary.getAvailableServiceNames());
}
// Populate with commands for host
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
index 8651fee..65189ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
@@ -28,6 +28,8 @@ public interface Service {
String getName();
+ String getDisplayName();
+
long getClusterId();
Cluster getCluster();
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 4ed0429..0247774 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -52,6 +52,7 @@ import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntityPK;
import org.apache.ambari.server.orm.entities.StackEntity;
import org.apache.ambari.server.serveraction.kerberos.Component;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,6 +94,7 @@ public class ServiceImpl implements Service {
* The name of the service.
*/
private final String serviceName;
+ private final String displayName;
@AssistedInject
ServiceImpl(@Assisted Cluster cluster, @Assisted String serviceName,
@@ -127,8 +129,8 @@ public class ServiceImpl implements Service {
ServiceInfo sInfo = ambariMetaInfo.getService(stackId.getStackName(),
stackId.getStackVersion(), serviceName);
+ displayName = sInfo.getDisplayName();
isClientOnlyService = sInfo.isClientOnlyService();
-
isCredentialStoreSupported = sInfo.isCredentialStoreSupported();
isCredentialStoreRequired = sInfo.isCredentialStoreRequired();
@@ -177,6 +179,7 @@ public class ServiceImpl implements Service {
isClientOnlyService = sInfo.isClientOnlyService();
isCredentialStoreSupported = sInfo.isCredentialStoreSupported();
isCredentialStoreRequired = sInfo.isCredentialStoreRequired();
+ displayName = sInfo.getDisplayName();
}
@@ -208,6 +211,11 @@ public class ServiceImpl implements Service {
}
@Override
+ public String getDisplayName() {
+ return StringUtils.isBlank(displayName) ? serviceName : displayName;
+ }
+
+ @Override
public long getClusterId() {
return cluster.getClusterId();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ClusterVersionSummary.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ClusterVersionSummary.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ClusterVersionSummary.java
new file mode 100644
index 0000000..e9d9920
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ClusterVersionSummary.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.state.repository;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * For a version, collects summary information for a cluster.
+ */
+public class ClusterVersionSummary {
+
+ @JsonProperty("services")
+ private Map<String, ServiceVersionSummary> m_services;
+
+ private transient Set<String> m_available = new HashSet<>();
+
+ ClusterVersionSummary(Map<String, ServiceVersionSummary> services) {
+ m_services = services;
+
+ for (Map.Entry<String, ServiceVersionSummary> entry : services.entrySet()) {
+ if (entry.getValue().isUpgrade()) {
+ m_available.add(entry.getKey());
+ }
+ }
+ }
+
+ /**
+ * @return service names that should participate in an upgrade, based on
+ * the VDF contents.
+ */
+ @JsonIgnore
+ public Set<String> getAvailableServiceNames() {
+ return m_available;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ServiceVersionSummary.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ServiceVersionSummary.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ServiceVersionSummary.java
new file mode 100644
index 0000000..29505c8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ServiceVersionSummary.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.state.repository;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Used to hold information about Service's ability to upgrade for a repository version.
+ */
+public class ServiceVersionSummary {
+
+ @JsonProperty("display_name")
+ private String m_displayName;
+
+ @JsonProperty("version")
+ private String m_version;
+
+ @JsonProperty("release_version")
+ private String m_releaseVersion;
+
+ @JsonProperty("upgrade")
+ private boolean m_upgrade = false;
+
+ ServiceVersionSummary(String displayName) {
+ m_displayName = displayName;
+ }
+
+ /**
+ * Sets the version information
+ *
+ * @param binaryVersion the binary version of the service
+ * @param releaseVersion the release version of the service
+ */
+ void setVersions(String binaryVersion, String releaseVersion) {
+ m_version = binaryVersion;
+ m_releaseVersion = releaseVersion;
+ }
+
+ @JsonIgnore
+ /**
+ * @return {@code true} if the service will be included in an upgrade
+ */
+ public boolean isUpgrade() {
+ return m_upgrade;
+ }
+
+ /**
+ * @param upgrade {@code true} if the service will be included in an upgrade
+ */
+ public void setUpgrade(boolean upgrade) {
+ m_upgrade = upgrade;
+ }
+
+ /**
+ * @return the relase version field
+ */
+ @JsonIgnore
+ public String getReleaseVersion() {
+ return m_releaseVersion;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
index f48c723..45d8e8e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
@@ -47,14 +47,18 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.repository.AvailableVersion.Component;
import org.apache.ambari.server.state.stack.RepositoryXml;
import org.apache.ambari.server.state.stack.RepositoryXml.Os;
+import org.apache.ambari.server.utils.VersionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -67,7 +71,6 @@ public class VersionDefinitionXml {
public static String SCHEMA_LOCATION = "version_definition.xsd";
-
/**
* Release details.
*/
@@ -114,6 +117,7 @@ public class VersionDefinitionXml {
private Map<String, String> m_packageVersions = null;
+
/**
* @param stack the stack info needed to lookup service and component display names
* @return a collection of AvailableServices used for web service consumption. This
@@ -163,6 +167,7 @@ public class VersionDefinitionXml {
}
}
+
/**
* Gets if the version definition was built as the default for a stack
* @return {@code true} if default for a stack
@@ -225,7 +230,97 @@ public class VersionDefinitionXml {
return m_packageVersions.get(osFamily);
}
+ /**
+ * Returns the XML representation of this instance.
+ */
+ public String toXml() throws Exception {
+
+ JAXBContext ctx = JAXBContext.newInstance(VersionDefinitionXml.class);
+ Marshaller marshaller = ctx.createMarshaller();
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+ InputStream xsdStream = VersionDefinitionXml.class.getClassLoader().getResourceAsStream(xsdLocation);
+
+ if (null == xsdStream) {
+ throw new Exception(String.format("Could not load XSD identified by '%s'", xsdLocation));
+ }
+
+ try {
+ Schema schema = factory.newSchema(new StreamSource(xsdStream));
+ marshaller.setSchema(schema);
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.setProperty("jaxb.noNamespaceSchemaLocation", xsdLocation);
+
+ StringWriter w = new StringWriter();
+ marshaller.marshal(this, w);
+
+ return w.toString();
+ } finally {
+ IOUtils.closeQuietly(xsdStream);
+ }
+ }
+
+ /**
+ * Gets a summary for cluster given the version information in this version.
+ * @param cluster the cluster by which to iterate services
+ * @return a summary instance
+ * @throws AmbariException
+ */
+ public ClusterVersionSummary getClusterSummary(Cluster cluster) throws AmbariException {
+
+ Map<String, ManifestService> manifests = buildManifestByService();
+ Set<String> available = getAvailableServiceNames();
+
+ available = available.isEmpty() ? manifests.keySet() : available;
+
+ Map<String, ServiceVersionSummary> summaries = new HashMap<>();
+ for (String serviceName : available) {
+ Service service = cluster.getServices().get(serviceName);
+ if (null == service) {
+ // !!! service is not installed
+ continue;
+ }
+
+ ServiceVersionSummary summary = new ServiceVersionSummary(service.getDisplayName());
+ summaries.put(service.getName(), summary);
+
+ String serviceVersion = service.getDesiredRepositoryVersion().getVersion();
+
+ // !!! currently only one version is supported (unique service names)
+ ManifestService manifest = manifests.get(serviceName);
+
+ summary.setVersions(manifest.version, StringUtils.isEmpty(manifest.releaseVersion) ?
+ release.version : manifest.releaseVersion);
+
+ // !!! installed service already meets the release version, then nothing to upgrade
+ // !!! TODO should this be using the release compatible-with field?
+ if (VersionUtils.compareVersions(summary.getReleaseVersion(), serviceVersion, 4) > 0) {
+ summary.setUpgrade(true);
+ }
+ }
+
+ return new ClusterVersionSummary(summaries);
+ }
+
+ /**
+ * Structures the manifest by service name.
+ * <p/>
+ * !!! WARNING. This is currently based on the assumption that there is one and only
+ * one version for a service in the VDF. This may have to change in the future.
+ * </p>
+ * @return
+ */
+ private Map<String, ManifestService> buildManifestByService() {
+ Map<String, ManifestService> manifests = new HashMap<>();
+
+ for (ManifestService manifest : manifestServices) {
+ if (!manifests.containsKey(manifest.serviceName)) {
+ manifests.put(manifest.serviceName, manifest);
+ }
+ }
+ return manifests;
+ }
/**
* Helper method to use a {@link ManifestService} to generate the available services structure
@@ -281,36 +376,6 @@ public class VersionDefinitionXml {
}
/**
- * Returns the XML representation of this instance.
- */
- public String toXml() throws Exception {
-
- JAXBContext ctx = JAXBContext.newInstance(VersionDefinitionXml.class);
- Marshaller marshaller = ctx.createMarshaller();
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- InputStream xsdStream = VersionDefinitionXml.class.getClassLoader().getResourceAsStream(xsdLocation);
-
- if (null == xsdStream) {
- throw new Exception(String.format("Could not load XSD identified by '%s'", xsdLocation));
- }
-
- try {
- Schema schema = factory.newSchema(new StreamSource(xsdStream));
- marshaller.setSchema(schema);
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- marshaller.setProperty("jaxb.noNamespaceSchemaLocation", xsdLocation);
-
- StringWriter w = new StringWriter();
- marshaller.marshal(this, w);
-
- return w.toString();
- } finally {
- IOUtils.closeQuietly(xsdStream);
- }
- }
-
- /**
* Parses a URL for a definition XML file into the object graph.
* @param url the URL to load. Can be a file URL reference also.
* @return the definition
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
index 89e8016..8433518 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
@@ -17,6 +17,9 @@
*/
package org.apache.ambari.server.state.repository;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -29,14 +32,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.stack.RepositoryXml;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
+import com.google.common.collect.ImmutableMap;
+
/**
* Tests for repository definitions.
*/
@@ -347,7 +355,7 @@ public class VersionDefinitionTest {
assertNotNull(hdfs);
assertNotNull(hive);
- assertEquals("2.3.3", hdfs.releaseVersion);
+ assertEquals("2.3.4.0", hdfs.releaseVersion);
assertNull(hive.releaseVersion);
StackInfo stack = new StackInfo() {
@@ -379,6 +387,51 @@ public class VersionDefinitionTest {
assertTrue("Found available version for HIVE", found);
}
+ @Test
+ public void testAvailableFull() throws Exception {
+
+ Cluster cluster = createNiceMock(Cluster.class);
+ RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+ expect(repositoryVersion.getVersion()).andReturn("2.3.4.0").atLeastOnce();
+
+ Service serviceHdfs = createNiceMock(Service.class);
+ expect(serviceHdfs.getName()).andReturn("HDFS").atLeastOnce();
+ expect(serviceHdfs.getDisplayName()).andReturn("HDFS").atLeastOnce();
+ expect(serviceHdfs.getDesiredRepositoryVersion()).andReturn(repositoryVersion).atLeastOnce();
+
+ Service serviceHBase = createNiceMock(Service.class);
+ expect(serviceHBase.getName()).andReturn("HBASE").atLeastOnce();
+ expect(serviceHBase.getDisplayName()).andReturn("HBase").atLeastOnce();
+ expect(serviceHBase.getDesiredRepositoryVersion()).andReturn(repositoryVersion).atLeastOnce();
+
+ // !!! should never be accessed as it's not in any VDF
+ Service serviceAMS = createNiceMock(Service.class);
+
+ expect(cluster.getServices()).andReturn(ImmutableMap.<String, Service>builder()
+ .put("HDFS", serviceHdfs)
+ .put("HBASE", serviceHBase)
+ .put("AMBARI_METRICS", serviceAMS).build()).atLeastOnce();
+
+
+ replay(cluster, repositoryVersion, serviceHdfs, serviceHBase);
+
+ File f = new File("src/test/resources/version_definition_test_all_services.xml");
+ VersionDefinitionXml xml = VersionDefinitionXml.load(f.toURI().toURL());
+ ClusterVersionSummary summary = xml.getClusterSummary(cluster);
+ assertEquals(2, summary.getAvailableServiceNames().size());
+
+ f = new File("src/test/resources/version_definition_test_maint.xml");
+ xml = VersionDefinitionXml.load(f.toURI().toURL());
+ summary = xml.getClusterSummary(cluster);
+ assertEquals(0, summary.getAvailableServiceNames().size());
+
+ f = new File("src/test/resources/version_definition_test_maint_partial.xml");
+ xml = VersionDefinitionXml.load(f.toURI().toURL());
+ summary = xml.getClusterSummary(cluster);
+ assertEquals(1, summary.getAvailableServiceNames().size());
+
+ }
+
private static ServiceInfo makeService(final String name) {
return new ServiceInfo() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/test/resources/version_definition_test_maint.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/version_definition_test_maint.xml b/ambari-server/src/test/resources/version_definition_test_maint.xml
index ac21045..430182c 100644
--- a/ambari-server/src/test/resources/version_definition_test_maint.xml
+++ b/ambari-server/src/test/resources/version_definition_test_maint.xml
@@ -29,7 +29,7 @@
</release>
<manifest>
- <service id="HDFS-271" name="HDFS" version="2.7.1" version-id="10" release-version="2.3.3" />
+ <service id="HDFS-271" name="HDFS" version="2.7.1" version-id="10" release-version="2.3.4.0" />
<service id="HIVE-200" name="HIVE" version="2.0.0" />
<service id="HIVE-110" name="HIVE" version="1.1.0" release-version="1.0.9" />
<service id="HBASE-899" name="HBASE" version="8.9.9" />
http://git-wip-us.apache.org/repos/asf/ambari/blob/f01c32ed/ambari-server/src/test/resources/version_definition_test_maint_partial.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/version_definition_test_maint_partial.xml b/ambari-server/src/test/resources/version_definition_test_maint_partial.xml
new file mode 100644
index 0000000..c8692c9
--- /dev/null
+++ b/ambari-server/src/test/resources/version_definition_test_maint_partial.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+-->
+
+<repository-version xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="version_definition.xsd">
+
+ <release>
+ <type>MAINT</type>
+ <stack-id>HDP-2.3</stack-id>
+ <version>2.3.4.1</version>
+ <build>1234</build>
+ <compatible-with>2.3.4.[1-9]</compatible-with>
+ <release-notes>http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.4/</release-notes>
+ </release>
+
+ <manifest>
+ <service id="HDFS-271" name="HDFS" version="2.7.1" version-id="10" release-version="2.3.4.0" />
+ <service id="HBASE-899" name="HBASE" version="8.9.9" />
+ </manifest>
+
+ <available-services />
+
+ <repository-info>
+ <os family="redhat6">
+ <repo>
+ <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0</baseurl>
+ <repoid>HDP-2.3</repoid>
+ <reponame>HDP</reponame>
+ <unique>true</unique>
+ </repo>
+ <repo>
+ <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6</baseurl>
+ <repoid>HDP-UTILS-1.1.0.20</repoid>
+ <reponame>HDP-UTILS</reponame>
+ <unique>false</unique>
+ </repo>
+ </os>
+ </repository-info>
+</repository-version>
[03/50] [abbrv] ambari git commit: AMBARI-21581 - Replace Hard Coded
conf-select Structures (jonathanhurley)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
index 8a6a6d3..b42d14e 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
@@ -28,7 +28,6 @@ from ambari_commons.os_utils import copy_file, extract_path_component
from resource_management.core.exceptions import ClientComponentHasNoStatus
from resource_management.core.source import InlineTemplate
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -77,7 +76,6 @@ class TezClientLinux(TezClient):
# Because this script was called from ru_execute_tasks.py which already enters an Environment with its own basedir,
# must change it now so this function can find the Jinja Templates for the service.
env.config.basedir = base_dir
- conf_select.select(params.stack_name, conf_select_name, params.version)
self.configure(env, config_dir=config_dir)
def pre_upgrade_restart(self, env, upgrade_type=None):
@@ -85,8 +83,6 @@ class TezClientLinux(TezClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "tez", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
index a435b80..2aec6ba 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
@@ -20,7 +20,7 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions import check_process_status
@@ -72,7 +72,6 @@ class ApplicationTimelineServerDefault(ApplicationTimelineServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def status(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
index 30045f8..a93bc17 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.py
@@ -21,7 +21,7 @@ Ambari Agent
from resource_management.libraries.script.script import Script
from resource_management.libraries.resources.hdfs_resource import HdfsResource
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -74,7 +74,6 @@ class HistoryServerDefault(HistoryServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
# MC Hammer said, "Can't touch this"
copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
index efcb2da..234e931 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/mapreduce2_client.py
@@ -24,7 +24,7 @@ import sys
# Local imports
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -66,12 +66,9 @@ class MapReduce2Client(Script):
config_dir = self.get_config_dir_during_stack_upgrade(env, base_dir, conf_select_name)
if config_dir:
- Logger.info("stack_upgrade_save_new_config(): Calling conf-select on %s using version %s" % (conf_select_name, str(params.version)))
-
# Because this script was called from ru_execute_tasks.py which already enters an Environment with its own basedir,
# must change it now so this function can find the Jinja Templates for the service.
env.config.basedir = base_dir
- conf_select.select(params.stack_name, conf_select_name, params.version)
self.configure(env, config_dir=config_dir)
@@ -87,7 +84,6 @@ class MapReduce2ClientDefault(MapReduce2Client):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
index ed83402..280fc2f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
@@ -22,7 +22,7 @@ Ambari Agent
import nodemanager_upgrade
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -72,7 +72,6 @@ class NodemanagerDefault(Nodemanager):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
index ecaea4c..7885c94 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
@@ -20,7 +20,6 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -111,7 +110,6 @@ class ResourcemanagerDefault(Resourcemanager):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
index ef4f7ea..b6a89b4 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn_client.py
@@ -21,7 +21,7 @@ Ambari Agent
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -56,7 +56,6 @@ class YarnClientDefault(YarnClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/application_timeline_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/application_timeline_server.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/application_timeline_server.py
index a435b80..2aec6ba 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/application_timeline_server.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/application_timeline_server.py
@@ -20,7 +20,7 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions import check_process_status
@@ -72,7 +72,6 @@ class ApplicationTimelineServerDefault(ApplicationTimelineServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def status(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/historyserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/historyserver.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/historyserver.py
index 3938c15..d89e5b5 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/historyserver.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/historyserver.py
@@ -21,7 +21,7 @@ Ambari Agent
from resource_management.libraries.script.script import Script
from resource_management.libraries.resources.hdfs_resource import HdfsResource
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -74,7 +74,6 @@ class HistoryServerDefault(HistoryServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
# MC Hammer said, "Can't touch this"
copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/mapreduce2_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/mapreduce2_client.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/mapreduce2_client.py
index efcb2da..79e3158 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/mapreduce2_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/mapreduce2_client.py
@@ -24,7 +24,7 @@ import sys
# Local imports
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -71,7 +71,6 @@ class MapReduce2Client(Script):
# Because this script was called from ru_execute_tasks.py which already enters an Environment with its own basedir,
# must change it now so this function can find the Jinja Templates for the service.
env.config.basedir = base_dir
- conf_select.select(params.stack_name, conf_select_name, params.version)
self.configure(env, config_dir=config_dir)
@@ -87,7 +86,6 @@ class MapReduce2ClientDefault(MapReduce2Client):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/nodemanager.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/nodemanager.py
index ed83402..280fc2f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/nodemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/nodemanager.py
@@ -22,7 +22,7 @@ Ambari Agent
import nodemanager_upgrade
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -72,7 +72,6 @@ class NodemanagerDefault(Nodemanager):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/resourcemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/resourcemanager.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/resourcemanager.py
index 4ceff1c..55214f6 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/resourcemanager.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/resourcemanager.py
@@ -20,7 +20,6 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -111,7 +110,6 @@ class ResourcemanagerDefault(Resourcemanager):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def disable_security(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn_client.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn_client.py
index ef4f7ea..b6a89b4 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn_client.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn_client.py
@@ -21,7 +21,7 @@ Ambari Agent
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -56,7 +56,6 @@ class YarnClientDefault(YarnClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
index f8f6e3d..7f506c5 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
@@ -30,7 +30,6 @@ from resource_management.core.source import StaticFile
from resource_management.libraries import XmlConfig
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.decorator import retry
@@ -251,7 +250,6 @@ class Master(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)):
- conf_select.select(params.stack_name, "zeppelin", params.version)
stack_select.select_packages(params.version)
def set_interpreter_settings(self, config_data):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.3.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.3.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.3.0/package/scripts/master.py
index c4fdfcc..ab798ec 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.3.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.3.0/package/scripts/master.py
@@ -30,7 +30,6 @@ from resource_management.core.source import StaticFile
from resource_management.libraries import XmlConfig
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.decorator import retry
@@ -253,7 +252,6 @@ class Master(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)):
- conf_select.select(params.stack_name, "zeppelin", params.version)
stack_select.select_packages(params.version)
def set_interpreter_settings(self, config_data):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py
index e52522a..39daea4 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_client.py
@@ -21,7 +21,7 @@ Ambari Agent
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.version import format_stack_version
from resource_management.libraries.functions.format import format
@@ -67,7 +67,6 @@ class ZookeeperClientLinux(ZookeeperClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)):
- conf_select.select(params.stack_name, "zookeeper", params.version)
stack_select.select_packages(params.version)
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py
index 8d6acd9..f0e4ab9 100644
--- a/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py
+++ b/ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5/package/scripts/zookeeper_server.py
@@ -24,7 +24,6 @@ from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import get_unique_id_and_date
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.version import format_stack_version
@@ -74,7 +73,6 @@ class ZookeeperServerLinux(ZookeeperServer):
env.set_params(params)
if check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)):
- conf_select.select(params.stack_name, "zookeeper", params.version)
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index eb3fb5d..ef5607e 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -205,10 +205,6 @@ class InstallPackages(Script):
Link("/usr/bin/conf-select", to = "/usr/bin/hdfconf-select")
for package_name, directories in conf_select.get_package_dirs().iteritems():
- conf_selector_name = stack_tools.get_stack_tool_name(stack_tools.CONF_SELECTOR_NAME)
- Logger.info("The current cluster stack of {0} does not require backing up configurations; "
- "only {1} versioned config directories will be created.".format(stack_version, conf_selector_name))
- # only link configs for all known packages
conf_select.select(self.stack_name, package_name, stack_version, ignore_errors = True)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/custom_actions/scripts/ru_set_all.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/ru_set_all.py b/ambari-server/src/main/resources/custom_actions/scripts/ru_set_all.py
index 95f7323..ef9ea29 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/ru_set_all.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/ru_set_all.py
@@ -79,7 +79,6 @@ class UpgradeSetAll(Script):
link_config(dir_def['conf_dir'], dir_def['current_dir'])
-
def is_host_skippable(stack_selector_path, formatted_version):
"""
Gets whether this host should not have the stack select tool called.
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
index 1915e9f..45f3b42 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
@@ -262,14 +262,14 @@ gpgcheck=0</value>
</value-attributes>
<on-ambari-upgrade add="true"/>
</property>
- <!-- Define stack_select_packages property in the base stack. DO NOT override this property for each stack version -->
+ <!-- Define stack_packages property in the base stack. DO NOT override this property for each stack version -->
<property>
- <name>stack_select_packages</name>
+ <name>stack_packages</name>
<value/>
<description>Associations between component and stack-select tools.</description>
<property-type>VALUE_FROM_PROPERTY_FILE</property-type>
<value-attributes>
- <property-file-name>stack_select_packages.json</property-file-name>
+ <property-file-name>stack_packages.json</property-file-name>
<property-file-type>json</property-file-type>
<read-only>true</read-only>
<overridable>false</overridable>
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
index 8b61a93..daaffd8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -50,8 +50,8 @@ def setup_stack_symlinks(struct_out_file):
return
# get the packages which the stack-select tool should be used on
- stack_select_packages = stack_select.get_packages(stack_select.PACKAGE_SCOPE_INSTALL)
- if stack_select_packages is None:
+ stack_packages = stack_select.get_packages(stack_select.PACKAGE_SCOPE_INSTALL)
+ if stack_packages is None:
return
json_version = load_version(struct_out_file)
@@ -62,7 +62,7 @@ def setup_stack_symlinks(struct_out_file):
# On parallel command execution this should be executed by a single process at a time.
with FcntlBasedProcessLock(params.stack_select_lock_file, enabled = params.is_parallel_execution_enabled, skip_fcntl_failures = True):
- for package in stack_select_packages:
+ for package in stack_packages:
stack_select.select(package, json_version)
@@ -123,10 +123,6 @@ def link_configs(struct_out_file):
"""
import params
- if not Script.is_stack_greater_or_equal("2.3"):
- Logger.info("Can only link configs for HDP-2.3 and higher.")
- return
-
json_version = load_version(struct_out_file)
if not json_version:
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
new file mode 100644
index 0000000..704fb54
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -0,0 +1,1146 @@
+{
+ "HDP": {
+ "stack-select": {
+ "ACCUMULO": {
+ "ACCUMULO_CLIENT": {
+ "STACK-SELECT-PACKAGE": "accumulo-client",
+ "INSTALL": [
+ "accumulo-client"
+ ],
+ "PATCH": [
+ "accumulo-client"
+ ],
+ "STANDARD": [
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_GC": {
+ "STACK-SELECT-PACKAGE": "accumulo-gc",
+ "INSTALL": [
+ "accumulo-gc"
+ ],
+ "PATCH": [
+ "accumulo-gc"
+ ],
+ "STANDARD": [
+ "accumulo-gc",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_MASTER": {
+ "STACK-SELECT-PACKAGE": "accumulo-master",
+ "INSTALL": [
+ "accumulo-master"
+ ],
+ "PATCH": [
+ "accumulo-master"
+ ],
+ "STANDARD": [
+ "accumulo-master",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_MONITOR": {
+ "STACK-SELECT-PACKAGE": "accumulo-monitor",
+ "INSTALL": [
+ "accumulo-monitor"
+ ],
+ "PATCH": [
+ "accumulo-monitor"
+ ],
+ "STANDARD": [
+ "accumulo-monitor",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_TRACER": {
+ "STACK-SELECT-PACKAGE": "accumulo-tracer",
+ "INSTALL": [
+ "accumulo-tracer"
+ ],
+ "PATCH": [
+ "accumulo-tracer"
+ ],
+ "STANDARD": [
+ "accumulo-tracer",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_TSERVER": {
+ "STACK-SELECT-PACKAGE": "accumulo-tablet",
+ "INSTALL": [
+ "accumulo-tablet"
+ ],
+ "PATCH": [
+ "accumulo-tablet"
+ ],
+ "STANDARD": [
+ "accumulo-tablet",
+ "accumulo-client"
+ ]
+ }
+ },
+ "ATLAS": {
+ "ATLAS_CLIENT": {
+ "STACK-SELECT-PACKAGE": "atlas-client",
+ "INSTALL": [
+ "atlas-client"
+ ],
+ "PATCH": [
+ "atlas-client"
+ ],
+ "STANDARD": [
+ "atlas-client"
+ ]
+ },
+ "ATLAS_SERVER": {
+ "STACK-SELECT-PACKAGE": "atlas-server",
+ "INSTALL": [
+ "atlas-server"
+ ],
+ "PATCH": [
+ "atlas-server"
+ ],
+ "STANDARD": [
+ "atlas-server"
+ ]
+ }
+ },
+ "DRUID": {
+ "DRUID_COORDINATOR": {
+ "STACK-SELECT-PACKAGE": "druid-coordinator",
+ "INSTALL": [
+ "druid-coordinator"
+ ],
+ "PATCH": [
+ "druid-coordinator"
+ ],
+ "STANDARD": [
+ "druid-coordinator"
+ ]
+ },
+ "DRUID_OVERLORD": {
+ "STACK-SELECT-PACKAGE": "druid-overlord",
+ "INSTALL": [
+ "druid-overlord"
+ ],
+ "PATCH": [
+ "druid-overlord"
+ ],
+ "STANDARD": [
+ "druid-overlord"
+ ]
+ },
+ "DRUID_HISTORICAL": {
+ "STACK-SELECT-PACKAGE": "druid-historical",
+ "INSTALL": [
+ "druid-historical"
+ ],
+ "PATCH": [
+ "druid-historical"
+ ],
+ "STANDARD": [
+ "druid-historical"
+ ]
+ },
+ "DRUID_BROKER": {
+ "STACK-SELECT-PACKAGE": "druid-broker",
+ "INSTALL": [
+ "druid-broker"
+ ],
+ "PATCH": [
+ "druid-broker"
+ ],
+ "STANDARD": [
+ "druid-broker"
+ ]
+ },
+ "DRUID_MIDDLEMANAGER": {
+ "STACK-SELECT-PACKAGE": "druid-middlemanager",
+ "INSTALL": [
+ "druid-middlemanager"
+ ],
+ "PATCH": [
+ "druid-middlemanager"
+ ],
+ "STANDARD": [
+ "druid-middlemanager"
+ ]
+ },
+ "DRUID_ROUTER": {
+ "STACK-SELECT-PACKAGE": "druid-router",
+ "INSTALL": [
+ "druid-router"
+ ],
+ "PATCH": [
+ "druid-router"
+ ],
+ "STANDARD": [
+ "druid-router"
+ ]
+ },
+ "DRUID_SUPERSET": {
+ "STACK-SELECT-PACKAGE": "druid-superset",
+ "INSTALL": [
+ "druid-superset"
+ ],
+ "PATCH": [
+ "druid-superset"
+ ],
+ "STANDARD": [
+ "druid-superset"
+ ]
+ }
+ },
+ "FALCON": {
+ "FALCON_CLIENT": {
+ "STACK-SELECT-PACKAGE": "falcon-client",
+ "INSTALL": [
+ "falcon-client"
+ ],
+ "PATCH": [
+ "falcon-client"
+ ],
+ "STANDARD": [
+ "falcon-client"
+ ]
+ },
+ "FALCON_SERVER": {
+ "STACK-SELECT-PACKAGE": "falcon-server",
+ "INSTALL": [
+ "falcon-server"
+ ],
+ "PATCH": [
+ "falcon-server"
+ ],
+ "STANDARD": [
+ "falcon-server"
+ ]
+ }
+ },
+ "FLUME": {
+ "FLUME_HANDLER": {
+ "STACK-SELECT-PACKAGE": "flume-server",
+ "INSTALL": [
+ "flume-server"
+ ],
+ "PATCH": [
+ "flume-server"
+ ],
+ "STANDARD": [
+ "flume-server"
+ ]
+ }
+ },
+ "HBASE": {
+ "HBASE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hbase-client",
+ "INSTALL": [
+ "hbase-client"
+ ],
+ "PATCH": [
+ "hbase-client"
+ ],
+ "STANDARD": [
+ "hbase-client",
+ "phoenix-client",
+ "hadoop-client"
+ ]
+ },
+ "HBASE_MASTER": {
+ "STACK-SELECT-PACKAGE": "hbase-master",
+ "INSTALL": [
+ "hbase-master"
+ ],
+ "PATCH": [
+ "hbase-master"
+ ],
+ "STANDARD": [
+ "hbase-master"
+ ]
+ },
+ "HBASE_REGIONSERVER": {
+ "STACK-SELECT-PACKAGE": "hbase-regionserver",
+ "INSTALL": [
+ "hbase-regionserver"
+ ],
+ "PATCH": [
+ "hbase-regionserver"
+ ],
+ "STANDARD": [
+ "hbase-regionserver"
+ ]
+ },
+ "PHOENIX_QUERY_SERVER": {
+ "STACK-SELECT-PACKAGE": "phoenix-server",
+ "INSTALL": [
+ "phoenix-server"
+ ],
+ "PATCH": [
+ "phoenix-server"
+ ],
+ "STANDARD": [
+ "phoenix-server"
+ ]
+ }
+ },
+ "HDFS": {
+ "DATANODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-datanode",
+ "INSTALL": [
+ "hadoop-hdfs-datanode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-datanode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-datanode"
+ ]
+ },
+ "HDFS_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ },
+ "NAMENODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-namenode",
+ "INSTALL": [
+ "hadoop-hdfs-namenode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-namenode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-namenode"
+ ]
+ },
+ "NFS_GATEWAY": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-nfs3",
+ "INSTALL": [
+ "hadoop-hdfs-nfs3"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-nfs3"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-nfs3"
+ ]
+ },
+ "JOURNALNODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-journalnode",
+ "INSTALL": [
+ "hadoop-hdfs-journalnode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-journalnode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-journalnode"
+ ]
+ },
+ "SECONDARY_NAMENODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-secondarynamenode",
+ "INSTALL": [
+ "hadoop-hdfs-secondarynamenode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-secondarynamenode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-secondarynamenode"
+ ]
+ },
+ "ZKFC": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-zkfc",
+ "INSTALL": [
+ "hadoop-hdfs-zkfc"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-zkfc"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-zkfc"
+ ]
+ }
+ },
+ "HIVE": {
+ "HCAT": {
+ "STACK-SELECT-PACKAGE": "hive-webhcat",
+ "INSTALL": [
+ "hive-webhcat"
+ ],
+ "PATCH": [
+ "hive-webhcat"
+ ],
+ "STANDARD": [
+ "hive-webhcat"
+ ]
+ },
+ "HIVE_METASTORE": {
+ "STACK-SELECT-PACKAGE": "hive-metastore",
+ "INSTALL": [
+ "hive-metastore"
+ ],
+ "PATCH": [
+ "hive-metastore"
+ ],
+ "STANDARD": [
+ "hive-metastore"
+ ]
+ },
+ "HIVE_SERVER": {
+ "STACK-SELECT-PACKAGE": "hive-server2",
+ "INSTALL": [
+ "hive-server2"
+ ],
+ "PATCH": [
+ "hive-server2"
+ ],
+ "STANDARD": [
+ "hive-server2"
+ ]
+ },
+ "HIVE_SERVER_INTERACTIVE": {
+ "STACK-SELECT-PACKAGE": "hive-server2-hive2",
+ "INSTALL": [
+ "hive-server2-hive2"
+ ],
+ "PATCH": [
+ "hive-server2-hive2"
+ ],
+ "STANDARD": [
+ "hive-server2-hive2"
+ ]
+ },
+ "HIVE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ },
+ "WEBHCAT_SERVER": {
+ "STACK-SELECT-PACKAGE": "hive-webhcat",
+ "INSTALL": [
+ "hive-webhcat"
+ ],
+ "PATCH": [
+ "hive-webhcat"
+ ],
+ "STANDARD": [
+ "hive-webhcat"
+ ]
+ }
+ },
+ "KAFKA": {
+ "KAFKA_BROKER": {
+ "STACK-SELECT-PACKAGE": "kafka-broker",
+ "INSTALL": [
+ "kafka-broker"
+ ],
+ "PATCH": [
+ "kafka-broker"
+ ],
+ "STANDARD": [
+ "kafka-broker"
+ ]
+ }
+ },
+ "KNOX": {
+ "KNOX_GATEWAY": {
+ "STACK-SELECT-PACKAGE": "knox-server",
+ "INSTALL": [
+ "knox-server"
+ ],
+ "PATCH": [
+ "knox-server"
+ ],
+ "STANDARD": [
+ "knox-server"
+ ]
+ }
+ },
+ "MAHOUT": {
+ "MAHOUT": {
+ "STACK-SELECT-PACKAGE": "mahout-client",
+ "INSTALL": [
+ "mahout-client"
+ ],
+ "PATCH": [
+ "mahout-client"
+ ],
+ "STANDARD": [
+ "mahout-client"
+ ]
+ }
+ },
+ "MAPREDUCE2": {
+ "HISTORYSERVER": {
+ "STACK-SELECT-PACKAGE": "hadoop-mapreduce-historyserver",
+ "INSTALL": [
+ "hadoop-mapreduce-historyserver"
+ ],
+ "PATCH": [
+ "hadoop-mapreduce-historyserver"
+ ],
+ "STANDARD": [
+ "hadoop-mapreduce-historyserver"
+ ]
+ },
+ "MAPREDUCE2_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "hadoop-mapreduce-INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "OOZIE": {
+ "OOZIE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "oozie-client",
+ "INSTALL": [
+ "oozie-client"
+ ],
+ "PATCH": [
+ "oozie-client"
+ ],
+ "STANDARD": [
+ "oozie-client"
+ ]
+ },
+ "OOZIE_SERVER": {
+ "STACK-SELECT-PACKAGE": "oozie-server",
+ "INSTALL": [
+ "oozie-client",
+ "oozie-server"
+ ],
+ "PATCH": [
+ "oozie-server"
+ ],
+ "STANDARD": [
+ "oozie-client",
+ "oozie-server"
+ ]
+ }
+ },
+ "PIG": {
+ "PIG": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "R4ML": {
+ "R4ML": {
+ "STACK-SELECT-PACKAGE": "r4ml-client",
+ "INSTALL": [
+ "r4ml-client"
+ ],
+ "PATCH": [
+ "r4ml-client"
+ ],
+ "STANDARD": [
+ "r4ml-client"
+ ]
+ }
+ },
+ "RANGER": {
+ "RANGER_ADMIN": {
+ "STACK-SELECT-PACKAGE": "ranger-admin",
+ "INSTALL": [
+ "ranger-admin"
+ ],
+ "PATCH": [
+ "ranger-admin"
+ ],
+ "STANDARD": [
+ "ranger-admin"
+ ]
+ },
+ "RANGER_TAGSYNC": {
+ "STACK-SELECT-PACKAGE": "ranger-tagsync",
+ "INSTALL": [
+ "ranger-tagsync"
+ ],
+ "PATCH": [
+ "ranger-tagsync"
+ ],
+ "STANDARD": [
+ "ranger-tagsync"
+ ]
+ },
+ "RANGER_USERSYNC": {
+ "STACK-SELECT-PACKAGE": "ranger-usersync",
+ "INSTALL": [
+ "ranger-usersync"
+ ],
+ "PATCH": [
+ "ranger-usersync"
+ ],
+ "STANDARD": [
+ "ranger-usersync"
+ ]
+ }
+ },
+ "RANGER_KMS": {
+ "RANGER_KMS_SERVER": {
+ "STACK-SELECT-PACKAGE": "ranger-kms",
+ "INSTALL": [
+ "ranger-kms"
+ ],
+ "PATCH": [
+ "ranger-kms"
+ ],
+ "STANDARD": [
+ "ranger-kms"
+ ]
+ }
+ },
+ "SLIDER": {
+ "SLIDER": {
+ "STACK-SELECT-PACKAGE": "slider-client",
+ "INSTALL": [
+ "slider-client"
+ ],
+ "PATCH": [
+ "slider-client"
+ ],
+ "STANDARD": [
+ "slider-client",
+ "hadoop-client"
+ ]
+ }
+ },
+ "SPARK": {
+ "LIVY_SERVER": {
+ "STACK-SELECT-PACKAGE": "livy-server",
+ "INSTALL": [
+ "livy-server"
+ ],
+ "PATCH": [
+ "livy-server"
+ ],
+ "STANDARD": [
+ "livy-server"
+ ]
+ },
+ "SPARK_CLIENT": {
+ "STACK-SELECT-PACKAGE": "spark-client",
+ "INSTALL": [
+ "spark-client"
+ ],
+ "PATCH": [
+ "spark-client"
+ ],
+ "STANDARD": [
+ "spark-client"
+ ]
+ },
+ "SPARK_JOBHISTORYSERVER": {
+ "STACK-SELECT-PACKAGE": "spark-historyserver",
+ "INSTALL": [
+ "spark-historyserver"
+ ],
+ "PATCH": [
+ "spark-historyserver"
+ ],
+ "STANDARD": [
+ "spark-historyserver"
+ ]
+ },
+ "SPARK_THRIFTSERVER": {
+ "STACK-SELECT-PACKAGE": "spark-thriftserver",
+ "INSTALL": [
+ "spark-thriftserver"
+ ],
+ "PATCH": [
+ "spark-thriftserver"
+ ],
+ "STANDARD": [
+ "spark-thriftserver"
+ ]
+ }
+ },
+ "SPARK2": {
+ "LIVY2_SERVER": {
+ "STACK-SELECT-PACKAGE": "livy2-server",
+ "INSTALL": [
+ "livy2-server"
+ ],
+ "PATCH": [
+ "livy2-server"
+ ],
+ "STANDARD": [
+ "livy2-server"
+ ]
+ },
+ "SPARK2_CLIENT": {
+ "STACK-SELECT-PACKAGE": "spark2-client",
+ "INSTALL": [
+ "spark2-client"
+ ],
+ "PATCH": [
+ "spark2-client"
+ ],
+ "STANDARD": [
+ "spark2-client"
+ ]
+ },
+ "SPARK2_JOBHISTORYSERVER": {
+ "STACK-SELECT-PACKAGE": "spark2-historyserver",
+ "INSTALL": [
+ "spark2-historyserver"
+ ],
+ "PATCH": [
+ "spark2-historyserver"
+ ],
+ "STANDARD": [
+ "spark2-historyserver"
+ ]
+ },
+ "SPARK2_THRIFTSERVER": {
+ "STACK-SELECT-PACKAGE": "spark2-thriftserver",
+ "INSTALL": [
+ "spark2-thriftserver"
+ ],
+ "PATCH": [
+ "spark2-thriftserver"
+ ],
+ "STANDARD": [
+ "spark2-thriftserver"
+ ]
+ }
+ },
+ "SQOOP": {
+ "SQOOP": {
+ "STACK-SELECT-PACKAGE": "sqoop-client",
+ "INSTALL": [
+ "sqoop-client"
+ ],
+ "PATCH": [
+ "sqoop-client"
+ ],
+ "STANDARD": [
+ "sqoop-client"
+ ]
+ }
+ },
+ "STORM": {
+ "NIMBUS": {
+ "STACK-SELECT-PACKAGE": "storm-nimbus",
+ "INSTALL": [
+ "storm-client",
+ "storm-nimbus"
+ ],
+ "PATCH": [
+ "storm-client",
+ "storm-nimbus"
+ ],
+ "STANDARD": [
+ "storm-client",
+ "storm-nimbus"
+ ]
+ },
+ "SUPERVISOR": {
+ "STACK-SELECT-PACKAGE": "storm-supervisor",
+ "INSTALL": [
+ "storm-supervisor"
+ ],
+ "PATCH": [
+ "storm-supervisor"
+ ],
+ "STANDARD": [
+ "storm-client",
+ "storm-supervisor"
+ ]
+ },
+ "DRPC_SERVER": {
+ "STACK-SELECT-PACKAGE": "storm-client",
+ "INSTALL": [
+ "storm-client"
+ ],
+ "PATCH": [
+ "storm-client"
+ ],
+ "STANDARD": [
+ "storm-client"
+ ]
+ },
+ "STORM_UI_SERVER": {
+ "STACK-SELECT-PACKAGE": "storm-client",
+ "INSTALL": [
+ "storm-client"
+ ],
+ "PATCH": [
+ "storm-client"
+ ],
+ "STANDARD": [
+ "storm-client"
+ ]
+ }
+ },
+ "SYSTEMML": {
+ "SYSTEMML": {
+ "STACK-SELECT-PACKAGE": "systemml-client",
+ "INSTALL": [
+ "systemml-client"
+ ],
+ "PATCH": [
+ "systemml-client"
+ ],
+ "STANDARD": [
+ "systemml-client"
+ ]
+ }
+ },
+ "TEZ": {
+ "TEZ_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "TITAN": {
+ "TITAN_CLIENT": {
+ "STACK-SELECT-PACKAGE": "titan-client",
+ "INSTALL": [
+ "titan-client"
+ ],
+ "PATCH": [
+ "titan-client"
+ ],
+ "STANDARD": [
+ "titan-client"
+ ]
+ },
+ "TITAN_SERVER": {
+ "STACK-SELECT-PACKAGE": "titan-server",
+ "INSTALL": [
+ "titan-server"
+ ],
+ "PATCH": [
+ "titan-server"
+ ],
+ "STANDARD": [
+ "titan-server"
+ ]
+ }
+ },
+ "YARN": {
+ "APP_TIMELINE_SERVER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-timelineserver",
+ "INSTALL": [
+ "hadoop-yarn-timelineserver"
+ ],
+ "PATCH": [
+ "hadoop-yarn-timelineserver"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-timelineserver"
+ ]
+ },
+ "NODEMANAGER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-nodemanager",
+ "INSTALL": [
+ "hadoop-yarn-nodemanager"
+ ],
+ "PATCH": [
+ "hadoop-yarn-nodemanager"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-nodemanager"
+ ]
+ },
+ "RESOURCEMANAGER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-resourcemanager",
+ "INSTALL": [
+ "hadoop-yarn-resourcemanager"
+ ],
+ "PATCH": [
+ "hadoop-yarn-resourcemanager"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-resourcemanager"
+ ]
+ },
+ "YARN_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "ZEPPELIN": {
+ "ZEPPELIN_MASTER": {
+ "STACK-SELECT-PACKAGE": "zeppelin-server",
+ "INSTALL": [
+ "zeppelin-server"
+ ],
+ "PATCH": [
+ "zeppelin-server"
+ ],
+ "STANDARD": [
+ "zeppelin-server"
+ ]
+ }
+ },
+ "ZOOKEEPER": {
+ "ZOOKEEPER_CLIENT": {
+ "STACK-SELECT-PACKAGE": "zookeeper-client",
+ "INSTALL": [
+ "zookeeper-client"
+ ],
+ "PATCH": [
+ "zookeeper-client"
+ ],
+ "STANDARD": [
+ "zookeeper-client"
+ ]
+ },
+ "ZOOKEEPER_SERVER": {
+ "STACK-SELECT-PACKAGE": "zookeeper-server",
+ "INSTALL": [
+ "zookeeper-server"
+ ],
+ "PATCH": [
+ "zookeeper-server"
+ ],
+ "STANDARD": [
+ "zookeeper-server"
+ ]
+ }
+ }
+ },
+ "conf-select": {
+ "accumulo": [
+ {
+ "conf_dir": "/etc/accumulo/conf",
+ "current_dir": "{0}/current/accumulo-client/conf"
+ }
+ ],
+ "atlas": [
+ {
+ "conf_dir": "/etc/atlas/conf",
+ "current_dir": "{0}/current/atlas-client/conf"
+ }
+ ],
+ "druid": [
+ {
+ "conf_dir": "/etc/druid/conf",
+ "current_dir": "{0}/current/druid-overlord/conf"
+ }
+ ],
+ "falcon": [
+ {
+ "conf_dir": "/etc/falcon/conf",
+ "current_dir": "{0}/current/falcon-client/conf"
+ }
+ ],
+ "flume": [
+ {
+ "conf_dir": "/etc/flume/conf",
+ "current_dir": "{0}/current/flume-server/conf"
+ }
+ ],
+ "hadoop": [
+ {
+ "conf_dir": "/etc/hadoop/conf",
+ "current_dir": "{0}/current/hadoop-client/conf"
+ }
+ ],
+ "hbase": [
+ {
+ "conf_dir": "/etc/hbase/conf",
+ "current_dir": "{0}/current/hbase-client/conf"
+ }
+ ],
+ "hive": [
+ {
+ "conf_dir": "/etc/hive/conf",
+ "current_dir": "{0}/current/hive-client/conf"
+ }
+ ],
+ "hive2": [
+ {
+ "conf_dir": "/etc/hive2/conf",
+ "current_dir": "{0}/current/hive-server2-hive2/conf"
+ }
+ ],
+ "hive-hcatalog": [
+ {
+ "conf_dir": "/etc/hive-webhcat/conf",
+ "prefix": "/etc/hive-webhcat",
+ "current_dir": "{0}/current/hive-webhcat/etc/webhcat"
+ },
+ {
+ "conf_dir": "/etc/hive-hcatalog/conf",
+ "prefix": "/etc/hive-hcatalog",
+ "current_dir": "{0}/current/hive-webhcat/etc/hcatalog"
+ }
+ ],
+ "kafka": [
+ {
+ "conf_dir": "/etc/kafka/conf",
+ "current_dir": "{0}/current/kafka-broker/conf"
+ }
+ ],
+ "knox": [
+ {
+ "conf_dir": "/etc/knox/conf",
+ "current_dir": "{0}/current/knox-server/conf"
+ }
+ ],
+ "mahout": [
+ {
+ "conf_dir": "/etc/mahout/conf",
+ "current_dir": "{0}/current/mahout-client/conf"
+ }
+ ],
+ "nifi": [
+ {
+ "conf_dir": "/etc/nifi/conf",
+ "current_dir": "{0}/current/nifi/conf"
+ }
+ ],
+ "oozie": [
+ {
+ "conf_dir": "/etc/oozie/conf",
+ "current_dir": "{0}/current/oozie-client/conf"
+ }
+ ],
+ "phoenix": [
+ {
+ "conf_dir": "/etc/phoenix/conf",
+ "current_dir": "{0}/current/phoenix-client/conf"
+ }
+ ],
+ "pig": [
+ {
+ "conf_dir": "/etc/pig/conf",
+ "current_dir": "{0}/current/pig-client/conf"
+ }
+ ],
+ "ranger-admin": [
+ {
+ "conf_dir": "/etc/ranger/admin/conf",
+ "current_dir": "{0}/current/ranger-admin/conf"
+ }
+ ],
+ "ranger-kms": [
+ {
+ "conf_dir": "/etc/ranger/kms/conf",
+ "current_dir": "{0}/current/ranger-kms/conf"
+ }
+ ],
+ "ranger-tagsync": [
+ {
+ "conf_dir": "/etc/ranger/tagsync/conf",
+ "current_dir": "{0}/current/ranger-tagsync/conf"
+ }
+ ],
+ "ranger-usersync": [
+ {
+ "conf_dir": "/etc/ranger/usersync/conf",
+ "current_dir": "{0}/current/ranger-usersync/conf"
+ }
+ ],
+ "slider": [
+ {
+ "conf_dir": "/etc/slider/conf",
+ "current_dir": "{0}/current/slider-client/conf"
+ }
+ ],
+ "spark": [
+ {
+ "conf_dir": "/etc/spark/conf",
+ "current_dir": "{0}/current/spark-client/conf"
+ }
+ ],
+ "spark2": [
+ {
+ "conf_dir": "/etc/spark2/conf",
+ "current_dir": "{0}/current/spark2-client/conf"
+ }
+ ],
+ "sqoop": [
+ {
+ "conf_dir": "/etc/sqoop/conf",
+ "current_dir": "{0}/current/sqoop-client/conf"
+ }
+ ],
+ "storm": [
+ {
+ "conf_dir": "/etc/storm/conf",
+ "current_dir": "{0}/current/storm-client/conf"
+ }
+ ],
+ "storm-slider-client": [
+ {
+ "conf_dir": "/etc/storm-slider-client/conf",
+ "current_dir": "{0}/current/storm-slider-client/conf"
+ }
+ ],
+ "superset": [
+ {
+ "conf_dir": "/etc/druid-superset/conf",
+ "current_dir": "{0}/current/druid-superset/conf"
+ }
+ ],
+ "tez": [
+ {
+ "conf_dir": "/etc/tez/conf",
+ "current_dir": "{0}/current/tez-client/conf"
+ }
+ ],
+ "zeppelin": [
+ {
+ "conf_dir": "/etc/zeppelin/conf",
+ "current_dir": "{0}/current/zeppelin-server/conf"
+ }
+ ],
+ "zookeeper": [
+ {
+ "conf_dir": "/etc/zookeeper/conf",
+ "current_dir": "{0}/current/zookeeper-client/conf"
+ }
+ ]
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_select_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_select_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_select_packages.json
deleted file mode 100644
index 2747188..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_select_packages.json
+++ /dev/null
@@ -1,952 +0,0 @@
-{
- "HDP": {
- "stack-select": {
- "ACCUMULO": {
- "ACCUMULO_CLIENT": {
- "STACK-SELECT-PACKAGE": "accumulo-client",
- "INSTALL": [
- "accumulo-client"
- ],
- "PATCH": [
- "accumulo-client"
- ],
- "STANDARD": [
- "accumulo-client"
- ]
- },
- "ACCUMULO_GC": {
- "STACK-SELECT-PACKAGE": "accumulo-gc",
- "INSTALL": [
- "accumulo-gc"
- ],
- "PATCH": [
- "accumulo-gc"
- ],
- "STANDARD": [
- "accumulo-gc",
- "accumulo-client"
- ]
- },
- "ACCUMULO_MASTER": {
- "STACK-SELECT-PACKAGE": "accumulo-master",
- "INSTALL": [
- "accumulo-master"
- ],
- "PATCH": [
- "accumulo-master"
- ],
- "STANDARD": [
- "accumulo-master",
- "accumulo-client"
- ]
- },
- "ACCUMULO_MONITOR": {
- "STACK-SELECT-PACKAGE": "accumulo-monitor",
- "INSTALL": [
- "accumulo-monitor"
- ],
- "PATCH": [
- "accumulo-monitor"
- ],
- "STANDARD": [
- "accumulo-monitor",
- "accumulo-client"
- ]
- },
- "ACCUMULO_TRACER": {
- "STACK-SELECT-PACKAGE": "accumulo-tracer",
- "INSTALL": [
- "accumulo-tracer"
- ],
- "PATCH": [
- "accumulo-tracer"
- ],
- "STANDARD": [
- "accumulo-tracer",
- "accumulo-client"
- ]
- },
- "ACCUMULO_TSERVER": {
- "STACK-SELECT-PACKAGE": "accumulo-tablet",
- "INSTALL": [
- "accumulo-tablet"
- ],
- "PATCH": [
- "accumulo-tablet"
- ],
- "STANDARD": [
- "accumulo-tablet",
- "accumulo-client"
- ]
- }
- },
- "ATLAS": {
- "ATLAS_CLIENT": {
- "STACK-SELECT-PACKAGE": "atlas-client",
- "INSTALL": [
- "atlas-client"
- ],
- "PATCH": [
- "atlas-client"
- ],
- "STANDARD": [
- "atlas-client"
- ]
- },
- "ATLAS_SERVER": {
- "STACK-SELECT-PACKAGE": "atlas-server",
- "INSTALL": [
- "atlas-server"
- ],
- "PATCH": [
- "atlas-server"
- ],
- "STANDARD": [
- "atlas-server"
- ]
- }
- },
- "DRUID": {
- "DRUID_COORDINATOR": {
- "STACK-SELECT-PACKAGE": "druid-coordinator",
- "INSTALL": [
- "druid-coordinator"
- ],
- "PATCH": [
- "druid-coordinator"
- ],
- "STANDARD": [
- "druid-coordinator"
- ]
- },
- "DRUID_OVERLORD": {
- "STACK-SELECT-PACKAGE": "druid-overlord",
- "INSTALL": [
- "druid-overlord"
- ],
- "PATCH": [
- "druid-overlord"
- ],
- "STANDARD": [
- "druid-overlord"
- ]
- },
- "DRUID_HISTORICAL": {
- "STACK-SELECT-PACKAGE": "druid-historical",
- "INSTALL": [
- "druid-historical"
- ],
- "PATCH": [
- "druid-historical"
- ],
- "STANDARD": [
- "druid-historical"
- ]
- },
- "DRUID_BROKER": {
- "STACK-SELECT-PACKAGE": "druid-broker",
- "INSTALL": [
- "druid-broker"
- ],
- "PATCH": [
- "druid-broker"
- ],
- "STANDARD": [
- "druid-broker"
- ]
- },
- "DRUID_MIDDLEMANAGER": {
- "STACK-SELECT-PACKAGE": "druid-middlemanager",
- "INSTALL": [
- "druid-middlemanager"
- ],
- "PATCH": [
- "druid-middlemanager"
- ],
- "STANDARD": [
- "druid-middlemanager"
- ]
- },
- "DRUID_ROUTER": {
- "STACK-SELECT-PACKAGE": "druid-router",
- "INSTALL": [
- "druid-router"
- ],
- "PATCH": [
- "druid-router"
- ],
- "STANDARD": [
- "druid-router"
- ]
- },
- "DRUID_SUPERSET": {
- "STACK-SELECT-PACKAGE": "druid-superset",
- "INSTALL": [
- "druid-superset"
- ],
- "PATCH": [
- "druid-superset"
- ],
- "STANDARD": [
- "druid-superset"
- ]
- }
- },
- "FALCON": {
- "FALCON_CLIENT": {
- "STACK-SELECT-PACKAGE": "falcon-client",
- "INSTALL": [
- "falcon-client"
- ],
- "PATCH": [
- "falcon-client"
- ],
- "STANDARD": [
- "falcon-client"
- ]
- },
- "FALCON_SERVER": {
- "STACK-SELECT-PACKAGE": "falcon-server",
- "INSTALL": [
- "falcon-server"
- ],
- "PATCH": [
- "falcon-server"
- ],
- "STANDARD": [
- "falcon-server"
- ]
- }
- },
- "FLUME": {
- "FLUME_HANDLER": {
- "STACK-SELECT-PACKAGE": "flume-server",
- "INSTALL": [
- "flume-server"
- ],
- "PATCH": [
- "flume-server"
- ],
- "STANDARD": [
- "flume-server"
- ]
- }
- },
- "HBASE": {
- "HBASE_CLIENT": {
- "STACK-SELECT-PACKAGE": "hbase-client",
- "INSTALL": [
- "hbase-client"
- ],
- "PATCH": [
- "hbase-client"
- ],
- "STANDARD": [
- "hbase-client",
- "phoenix-client",
- "hadoop-client"
- ]
- },
- "HBASE_MASTER": {
- "STACK-SELECT-PACKAGE": "hbase-master",
- "INSTALL": [
- "hbase-master"
- ],
- "PATCH": [
- "hbase-master"
- ],
- "STANDARD": [
- "hbase-master"
- ]
- },
- "HBASE_REGIONSERVER": {
- "STACK-SELECT-PACKAGE": "hbase-regionserver",
- "INSTALL": [
- "hbase-regionserver"
- ],
- "PATCH": [
- "hbase-regionserver"
- ],
- "STANDARD": [
- "hbase-regionserver"
- ]
- },
- "PHOENIX_QUERY_SERVER": {
- "STACK-SELECT-PACKAGE": "phoenix-server",
- "INSTALL": [
- "phoenix-server"
- ],
- "PATCH": [
- "phoenix-server"
- ],
- "STANDARD": [
- "phoenix-server"
- ]
- }
- },
- "HDFS": {
- "DATANODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-datanode",
- "INSTALL": [
- "hadoop-hdfs-datanode"
- ],
- "PATCH": [
- "hadoop-hdfs-datanode"
- ],
- "STANDARD": [
- "hadoop-hdfs-datanode"
- ]
- },
- "HDFS_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- },
- "NAMENODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-namenode",
- "INSTALL": [
- "hadoop-hdfs-namenode"
- ],
- "PATCH": [
- "hadoop-hdfs-namenode"
- ],
- "STANDARD": [
- "hadoop-hdfs-namenode"
- ]
- },
- "NFS_GATEWAY": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-nfs3",
- "INSTALL": [
- "hadoop-hdfs-nfs3"
- ],
- "PATCH": [
- "hadoop-hdfs-nfs3"
- ],
- "STANDARD": [
- "hadoop-hdfs-nfs3"
- ]
- },
- "JOURNALNODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-journalnode",
- "INSTALL": [
- "hadoop-hdfs-journalnode"
- ],
- "PATCH": [
- "hadoop-hdfs-journalnode"
- ],
- "STANDARD": [
- "hadoop-hdfs-journalnode"
- ]
- },
- "SECONDARY_NAMENODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-secondarynamenode",
- "INSTALL": [
- "hadoop-hdfs-secondarynamenode"
- ],
- "PATCH": [
- "hadoop-hdfs-secondarynamenode"
- ],
- "STANDARD": [
- "hadoop-hdfs-secondarynamenode"
- ]
- },
- "ZKFC": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-zkfc",
- "INSTALL": [
- "hadoop-hdfs-zkfc"
- ],
- "PATCH": [
- "hadoop-hdfs-zkfc"
- ],
- "STANDARD": [
- "hadoop-hdfs-zkfc"
- ]
- }
- },
- "HIVE": {
- "HCAT": {
- "STACK-SELECT-PACKAGE": "hive-webhcat",
- "INSTALL": [
- "hive-webhcat"
- ],
- "PATCH": [
- "hive-webhcat"
- ],
- "STANDARD": [
- "hive-webhcat"
- ]
- },
- "HIVE_METASTORE": {
- "STACK-SELECT-PACKAGE": "hive-metastore",
- "INSTALL": [
- "hive-metastore"
- ],
- "PATCH": [
- "hive-metastore"
- ],
- "STANDARD": [
- "hive-metastore"
- ]
- },
- "HIVE_SERVER": {
- "STACK-SELECT-PACKAGE": "hive-server2",
- "INSTALL": [
- "hive-server2"
- ],
- "PATCH": [
- "hive-server2"
- ],
- "STANDARD": [
- "hive-server2"
- ]
- },
- "HIVE_SERVER_INTERACTIVE": {
- "STACK-SELECT-PACKAGE": "hive-server2-hive2",
- "INSTALL": [
- "hive-server2-hive2"
- ],
- "PATCH": [
- "hive-server2-hive2"
- ],
- "STANDARD": [
- "hive-server2-hive2"
- ]
- },
- "HIVE_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- },
- "WEBHCAT_SERVER": {
- "STACK-SELECT-PACKAGE": "hive-webhcat",
- "INSTALL": [
- "hive-webhcat"
- ],
- "PATCH": [
- "hive-webhcat"
- ],
- "STANDARD": [
- "hive-webhcat"
- ]
- }
- },
- "KAFKA": {
- "KAFKA_BROKER": {
- "STACK-SELECT-PACKAGE": "kafka-broker",
- "INSTALL": [
- "kafka-broker"
- ],
- "PATCH": [
- "kafka-broker"
- ],
- "STANDARD": [
- "kafka-broker"
- ]
- }
- },
- "KNOX": {
- "KNOX_GATEWAY": {
- "STACK-SELECT-PACKAGE": "knox-server",
- "INSTALL": [
- "knox-server"
- ],
- "PATCH": [
- "knox-server"
- ],
- "STANDARD": [
- "knox-server"
- ]
- }
- },
- "MAHOUT": {
- "MAHOUT": {
- "STACK-SELECT-PACKAGE": "mahout-client",
- "INSTALL": [
- "mahout-client"
- ],
- "PATCH": [
- "mahout-client"
- ],
- "STANDARD": [
- "mahout-client"
- ]
- }
- },
- "MAPREDUCE2": {
- "HISTORYSERVER": {
- "STACK-SELECT-PACKAGE": "hadoop-mapreduce-historyserver",
- "INSTALL": [
- "hadoop-mapreduce-historyserver"
- ],
- "PATCH": [
- "hadoop-mapreduce-historyserver"
- ],
- "STANDARD": [
- "hadoop-mapreduce-historyserver"
- ]
- },
- "MAPREDUCE2_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "hadoop-mapreduce-INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "OOZIE": {
- "OOZIE_CLIENT": {
- "STACK-SELECT-PACKAGE": "oozie-client",
- "INSTALL": [
- "oozie-client"
- ],
- "PATCH": [
- "oozie-client"
- ],
- "STANDARD": [
- "oozie-client"
- ]
- },
- "OOZIE_SERVER": {
- "STACK-SELECT-PACKAGE": "oozie-server",
- "INSTALL": [
- "oozie-client",
- "oozie-server"
- ],
- "PATCH": [
- "oozie-server"
- ],
- "STANDARD": [
- "oozie-client",
- "oozie-server"
- ]
- }
- },
- "PIG": {
- "PIG": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "R4ML": {
- "R4ML": {
- "STACK-SELECT-PACKAGE": "r4ml-client",
- "INSTALL": [
- "r4ml-client"
- ],
- "PATCH": [
- "r4ml-client"
- ],
- "STANDARD": [
- "r4ml-client"
- ]
- }
- },
- "RANGER": {
- "RANGER_ADMIN": {
- "STACK-SELECT-PACKAGE": "ranger-admin",
- "INSTALL": [
- "ranger-admin"
- ],
- "PATCH": [
- "ranger-admin"
- ],
- "STANDARD": [
- "ranger-admin"
- ]
- },
- "RANGER_TAGSYNC": {
- "STACK-SELECT-PACKAGE": "ranger-tagsync",
- "INSTALL": [
- "ranger-tagsync"
- ],
- "PATCH": [
- "ranger-tagsync"
- ],
- "STANDARD": [
- "ranger-tagsync"
- ]
- },
- "RANGER_USERSYNC": {
- "STACK-SELECT-PACKAGE": "ranger-usersync",
- "INSTALL": [
- "ranger-usersync"
- ],
- "PATCH": [
- "ranger-usersync"
- ],
- "STANDARD": [
- "ranger-usersync"
- ]
- }
- },
- "RANGER_KMS": {
- "RANGER_KMS_SERVER": {
- "STACK-SELECT-PACKAGE": "ranger-kms",
- "INSTALL": [
- "ranger-kms"
- ],
- "PATCH": [
- "ranger-kms"
- ],
- "STANDARD": [
- "ranger-kms"
- ]
- }
- },
- "SLIDER": {
- "SLIDER": {
- "STACK-SELECT-PACKAGE": "slider-client",
- "INSTALL": [
- "slider-client"
- ],
- "PATCH": [
- "slider-client"
- ],
- "STANDARD": [
- "slider-client",
- "hadoop-client"
- ]
- }
- },
- "SPARK": {
- "LIVY_SERVER": {
- "STACK-SELECT-PACKAGE": "livy-server",
- "INSTALL": [
- "livy-server"
- ],
- "PATCH": [
- "livy-server"
- ],
- "STANDARD": [
- "livy-server"
- ]
- },
- "SPARK_CLIENT": {
- "STACK-SELECT-PACKAGE": "spark-client",
- "INSTALL": [
- "spark-client"
- ],
- "PATCH": [
- "spark-client"
- ],
- "STANDARD": [
- "spark-client"
- ]
- },
- "SPARK_JOBHISTORYSERVER": {
- "STACK-SELECT-PACKAGE": "spark-historyserver",
- "INSTALL": [
- "spark-historyserver"
- ],
- "PATCH": [
- "spark-historyserver"
- ],
- "STANDARD": [
- "spark-historyserver"
- ]
- },
- "SPARK_THRIFTSERVER": {
- "STACK-SELECT-PACKAGE": "spark-thriftserver",
- "INSTALL": [
- "spark-thriftserver"
- ],
- "PATCH": [
- "spark-thriftserver"
- ],
- "STANDARD": [
- "spark-thriftserver"
- ]
- }
- },
- "SPARK2": {
- "LIVY2_SERVER": {
- "STACK-SELECT-PACKAGE": "livy2-server",
- "INSTALL": [
- "livy2-server"
- ],
- "PATCH": [
- "livy2-server"
- ],
- "STANDARD": [
- "livy2-server"
- ]
- },
- "SPARK2_CLIENT": {
- "STACK-SELECT-PACKAGE": "spark2-client",
- "INSTALL": [
- "spark2-client"
- ],
- "PATCH": [
- "spark2-client"
- ],
- "STANDARD": [
- "spark2-client"
- ]
- },
- "SPARK2_JOBHISTORYSERVER": {
- "STACK-SELECT-PACKAGE": "spark2-historyserver",
- "INSTALL": [
- "spark2-historyserver"
- ],
- "PATCH": [
- "spark2-historyserver"
- ],
- "STANDARD": [
- "spark2-historyserver"
- ]
- },
- "SPARK2_THRIFTSERVER": {
- "STACK-SELECT-PACKAGE": "spark2-thriftserver",
- "INSTALL": [
- "spark2-thriftserver"
- ],
- "PATCH": [
- "spark2-thriftserver"
- ],
- "STANDARD": [
- "spark2-thriftserver"
- ]
- }
- },
- "SQOOP": {
- "SQOOP": {
- "STACK-SELECT-PACKAGE": "sqoop-client",
- "INSTALL": [
- "sqoop-client"
- ],
- "PATCH": [
- "sqoop-client"
- ],
- "STANDARD": [
- "sqoop-client"
- ]
- }
- },
- "STORM": {
- "NIMBUS": {
- "STACK-SELECT-PACKAGE": "storm-nimbus",
- "INSTALL": [
- "storm-client",
- "storm-nimbus"
- ],
- "PATCH": [
- "storm-client",
- "storm-nimbus"
- ],
- "STANDARD": [
- "storm-client",
- "storm-nimbus"
- ]
- },
- "SUPERVISOR": {
- "STACK-SELECT-PACKAGE": "storm-supervisor",
- "INSTALL": [
- "storm-supervisor"
- ],
- "PATCH": [
- "storm-supervisor"
- ],
- "STANDARD": [
- "storm-client",
- "storm-supervisor"
- ]
- },
- "DRPC_SERVER": {
- "STACK-SELECT-PACKAGE": "storm-client",
- "INSTALL": [
- "storm-client"
- ],
- "PATCH": [
- "storm-client"
- ],
- "STANDARD": [
- "storm-client"
- ]
- },
- "STORM_UI_SERVER": {
- "STACK-SELECT-PACKAGE": "storm-client",
- "INSTALL": [
- "storm-client"
- ],
- "PATCH": [
- "storm-client"
- ],
- "STANDARD": [
- "storm-client"
- ]
- }
- },
- "SYSTEMML": {
- "SYSTEMML": {
- "STACK-SELECT-PACKAGE": "systemml-client",
- "INSTALL": [
- "systemml-client"
- ],
- "PATCH": [
- "systemml-client"
- ],
- "STANDARD": [
- "systemml-client"
- ]
- }
- },
- "TEZ": {
- "TEZ_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "TITAN": {
- "TITAN_CLIENT": {
- "STACK-SELECT-PACKAGE": "titan-client",
- "INSTALL": [
- "titan-client"
- ],
- "PATCH": [
- "titan-client"
- ],
- "STANDARD": [
- "titan-client"
- ]
- },
- "TITAN_SERVER": {
- "STACK-SELECT-PACKAGE": "titan-server",
- "INSTALL": [
- "titan-server"
- ],
- "PATCH": [
- "titan-server"
- ],
- "STANDARD": [
- "titan-server"
- ]
- }
- },
- "YARN": {
- "APP_TIMELINE_SERVER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-timelineserver",
- "INSTALL": [
- "hadoop-yarn-timelineserver"
- ],
- "PATCH": [
- "hadoop-yarn-timelineserver"
- ],
- "STANDARD": [
- "hadoop-yarn-timelineserver"
- ]
- },
- "NODEMANAGER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-nodemanager",
- "INSTALL": [
- "hadoop-yarn-nodemanager"
- ],
- "PATCH": [
- "hadoop-yarn-nodemanager"
- ],
- "STANDARD": [
- "hadoop-yarn-nodemanager"
- ]
- },
- "RESOURCEMANAGER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-resourcemanager",
- "INSTALL": [
- "hadoop-yarn-resourcemanager"
- ],
- "PATCH": [
- "hadoop-yarn-resourcemanager"
- ],
- "STANDARD": [
- "hadoop-yarn-resourcemanager"
- ]
- },
- "YARN_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "ZEPPELIN": {
- "ZEPPELIN_MASTER": {
- "STACK-SELECT-PACKAGE": "zeppelin-server",
- "INSTALL": [
- "zeppelin-server"
- ],
- "PATCH": [
- "zeppelin-server"
- ],
- "STANDARD": [
- "zeppelin-server"
- ]
- }
- },
- "ZOOKEEPER": {
- "ZOOKEEPER_CLIENT": {
- "STACK-SELECT-PACKAGE": "zookeeper-client",
- "INSTALL": [
- "zookeeper-client"
- ],
- "PATCH": [
- "zookeeper-client"
- ],
- "STANDARD": [
- "zookeeper-client"
- ]
- },
- "ZOOKEEPER_SERVER": {
- "STACK-SELECT-PACKAGE": "zookeeper-server",
- "INSTALL": [
- "zookeeper-server"
- ],
- "PATCH": [
- "zookeeper-server"
- ],
- "STANDARD": [
- "zookeeper-server"
- ]
- }
- }
- }
- }
-}
\ No newline at end of file
[17/50] [abbrv] ambari git commit: AMBARI-21623 Log Search Config
should be separated into a Server and Log Feeder interface (mgergely)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
index 5fdfded..8f8c4fd 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
@@ -27,8 +27,8 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
import org.apache.log4j.Logger;
import com.google.common.io.Files;
@@ -47,13 +47,13 @@ public class InputConfigUploader extends Thread {
};
private final Set<String> filesHandled = new HashSet<>();
private final Pattern serviceNamePattern = Pattern.compile("input.config-(.+).json");
- private final LogSearchConfig config;
+ private final LogSearchConfigLogFeeder config;
- public static void load(LogSearchConfig config) {
+ public static void load(LogSearchConfigLogFeeder config) {
new InputConfigUploader(config).start();
}
- private InputConfigUploader(LogSearchConfig config) {
+ private InputConfigUploader(LogSearchConfigLogFeeder config) {
super("Input Config Loader");
setDaemon(true);
@@ -73,7 +73,7 @@ public class InputConfigUploader extends Thread {
String serviceName = m.group(1);
String inputConfig = Files.toString(inputConfigFile, Charset.defaultCharset());
- if (!config.inputConfigExistsLogFeeder(serviceName)) {
+ if (!config.inputConfigExists(serviceName)) {
config.createInputConfig(LogFeederPropertiesUtil.getClusterName(), serviceName, inputConfig);
}
filesHandled.add(inputConfigFile.getAbsolutePath());
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
index b370e58..c0075b5 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/Output.java
@@ -28,7 +28,7 @@ import org.apache.ambari.logfeeder.common.ConfigBlock;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
import org.apache.ambari.logsearch.config.api.OutputConfigMonitor;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputProperties;
@@ -104,9 +104,9 @@ public abstract class Output extends ConfigBlock implements OutputConfigMonitor
this.destination = destination;
}
- protected LogSearchConfig logSearchConfig;
+ protected LogSearchConfigLogFeeder logSearchConfig;
- public void setLogSearchConfig(LogSearchConfig logSearchConfig) {
+ public void setLogSearchConfig(LogSearchConfigLogFeeder logSearchConfig) {
this.logSearchConfig = logSearchConfig;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
index ce040f9..5ab271a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
import org.apache.ambari.logsearch.config.zookeeper.model.outputconfig.impl.OutputSolrPropertiesImpl;
import org.apache.log4j.Logger;
@@ -50,7 +50,7 @@ public class OutputSolrTest {
private static final Logger LOG = Logger.getLogger(OutputSolrTest.class);
private OutputSolr outputSolr;
- private LogSearchConfig logSearchConfigMock;
+ private LogSearchConfigLogFeeder logSearchConfigMock;
private Map<Integer, SolrInputDocument> receivedDocs = new ConcurrentHashMap<>();
@Rule
@@ -80,7 +80,7 @@ public class OutputSolrTest {
};
OutputSolrProperties outputSolrProperties = new OutputSolrPropertiesImpl("hadoop_logs", "none");
- logSearchConfigMock = EasyMock.createNiceMock(LogSearchConfig.class);
+ logSearchConfigMock = EasyMock.createNiceMock(LogSearchConfigLogFeeder.class);
EasyMock.expect(logSearchConfigMock.getOutputSolrProperties("service")).andReturn(outputSolrProperties);
EasyMock.replay(logSearchConfigMock);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
index 3f6df75..23b7430 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/LogSearchConfigConfigurer.java
@@ -25,10 +25,9 @@ import javax.inject.Named;
import org.apache.ambari.logsearch.common.PropertiesHelper;
import org.apache.ambari.logsearch.conf.global.LogSearchConfigState;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig.Component;
-import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigZK;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
+import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigServerZK;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,8 +37,8 @@ public class LogSearchConfigConfigurer implements Configurer {
private static final int RETRY_INTERVAL_SECONDS = 10;
- private static LogSearchConfig logSearchConfig;
- public static LogSearchConfig getConfig() {
+ private LogSearchConfigServer logSearchConfig;
+ public LogSearchConfigServer getConfig() {
return logSearchConfig;
}
@@ -55,8 +54,8 @@ public class LogSearchConfigConfigurer implements Configurer {
logger.info("Started thread to set up log search config");
while (true) {
try {
- logSearchConfig = LogSearchConfigFactory.createLogSearchConfig(Component.SERVER, PropertiesHelper.getProperties(),
- null, LogSearchConfigZK.class);
+ logSearchConfig = LogSearchConfigFactory.createLogSearchConfigServer(PropertiesHelper.getProperties(),
+ LogSearchConfigServerZK.class);
logSearchConfigState.setLogSearchConfigAvailable(true);
break;
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
index 6de34ce..ff828a3 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
@@ -219,7 +219,8 @@ public class SolrCollectionConfigurer implements Configurer {
boolean reloadCollectionNeeded) {
try {
List<String> allCollectionList = new ListCollectionHandler().handle(solrClient, null);
- boolean collectionCreated = new CreateCollectionHandler(allCollectionList).handle(solrClient, solrPropsConfig);
+ CreateCollectionHandler handler = new CreateCollectionHandler(solrDaoBase.getLogSearchConfig(), allCollectionList);
+ boolean collectionCreated = handler.handle(solrClient, solrPropsConfig);
boolean collectionReloaded = true;
if (reloadCollectionNeeded) {
collectionReloaded = new ReloadCollectionHandler().handle(solrClient, solrPropsConfig);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index 15f59e4..ef5e697 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -26,6 +26,8 @@ import org.apache.ambari.logsearch.conf.SolrKerberosConfig;
import org.apache.ambari.logsearch.conf.SolrPropsConfig;
import org.apache.ambari.logsearch.conf.global.LogSearchConfigState;
import org.apache.ambari.logsearch.conf.global.SolrCollectionState;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
+import org.apache.ambari.logsearch.configurer.LogSearchConfigConfigurer;
import org.apache.ambari.logsearch.util.RESTErrorUtil;
import org.apache.ambari.logsearch.util.SolrUtil;
import org.apache.log4j.Logger;
@@ -56,7 +58,10 @@ public abstract class SolrDaoBase {
private SolrKerberosConfig solrKerberosConfig;
@Inject
- protected LogSearchConfigState logSearchConfigState;
+ private LogSearchConfigState logSearchConfigState;
+
+ @Inject
+ private LogSearchConfigConfigurer logSearchConfigConfigurer;
protected SolrDaoBase(LogType logType) {
this.logType = logType;
@@ -152,6 +157,10 @@ public abstract class SolrDaoBase {
return (CloudSolrClient) getSolrTemplate().getSolrClient();
}
+ public LogSearchConfigServer getLogSearchConfig() {
+ return logSearchConfigConfigurer.getConfig();
+ }
+
public abstract SolrTemplate getSolrTemplate();
public abstract void setSolrTemplate(SolrTemplate solrTemplate);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
index 8b4c7bf..a988856 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
@@ -19,6 +19,7 @@
package org.apache.ambari.logsearch.handler;
import org.apache.ambari.logsearch.conf.SolrPropsConfig;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
import org.apache.ambari.logsearch.config.zookeeper.model.outputconfig.impl.OutputSolrPropertiesImpl;
import org.apache.ambari.logsearch.configurer.LogSearchConfigConfigurer;
@@ -54,9 +55,11 @@ public class CreateCollectionHandler implements SolrZkRequestHandler<Boolean> {
private static final String MODIFY_COLLECTION_QUERY = "/admin/collections?action=MODIFYCOLLECTION&collection=%s&%s=%d";
private static final String MAX_SHARDS_PER_NODE = "maxShardsPerNode";
+ private final LogSearchConfigServer logSearchConfig;
private final List<String> allCollectionList;
- public CreateCollectionHandler(List<String> allCollectionList) {
+ public CreateCollectionHandler(LogSearchConfigServer logSearchConfig, List<String> allCollectionList) {
+ this.logSearchConfig = logSearchConfig;
this.allCollectionList = allCollectionList;
}
@@ -65,7 +68,7 @@ public class CreateCollectionHandler implements SolrZkRequestHandler<Boolean> {
if (solrPropsConfig.getLogType() != null) {
OutputSolrProperties outputSolrProperties = new OutputSolrPropertiesImpl(solrPropsConfig.getCollection(),
solrPropsConfig.getSplitInterval());
- LogSearchConfigConfigurer.getConfig().saveOutputSolrProperties(solrPropsConfig.getLogType(), outputSolrProperties);
+ logSearchConfig.saveOutputSolrProperties(solrPropsConfig.getLogType(), outputSolrProperties);
}
boolean result;
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ShipperConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ShipperConfigManager.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ShipperConfigManager.java
index a1181b4..b19db72 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ShipperConfigManager.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/manager/ShipperConfigManager.java
@@ -50,24 +50,24 @@ public class ShipperConfigManager extends JsonManagerBase {
private LogSearchConfigConfigurer logSearchConfigConfigurer;
public List<String> getServices(String clusterName) {
- return LogSearchConfigConfigurer.getConfig().getServices(clusterName);
+ return logSearchConfigConfigurer.getConfig().getServices(clusterName);
}
public LSServerInputConfig getInputConfig(String clusterName, String serviceName) {
- InputConfig inputConfig = LogSearchConfigConfigurer.getConfig().getInputConfig(clusterName, serviceName);
+ InputConfig inputConfig = logSearchConfigConfigurer.getConfig().getInputConfig(clusterName, serviceName);
return new LSServerInputConfig(inputConfig);
}
public Response createInputConfig(String clusterName, String serviceName, LSServerInputConfig inputConfig) {
try {
- if (LogSearchConfigConfigurer.getConfig().inputConfigExistsServer(clusterName, serviceName)) {
+ if (logSearchConfigConfigurer.getConfig().inputConfigExists(clusterName, serviceName)) {
return Response.serverError()
.type(MediaType.APPLICATION_JSON)
.entity(ImmutableMap.of("errorMessage", "Input config already exists for service " + serviceName))
.build();
}
- LogSearchConfigConfigurer.getConfig().createInputConfig(clusterName, serviceName, new ObjectMapper().writeValueAsString(inputConfig));
+ logSearchConfigConfigurer.getConfig().createInputConfig(clusterName, serviceName, new ObjectMapper().writeValueAsString(inputConfig));
return Response.ok().build();
} catch (Exception e) {
logger.warn("Could not create input config", e);
@@ -77,14 +77,14 @@ public class ShipperConfigManager extends JsonManagerBase {
public Response setInputConfig(String clusterName, String serviceName, LSServerInputConfig inputConfig) {
try {
- if (!LogSearchConfigConfigurer.getConfig().inputConfigExistsServer(clusterName, serviceName)) {
+ if (!logSearchConfigConfigurer.getConfig().inputConfigExists(clusterName, serviceName)) {
return Response.serverError()
.type(MediaType.APPLICATION_JSON)
.entity(ImmutableMap.of("errorMessage", "Input config doesn't exist for service " + serviceName))
.build();
}
- LogSearchConfigConfigurer.getConfig().setInputConfig(clusterName, serviceName, new ObjectMapper().writeValueAsString(inputConfig));
+ logSearchConfigConfigurer.getConfig().setInputConfig(clusterName, serviceName, new ObjectMapper().writeValueAsString(inputConfig));
return Response.ok().build();
} catch (Exception e) {
logger.warn("Could not update input config", e);
@@ -101,7 +101,7 @@ public class ShipperConfigManager extends JsonManagerBase {
throw new IllegalArgumentException("Error validating shipper config:\n" + violations);
}
- String globalConfigs = LogSearchConfigConfigurer.getConfig().getGlobalConfigs(clusterName);
+ String globalConfigs = logSearchConfigConfigurer.getConfig().getGlobalConfigs(clusterName);
LogEntryParseTester tester = new LogEntryParseTester(testEntry, shipperConfig, globalConfigs, logId);
return tester.parse();
} catch (Exception e) {
@@ -111,12 +111,12 @@ public class ShipperConfigManager extends JsonManagerBase {
}
public LSServerLogLevelFilterMap getLogLevelFilters(String clusterName) {
- return new LSServerLogLevelFilterMap(LogSearchConfigConfigurer.getConfig().getLogLevelFilters(clusterName));
+ return new LSServerLogLevelFilterMap(logSearchConfigConfigurer.getConfig().getLogLevelFilters(clusterName));
}
public Response setLogLevelFilters(String clusterName, LSServerLogLevelFilterMap request) {
try {
- LogSearchConfigConfigurer.getConfig().setLogLevelFilters(clusterName, request.convertToApi());
+ logSearchConfigConfigurer.getConfig().setLogLevelFilters(clusterName, request.convertToApi());
return Response.ok().build();
} catch (Exception e) {
logger.warn("Could not update log level filters", e);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/model/common/LSServerFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/model/common/LSServerFilter.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/model/common/LSServerFilter.java
index 84bddb8..72cc72b 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/model/common/LSServerFilter.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/model/common/LSServerFilter.java
@@ -70,10 +70,12 @@ public abstract class LSServerFilter {
this.sourceField = filterDescriptor.getSourceField();
this.removeSourceField = filterDescriptor.isRemoveSourceField();
- this.postMapValues = new HashMap<String, LSServerPostMapValuesList>();
- for (Map.Entry<String, ? extends List<? extends PostMapValues>> e : filterDescriptor.getPostMapValues().entrySet()) {
- LSServerPostMapValuesList lsServerPostMapValuesList = new LSServerPostMapValuesList(e.getValue());
- postMapValues.put(e.getKey(), lsServerPostMapValuesList);
+ if (filterDescriptor.getPostMapValues() != null) {
+ this.postMapValues = new HashMap<String, LSServerPostMapValuesList>();
+ for (Map.Entry<String, ? extends List<? extends PostMapValues>> e : filterDescriptor.getPostMapValues().entrySet()) {
+ LSServerPostMapValuesList lsServerPostMapValuesList = new LSServerPostMapValuesList(e.getValue());
+ postMapValues.put(e.getKey(), lsServerPostMapValuesList);
+ }
}
this.isEnabled = filterDescriptor.isEnabled();
[23/50] [abbrv] ambari git commit: AMBARI-21663. Livy2 should use the
same keytab as Livy. (Bikas Saha via smohanty)
Posted by ab...@apache.org.
AMBARI-21663. Livy2 should use the same keytab as Livy. (Bikas Saha via smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aa9e16d8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa9e16d8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa9e16d8
Branch: refs/heads/branch-feature-logsearch-ui
Commit: aa9e16d8928b95c555a1e5b966fe1cf86c15cf82
Parents: b175d8f
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Fri Aug 4 15:03:24 2017 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Fri Aug 4 15:11:22 2017 -0700
----------------------------------------------------------------------
.../main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa9e16d8/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json
index 198ab41..0f99bbb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/kerberos.json
@@ -96,7 +96,7 @@
"local_username": "${livy2-env/livy2_user}"
},
"keytab": {
- "file": "${keytab_dir}/livy2.service.keytab",
+ "file": "${keytab_dir}/livy.service.keytab",
"owner": {
"name": "${livy2-env/livy2_user}",
"access": "r"
[35/50] [abbrv] ambari git commit: AMBARI-21672 - Update
Orchestration to support MAINT (part2) (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21672 - Update Orchestration to support MAINT (part2) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4dee0f0e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4dee0f0e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4dee0f0e
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 4dee0f0e838265d124dd3066b27760acb57c4cb5
Parents: 3155a43
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Aug 8 10:19:39 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Aug 8 10:21:23 2017 -0400
----------------------------------------------------------------------
.../java/org/apache/ambari/server/state/UpgradeContextTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4dee0f0e/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
index e04be5e..629ea9b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
@@ -38,13 +38,13 @@ import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.UpgradePack;
import org.apache.ambari.server.state.stack.upgrade.Direction;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
-import org.apache.hadoop.metrics2.sink.relocated.google.common.collect.Lists;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
/**
[16/50] [abbrv] ambari git commit: AMBARI-21592 Log Feeder properties
should be handled by one class (mgergely)
Posted by ab...@apache.org.
AMBARI-21592 Log Feeder properties should be handled by one class (mgergely)
Change-Id: I3193f3b7a4b7f64ed7d60191f446640500b46a0e
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/27386c3d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/27386c3d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/27386c3d
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 27386c3d9eae250a72f3b23308c752e5e32765c1
Parents: 98f15c9
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Fri Aug 4 11:03:51 2017 +0200
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Fri Aug 4 11:03:51 2017 +0200
----------------------------------------------------------------------
.../org/apache/ambari/logfeeder/LogFeeder.java | 10 +-
.../ambari/logfeeder/common/ConfigHandler.java | 27 +-
.../logfeeder/input/AbstractInputFile.java | 4 +-
.../apache/ambari/logfeeder/input/Input.java | 70 +--
.../logfeeder/input/InputConfigUploader.java | 17 +-
.../ambari/logfeeder/input/InputManager.java | 28 +-
.../ambari/logfeeder/input/InputSimulate.java | 77 +--
.../loglevelfilter/LogLevelFilterHandler.java | 29 +-
.../logfeeder/metrics/LogFeederAMSClient.java | 45 +-
.../ambari/logfeeder/output/OutputHDFSFile.java | 3 +-
.../ambari/logfeeder/output/OutputS3File.java | 3 +-
.../ambari/logfeeder/output/OutputSolr.java | 39 +-
.../logfeeder/util/LogFeederPropertiesUtil.java | 498 +++++++++++++++++++
.../ambari/logfeeder/util/LogFeederUtil.java | 165 +-----
.../apache/ambari/logfeeder/util/SSLUtil.java | 14 +-
.../logconfig/LogConfigHandlerTest.java | 4 +-
.../logfeeder/metrics/MetricsManagerTest.java | 4 +-
17 files changed, 575 insertions(+), 462 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
index ba3412b..2461819 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
@@ -36,7 +36,7 @@ import org.apache.ambari.logfeeder.input.InputConfigUploader;
import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.metrics.MetricsManager;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.SSLUtil;
import com.google.common.collect.Maps;
import com.google.gson.GsonBuilder;
@@ -80,13 +80,13 @@ public class LogFeeder {
SSLUtil.ensureStorePasswords();
- config = LogSearchConfigFactory.createLogSearchConfig(Component.LOGFEEDER, Maps.fromProperties(LogFeederUtil.getProperties()),
- LogFeederUtil.getClusterName(), LogSearchConfigZK.class);
+ config = LogSearchConfigFactory.createLogSearchConfig(Component.LOGFEEDER,Maps.fromProperties(LogFeederPropertiesUtil.getProperties()),
+ LogFeederPropertiesUtil.getClusterName(), LogSearchConfigZK.class);
configHandler = new ConfigHandler(config);
configHandler.init();
LogLevelFilterHandler.init(config);
InputConfigUploader.load(config);
- config.monitorInputConfigChanges(configHandler, new LogLevelFilterHandler(), LogFeederUtil.getClusterName());
+ config.monitorInputConfigChanges(configHandler, new LogLevelFilterHandler(), LogFeederPropertiesUtil.getClusterName());
metricsManager.init();
@@ -182,7 +182,7 @@ public class LogFeeder {
if (cli.isMonitor()) {
try {
- LogFeederUtil.loadProperties();
+ LogFeederPropertiesUtil.loadProperties();
} catch (Throwable t) {
LOG.warn("Could not load logfeeder properites");
System.exit(1);
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
index 30b61a1..11df9dc 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
@@ -47,9 +47,9 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ambari.logfeeder.util.AliasUtil.AliasType;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterGrokDescriptor;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
@@ -62,30 +62,9 @@ import org.apache.log4j.Logger;
import com.google.gson.reflect.TypeToken;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class ConfigHandler implements InputConfigMonitor {
private static final Logger LOG = Logger.getLogger(ConfigHandler.class);
- @LogSearchPropertyDescription(
- name = "logfeeder.config.files",
- description = "Comma separated list of the config files containing global / output configurations.",
- examples = {"global.json,output.json", "/etc/ambari-logsearch-logfeeder/conf/global.json"},
- defaultValue = "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CONFIG_FILES_PROPERTY = "logfeeder.config.files";
-
- private static final int DEFAULT_SIMULATE_INPUT_NUMBER = 0;
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.input_number",
- description = "The number of the simulator instances to run with. O means no simulation.",
- examples = {"10"},
- defaultValue = DEFAULT_SIMULATE_INPUT_NUMBER + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String SIMULATE_INPUT_NUMBER_PROPERTY = "logfeeder.simulate.input_number";
-
private final LogSearchConfig logSearchConfig;
private final OutputManager outputManager = new OutputManager();
@@ -135,7 +114,7 @@ public class ConfigHandler implements InputConfigMonitor {
private List<String> getConfigFiles() {
List<String> configFiles = new ArrayList<>();
- String logFeederConfigFilesProperty = LogFeederUtil.getStringProperty(CONFIG_FILES_PROPERTY);
+ String logFeederConfigFilesProperty = LogFeederPropertiesUtil.getConfigFiles();
LOG.info("logfeeder.config.files=" + logFeederConfigFilesProperty);
if (logFeederConfigFilesProperty != null) {
configFiles.addAll(Arrays.asList(logFeederConfigFilesProperty.split(",")));
@@ -238,7 +217,7 @@ public class ConfigHandler implements InputConfigMonitor {
}
private void simulateIfNeeded() throws Exception {
- int simulatedInputNumber = LogFeederUtil.getIntProperty(SIMULATE_INPUT_NUMBER_PROPERTY, DEFAULT_SIMULATE_INPUT_NUMBER);
+ int simulatedInputNumber = LogFeederPropertiesUtil.getSimulateInputNumber();
if (simulatedInputNumber == 0)
return;
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
index 9535260..b021c37 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ambari.logfeeder.util.FileUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputFileBaseDescriptor;
import org.apache.commons.lang.ObjectUtils;
@@ -68,8 +69,7 @@ public abstract class AbstractInputFile extends Input {
public void init() throws Exception {
LOG.info("init() called");
- checkPointExtension = LogFeederUtil.getStringProperty(InputManager.CHECKPOINT_EXTENSION_PROPERTY,
- InputManager.DEFAULT_CHECKPOINT_EXTENSION);
+ checkPointExtension = LogFeederPropertiesUtil.getCheckPointExtension();
// Let's close the file and set it to true after we start monitoring it
setClosed(true);
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
index 8050263..972011d 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
@@ -31,8 +31,7 @@ import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.output.Output;
import org.apache.ambari.logfeeder.output.OutputManager;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.model.inputconfig.Conditions;
import org.apache.ambari.logsearch.config.api.model.inputconfig.Fields;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
@@ -40,58 +39,7 @@ import org.apache.ambari.logsearch.config.api.model.inputconfig.InputDescriptor;
import org.apache.commons.lang.BooleanUtils;
import org.apache.log4j.Priority;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public abstract class Input extends ConfigItem implements Runnable {
- private static final boolean DEFAULT_CACHE_ENABLED = false;
- @LogSearchPropertyDescription(
- name = "logfeeder.cache.enabled",
- description = "Enables the usage of a cache to avoid duplications.",
- examples = {"true"},
- defaultValue = DEFAULT_CACHE_ENABLED + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CACHE_ENABLED_PROPERTY = "logfeeder.cache.enabled";
-
- private static final String DEFAULT_CACHE_KEY_FIELD = "log_message";
- @LogSearchPropertyDescription(
- name = "logfeeder.cache.key.field",
- description = "The field which's value should be cached and should be checked for repteitions.",
- examples = {"some_field_prone_to_repeating_value"},
- defaultValue = DEFAULT_CACHE_KEY_FIELD,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CACHE_KEY_FIELD_PROPERTY = "logfeeder.cache.key.field";
-
- private static final int DEFAULT_CACHE_SIZE = 100;
- @LogSearchPropertyDescription(
- name = "logfeeder.cache.size",
- description = "The number of log entries to cache in order to avoid duplications.",
- examples = {"50"},
- defaultValue = DEFAULT_CACHE_SIZE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CACHE_SIZE_PROPERTY = "logfeeder.cache.size";
-
- private static final boolean DEFAULT_CACHE_LAST_DEDUP_ENABLED = false;
- @LogSearchPropertyDescription(
- name = "logfeeder.cache.last.dedup.enabled",
- description = "Enable filtering directly repeating log entries irrelevant of the time spent between them.",
- examples = {"true"},
- defaultValue = DEFAULT_CACHE_LAST_DEDUP_ENABLED + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CACHE_LAST_DEDUP_ENABLED_PROPERTY = "logfeeder.cache.last.dedup.enabled";
-
- private static final long DEFAULT_CACHE_DEDUP_INTERVAL = 1000;
- @LogSearchPropertyDescription(
- name = "logfeeder.cache.dedup.interval",
- description = "Maximum number of milliseconds between two identical messages to be filtered out.",
- examples = {"500"},
- defaultValue = DEFAULT_CACHE_DEDUP_INTERVAL + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CACHE_DEDUP_INTERVAL_PROPERTY = "logfeeder.cache.dedup.interval";
private static final boolean DEFAULT_TAIL = true;
private static final boolean DEFAULT_USE_EVENT_MD5 = false;
@@ -294,25 +242,25 @@ public abstract class Input extends ConfigItem implements Runnable {
private void initCache() {
boolean cacheEnabled = inputDescriptor.isCacheEnabled() != null
? inputDescriptor.isCacheEnabled()
- : LogFeederUtil.getBooleanProperty(CACHE_ENABLED_PROPERTY, DEFAULT_CACHE_ENABLED);
+ : LogFeederPropertiesUtil.isCacheEnabled();
if (cacheEnabled) {
String cacheKeyField = inputDescriptor.getCacheKeyField() != null
? inputDescriptor.getCacheKeyField()
- : LogFeederUtil.getStringProperty(CACHE_KEY_FIELD_PROPERTY, DEFAULT_CACHE_KEY_FIELD);
+ : LogFeederPropertiesUtil.getCacheKeyField();
setCacheKeyField(cacheKeyField);
- boolean cacheLastDedupEnabled = inputDescriptor.getCacheLastDedupEnabled() != null
- ? inputDescriptor.getCacheLastDedupEnabled()
- : LogFeederUtil.getBooleanProperty(CACHE_LAST_DEDUP_ENABLED_PROPERTY, DEFAULT_CACHE_LAST_DEDUP_ENABLED);
-
int cacheSize = inputDescriptor.getCacheSize() != null
? inputDescriptor.getCacheSize()
- : LogFeederUtil.getIntProperty(CACHE_SIZE_PROPERTY, DEFAULT_CACHE_SIZE);
+ : LogFeederPropertiesUtil.getCacheSize();
+
+ boolean cacheLastDedupEnabled = inputDescriptor.getCacheLastDedupEnabled() != null
+ ? inputDescriptor.getCacheLastDedupEnabled()
+ : LogFeederPropertiesUtil.isCacheLastDedupEnabled();
long cacheDedupInterval = inputDescriptor.getCacheDedupInterval() != null
? inputDescriptor.getCacheDedupInterval()
- : Long.parseLong(LogFeederUtil.getStringProperty(CACHE_DEDUP_INTERVAL_PROPERTY, String.valueOf(DEFAULT_CACHE_DEDUP_INTERVAL)));
+ : Long.parseLong(LogFeederPropertiesUtil.getCacheDedupInterval());
setCache(new LRUCache(cacheSize, filePath, cacheDedupInterval, cacheLastDedupEnabled));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
index 10642d1..5fdfded 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
@@ -28,25 +28,14 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.log4j.Logger;
import com.google.common.io.Files;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class InputConfigUploader extends Thread {
protected static final Logger LOG = Logger.getLogger(InputConfigUploader.class);
- @LogSearchPropertyDescription(
- name = "logfeeder.config.dir",
- description = "The directory where shipper configuration files are looked for.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CONFIG_DIR_PROPERTY = "logfeeder.config.dir";
-
private static final long SLEEP_BETWEEN_CHECK = 2000;
private final File configDir;
@@ -68,7 +57,7 @@ public class InputConfigUploader extends Thread {
super("Input Config Loader");
setDaemon(true);
- this.configDir = new File(LogFeederUtil.getStringProperty(CONFIG_DIR_PROPERTY));
+ this.configDir = new File(LogFeederPropertiesUtil.getConfigDir());
this.config = config;
}
@@ -85,7 +74,7 @@ public class InputConfigUploader extends Thread {
String inputConfig = Files.toString(inputConfigFile, Charset.defaultCharset());
if (!config.inputConfigExistsLogFeeder(serviceName)) {
- config.createInputConfig(LogFeederUtil.getClusterName(), serviceName, inputConfig);
+ config.createInputConfig(LogFeederPropertiesUtil.getClusterName(), serviceName, inputConfig);
}
filesHandled.add(inputConfigFile.getAbsolutePath());
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
index 091015a..f1b422f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
@@ -35,36 +35,16 @@ import java.util.UUID;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.FileUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.solr.common.util.Base64;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class InputManager {
private static final Logger LOG = Logger.getLogger(InputManager.class);
- public static final String DEFAULT_CHECKPOINT_EXTENSION = ".cp";
- @LogSearchPropertyDescription(
- name = "logfeeder.checkpoint.extension",
- description = "The extension used for checkpoint files.",
- examples = {"ckp"},
- defaultValue = DEFAULT_CHECKPOINT_EXTENSION,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static final String CHECKPOINT_EXTENSION_PROPERTY = "logfeeder.checkpoint.extension";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.checkpoint.folder",
- description = "The folder wher checkpoint files are stored.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf/checkpoints"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CHECKPOINT_FOLDER_PROPERTY = "logfeeder.checkpoint.folder";
-
private static final String CHECKPOINT_SUBFOLDER_NAME = "logfeeder_checkpoints";
private Map<String, List<Input>> inputs = new HashMap<>();
@@ -138,11 +118,11 @@ public class InputManager {
}
private void initCheckPointSettings() {
- checkPointExtension = LogFeederUtil.getStringProperty(CHECKPOINT_EXTENSION_PROPERTY, DEFAULT_CHECKPOINT_EXTENSION);
+ checkPointExtension = LogFeederPropertiesUtil.getCheckPointExtension();
LOG.info("Determining valid checkpoint folder");
boolean isCheckPointFolderValid = false;
// We need to keep track of the files we are reading.
- String checkPointFolder = LogFeederUtil.getStringProperty(CHECKPOINT_FOLDER_PROPERTY);
+ String checkPointFolder = LogFeederPropertiesUtil.getCheckpointFolder();
if (!StringUtils.isEmpty(checkPointFolder)) {
checkPointFolderFile = new File(checkPointFolder);
isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
@@ -150,7 +130,7 @@ public class InputManager {
if (!isCheckPointFolderValid) {
// Let's use tmp folder
- String tmpFolder = LogFeederUtil.getLogFeederTempDir();
+ String tmpFolder = LogFeederPropertiesUtil.getLogFeederTempDir();
checkPointFolderFile = new File(tmpFolder, CHECKPOINT_SUBFOLDER_NAME);
LOG.info("Checking if tmp folder can be used for checkpoints. Folder=" + checkPointFolderFile);
isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
index 7c487ba..df6c941 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
@@ -33,8 +33,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.filter.FilterJSON;
import org.apache.ambari.logfeeder.output.Output;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputDescriptor;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.FilterJsonDescriptorImpl;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputDescriptorImpl;
@@ -43,70 +43,9 @@ import org.apache.solr.common.util.Base64;
import com.google.common.base.Joiner;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class InputSimulate extends Input {
private static final String LOG_TEXT_PATTERN = "{ logtime=\"%d\", level=\"%s\", log_message=\"%s\", host=\"%s\"}";
-
- private static final String DEFAULT_LOG_LEVEL = "WARN";
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.log_level",
- description = "The log level to create the simulated log entries with.",
- examples = {"INFO"},
- defaultValue = DEFAULT_LOG_LEVEL,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String LOG_LEVEL_PROPERTY = "logfeeder.simulate.log_level";
-
- private static final int DEFAULT_NUMBER_OF_WORDS = 1000;
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.number_of_words",
- description = "The size of the set of words that may be used to create the simulated log entries with.",
- examples = {"100"},
- defaultValue = DEFAULT_NUMBER_OF_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String NUMBER_OF_WORDS_PROPERTY = "logfeeder.simulate.number_of_words";
-
- private static final int DEFAULT_MIN_LOG_WORDS = 5;
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.min_log_words",
- description = "The minimum number of words in a simulated log entry.",
- examples = {"3"},
- defaultValue = DEFAULT_MIN_LOG_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String MIN_LOG_WORDS_PROPERTY = "logfeeder.simulate.min_log_words";
-
- private static final int DEFAULT_MAX_LOG_WORDS = 5;
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.max_log_words",
- description = "The maximum number of words in a simulated log entry.",
- examples = {"8"},
- defaultValue = DEFAULT_MAX_LOG_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String MAX_LOG_WORDS_PROPERTY = "logfeeder.simulate.max_log_words";
-
- private static final int DEFAULT_SLEEP_MILLISECONDS = 10000;
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.sleep_milliseconds",
- description = "The milliseconds to sleep between creating two simulated log entries.",
- examples = {"5000"},
- defaultValue = DEFAULT_SLEEP_MILLISECONDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String SLEEP_MILLISECONDS_PROPERTY = "logfeeder.simulate.sleep_milliseconds";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.simulate.log_ids",
- description = "The comma separated list of log ids for which to create the simulated log entries.",
- examples = {"ambari_server,zookeeper,infra_solr,logsearch_app"},
- defaultValue = "The log ids of the installed services in the cluster",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String LOG_IDS_PROPERTY = "logfeeder.simulate.log_ids";
-
+
private static final Map<String, String> typeToFilePath = new HashMap<>();
private static final List<String> inputTypes = new ArrayList<>();
public static void loadTypeToFilePath(List<InputDescriptor> inputList) {
@@ -137,11 +76,11 @@ public class InputSimulate extends Input {
public InputSimulate() throws Exception {
this.types = getSimulatedLogTypes();
- this.level = LogFeederUtil.getStringProperty(LOG_LEVEL_PROPERTY, DEFAULT_LOG_LEVEL);
- this.numberOfWords = LogFeederUtil.getIntProperty(NUMBER_OF_WORDS_PROPERTY, DEFAULT_NUMBER_OF_WORDS, 50, 1000000);
- this.minLogWords = LogFeederUtil.getIntProperty(MIN_LOG_WORDS_PROPERTY, DEFAULT_MIN_LOG_WORDS, 1, 10);
- this.maxLogWords = LogFeederUtil.getIntProperty(MAX_LOG_WORDS_PROPERTY, DEFAULT_MAX_LOG_WORDS, 10, 20);
- this.sleepMillis = LogFeederUtil.getIntProperty(SLEEP_MILLISECONDS_PROPERTY, DEFAULT_SLEEP_MILLISECONDS);
+ this.level = LogFeederPropertiesUtil.getSimulateLogLevel();
+ this.numberOfWords = LogFeederPropertiesUtil.getSimulateNumberOfWords();
+ this.minLogWords = LogFeederPropertiesUtil.getSimulateMinLogWords();
+ this.maxLogWords = LogFeederPropertiesUtil.getSimulateMaxLogWords();
+ this.sleepMillis = LogFeederPropertiesUtil.getSimulateSleepMilliseconds();
this.host = "#" + hostNumber.incrementAndGet() + "-" + LogFeederUtil.hostName;
Filter filter = new FilterJSON();
@@ -151,7 +90,7 @@ public class InputSimulate extends Input {
}
private List<String> getSimulatedLogTypes() {
- String logsToSimulate = LogFeederUtil.getStringProperty(LOG_IDS_PROPERTY);
+ String logsToSimulate = LogFeederPropertiesUtil.getSimulateLogIds();
return (logsToSimulate == null) ?
inputTypes :
Arrays.asList(logsToSimulate.split(","));
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
index 79bf5ea..e44873b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
@@ -29,37 +29,16 @@ import java.util.Map;
import java.util.TimeZone;
import org.apache.ambari.logfeeder.common.LogFeederConstants;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.LogLevelFilterMonitor;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class LogLevelFilterHandler implements LogLevelFilterMonitor {
private static final Logger LOG = Logger.getLogger(LogLevelFilterHandler.class);
-
- private static final boolean DEFAULT_LOG_FILTER_ENABLE = false;
- @LogSearchPropertyDescription(
- name = "logfeeder.log.filter.enable",
- description = "Enables the filtering of the log entries by log level filters.",
- examples = {"true"},
- defaultValue = DEFAULT_LOG_FILTER_ENABLE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String LOG_FILTER_ENABLE_PROPERTY = "logfeeder.log.filter.enable";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.include.default.level",
- description = "Comma separtaed list of the default log levels to be enabled by the filtering.",
- examples = {"FATAL,ERROR,WARN"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String INCLUDE_DEFAULT_LEVEL_PROPERTY = "logfeeder.include.default.level";
private static final String TIMEZONE = "GMT";
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
@@ -79,8 +58,8 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
public static void init(LogSearchConfig config_) {
config = config_;
- filterEnabled = LogFeederUtil.getBooleanProperty(LOG_FILTER_ENABLE_PROPERTY, DEFAULT_LOG_FILTER_ENABLE);
- defaultLogLevels = Arrays.asList(LogFeederUtil.getStringProperty(INCLUDE_DEFAULT_LEVEL_PROPERTY).split(","));
+ filterEnabled = LogFeederPropertiesUtil.isLogFilterEnabled();
+ defaultLogLevels = Arrays.asList(LogFeederPropertiesUtil.getIncludeDefaultLevel().split(","));
TimeZone.setDefault(TimeZone.getTimeZone(TIMEZONE));
}
@@ -120,7 +99,7 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
defaultFilter.setDefaultLevels(defaultLogLevels);
try {
- config.createLogLevelFilter(LogFeederUtil.getClusterName(), logId, defaultFilter);
+ config.createLogLevelFilter(LogFeederPropertiesUtil.getClusterName(), logId, defaultFilter);
filters.put(logId, defaultFilter);
} catch (Exception e) {
LOG.warn("Could not persist the default filter for log " + logId, e);
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
index fdad9a6..f446446 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
@@ -19,9 +19,8 @@
package org.apache.ambari.logfeeder.metrics;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.SSLUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.metrics2.sink.timeline.AbstractTimelineMetricsSink;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
@@ -29,8 +28,6 @@ import org.apache.log4j.Logger;
import com.google.common.base.Splitter;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
import java.util.Collection;
import java.util.List;
@@ -38,53 +35,21 @@ import java.util.List;
public class LogFeederAMSClient extends AbstractTimelineMetricsSink {
private static final Logger LOG = Logger.getLogger(LogFeederAMSClient.class);
- @LogSearchPropertyDescription(
- name = "logfeeder.metrics.collector.hosts",
- description = "Comma separtaed list of metric collector hosts.",
- examples = {"c6401.ambari.apache.org"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String METRICS_COLLECTOR_HOSTS_PROPERTY = "logfeeder.metrics.collector.hosts";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.metrics.collector.protocol",
- description = "The protocol used by metric collectors.",
- examples = {"http", "https"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String METRICS_COLLECTOR_PROTOCOL_PROPERTY = "logfeeder.metrics.collector.protocol";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.metrics.collector.port",
- description = "The port used by metric collectors.",
- examples = {"6188"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String METRICS_COLLECTOR_PORT_PROPERTY = "logfeeder.metrics.collector.port";
-
- @LogSearchPropertyDescription(
- name = "logfeeder.metrics.collector.path",
- description = "The path used by metric collectors.",
- examples = {"/ws/v1/timeline/metrics"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String METRICS_COLLECTOR_PATH_PROPERTY = "logfeeder.metrics.collector.path";
-
private final List<String> collectorHosts;
private final String collectorProtocol;
private final String collectorPort;
private final String collectorPath;
public LogFeederAMSClient() {
- String collectorHostsString = LogFeederUtil.getStringProperty(METRICS_COLLECTOR_HOSTS_PROPERTY);
+ String collectorHostsString = LogFeederPropertiesUtil.getMetricsCollectorHosts();
if (!StringUtils.isBlank(collectorHostsString)) {
collectorHostsString = collectorHostsString.trim();
LOG.info("AMS collector Hosts=" + collectorHostsString);
collectorHosts = Splitter.on(",").splitToList(collectorHostsString);
- collectorProtocol = LogFeederUtil.getStringProperty(METRICS_COLLECTOR_PROTOCOL_PROPERTY);
- collectorPort = LogFeederUtil.getStringProperty(METRICS_COLLECTOR_PORT_PROPERTY);
- collectorPath = LogFeederUtil.getStringProperty(METRICS_COLLECTOR_PATH_PROPERTY);
+ collectorProtocol = LogFeederPropertiesUtil.getMetricsCollectorProtocol();
+ collectorPort = LogFeederPropertiesUtil.getMetricsCollectorPort();
+ collectorPath = LogFeederPropertiesUtil.getMetricsCollectorPath();
} else {
collectorHosts = null;
collectorProtocol = null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
index 2b47a00..ba4d60a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
@@ -26,6 +26,7 @@ import org.apache.ambari.logfeeder.output.spool.RolloverCondition;
import org.apache.ambari.logfeeder.output.spool.RolloverHandler;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logfeeder.util.LogFeederHDFSUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.PlaceholderUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.fs.FileSystem;
@@ -87,7 +88,7 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
HashMap<String, String> contextParam = buildContextParam();
hdfsOutDir = PlaceholderUtil.replaceVariables(hdfsOutDir, contextParam);
LOG.info("hdfs Output dir=" + hdfsOutDir);
- String localFileDir = LogFeederUtil.getLogFeederTempDir() + "hdfs/service/";
+ String localFileDir = LogFeederPropertiesUtil.getLogFeederTempDir() + "hdfs/service/";
logSpooler = new LogSpooler(localFileDir, filenamePrefix, this, this);
this.startHDFSCopyThread();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
index 9f41a15..5b213e8 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
@@ -26,6 +26,7 @@ import org.apache.ambari.logfeeder.output.spool.LogSpooler;
import org.apache.ambari.logfeeder.output.spool.LogSpoolerContext;
import org.apache.ambari.logfeeder.output.spool.RolloverCondition;
import org.apache.ambari.logfeeder.output.spool.RolloverHandler;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logfeeder.util.S3Util;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
@@ -205,7 +206,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
@VisibleForTesting
protected LogSpooler createSpooler(String filePath) {
- String spoolDirectory = LogFeederUtil.getLogFeederTempDir() + "/s3/service";
+ String spoolDirectory = LogFeederPropertiesUtil.getLogFeederTempDir() + "/s3/service";
LOG.info(String.format("Creating spooler with spoolDirectory=%s, filePath=%s", spoolDirectory, filePath));
return new LogSpooler(spoolDirectory, new File(filePath).getName()+"-", this, this,
s3OutputConfiguration.getRolloverTimeThresholdSecs());
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index e3da864..38219df 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -37,8 +37,8 @@ import java.util.concurrent.TimeUnit;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.util.DateUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputProperties;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
import org.apache.commons.lang3.StringUtils;
@@ -56,34 +56,12 @@ import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.CollectionStateWatcher;
import org.apache.solr.common.cloud.DocCollection;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class OutputSolr extends Output implements CollectionStateWatcher {
private static final Logger LOG = Logger.getLogger(OutputSolr.class);
private static final int OUTPUT_PROPERTIES_WAIT_MS = 10000;
private static final int SHARDS_WAIT_MS = 10000;
-
- private static final String DEFAULT_SOLR_JAAS_FILE = "/etc/security/keytabs/logsearch_solr.service.keytab";
- @LogSearchPropertyDescription(
- name = "logfeeder.solr.jaas.file",
- description = "The jaas file used for solr.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf/logfeeder_jaas.conf"},
- defaultValue = DEFAULT_SOLR_JAAS_FILE,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String SOLR_JAAS_FILE_PROPERTY = "logfeeder.solr.jaas.file";
-
- private static final boolean DEFAULT_SOLR_KERBEROS_ENABLE = false;
- @LogSearchPropertyDescription(
- name = "logfeeder.solr.kerberos.enable",
- description = "Enables using kerberos for accessing solr.",
- examples = {"true"},
- defaultValue = DEFAULT_SOLR_KERBEROS_ENABLE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String SOLR_KERBEROS_ENABLE_PROPERTY = "logfeeder.solr.kerberos.enable";
private static final int DEFAULT_MAX_BUFFER_SIZE = 5000;
private static final int DEFAULT_MAX_INTERVAL_MS = 3000;
@@ -197,8 +175,8 @@ public class OutputSolr extends Output implements CollectionStateWatcher {
}
private void setupSecurity() {
- String jaasFile = LogFeederUtil.getStringProperty(SOLR_JAAS_FILE_PROPERTY, DEFAULT_SOLR_JAAS_FILE);
- boolean securityEnabled = LogFeederUtil.getBooleanProperty(SOLR_KERBEROS_ENABLE_PROPERTY, DEFAULT_SOLR_KERBEROS_ENABLE);
+ String jaasFile = LogFeederPropertiesUtil.getSolrJaasFile();
+ boolean securityEnabled = LogFeederPropertiesUtil.isSolrKerberosEnabled();
if (securityEnabled) {
System.setProperty("java.security.auth.login.config", jaasFile);
HttpClientUtil.addConfigurer(new Krb5HttpClientConfigurer());
@@ -397,21 +375,22 @@ public class OutputSolr extends Output implements CollectionStateWatcher {
if (outputData != null) {
createSolrDocument(outputData);
} else {
- if (isDrain() && outgoingBuffer.size() == 0) {
+ if (isDrain() && outgoingBuffer.isEmpty()) {
break;
}
}
- if (localBuffer.size() > 0 && ((outputData == null && isDrain()) ||
- (nextDispatchDuration <= 0 || localBuffer.size() >= maxBufferSize))) {
+ if (!localBuffer.isEmpty() &&
+ (outputData == null && isDrain() || nextDispatchDuration <= 0 || localBuffer.size() >= maxBufferSize)
+ ) {
boolean response = sendToSolr(outputData);
- if( isDrain() && !response) {
+ if (isDrain() && !response) {
//Since sending to Solr response failed and it is in draining mode, let's break;
LOG.warn("In drain mode and sending to Solr failed. So exiting. output=" + getShortDescription());
break;
}
}
- if (localBuffer.size() == 0) {
+ if (localBuffer.isEmpty()) {
//If localBuffer is empty, then reset the timer
lastDispatchTime = currTimeMS;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
new file mode 100644
index 0000000..1636653
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logfeeder.util;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ambari.logfeeder.LogFeeder;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+
+/**
+ * This class contains utility methods used by LogFeeder
+ */
+public class LogFeederPropertiesUtil {
+ private static final Logger LOG = Logger.getLogger(LogFeederPropertiesUtil.class);
+
+ public static final String LOGFEEDER_PROPERTIES_FILE = "logfeeder.properties";
+
+ private static Properties props;
+ public static Properties getProperties() {
+ return props;
+ }
+
+ public static void loadProperties() throws Exception {
+ loadProperties(LOGFEEDER_PROPERTIES_FILE);
+ }
+
+ /**
+ * This method will read the properties from System, followed by propFile and finally from the map
+ */
+ public static void loadProperties(String propFile) throws Exception {
+ LOG.info("Loading properties. propFile=" + propFile);
+ props = new Properties(System.getProperties());
+ boolean propLoaded = false;
+
+ // First get properties file path from environment value
+ String propertiesFilePath = System.getProperty("properties");
+ if (StringUtils.isNotEmpty(propertiesFilePath)) {
+ File propertiesFile = new File(propertiesFilePath);
+ if (propertiesFile.exists() && propertiesFile.isFile()) {
+ LOG.info("Properties file path set in environment. Loading properties file=" + propertiesFilePath);
+ try (FileInputStream fis = new FileInputStream(propertiesFile)) {
+ props.load(fis);
+ propLoaded = true;
+ } catch (Throwable t) {
+ LOG.error("Error loading properties file. properties file=" + propertiesFile.getAbsolutePath());
+ }
+ } else {
+ LOG.error("Properties file path set in environment, but file not found. properties file=" + propertiesFilePath);
+ }
+ }
+
+ if (!propLoaded) {
+ try (BufferedInputStream bis = (BufferedInputStream) LogFeeder.class.getClassLoader().getResourceAsStream(propFile)) {
+ // Properties not yet loaded, let's try from class loader
+ if (bis != null) {
+ LOG.info("Loading properties file " + propFile + " from classpath");
+ props.load(bis);
+ propLoaded = true;
+ } else {
+ LOG.fatal("Properties file not found in classpath. properties file name= " + propFile);
+ }
+ }
+ }
+
+ if (!propLoaded) {
+ LOG.fatal("Properties file is not loaded.");
+ throw new Exception("Properties not loaded");
+ }
+ }
+
+ public static String getStringProperty(String key) {
+ return props == null ? null : props.getProperty(key);
+ }
+
+ public static String getStringProperty(String key, String defaultValue) {
+ return props == null ? defaultValue : props.getProperty(key, defaultValue);
+ }
+
+ public static boolean getBooleanProperty(String key, boolean defaultValue) {
+ String value = getStringProperty(key);
+ return toBoolean(value, defaultValue);
+ }
+
+ private static boolean toBoolean(String value, boolean defaultValue) {
+ if (StringUtils.isEmpty(value)) {
+ return defaultValue;
+ }
+
+ return "true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value);
+ }
+
+ public static int getIntProperty(String key, int defaultValue) {
+ return getIntProperty(key, defaultValue, null, null);
+ }
+
+ public static int getIntProperty(String key, int defaultValue, Integer minValue, Integer maxValue) {
+ String value = getStringProperty(key);
+ int retValue = LogFeederUtil.objectToInt(value, defaultValue, ", key=" + key);
+ if (minValue != null && retValue < minValue) {
+ LOG.info("Minimum rule was applied for " + key + ": " + retValue + " < " + minValue);
+ retValue = minValue;
+ }
+ if (maxValue != null && retValue > maxValue) {
+ LOG.info("Maximum rule was applied for " + key + ": " + retValue + " > " + maxValue);
+ retValue = maxValue;
+ }
+ return retValue;
+ }
+
+ private static final String CLUSTER_NAME_PROPERTY = "cluster.name";
+
+ @LogSearchPropertyDescription(
+ name = CLUSTER_NAME_PROPERTY,
+ description = "The name of the cluster the Log Feeder program runs in.",
+ examples = {"cl1"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getClusterName() {
+ return getStringProperty(CLUSTER_NAME_PROPERTY);
+ }
+
+ private static final String TMP_DIR_PROPERTY = "logfeeder.tmp.dir";
+ private static final String DEFAULT_TMP_DIR = "/tmp/$username/logfeeder/";
+ private static String logFeederTempDir = null;
+
+ @LogSearchPropertyDescription(
+ name = TMP_DIR_PROPERTY,
+ description = "The tmp dir used for creating temporary files.",
+ examples = {"/tmp/"},
+ defaultValue = DEFAULT_TMP_DIR,
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public synchronized static String getLogFeederTempDir() {
+ if (logFeederTempDir == null) {
+ String tempDirValue = getStringProperty(TMP_DIR_PROPERTY, DEFAULT_TMP_DIR);
+ HashMap<String, String> contextParam = new HashMap<String, String>();
+ String username = System.getProperty("user.name");
+ contextParam.put("username", username);
+ logFeederTempDir = PlaceholderUtil.replaceVariables(tempDirValue, contextParam);
+ }
+ return logFeederTempDir;
+ }
+
+ public static final String CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY = "hadoop.security.credential.provider.path";
+
+ @LogSearchPropertyDescription(
+ name = CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY,
+ description = "The jceks file that provides passwords.",
+ examples = {"jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getCredentialStoreProviderPath() {
+ return getStringProperty(CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY);
+ }
+
+ private static final String CONFIG_FILES_PROPERTY = "logfeeder.config.files";
+
+ @LogSearchPropertyDescription(
+ name = CONFIG_FILES_PROPERTY,
+ description = "Comma separated list of the config files containing global / output configurations.",
+ examples = {"global.json,output.json", "/etc/ambari-logsearch-logfeeder/conf/global.json"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getConfigFiles() {
+ return getStringProperty(CONFIG_FILES_PROPERTY);
+ }
+
+ private static final String CONFIG_DIR_PROPERTY = "logfeeder.config.dir";
+
+ @LogSearchPropertyDescription(
+ name = CONFIG_DIR_PROPERTY,
+ description = "The directory where shipper configuration files are looked for.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getConfigDir() {
+ return getStringProperty(CONFIG_DIR_PROPERTY);
+ }
+
+ public static final String CHECKPOINT_EXTENSION_PROPERTY = "logfeeder.checkpoint.extension";
+ public static final String DEFAULT_CHECKPOINT_EXTENSION = ".cp";
+
+ @LogSearchPropertyDescription(
+ name = CHECKPOINT_EXTENSION_PROPERTY,
+ description = "The extension used for checkpoint files.",
+ examples = {"ckp"},
+ defaultValue = DEFAULT_CHECKPOINT_EXTENSION,
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getCheckPointExtension() {
+ return getStringProperty(CHECKPOINT_EXTENSION_PROPERTY, DEFAULT_CHECKPOINT_EXTENSION);
+ }
+
+ private static final String CHECKPOINT_FOLDER_PROPERTY = "logfeeder.checkpoint.folder";
+
+ @LogSearchPropertyDescription(
+ name = CHECKPOINT_FOLDER_PROPERTY,
+ description = "The folder wher checkpoint files are stored.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf/checkpoints"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getCheckpointFolder() {
+ return getStringProperty(CHECKPOINT_FOLDER_PROPERTY);
+ }
+
+ private static final String CACHE_ENABLED_PROPERTY = "logfeeder.cache.enabled";
+ private static final boolean DEFAULT_CACHE_ENABLED = false;
+
+ @LogSearchPropertyDescription(
+ name = CACHE_ENABLED_PROPERTY,
+ description = "Enables the usage of a cache to avoid duplications.",
+ examples = {"true"},
+ defaultValue = DEFAULT_CACHE_ENABLED + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static boolean isCacheEnabled() {
+ return getBooleanProperty(CACHE_ENABLED_PROPERTY, DEFAULT_CACHE_ENABLED);
+ }
+
+ private static final String CACHE_KEY_FIELD_PROPERTY = "logfeeder.cache.key.field";
+ private static final String DEFAULT_CACHE_KEY_FIELD = "log_message";
+
+ @LogSearchPropertyDescription(
+ name = CACHE_KEY_FIELD_PROPERTY,
+ description = "The field which's value should be cached and should be checked for repteitions.",
+ examples = {"some_field_prone_to_repeating_value"},
+ defaultValue = DEFAULT_CACHE_KEY_FIELD,
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getCacheKeyField() {
+ return getStringProperty(CACHE_KEY_FIELD_PROPERTY, DEFAULT_CACHE_KEY_FIELD);
+ }
+
+ private static final String CACHE_SIZE_PROPERTY = "logfeeder.cache.size";
+ private static final int DEFAULT_CACHE_SIZE = 100;
+
+ @LogSearchPropertyDescription(
+ name = CACHE_SIZE_PROPERTY,
+ description = "The number of log entries to cache in order to avoid duplications.",
+ examples = {"50"},
+ defaultValue = DEFAULT_CACHE_SIZE + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getCacheSize() {
+ return getIntProperty(CACHE_SIZE_PROPERTY, DEFAULT_CACHE_SIZE);
+ }
+
+ private static final String CACHE_LAST_DEDUP_ENABLED_PROPERTY = "logfeeder.cache.last.dedup.enabled";
+ private static final boolean DEFAULT_CACHE_LAST_DEDUP_ENABLED = false;
+
+ @LogSearchPropertyDescription(
+ name = CACHE_LAST_DEDUP_ENABLED_PROPERTY,
+ description = "Enable filtering directly repeating log entries irrelevant of the time spent between them.",
+ examples = {"true"},
+ defaultValue = DEFAULT_CACHE_LAST_DEDUP_ENABLED + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static boolean isCacheLastDedupEnabled() {
+ return getBooleanProperty(CACHE_LAST_DEDUP_ENABLED_PROPERTY, DEFAULT_CACHE_LAST_DEDUP_ENABLED);
+ }
+
+ private static final String CACHE_DEDUP_INTERVAL_PROPERTY = "logfeeder.cache.dedup.interval";
+ private static final long DEFAULT_CACHE_DEDUP_INTERVAL = 1000;
+
+ @LogSearchPropertyDescription(
+ name = CACHE_DEDUP_INTERVAL_PROPERTY,
+ description = "Maximum number of milliseconds between two identical messages to be filtered out.",
+ examples = {"500"},
+ defaultValue = DEFAULT_CACHE_DEDUP_INTERVAL + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getCacheDedupInterval() {
+ return getStringProperty(CACHE_DEDUP_INTERVAL_PROPERTY, String.valueOf(DEFAULT_CACHE_DEDUP_INTERVAL));
+ }
+
+ private static final String LOG_FILTER_ENABLE_PROPERTY = "logfeeder.log.filter.enable";
+ private static final boolean DEFAULT_LOG_FILTER_ENABLE = false;
+
+ @LogSearchPropertyDescription(
+ name = LOG_FILTER_ENABLE_PROPERTY,
+ description = "Enables the filtering of the log entries by log level filters.",
+ examples = {"true"},
+ defaultValue = DEFAULT_LOG_FILTER_ENABLE + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static boolean isLogFilterEnabled() {
+ return getBooleanProperty(LOG_FILTER_ENABLE_PROPERTY, DEFAULT_LOG_FILTER_ENABLE);
+ }
+
+ private static final String INCLUDE_DEFAULT_LEVEL_PROPERTY = "logfeeder.include.default.level";
+
+ @LogSearchPropertyDescription(
+ name = INCLUDE_DEFAULT_LEVEL_PROPERTY,
+ description = "Comma separtaed list of the default log levels to be enabled by the filtering.",
+ examples = {"FATAL,ERROR,WARN"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getIncludeDefaultLevel() {
+ return getStringProperty(INCLUDE_DEFAULT_LEVEL_PROPERTY);
+ }
+
+ private static final String DEFAULT_SOLR_JAAS_FILE = "/etc/security/keytabs/logsearch_solr.service.keytab";
+ private static final String SOLR_JAAS_FILE_PROPERTY = "logfeeder.solr.jaas.file";
+
+ @LogSearchPropertyDescription(
+ name = SOLR_JAAS_FILE_PROPERTY,
+ description = "The jaas file used for solr.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf/logfeeder_jaas.conf"},
+ defaultValue = DEFAULT_SOLR_JAAS_FILE,
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getSolrJaasFile() {
+ return getStringProperty(SOLR_JAAS_FILE_PROPERTY, DEFAULT_SOLR_JAAS_FILE);
+ }
+
+ private static final String SOLR_KERBEROS_ENABLE_PROPERTY = "logfeeder.solr.kerberos.enable";
+ private static final boolean DEFAULT_SOLR_KERBEROS_ENABLE = false;
+
+ @LogSearchPropertyDescription(
+ name = SOLR_KERBEROS_ENABLE_PROPERTY,
+ description = "Enables using kerberos for accessing solr.",
+ examples = {"true"},
+ defaultValue = DEFAULT_SOLR_KERBEROS_ENABLE + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static boolean isSolrKerberosEnabled() {
+ return getBooleanProperty(SOLR_KERBEROS_ENABLE_PROPERTY, DEFAULT_SOLR_KERBEROS_ENABLE);
+ }
+
+ private static final String METRICS_COLLECTOR_HOSTS_PROPERTY = "logfeeder.metrics.collector.hosts";
+
+ @LogSearchPropertyDescription(
+ name = METRICS_COLLECTOR_HOSTS_PROPERTY,
+ description = "Comma separtaed list of metric collector hosts.",
+ examples = {"c6401.ambari.apache.org"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getMetricsCollectorHosts() {
+ return getStringProperty(METRICS_COLLECTOR_HOSTS_PROPERTY);
+ }
+
+ private static final String METRICS_COLLECTOR_PROTOCOL_PROPERTY = "logfeeder.metrics.collector.protocol";
+
+ @LogSearchPropertyDescription(
+ name = METRICS_COLLECTOR_PROTOCOL_PROPERTY,
+ description = "The protocol used by metric collectors.",
+ examples = {"http", "https"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getMetricsCollectorProtocol() {
+ return getStringProperty(METRICS_COLLECTOR_PROTOCOL_PROPERTY);
+ }
+
+ private static final String METRICS_COLLECTOR_PORT_PROPERTY = "logfeeder.metrics.collector.port";
+
+ @LogSearchPropertyDescription(
+ name = METRICS_COLLECTOR_PORT_PROPERTY,
+ description = "The port used by metric collectors.",
+ examples = {"6188"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getMetricsCollectorPort() {
+ return getStringProperty(METRICS_COLLECTOR_PORT_PROPERTY);
+ }
+
+ private static final String METRICS_COLLECTOR_PATH_PROPERTY = "logfeeder.metrics.collector.path";
+
+ @LogSearchPropertyDescription(
+ name = METRICS_COLLECTOR_PATH_PROPERTY,
+ description = "The path used by metric collectors.",
+ examples = {"/ws/v1/timeline/metrics"},
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getMetricsCollectorPath() {
+ return getStringProperty(METRICS_COLLECTOR_PATH_PROPERTY);
+ }
+
+ private static final String SIMULATE_INPUT_NUMBER_PROPERTY = "logfeeder.simulate.input_number";
+ private static final int DEFAULT_SIMULATE_INPUT_NUMBER = 0;
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_INPUT_NUMBER_PROPERTY,
+ description = "The number of the simulator instances to run with. O means no simulation.",
+ examples = {"10"},
+ defaultValue = DEFAULT_SIMULATE_INPUT_NUMBER + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getSimulateInputNumber() {
+ return getIntProperty(SIMULATE_INPUT_NUMBER_PROPERTY, DEFAULT_SIMULATE_INPUT_NUMBER);
+ }
+
+ private static final String SIMULATE_LOG_LEVEL_PROPERTY = "logfeeder.simulate.log_level";
+ private static final String DEFAULT_SIMULATE_LOG_LEVEL = "WARN";
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_LOG_LEVEL_PROPERTY,
+ description = "The log level to create the simulated log entries with.",
+ examples = {"INFO"},
+ defaultValue = DEFAULT_SIMULATE_LOG_LEVEL,
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getSimulateLogLevel() {
+ return getStringProperty(SIMULATE_LOG_LEVEL_PROPERTY, DEFAULT_SIMULATE_LOG_LEVEL);
+ }
+
+ private static final String SIMULATE_NUMBER_OF_WORDS_PROPERTY = "logfeeder.simulate.number_of_words";
+ private static final int DEFAULT_SIMULATE_NUMBER_OF_WORDS = 1000;
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_NUMBER_OF_WORDS_PROPERTY,
+ description = "The size of the set of words that may be used to create the simulated log entries with.",
+ examples = {"100"},
+ defaultValue = DEFAULT_SIMULATE_NUMBER_OF_WORDS + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getSimulateNumberOfWords() {
+ return getIntProperty(SIMULATE_NUMBER_OF_WORDS_PROPERTY, DEFAULT_SIMULATE_NUMBER_OF_WORDS, 50, 1000000);
+ }
+
+ private static final String SIMULATE_MIN_LOG_WORDS_PROPERTY = "logfeeder.simulate.min_log_words";
+ private static final int DEFAULT_SIMULATE_MIN_LOG_WORDS = 5;
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_MIN_LOG_WORDS_PROPERTY,
+ description = "The minimum number of words in a simulated log entry.",
+ examples = {"3"},
+ defaultValue = DEFAULT_SIMULATE_MIN_LOG_WORDS + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getSimulateMinLogWords() {
+ return getIntProperty(SIMULATE_MIN_LOG_WORDS_PROPERTY, DEFAULT_SIMULATE_MIN_LOG_WORDS, 1, 10);
+ }
+
+ private static final String SIMULATE_MAX_LOG_WORDS_PROPERTY = "logfeeder.simulate.max_log_words";
+ private static final int DEFAULT_SIMULATE_MAX_LOG_WORDS = 5;
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_MAX_LOG_WORDS_PROPERTY,
+ description = "The maximum number of words in a simulated log entry.",
+ examples = {"8"},
+ defaultValue = DEFAULT_SIMULATE_MAX_LOG_WORDS + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getSimulateMaxLogWords() {
+ return getIntProperty(SIMULATE_MAX_LOG_WORDS_PROPERTY, DEFAULT_SIMULATE_MAX_LOG_WORDS, 10, 20);
+ }
+
+ private static final String SIMULATE_SLEEP_MILLISECONDS_PROPERTY = "logfeeder.simulate.sleep_milliseconds";
+ private static final int DEFAULT_SIMULATE_SLEEP_MILLISECONDS = 10000;
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_SLEEP_MILLISECONDS_PROPERTY,
+ description = "The milliseconds to sleep between creating two simulated log entries.",
+ examples = {"5000"},
+ defaultValue = DEFAULT_SIMULATE_SLEEP_MILLISECONDS + "",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static int getSimulateSleepMilliseconds() {
+ return getIntProperty(SIMULATE_SLEEP_MILLISECONDS_PROPERTY, DEFAULT_SIMULATE_SLEEP_MILLISECONDS);
+ }
+
+ private static final String SIMULATE_LOG_IDS_PROPERTY = "logfeeder.simulate.log_ids";
+
+ @LogSearchPropertyDescription(
+ name = SIMULATE_LOG_IDS_PROPERTY,
+ description = "The comma separated list of log ids for which to create the simulated log entries.",
+ examples = {"ambari_server,zookeeper,infra_solr,logsearch_app"},
+ defaultValue = "The log ids of the installed services in the cluster",
+ sources = {LOGFEEDER_PROPERTIES_FILE}
+ )
+ public static String getSimulateLogIds() {
+ return getStringProperty(SIMULATE_LOG_IDS_PROPERTY);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
index a244a4e..9efab25 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederUtil.java
@@ -19,20 +19,14 @@
package org.apache.ambari.logfeeder.util;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.lang.reflect.Type;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
-import java.util.Properties;
-import org.apache.ambari.logfeeder.LogFeeder;
import org.apache.ambari.logfeeder.metrics.MetricData;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -47,26 +41,6 @@ import com.google.gson.reflect.TypeToken;
public class LogFeederUtil {
private static final Logger LOG = Logger.getLogger(LogFeederUtil.class);
- public static final String LOGFEEDER_PROPERTIES_FILE = "logfeeder.properties";
-
- @LogSearchPropertyDescription(
- name = "cluster.name",
- description = "The name of the cluster the Log Feeder program runs in.",
- examples = {"cl1"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CLUSTER_NAME_PROPERTY = "cluster.name";
-
- private static final String DEFAULT_TMP_DIR = "/tmp/$username/logfeeder/";
- @LogSearchPropertyDescription(
- name = "logfeeder.tmp.dir",
- description = "The tmp dir used for creating temporary files.",
- examples = {"/tmp/"},
- defaultValue = DEFAULT_TMP_DIR,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String TMP_DIR_PROPERTY = "logfeeder.tmp.dir";
-
private final static String GSON_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
private static Gson gson = new GsonBuilder().setDateFormat(GSON_DATE_FORMAT).create();
@@ -96,113 +70,6 @@ public class LogFeederUtil {
LOG.error("Error getting hostname.", e);
}
}
-
- private static Properties props;
- public static Properties getProperties() {
- return props;
- }
-
- public static void loadProperties() throws Exception {
- loadProperties(LOGFEEDER_PROPERTIES_FILE);
- }
-
- /**
- * This method will read the properties from System, followed by propFile and finally from the map
- */
- public static void loadProperties(String propFile) throws Exception {
- LOG.info("Loading properties. propFile=" + propFile);
- props = new Properties(System.getProperties());
- boolean propLoaded = false;
-
- // First get properties file path from environment value
- String propertiesFilePath = System.getProperty("properties");
- if (StringUtils.isNotEmpty(propertiesFilePath)) {
- File propertiesFile = new File(propertiesFilePath);
- if (propertiesFile.exists() && propertiesFile.isFile()) {
- LOG.info("Properties file path set in environment. Loading properties file=" + propertiesFilePath);
- try (FileInputStream fis = new FileInputStream(propertiesFile)) {
- props.load(fis);
- propLoaded = true;
- } catch (Throwable t) {
- LOG.error("Error loading properties file. properties file=" + propertiesFile.getAbsolutePath());
- }
- } else {
- LOG.error("Properties file path set in environment, but file not found. properties file=" + propertiesFilePath);
- }
- }
-
- if (!propLoaded) {
- try (BufferedInputStream bis = (BufferedInputStream) LogFeeder.class.getClassLoader().getResourceAsStream(propFile)) {
- // Properties not yet loaded, let's try from class loader
- if (bis != null) {
- LOG.info("Loading properties file " + propFile + " from classpath");
- props.load(bis);
- propLoaded = true;
- } else {
- LOG.fatal("Properties file not found in classpath. properties file name= " + propFile);
- }
- }
- }
-
- if (!propLoaded) {
- LOG.fatal("Properties file is not loaded.");
- throw new Exception("Properties not loaded");
- }
- }
-
- public static String getStringProperty(String key) {
- return props == null ? null : props.getProperty(key);
- }
-
- public static String getStringProperty(String key, String defaultValue) {
- return props == null ? defaultValue : props.getProperty(key, defaultValue);
- }
-
- public static boolean getBooleanProperty(String key, boolean defaultValue) {
- String value = getStringProperty(key);
- return toBoolean(value, defaultValue);
- }
-
- private static boolean toBoolean(String value, boolean defaultValue) {
- if (StringUtils.isEmpty(value)) {
- return defaultValue;
- }
-
- return "true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value);
- }
-
- public static int getIntProperty(String key, int defaultValue) {
- return getIntProperty(key, defaultValue, null, null);
- }
-
- public static int getIntProperty(String key, int defaultValue, Integer minValue, Integer maxValue) {
- String value = getStringProperty(key);
- int retValue = objectToInt(value, defaultValue, ", key=" + key);
- if (minValue != null && retValue < minValue) {
- LOG.info("Minimum rule was applied for " + key + ": " + retValue + " < " + minValue);
- retValue = minValue;
- }
- if (maxValue != null && retValue > maxValue) {
- LOG.info("Maximum rule was applied for " + key + ": " + retValue + " > " + maxValue);
- retValue = maxValue;
- }
- return retValue;
- }
-
- public static int objectToInt(Object objValue, int retValue, String errMessage) {
- if (objValue == null) {
- return retValue;
- }
- String strValue = objValue.toString();
- if (StringUtils.isNotEmpty(strValue)) {
- try {
- retValue = Integer.parseInt(strValue);
- } catch (Throwable t) {
- LOG.error("Error parsing integer value. str=" + strValue + ", " + errMessage);
- }
- }
- return retValue;
- }
public static void logStatForMetric(MetricData metric, String prefixStr, String postFix) {
long currStat = metric.value;
@@ -232,6 +99,21 @@ public class LogFeederUtil {
return gson.fromJson(jsonStr, type);
}
+ public static int objectToInt(Object objValue, int retValue, String errMessage) {
+ if (objValue == null) {
+ return retValue;
+ }
+ String strValue = objValue.toString();
+ if (StringUtils.isNotEmpty(strValue)) {
+ try {
+ retValue = Integer.parseInt(strValue);
+ } catch (Throwable t) {
+ LOG.error("Error parsing integer value. str=" + strValue + ", " + errMessage);
+ }
+ }
+ return retValue;
+ }
+
private static class LogHistory {
private long lastLogTime = 0;
private int counter = 0;
@@ -260,21 +142,4 @@ public class LogFeederUtil {
return false;
}
}
-
- public static String getClusterName() {
- return getStringProperty(CLUSTER_NAME_PROPERTY);
- }
-
- private static String logFeederTempDir = null;
-
- public synchronized static String getLogFeederTempDir() {
- if (logFeederTempDir == null) {
- String tempDirValue = getStringProperty(TMP_DIR_PROPERTY, DEFAULT_TMP_DIR);
- HashMap<String, String> contextParam = new HashMap<String, String>();
- String username = System.getProperty("user.name");
- contextParam.put("username", username);
- logFeederTempDir = PlaceholderUtil.replaceVariables(tempDirValue, contextParam);
- }
- return logFeederTempDir;
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
index 573bb1c..6bcaac9 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
@@ -19,7 +19,6 @@
package org.apache.ambari.logfeeder.util;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.ArrayUtils;
@@ -29,8 +28,6 @@ import org.apache.log4j.Logger;
import java.io.File;
import java.nio.charset.Charset;
-import static org.apache.ambari.logfeeder.util.LogFeederUtil.LOGFEEDER_PROPERTIES_FILE;
-
public class SSLUtil {
private static final Logger LOG = Logger.getLogger(SSLUtil.class);
@@ -45,13 +42,6 @@ public class SSLUtil {
private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
- @LogSearchPropertyDescription(
- name = "hadoop.security.credential.provider.path",
- description = "The jceks file that provides passwords.",
- examples = {"jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- private static final String CREDENTIAL_STORE_PROVIDER_PATH = "hadoop.security.credential.provider.path";
private static final String LOGFEEDER_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
private static final String LOGFEEDER_STORE_DEFAULT_PASSWORD = "bigdata";
@@ -111,13 +101,13 @@ public class SSLUtil {
private static String getPasswordFromCredentialStore(String propertyName) {
try {
- String providerPath = LogFeederUtil.getStringProperty(CREDENTIAL_STORE_PROVIDER_PATH);
+ String providerPath = LogFeederPropertiesUtil.getCredentialStoreProviderPath();
if (providerPath == null) {
return null;
}
Configuration config = new Configuration();
- config.set(CREDENTIAL_STORE_PROVIDER_PATH, providerPath);
+ config.set(LogFeederPropertiesUtil.CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY, providerPath);
char[] passwordChars = config.getPassword(propertyName);
return (ArrayUtils.isNotEmpty(passwordChars)) ? new String(passwordChars) : null;
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
index c07035b..46abc63 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
@@ -29,7 +29,7 @@ import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.loglevelfilter.FilterLogData;
import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
import org.apache.commons.lang.time.DateUtils;
@@ -61,7 +61,7 @@ public class LogConfigHandlerTest {
@BeforeClass
public static void init() throws Exception {
- LogFeederUtil.loadProperties("logfeeder.properties");
+ LogFeederPropertiesUtil.loadProperties("logfeeder.properties");
LogSearchConfig config = strictMock(LogSearchConfig.class);
config.createLogLevelFilter(anyString(), anyString(), anyObject(LogLevelFilter.class));
http://git-wip-us.apache.org/repos/asf/ambari/blob/27386c3d/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
index 4b4067c..24042a7 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
@@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.TreeMap;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
+import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.junit.Before;
@@ -44,7 +44,7 @@ public class MetricsManagerTest {
@BeforeClass
public static void loadProperties() throws Exception {
- LogFeederUtil.loadProperties("logfeeder.properties");
+ LogFeederPropertiesUtil.loadProperties("logfeeder.properties");
}
@Before
[48/50] [abbrv] ambari git commit: AMBARI-21677. Upgrade Pre-Checks
Should Take PATCH/SERVICE Types Into Account - fix import
Posted by ab...@apache.org.
AMBARI-21677. Upgrade Pre-Checks Should Take PATCH/SERVICE Types Into Account - fix import
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1433ecff
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1433ecff
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1433ecff
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 1433ecff108df159f71961e23a34d248e1684c85
Parents: 655c3c6
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Thu Aug 10 11:56:16 2017 +0200
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Thu Aug 10 11:56:16 2017 +0200
----------------------------------------------------------------------
.../apache/ambari/server/checks/AbstractCheckDescriptorTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1433ecff/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
index 1b87b30..092bd0b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
@@ -36,13 +36,13 @@ import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckType;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
-import org.apache.hadoop.metrics2.sink.relocated.google.common.collect.Sets;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.easymock.Mock;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.Sets;
import com.google.inject.Provider;
import junit.framework.Assert;
@@ -303,4 +303,4 @@ public class AbstractCheckDescriptorTest extends EasyMockSupport {
throws AmbariException {
}
}
-}
\ No newline at end of file
+}
[22/50] [abbrv] ambari git commit: AMBARI-21661 Services are not
started for the correct count of nodes selected in the Hosts list.
(ababiichuk)
Posted by ab...@apache.org.
AMBARI-21661 Services are not started for the correct count of nodes selected in the Hosts list. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b175d8f6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b175d8f6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b175d8f6
Branch: refs/heads/branch-feature-logsearch-ui
Commit: b175d8f697c8690e719c8a3f8dbcd20df073d2a6
Parents: 2258b10
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Aug 4 16:37:10 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Aug 4 18:12:04 2017 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/bulk_operations_controller.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b175d8f6/ambari-web/app/controllers/main/host/bulk_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/bulk_operations_controller.js b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
index 34d61d8..bcd0af0 100644
--- a/ambari-web/app/controllers/main/host/bulk_operations_controller.js
+++ b/ambari-web/app/controllers/main/host/bulk_operations_controller.js
@@ -1115,7 +1115,7 @@ App.BulkOperationsController = Em.Controller.extend({
// @todo remove using external controller
switch(selection) {
case 's':
- hostsNames = App.router.get('mainHostController.content').filterProperty('selected').mapProperty('hostName');
+ hostsNames = App.db.getSelectedHosts('mainHostController');
if(hostsNames.length > 0){
queryParams.push({
key: 'Hosts/host_name',
[40/50] [abbrv] ambari git commit: AMBARI-21679. Service Checks Will
Run Multiple Times In Patch/Service Upgrades (ncole)
Posted by ab...@apache.org.
AMBARI-21679. Service Checks Will Run Multiple Times In Patch/Service Upgrades (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b2346493
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b2346493
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b2346493
Branch: refs/heads/branch-feature-logsearch-ui
Commit: b23464936abad71f07e632ab6b0472b60a9ab0e3
Parents: c9ced87
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Aug 8 12:26:35 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Aug 9 11:12:15 2017 -0400
----------------------------------------------------------------------
.../ambari/server/state/UpgradeHelper.java | 68 +++++++++++++++++++-
.../state/stack/upgrade/ClusterGrouping.java | 4 ++
.../server/state/stack/upgrade/Grouping.java | 15 +++++
.../stack/upgrade/ServiceCheckGrouping.java | 60 ++++++++++++++---
.../ambari/server/state/UpgradeHelperTest.java | 68 +++++++++++++++++++-
.../HDP/2.1.1/upgrades/upgrade_test_checks.xml | 15 +++++
6 files changed, 217 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index 7ed70de..464cb41 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -63,6 +63,8 @@ import org.apache.ambari.server.state.stack.upgrade.Direction;
import org.apache.ambari.server.state.stack.upgrade.Grouping;
import org.apache.ambari.server.state.stack.upgrade.ManualTask;
import org.apache.ambari.server.state.stack.upgrade.RestartTask;
+import org.apache.ambari.server.state.stack.upgrade.ServiceCheckGrouping;
+import org.apache.ambari.server.state.stack.upgrade.ServiceCheckGrouping.ServiceCheckStageWrapper;
import org.apache.ambari.server.state.stack.upgrade.StageWrapper;
import org.apache.ambari.server.state.stack.upgrade.StageWrapperBuilder;
import org.apache.ambari.server.state.stack.upgrade.StartTask;
@@ -77,6 +79,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -299,6 +302,7 @@ public class UpgradeHelper {
Map<String, Map<String, ProcessingComponent>> allTasks = upgradePack.getTasks();
List<UpgradeGroupHolder> groups = new ArrayList<>();
+ UpgradeGroupHolder previousGroupHolder = null;
for (Grouping group : upgradePack.getGroups(context.getDirection())) {
// !!! grouping is not scoped to context
@@ -320,6 +324,7 @@ public class UpgradeHelper {
groupHolder.skippable = group.skippable;
groupHolder.supportsAutoSkipOnFailure = group.supportsAutoSkipOnFailure;
groupHolder.allowRetry = group.allowRetry;
+ groupHolder.processingGroup = group.isProcessingGroup();
// !!! all downgrades are skippable
if (context.getDirection().isDowngrade()) {
@@ -496,9 +501,22 @@ public class UpgradeHelper {
List<StageWrapper> proxies = builder.build(context);
if (CollectionUtils.isNotEmpty(proxies)) {
+
groupHolder.items = proxies;
postProcess(context, groupHolder);
- groups.add(groupHolder);
+
+ // !!! prevent service checks from running twice. merge the stage wrappers
+ if (ServiceCheckGrouping.class.isInstance(group)) {
+ if (null != previousGroupHolder && ServiceCheckGrouping.class.equals(previousGroupHolder.groupClass)) {
+ mergeServiceChecks(groupHolder, previousGroupHolder);
+ } else {
+ groups.add(groupHolder);
+ }
+ } else {
+ groups.add(groupHolder);
+ }
+
+ previousGroupHolder = groupHolder;
}
}
@@ -518,10 +536,53 @@ public class UpgradeHelper {
}
}
+ // !!! strip off the first service check if nothing has been processed
+ Iterator<UpgradeGroupHolder> iterator = groups.iterator();
+ boolean canServiceCheck = false;
+ while (iterator.hasNext()) {
+ UpgradeGroupHolder holder = iterator.next();
+
+ if (ServiceCheckGrouping.class.equals(holder.groupClass) && !canServiceCheck) {
+ iterator.remove();
+ }
+
+ canServiceCheck |= holder.processingGroup;
+ }
+
return groups;
}
/**
+ * Merges two service check groups when they have been orchestrated back-to-back.
+ * @param newHolder the "new" group holder, which was orchestrated after the "old" one
+ * @param oldHolder the "old" group holder, which is one that was already orchestrated
+ */
+ @SuppressWarnings("unchecked")
+ private void mergeServiceChecks(UpgradeGroupHolder newHolder, UpgradeGroupHolder oldHolder) {
+
+ LinkedHashSet<StageWrapper> priority = new LinkedHashSet<>();
+ LinkedHashSet<StageWrapper> others = new LinkedHashSet<>();
+
+ for (List<StageWrapper> holderItems : new List[] { oldHolder.items, newHolder.items }) {
+ for (StageWrapper stageWrapper : holderItems) {
+ ServiceCheckStageWrapper wrapper = (ServiceCheckStageWrapper) stageWrapper;
+
+ if (wrapper.priority) {
+ priority.add(stageWrapper);
+ } else {
+ others.add(stageWrapper);
+ }
+ }
+ }
+
+ // !!! remove duplicate wrappers that are now in the priority list
+ others = new LinkedHashSet<>(CollectionUtils.subtract(others, priority));
+
+ oldHolder.items = Lists.newLinkedList(priority);
+ oldHolder.items.addAll(others);
+ }
+
+ /**
* Walks through the UpgradeGroupHolder and updates titles and manual tasks,
* replacing keyword tokens needed for display purposes
*
@@ -643,6 +704,11 @@ public class UpgradeHelper {
*/
public static class UpgradeGroupHolder {
/**
+ *
+ */
+ private boolean processingGroup;
+
+ /**
* The name
*/
public String name;
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
index 3deb7c8..7ad0257 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
@@ -70,6 +70,10 @@ public class ClusterGrouping extends Grouping {
return new ClusterBuilder(this);
}
+ @Override
+ protected boolean serviceCheckAfterProcessing() {
+ return false;
+ }
/**
* Represents a single-stage execution that happens as part of a cluster-wide
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java
index 4f278fd..bfa0b5b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Grouping.java
@@ -93,6 +93,21 @@ public class Grouping {
public Condition condition;
/**
+ * @return {@code true} when the grouping is used to upgrade services and that it is
+ * appropriate to run service checks after orchestration.
+ */
+ public final boolean isProcessingGroup() {
+ return serviceCheckAfterProcessing();
+ }
+
+ /**
+ * Overridable function to indicate if full service checks can be run
+ */
+ protected boolean serviceCheckAfterProcessing() {
+ return true;
+ }
+
+ /**
* Gets the default builder.
*/
public StageWrapperBuilder getBuilder() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java
index 61a387f..44c8ae1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ServiceCheckGrouping.java
@@ -67,6 +67,11 @@ public class ServiceCheckGrouping extends Grouping {
@XmlElement(name="service")
private Set<String> excludeServices = new HashSet<>();
+ @Override
+ protected boolean serviceCheckAfterProcessing() {
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
@@ -137,11 +142,8 @@ public class ServiceCheckGrouping extends Grouping {
// create stages for the priorities
for (String service : priorityServices) {
if (checkServiceValidity(upgradeContext, service, serviceMap)) {
- StageWrapper wrapper = new StageWrapper(
- StageWrapper.Type.SERVICE_CHECK,
- "Service Check " + upgradeContext.getServiceDisplay(service),
- new TaskWrapper(service, "", Collections.<String>emptySet(),
- new ServiceCheckTask()));
+ StageWrapper wrapper = new ServiceCheckStageWrapper(service,
+ upgradeContext.getServiceDisplay(service), true);
result.add(wrapper);
clusterServices.remove(service);
@@ -156,11 +158,9 @@ public class ServiceCheckGrouping extends Grouping {
}
if (checkServiceValidity(upgradeContext, service, serviceMap)) {
- StageWrapper wrapper = new StageWrapper(
- StageWrapper.Type.SERVICE_CHECK,
- "Service Check " + upgradeContext.getServiceDisplay(service),
- new TaskWrapper(service, "", Collections.<String>emptySet(),
- new ServiceCheckTask()));
+ StageWrapper wrapper = new ServiceCheckStageWrapper(service,
+ upgradeContext.getServiceDisplay(service), false);
+
result.add(wrapper);
}
}
@@ -266,4 +266,44 @@ public class ServiceCheckGrouping extends Grouping {
}
}
}
+
+ /**
+ * Special type of stage wrapper that allows inspection of the service check for
+ * merging if required. This prevents consecutive service checks from running, particularly
+ * for Patch or Maintenance types of upgrades.
+ */
+ public static class ServiceCheckStageWrapper extends StageWrapper {
+ public String service;
+ public boolean priority;
+
+ ServiceCheckStageWrapper(String service, String serviceDisplay, boolean priority) {
+ super(StageWrapper.Type.SERVICE_CHECK,
+ String.format("Service Check %s", serviceDisplay),
+ new TaskWrapper(service, "", Collections.<String>emptySet(), new ServiceCheckTask()));
+
+ this.service = service;
+ this.priority = priority;
+ }
+
+ @Override
+ public int hashCode() {
+ return service.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!other.getClass().equals(getClass())) {
+ return false;
+ }
+
+ if (other == this) {
+ return true;
+ }
+
+ return ((ServiceCheckStageWrapper) other).service.equals(service);
+
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index 24a3fa2..5dfbc53 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -77,6 +77,7 @@ import org.apache.ambari.server.state.stack.upgrade.HostOrderItem;
import org.apache.ambari.server.state.stack.upgrade.HostOrderItem.HostOrderActionType;
import org.apache.ambari.server.state.stack.upgrade.ManualTask;
import org.apache.ambari.server.state.stack.upgrade.SecurityCondition;
+import org.apache.ambari.server.state.stack.upgrade.ServiceCheckGrouping;
import org.apache.ambari.server.state.stack.upgrade.StageWrapper;
import org.apache.ambari.server.state.stack.upgrade.StopGrouping;
import org.apache.ambari.server.state.stack.upgrade.Task;
@@ -1109,11 +1110,11 @@ public class UpgradeHelperTest extends EasyMockSupport {
List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
- assertEquals(5, groups.size());
+ assertEquals(6, groups.size());
// grab the manual task out of ZK which has placeholder text
- UpgradeGroupHolder zookeeperGroup = groups.get(3);
+ UpgradeGroupHolder zookeeperGroup = groups.get(4);
assertEquals("ZOOKEEPER", zookeeperGroup.name);
ManualTask manualTask = (ManualTask) zookeeperGroup.items.get(0).getTasks().get(
0).getTasks().get(0);
@@ -2498,8 +2499,71 @@ public class UpgradeHelperTest extends EasyMockSupport {
assertNotNull(clusterEnvMap);
assertTrue(clusterEnvMap.containsKey("a"));
+
+ // Do stacks cleanup
+ stackManagerMock.invalidateCurrentPaths();
+ ambariMetaInfo.init();
+ }
+
+ @Test
+ public void testSequentialServiceChecks() throws Exception {
+ Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
+ assertTrue(upgrades.containsKey("upgrade_test_checks"));
+ UpgradePack upgrade = upgrades.get("upgrade_test_checks");
+ assertNotNull(upgrade);
+
+ Cluster cluster = makeCluster();
+ cluster.deleteService("HDFS");
+ cluster.deleteService("YARN");
+
+ UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE,
+ UpgradeType.ROLLING, repositoryVersion2110);
+
+ List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
+ assertEquals(5, groups.size());
+
+ UpgradeGroupHolder serviceCheckGroup = groups.get(2);
+ assertEquals(ServiceCheckGrouping.class, serviceCheckGroup.groupClass);
+ assertEquals(3, serviceCheckGroup.items.size());
+
+ StageWrapper wrapper = serviceCheckGroup.items.get(0);
+ assertEquals(ServiceCheckGrouping.ServiceCheckStageWrapper.class, wrapper.getClass());
+ assertTrue(wrapper.getText().contains("ZooKeeper"));
+
+ // Do stacks cleanup
+ stackManagerMock.invalidateCurrentPaths();
+ ambariMetaInfo.init();
}
+ @Test
+ public void testPrematureServiceChecks() throws Exception {
+ Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
+ assertTrue(upgrades.containsKey("upgrade_test_checks"));
+ UpgradePack upgrade = upgrades.get("upgrade_test_checks");
+ assertNotNull(upgrade);
+
+ Cluster cluster = makeCluster();
+ cluster.deleteService("HDFS");
+ cluster.deleteService("YARN");
+ cluster.deleteService("ZOOKEEPER");
+
+ UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE,
+ UpgradeType.ROLLING, repositoryVersion2110);
+
+ List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
+
+ assertEquals(3, groups.size());
+
+ for (UpgradeGroupHolder holder : groups) {
+ assertFalse(ServiceCheckGrouping.class.equals(holder.groupClass));
+ }
+
+ // Do stacks cleanup
+ stackManagerMock.invalidateCurrentPaths();
+ ambariMetaInfo.init();
+ }
+
+
/**
* @param cluster
* @param direction
http://git-wip-us.apache.org/repos/asf/ambari/blob/b2346493/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_checks.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_checks.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_checks.xml
index f82b025..6b91ee3 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_checks.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_checks.xml
@@ -68,6 +68,7 @@
<component>ZOOKEEPER_CLIENT</component>
</service>
</group>
+
<group name="CORE_MASTER" title="Core Masters">
<service name="HDFS">
<component>JOURNALNODE</component>
@@ -108,11 +109,18 @@
<group name="SERVICE_CHECK_2" title="Post-Slave Service Checks" xsi:type="service-check">
<priority>
+ <service>ZOOKEEPER</service>
<service>HDFS</service>
<service>YARN</service>
</priority>
</group>
+ <group name="OOZIE" title="Oozie">
+ <service name="OOZIE">
+ <component>OOZIE_SERVER</component>
+ </service>
+ </group>
+
<group xsi:type="cluster" name="POST_CLUSTER" title="Finalize Upgrade">
<execute-stage title="Confirm Finalize">
@@ -213,5 +221,12 @@
<upgrade />
</component>
</service>
+ <service name="OOZIE">
+ <component name="OOZIE_SERVER">
+ <upgrade>
+ <task xsi:type="restart-task" />
+ </upgrade>
+ </component>
+ </service>
</processing>
</upgrade>
[26/50] [abbrv] ambari git commit: AMBARI-21669 Provide ability on
the UI to parse include/exclude files host task name. (atkach)
Posted by ab...@apache.org.
AMBARI-21669 Provide ability on the UI to parse include/exclude files host task name. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/153e03aa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/153e03aa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/153e03aa
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 153e03aa024ffa483ad2f905151f1dcb8911b520
Parents: 58827ad
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Aug 7 16:24:50 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Aug 7 17:24:41 2017 +0300
----------------------------------------------------------------------
ambari-web/app/utils/helper.js | 11 ++++++++---
ambari-web/test/utils/helper_test.js | 5 +++++
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/153e03aa/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 4867c65..3bc247c 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -698,23 +698,28 @@ App.format = {
var detailArr = command_detail.split(' ');
var self = this;
var result = '';
+ var isIncludeExcludeFiles = false;
//if an optional operation display name has been specified in the service metainfo.xml
if (ops_display_name != null && ops_display_name.length > 0) {
result = result + ' ' + ops_display_name;
} else {
detailArr.forEach( function(item) {
// if the item has the pattern SERVICE/COMPONENT, drop the SERVICE part
- if (item.contains('/')) {
+ if (item.contains('/') && !isIncludeExcludeFiles) {
item = item.split('/')[1];
}
- if (item == 'DECOMMISSION,') {
+ if (item === 'DECOMMISSION,') {
// ignore text 'DECOMMISSION,'( command came from 'excluded/included'), here get the component name from request_inputs
- item = (jQuery.parseJSON(request_inputs)) ? jQuery.parseJSON(request_inputs).slave_type : '';
+ var parsedInputs = jQuery.parseJSON(request_inputs);
+ item = (parsedInputs) ? (parsedInputs.slave_type || '') : '';
+ isIncludeExcludeFiles = (parsedInputs) ? parsedInputs.is_add_or_delete_slave_request === 'true' : false;
}
if (self.components[item]) {
result = result + ' ' + self.components[item];
} else if (self.command[item]) {
result = result + ' ' + self.command[item];
+ } else if (isIncludeExcludeFiles) {
+ result = result + ' ' + item;
} else {
result = result + ' ' + self.role(item, false);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/153e03aa/ambari-web/test/utils/helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/helper_test.js b/ambari-web/test/utils/helper_test.js
index 9dcbc4f..e64ee7e 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -280,6 +280,11 @@ describe('utils/helper', function() {
it('should return install repo message', function() {
expect(App.format.commandDetail(installRepo)).to.be.equal(Em.I18n.t('common.installRepo.task'));
});
+ it('should return raw text when is_add_or_delete_slave_request=true', function() {
+ var inputs = '{"is_add_or_delete_slave_request":"true"}';
+ expect(App.format.commandDetail('DECOMMISSION, Update Include/Exclude Files', inputs))
+ .to.be.equal(' Update Include/Exclude Files');
+ });
});
describe('#taskStatus()', function(){
var testable = [
[05/50] [abbrv] ambari git commit: AMBARI-21581 - Replace Hard Coded
conf-select Structures (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21581 - Replace Hard Coded conf-select Structures (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/97ccf3bf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/97ccf3bf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/97ccf3bf
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 97ccf3bff96f8717c185776c7c000496df90daa0
Parents: 0a9f6fa
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Aug 1 10:02:37 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Aug 2 08:45:31 2017 -0400
----------------------------------------------------------------------
.../libraries/functions/conf_select.py | 213 +---
.../libraries/functions/stack_select.py | 8 +-
.../BlueprintConfigurationProcessor.java | 2 +-
.../ambari/server/state/ConfigHelper.java | 2 +-
.../server/upgrade/FinalUpgradeCatalog.java | 4 +-
.../package/scripts/accumulo_client.py | 2 -
.../package/scripts/accumulo_script.py | 2 -
.../0.1.0.2.3/package/scripts/atlas_client.py | 3 +-
.../package/scripts/metadata_server.py | 3 +-
.../0.7.0.3.0/package/scripts/atlas_client.py | 3 +-
.../package/scripts/metadata_server.py | 3 +-
.../DRUID/0.9.2/package/scripts/druid_node.py | 3 -
.../DRUID/0.9.2/package/scripts/superset.py | 3 -
.../0.5.0.2.1/package/scripts/falcon_client.py | 3 +-
.../0.5.0.2.1/package/scripts/falcon_server.py | 2 -
.../1.4.0.2.0/package/scripts/flume_handler.py | 3 +-
.../0.96.0.2.0/package/scripts/hbase_client.py | 11 +-
.../package/scripts/phoenix_queryserver.py | 5 +-
.../HBASE/0.96.0.2.0/package/scripts/upgrade.py | 3 +-
.../2.0.0.3.0/package/scripts/hbase_client.py | 9 +-
.../package/scripts/phoenix_queryserver.py | 2 -
.../HBASE/2.0.0.3.0/package/scripts/upgrade.py | 3 +-
.../HDFS/2.1.0.2.0/package/scripts/datanode.py | 6 +-
.../2.1.0.2.0/package/scripts/hdfs_client.py | 3 +-
.../2.1.0.2.0/package/scripts/journalnode.py | 3 +-
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 9 +-
.../2.1.0.2.0/package/scripts/nfsgateway.py | 2 -
.../HDFS/2.1.0.2.0/package/scripts/snamenode.py | 3 +-
.../2.1.0.2.0/package/scripts/zkfc_slave.py | 3 +-
.../HDFS/3.0.0.3.0/package/scripts/datanode.py | 6 +-
.../3.0.0.3.0/package/scripts/hdfs_client.py | 3 +-
.../3.0.0.3.0/package/scripts/journalnode.py | 3 +-
.../HDFS/3.0.0.3.0/package/scripts/namenode.py | 6 +-
.../3.0.0.3.0/package/scripts/nfsgateway.py | 2 -
.../HDFS/3.0.0.3.0/package/scripts/snamenode.py | 3 +-
.../3.0.0.3.0/package/scripts/zkfc_slave.py | 3 +-
.../0.12.0.2.0/package/scripts/hive_client.py | 4 +-
.../package/scripts/hive_metastore.py | 2 -
.../0.12.0.2.0/package/scripts/hive_server.py | 2 -
.../package/scripts/hive_server_interactive.py | 2 -
.../package/scripts/webhcat_server.py | 5 +-
.../2.1.0.3.0/package/scripts/hive_client.py | 4 +-
.../2.1.0.3.0/package/scripts/hive_metastore.py | 2 -
.../2.1.0.3.0/package/scripts/hive_server.py | 2 -
.../package/scripts/hive_server_interactive.py | 2 -
.../2.1.0.3.0/package/scripts/webhcat_server.py | 4 +-
.../0.10.0.3.0/package/scripts/kafka_broker.py | 4 -
.../KAFKA/0.8.1/package/scripts/kafka_broker.py | 6 +-
.../0.5.0.2.2/package/scripts/knox_gateway.py | 4 +-
.../0.5.0.3.0/package/scripts/knox_gateway.py | 4 +-
.../1.0.0.2.3/package/scripts/mahout_client.py | 2 -
.../4.0.0.2.0/package/scripts/oozie_client.py | 3 +-
.../4.0.0.2.0/package/scripts/oozie_server.py | 5 -
.../4.2.0.3.0/package/scripts/oozie_client.py | 3 +-
.../4.2.0.3.0/package/scripts/oozie_server.py | 5 -
.../0.12.0.2.0/package/scripts/pig_client.py | 4 +-
.../0.16.1.3.0/package/scripts/pig_client.py | 4 +-
.../0.4.0/package/scripts/ranger_admin.py | 8 +-
.../0.4.0/package/scripts/ranger_tagsync.py | 8 +-
.../0.4.0/package/scripts/ranger_usersync.py | 4 +-
.../RANGER/0.4.0/package/scripts/upgrade.py | 31 -
.../1.0.0.3.0/package/scripts/ranger_admin.py | 4 +-
.../1.0.0.3.0/package/scripts/ranger_tagsync.py | 7 +-
.../package/scripts/ranger_usersync.py | 2 +-
.../RANGER/1.0.0.3.0/package/scripts/upgrade.py | 4 +-
.../0.5.0.2.3/package/scripts/kms_server.py | 3 +-
.../0.5.0.2.3/package/scripts/upgrade.py | 30 -
.../1.0.0.3.0/package/scripts/kms_server.py | 2 +-
.../1.0.0.3.0/package/scripts/upgrade.py | 3 +-
.../0.60.0.2.2/package/scripts/slider_client.py | 8 +-
.../0.91.0.3.0/package/scripts/slider_client.py | 8 +-
.../1.2.1/package/scripts/job_history_server.py | 3 +-
.../SPARK/1.2.1/package/scripts/livy_server.py | 3 +-
.../SPARK/1.2.1/package/scripts/spark_client.py | 4 +-
.../package/scripts/spark_thrift_server.py | 3 +-
.../2.2.0/package/scripts/job_history_server.py | 3 +-
.../SPARK/2.2.0/package/scripts/livy_server.py | 3 +-
.../SPARK/2.2.0/package/scripts/spark_client.py | 3 +-
.../package/scripts/spark_thrift_server.py | 3 +-
.../2.0.0/package/scripts/job_history_server.py | 3 +-
.../2.0.0/package/scripts/livy2_server.py | 3 +-
.../2.0.0/package/scripts/spark_client.py | 3 +-
.../package/scripts/spark_thrift_server.py | 3 +-
.../1.4.4.2.0/package/scripts/sqoop_client.py | 4 +-
.../1.4.4.3.0/package/scripts/sqoop_client.py | 4 +-
.../STORM/0.9.1/package/scripts/drpc_server.py | 2 -
.../STORM/0.9.1/package/scripts/nimbus.py | 2 -
.../STORM/0.9.1/package/scripts/nimbus_prod.py | 2 -
.../STORM/0.9.1/package/scripts/pacemaker.py | 2 -
.../STORM/0.9.1/package/scripts/supervisor.py | 2 -
.../0.9.1/package/scripts/supervisor_prod.py | 2 -
.../STORM/0.9.1/package/scripts/ui_server.py | 2 -
.../1.0.1.3.0/package/scripts/drpc_server.py | 2 -
.../STORM/1.0.1.3.0/package/scripts/nimbus.py | 2 -
.../1.0.1.3.0/package/scripts/nimbus_prod.py | 2 -
.../1.0.1.3.0/package/scripts/pacemaker.py | 2 -
.../1.0.1.3.0/package/scripts/supervisor.py | 2 -
.../package/scripts/supervisor_prod.py | 2 -
.../1.0.1.3.0/package/scripts/ui_server.py | 2 -
.../TEZ/0.4.0.2.1/package/scripts/tez_client.py | 6 -
.../TEZ/0.9.0.3.0/package/scripts/tez_client.py | 4 -
.../scripts/application_timeline_server.py | 3 +-
.../2.1.0.2.0/package/scripts/historyserver.py | 3 +-
.../package/scripts/mapreduce2_client.py | 6 +-
.../2.1.0.2.0/package/scripts/nodemanager.py | 3 +-
.../package/scripts/resourcemanager.py | 2 -
.../2.1.0.2.0/package/scripts/yarn_client.py | 3 +-
.../scripts/application_timeline_server.py | 3 +-
.../3.0.0.3.0/package/scripts/historyserver.py | 3 +-
.../package/scripts/mapreduce2_client.py | 4 +-
.../3.0.0.3.0/package/scripts/nodemanager.py | 3 +-
.../package/scripts/resourcemanager.py | 2 -
.../3.0.0.3.0/package/scripts/yarn_client.py | 3 +-
.../0.6.0.2.5/package/scripts/master.py | 2 -
.../0.6.0.3.0/package/scripts/master.py | 2 -
.../3.4.5/package/scripts/zookeeper_client.py | 3 +-
.../3.4.5/package/scripts/zookeeper_server.py | 2 -
.../custom_actions/scripts/install_packages.py | 4 -
.../custom_actions/scripts/ru_set_all.py | 1 -
.../HDP/2.0.6/configuration/cluster-env.xml | 6 +-
.../scripts/shared_initialization.py | 10 +-
.../HDP/2.0.6/properties/stack_packages.json | 1146 ++++++++++++++++++
.../2.0.6/properties/stack_select_packages.json | 952 ---------------
.../HDP/3.0/properties/stack_packages.json | 1042 ++++++++++++++++
.../3.0/properties/stack_select_packages.json | 848 -------------
.../python/custom_actions/test_ru_set_all.py | 2 +
.../stacks/2.0.6/HBASE/test_hbase_client.py | 17 -
.../stacks/2.0.6/HBASE/test_hbase_master.py | 11 -
.../2.0.6/HBASE/test_hbase_regionserver.py | 10 -
.../2.0.6/HBASE/test_phoenix_queryserver.py | 5 -
.../python/stacks/2.0.6/HDFS/test_datanode.py | 11 -
.../stacks/2.0.6/HDFS/test_hdfs_client.py | 10 -
.../stacks/2.0.6/HDFS/test_journalnode.py | 9 -
.../python/stacks/2.0.6/HDFS/test_namenode.py | 9 -
.../python/stacks/2.0.6/HDFS/test_nfsgateway.py | 4 +-
.../stacks/2.0.6/HIVE/test_hive_client.py | 17 -
.../stacks/2.0.6/HIVE/test_hive_server.py | 11 -
.../stacks/2.0.6/HIVE/test_webhcat_server.py | 15 -
.../stacks/2.0.6/OOZIE/test_oozie_client.py | 11 -
.../stacks/2.0.6/OOZIE/test_oozie_server.py | 31 +-
.../python/stacks/2.0.6/PIG/test_pig_client.py | 16 -
.../python/stacks/2.0.6/SQOOP/test_sqoop.py | 11 -
.../stacks/2.0.6/YARN/test_historyserver.py | 3 -
.../stacks/2.0.6/YARN/test_mapreduce2_client.py | 10 -
.../stacks/2.0.6/YARN/test_nodemanager.py | 10 -
.../stacks/2.0.6/YARN/test_resourcemanager.py | 10 -
.../stacks/2.0.6/YARN/test_yarn_client.py | 10 -
.../2.0.6/ZOOKEEPER/test_zookeeper_client.py | 10 -
.../2.0.6/ZOOKEEPER/test_zookeeper_server.py | 12 -
.../hooks/after-INSTALL/test_after_install.py | 13 +-
.../stacks/2.1/FALCON/test_falcon_client.py | 10 -
.../stacks/2.1/FALCON/test_falcon_server.py | 10 -
.../stacks/2.1/HIVE/test_hive_metastore.py | 16 -
.../stacks/2.1/STORM/test_storm_drpc_server.py | 10 -
.../stacks/2.1/STORM/test_storm_nimbus.py | 11 -
.../stacks/2.1/STORM/test_storm_nimbus_prod.py | 11 -
.../stacks/2.1/STORM/test_storm_supervisor.py | 10 -
.../2.1/STORM/test_storm_supervisor_prod.py | 11 -
.../stacks/2.1/STORM/test_storm_ui_server.py | 10 -
.../python/stacks/2.1/TEZ/test_tez_client.py | 15 -
.../stacks/2.1/YARN/test_apptimelineserver.py | 10 -
.../stacks/2.2/ACCUMULO/test_accumulo_client.py | 11 -
.../stacks/2.2/KAFKA/test_kafka_broker.py | 11 -
.../python/stacks/2.2/KNOX/test_knox_gateway.py | 26 -
.../stacks/2.2/RANGER/test_ranger_admin.py | 10 -
.../stacks/2.2/RANGER/test_ranger_usersync.py | 9 -
.../stacks/2.2/SLIDER/test_slider_client.py | 17 -
.../stacks/2.2/SPARK/test_job_history_server.py | 10 -
.../stacks/2.2/SPARK/test_spark_client.py | 9 -
.../stacks/2.2/common/test_conf_select.py | 30 +-
.../stacks/2.3/MAHOUT/test_mahout_client.py | 14 +-
.../2.3/SPARK/test_spark_thrift_server.py | 10 -
.../src/test/python/stacks/utils/RMFTestCase.py | 12 +-
173 files changed, 2346 insertions(+), 2906 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index 4f11633..ffcaad5 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -21,9 +21,9 @@ limitations under the License.
__all__ = ["select", "create", "get_hadoop_conf_dir", "get_hadoop_dir", "get_package_dirs"]
# Python Imports
-import copy
import os
import subprocess
+import ambari_simplejson as json
# Local Imports
import stack_select
@@ -41,191 +41,6 @@ from resource_management.core.shell import as_sudo
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions import StackFeature
-STACK_ROOT_PATTERN = "{{ stack_root }}"
-
-_PACKAGE_DIRS = {
- "atlas": [
- {
- "conf_dir": "/etc/atlas/conf",
- "current_dir": "{0}/current/atlas-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "accumulo": [
- {
- "conf_dir": "/etc/accumulo/conf",
- "current_dir": "{0}/current/accumulo-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "falcon": [
- {
- "conf_dir": "/etc/falcon/conf",
- "current_dir": "{0}/current/falcon-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "hadoop": [
- {
- "conf_dir": "/etc/hadoop/conf",
- "current_dir": "{0}/current/hadoop-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "hbase": [
- {
- "conf_dir": "/etc/hbase/conf",
- "current_dir": "{0}/current/hbase-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "hive": [
- {
- "conf_dir": "/etc/hive/conf",
- "current_dir": "{0}/current/hive-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "hive2": [
- {
- "conf_dir": "/etc/hive2/conf",
- "current_dir": "{0}/current/hive-server2-hive2/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "kafka": [
- {
- "conf_dir": "/etc/kafka/conf",
- "current_dir": "{0}/current/kafka-broker/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "knox": [
- {
- "conf_dir": "/etc/knox/conf",
- "current_dir": "{0}/current/knox-server/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "mahout": [
- {
- "conf_dir": "/etc/mahout/conf",
- "current_dir": "{0}/current/mahout-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "nifi": [
- {
- "conf_dir": "/etc/nifi/conf",
- "current_dir": "{0}/current/nifi/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "oozie": [
- {
- "conf_dir": "/etc/oozie/conf",
- "current_dir": "{0}/current/oozie-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "phoenix": [
- {
- "conf_dir": "/etc/phoenix/conf",
- "current_dir": "{0}/current/phoenix-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "ranger-admin": [
- {
- "conf_dir": "/etc/ranger/admin/conf",
- "current_dir": "{0}/current/ranger-admin/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "ranger-tagsync": [
- {
- "conf_dir": "/etc/ranger/tagsync/conf",
- "current_dir": "{0}/current/ranger-tagsync/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "ranger-kms": [
- {
- "conf_dir": "/etc/ranger/kms/conf",
- "current_dir": "{0}/current/ranger-kms/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "ranger-usersync": [
- {
- "conf_dir": "/etc/ranger/usersync/conf",
- "current_dir": "{0}/current/ranger-usersync/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "slider": [
- {
- "conf_dir": "/etc/slider/conf",
- "current_dir": "{0}/current/slider-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "spark": [
- {
- "conf_dir": "/etc/spark/conf",
- "current_dir": "{0}/current/spark-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "zeppelin": [
- {
- "conf_dir": "/etc/zeppelin/conf",
- "current_dir": "{0}/current/zeppelin-server/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "spark2": [
- {
- "conf_dir": "/etc/spark2/conf",
- "current_dir": "{0}/current/spark2-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "sqoop": [
- {
- "conf_dir": "/etc/sqoop/conf",
- "current_dir": "{0}/current/sqoop-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "storm": [
- {
- "conf_dir": "/etc/storm/conf",
- "current_dir": "{0}/current/storm-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "tez": [
- {
- "conf_dir": "/etc/tez/conf",
- "current_dir": "{0}/current/tez-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "zookeeper": [
- {
- "conf_dir": "/etc/zookeeper/conf",
- "current_dir": "{0}/current/zookeeper-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "pig": [
- {
- "conf_dir": "/etc/pig/conf",
- "current_dir": "{0}/current/pig-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "flume": [
- {
- "conf_dir": "/etc/flume/conf",
- "current_dir": "{0}/current/flume-server/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "storm-slider-client": [
- {
- "conf_dir": "/etc/storm-slider-client/conf",
- "current_dir": "{0}/current/storm-slider-client/conf".format(STACK_ROOT_PATTERN)
- }
- ],
- "hive-hcatalog": [
- {
- "conf_dir": "/etc/hive-webhcat/conf",
- "prefix": "/etc/hive-webhcat",
- "current_dir": "{0}/current/hive-webhcat/etc/webhcat".format(STACK_ROOT_PATTERN)
- },
- {
- "conf_dir": "/etc/hive-hcatalog/conf",
- "prefix": "/etc/hive-hcatalog",
- "current_dir": "{0}/current/hive-webhcat/etc/hcatalog".format(STACK_ROOT_PATTERN)
- }
- ]
-}
-
DIRECTORY_TYPE_BACKUP = "backup"
DIRECTORY_TYPE_CURRENT = "current"
@@ -241,13 +56,35 @@ def get_package_dirs():
Get package dir mappings
:return:
"""
+ stack_name = default("/hostLevelParams/stack_name", None)
+ if stack_name is None:
+ raise Fail("The stack name is not present in the command. Packages for conf-select tool cannot be loaded.")
+
+ stack_packages_config = default("/configurations/cluster-env/stack_packages", None)
+ if stack_packages_config is None:
+ raise Fail("The stack packages are not defined on the command. Unable to load packages for the conf-select tool")
+
+ data = json.loads(stack_packages_config)
+
+ if stack_name not in data:
+ raise Fail(
+ "Cannot find conf-select packages for the {0} stack".format(stack_name))
+
+ conf_select_key = "conf-select"
+ data = data[stack_name]
+ if conf_select_key not in data:
+ raise Fail(
+ "There are no conf-select packages defined for this command for the {0} stack".format(stack_name))
+
+ package_dirs = data[conf_select_key]
+
stack_root = Script.get_stack_root()
- package_dirs = copy.deepcopy(_PACKAGE_DIRS)
for package_name, directories in package_dirs.iteritems():
for dir in directories:
current_dir = dir['current_dir']
- current_dir = current_dir.replace(STACK_ROOT_PATTERN, stack_root)
+ current_dir = current_dir.format(stack_root)
dir['current_dir'] = current_dir
+
return package_dirs
def create(stack_name, package, version, dry_run = False):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
index 723871b..53c8e9f 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
@@ -121,8 +121,6 @@ def get_packages(scope, service_name = None, component_name = None):
"""
from resource_management.libraries.functions.default import default
- import time
-
if scope not in _PACKAGE_SCOPES:
raise Fail("The specified scope of {0} is not valid".format(scope))
@@ -140,11 +138,11 @@ def get_packages(scope, service_name = None, component_name = None):
if stack_name is None:
raise Fail("The stack name is not present in the command. Packages for stack-select tool cannot be loaded.")
- stack_select_packages_config = default("/configurations/cluster-env/stack_select_packages", None)
- if stack_select_packages_config is None:
+ stack_packages_config = default("/configurations/cluster-env/stack_packages", None)
+ if stack_packages_config is None:
raise Fail("The stack packages are not defined on the command. Unable to load packages for the stack-select tool")
- data = json.loads(stack_select_packages_config)
+ data = json.loads(stack_packages_config)
if stack_name not in data:
raise Fail(
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 34102b6..91a84ea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2948,7 +2948,7 @@ public class BlueprintConfigurationProcessor {
Set<String> properties = Sets.newHashSet(ConfigHelper.CLUSTER_ENV_STACK_NAME_PROPERTY,
ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY, ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY,
- ConfigHelper.CLUSTER_ENV_STACK_SELECT_PACKAGES_PROPERTY);
+ ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY);
try {
Map<String, Map<String, String>> defaultStackProperties = configHelper.getDefaultStackProperties(stackId);
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 5393f81..5ac4c8f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -92,7 +92,7 @@ public class ConfigHelper {
public static final String CLUSTER_ENV_STACK_FEATURES_PROPERTY = "stack_features";
public static final String CLUSTER_ENV_STACK_TOOLS_PROPERTY = "stack_tools";
public static final String CLUSTER_ENV_STACK_ROOT_PROPERTY = "stack_root";
- public static final String CLUSTER_ENV_STACK_SELECT_PACKAGES_PROPERTY = "stack_select_packages";
+ public static final String CLUSTER_ENV_STACK_PACKAGES_PROPERTY = "stack_packages";
public static final String HTTP_ONLY = "HTTP_ONLY";
public static final String HTTPS_ONLY = "HTTPS_ONLY";
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
index 216d39d..052edba 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
@@ -77,7 +77,7 @@ public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
* <ul>
* <li>Adds/Updates {@link ConfigHelper#CLUSTER_ENV_STACK_FEATURES_PROPERTY} from stack</li>
* <li>Adds/Updates {@link ConfigHelper#CLUSTER_ENV_STACK_TOOLS_PROPERTY} from stack</li>
- * <li>Adds/Updates {@link ConfigHelper#CLUSTER_ENV_STACK_SELECT_PACKAGES_PROPERTY} from stack</li>
+ * <li>Adds/Updates {@link ConfigHelper#CLUSTER_ENV_STACK_PACKAGES_PROPERTY} from stack</li>
* </ul>
*
* Note: Config properties stack_features and stack_tools should always be updated to latest values as defined
@@ -108,7 +108,7 @@ public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
for(PropertyInfo property : properties) {
if(property.getName().equals(ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY) ||
property.getName().equals(ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY) ||
- property.getName().equals(ConfigHelper.CLUSTER_ENV_STACK_SELECT_PACKAGES_PROPERTY)) {
+ property.getName().equals(ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY)) {
propertyMap.put(property.getName(), property.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_client.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_client.py
index 856446c..ae5181f 100644
--- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_client.py
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_client.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.core.logger import Logger
from resource_management.core.exceptions import ClientComponentHasNoStatus
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -56,7 +55,6 @@ class AccumuloClient(Script):
return
Logger.info("Executing Accumulo Client Upgrade pre-restart")
- conf_select.select(params.stack_name, "accumulo", params.version)
stack_select.select_packages(params.version)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
index d884bcd..6aafb05 100644
--- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
+++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
@@ -21,7 +21,6 @@ from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.libraries.functions import format
from resource_management.libraries.functions import check_process_status
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.security_commons import build_expectations
from resource_management.libraries.functions.security_commons import cached_kinit_executor
@@ -87,7 +86,6 @@ class AccumuloScript(Script):
stack_component = stack_select.get_package_name()
Logger.info("Executing Accumulo Upgrade pre-restart for {0}".format(stack_component))
- conf_select.select(params.stack_name, "accumulo", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
index 4a8210d..e234164 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/atlas_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -35,7 +35,6 @@ class AtlasClient(Script):
env.set_params(params)
if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version_for_stack_feature_checks):
- conf_select.select(params.stack_name, "atlas", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
index 948fe8c..038b723 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata_server.py
@@ -22,7 +22,7 @@ import os
# Local Imports
from metadata import metadata
from resource_management import Fail
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute, File
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.version import format_stack_version
@@ -60,7 +60,6 @@ class MetadataServer(Script):
env.set_params(params)
if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version):
- conf_select.select(params.stack_name, "atlas", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/atlas_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/atlas_client.py b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/atlas_client.py
index 3f9a5bc..ea1d547 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/atlas_client.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/atlas_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -35,7 +35,6 @@ class AtlasClient(Script):
env.set_params(params)
if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version):
- conf_select.select(params.stack_name, "atlas", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/metadata_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/metadata_server.py b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/metadata_server.py
index daaa871..cc19858 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/metadata_server.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/metadata_server.py
@@ -22,7 +22,7 @@ import os
# Local Imports
from metadata import metadata
from resource_management import Fail
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute, File
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.version import format_stack_version
@@ -61,7 +61,6 @@ class MetadataServer(Script):
env.set_params(params)
if check_stack_feature(StackFeature.ATLAS_UPGRADE_SUPPORT, params.version):
- conf_select.select(params.stack_name, "atlas", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid_node.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid_node.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid_node.py
index 20623f7..8053dcb 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid_node.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid_node.py
@@ -22,7 +22,6 @@ from resource_management import Script
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -52,8 +51,6 @@ class DruidBase(Script):
if params.stack_version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.stack_version):
stack_select.select_packages(params.stack_version)
- if params.stack_version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.stack_version):
- conf_select.select(params.stack_name, "druid", params.stack_version)
def start(self, env, upgrade_type=None):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/superset.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/superset.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/superset.py
index 36dab51..a5dd4fb 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/superset.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/superset.py
@@ -26,7 +26,6 @@ from resource_management.core.resources.system import Execute
from resource_management.core.source import InlineTemplate
from resource_management.core.source import Template
from resource_management.libraries.functions import StackFeature
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.format import format
@@ -96,8 +95,6 @@ class Superset(Script):
if params.stack_version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.stack_version):
stack_select.select_packages(params.version)
- if params.stack_version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.stack_version):
- conf_select.select(params.stack_name, "superset", params.stack_version)
def start(self, env, upgrade_type=None):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
index f75f34f..540027d 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_client.py
@@ -18,7 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from falcon import falcon
from ambari_commons import OSConst
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
@@ -53,7 +53,6 @@ class FalconClientLinux(FalconClient):
return
Logger.info("Executing Falcon Client Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "falcon", params.version)
stack_select.select_packages(params.version)
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
index d547a1a..055d6cb 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon_server.py
@@ -21,7 +21,6 @@ import falcon_server_upgrade
from resource_management.core.logger import Logger
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.functions.security_commons import build_expectations
@@ -81,7 +80,6 @@ class FalconServerLinux(FalconServer):
return
Logger.info("Executing Falcon Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "falcon", params.version)
stack_select.select_packages(params.version)
falcon_server_upgrade.pre_start_restore()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
index a21ecf5..4340618 100644
--- a/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
+++ b/ambari-server/src/main/resources/common-services/FLUME/1.4.0.2.0/package/scripts/flume_handler.py
@@ -21,7 +21,7 @@ from flume import flume
from flume import get_desired_state
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.flume_agent_helper import find_expected_agent_names, get_flume_status, get_flume_pid_files
from resource_management.core.exceptions import ComponentIsNotRunning
from resource_management.core.logger import Logger
@@ -86,7 +86,6 @@ class FlumeHandlerLinux(FlumeHandler):
return
Logger.info("Executing Flume Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "flume", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
index 3027bff..650931f 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from hbase import hbase
@@ -56,8 +56,6 @@ class HbaseClientDefault(HbaseClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hbase", params.version)
-
# phoenix may not always be deployed
try:
stack_select.select_packages(params.version)
@@ -65,12 +63,5 @@ class HbaseClientDefault(HbaseClient):
print "Ignoring error due to missing phoenix-client"
print str(e)
-
- # set all of the hadoop clients since hbase client is upgraded as part
- # of the final "CLIENTS" group and we need to ensure that hadoop-client
- # is also set
- conf_select.select(params.stack_name, "hadoop", params.version)
-
-
if __name__ == "__main__":
HbaseClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
index e6dff39..dfc35fb 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/phoenix_queryserver.py
@@ -17,7 +17,6 @@ limitations under the License.
"""
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -57,9 +56,7 @@ class PhoenixQueryServer(Script):
import params
env.set_params(params)
- if params.stack_version_formatted and check_stack_feature(StackFeature.PHOENIX, params.stack_version_formatted):
- # phoenix uses hbase configs
- conf_select.select(params.stack_name, "hbase", params.version)
+ if params.stack_version_formatted and check_stack_feature(StackFeature.PHOENIX, params.stack_version_formatted):
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/upgrade.py
index a502c1d..b5e2262 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/upgrade.py
@@ -25,7 +25,7 @@ from resource_management.core import shell
from resource_management.core.exceptions import ComponentIsNotRunning
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.decorator import retry
@@ -37,7 +37,6 @@ def prestart(env):
import params
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hbase", params.version)
stack_select.select_packages(params.version)
def post_regionserver(env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase_client.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase_client.py
index 3027bff..b301c75 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase_client.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from hbase import hbase
@@ -56,8 +56,6 @@ class HbaseClientDefault(HbaseClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hbase", params.version)
-
# phoenix may not always be deployed
try:
stack_select.select_packages(params.version)
@@ -66,11 +64,6 @@ class HbaseClientDefault(HbaseClient):
print str(e)
- # set all of the hadoop clients since hbase client is upgraded as part
- # of the final "CLIENTS" group and we need to ensure that hadoop-client
- # is also set
- conf_select.select(params.stack_name, "hadoop", params.version)
-
if __name__ == "__main__":
HbaseClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/phoenix_queryserver.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/phoenix_queryserver.py
index 872a5c1..cdd1495 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/phoenix_queryserver.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/phoenix_queryserver.py
@@ -17,7 +17,6 @@ limitations under the License.
"""
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -59,7 +58,6 @@ class PhoenixQueryServer(Script):
if params.stack_version_formatted and check_stack_feature(StackFeature.PHOENIX, params.stack_version_formatted):
# phoenix uses hbase configs
- conf_select.select(params.stack_name, "hbase", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/upgrade.py
index a502c1d..b5e2262 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/upgrade.py
@@ -25,7 +25,7 @@ from resource_management.core import shell
from resource_management.core.exceptions import ComponentIsNotRunning
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.decorator import retry
@@ -37,7 +37,6 @@ def prestart(env):
import params
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hbase", params.version)
stack_select.select_packages(params.version)
def post_regionserver(env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
index 257ccf9..0aa0bc0 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
@@ -23,7 +23,7 @@ from ambari_commons.constants import UPGRADE_TYPE_ROLLING
from hdfs_datanode import datanode
from resource_management import Script, Fail, shell, Logger
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions import format
@@ -43,8 +43,7 @@ class DataNode(Script):
"""
Get the name or path to the hdfs binary depending on the component name.
"""
- component_name = stack_select.get_package_name()
- return get_hdfs_binary(component_name)
+ return get_hdfs_binary("hadoop-hdfs-datanode")
def install(self, env):
@@ -130,7 +129,6 @@ class DataNodeDefault(DataNode):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
index 5633cba..0896f30 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
@@ -18,7 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.security_commons import build_expectations, \
@@ -60,7 +60,6 @@ class HdfsClientDefault(HdfsClient):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
index bb2895e..75b2eeb 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
@@ -19,7 +19,7 @@ limitations under the License.
from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -49,7 +49,6 @@ class JournalNodeDefault(JournalNode):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index 47b8021..50bf1e0 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -29,7 +29,6 @@ from ambari_commons import constants
from resource_management.libraries.script.script import Script
from resource_management.core.resources.system import Execute, File
from resource_management.core import shell
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.format import format
@@ -71,8 +70,7 @@ class NameNode(Script):
"""
Get the name or path to the hdfs binary depending on the component name.
"""
- component_name = stack_select.get_package_name()
- return get_hdfs_binary(component_name)
+ return get_hdfs_binary("hadoop-hdfs-namenode")
def install(self, env):
import params
@@ -196,11 +194,6 @@ class NameNodeDefault(NameNode):
import params
env.set_params(params)
- # When downgrading an Express Upgrade, the first thing we do is to revert the symlinks.
- # Therefore, we cannot call this code in that scenario.
- if upgrade_type != constants.UPGRADE_TYPE_NON_ROLLING or params.upgrade_direction != Direction.DOWNGRADE:
- conf_select.select(params.stack_name, "hadoop", params.version)
-
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
index 66968b7..f16e260 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/nfsgateway.py
@@ -24,7 +24,6 @@ from resource_management.libraries.functions.security_commons import build_expec
FILE_TYPE_XML
from hdfs_nfsgateway import nfsgateway
from hdfs import hdfs
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -43,7 +42,6 @@ class NFSGateway(Script):
env.set_params(params)
if params.stack_version_formatted and check_stack_feature(StackFeature.NFS, params.stack_version_formatted):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
index 0494df0..4977e1c 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/snamenode.py
@@ -18,7 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.security_commons import build_expectations, \
@@ -69,7 +69,6 @@ class SNameNodeDefault(SNameNode):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
index 628b01a..955ff60 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py
@@ -27,7 +27,7 @@ from resource_management.core.exceptions import Fail
from resource_management.core.resources.system import Directory
from resource_management.core.resources.service import Service
from resource_management.core import shell
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -133,7 +133,6 @@ class ZkfcSlaveDefault(ZkfcSlave):
import params
env.set_params(params)
if check_stack_feature(StackFeature.ZKFC_VERSION_ADVERTISED, params.version_for_stack_feature_checks):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def initialize_ha_zookeeper(params):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/datanode.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/datanode.py
index 9f72aa0..d8fb361 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/datanode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/datanode.py
@@ -19,7 +19,7 @@ limitations under the License.
import datanode_upgrade
from hdfs_datanode import datanode
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.security_commons import build_expectations, \
@@ -36,8 +36,7 @@ class DataNode(Script):
"""
Get the name or path to the hdfs binary depending on the component name.
"""
- component_name = self.get_component_name()
- return get_hdfs_binary(component_name)
+ return get_hdfs_binary("hadoop-hdfs-datanode")
def install(self, env):
@@ -84,7 +83,6 @@ class DataNodeDefault(DataNode):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs_client.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs_client.py
index 5633cba..0896f30 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs_client.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs_client.py
@@ -18,7 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.security_commons import build_expectations, \
@@ -60,7 +60,6 @@ class HdfsClientDefault(HdfsClient):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/journalnode.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/journalnode.py
index bb2895e..75b2eeb 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/journalnode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/journalnode.py
@@ -19,7 +19,7 @@ limitations under the License.
from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -49,7 +49,6 @@ class JournalNodeDefault(JournalNode):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/namenode.py
index a904de8..7a0e784 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/namenode.py
@@ -29,7 +29,6 @@ from ambari_commons import constants
from resource_management.libraries.script.script import Script
from resource_management.core.resources.system import Execute, File
from resource_management.core import shell
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.format import format
@@ -71,8 +70,7 @@ class NameNode(Script):
"""
Get the name or path to the hdfs binary depending on the component name.
"""
- component_name = self.get_component_name()
- return get_hdfs_binary(component_name)
+ return get_hdfs_binary("hadoop-hdfs-namenode")
def install(self, env):
import params
@@ -195,8 +193,6 @@ class NameNodeDefault(NameNode):
# When downgrading an Express Upgrade, the first thing we do is to revert the symlinks.
# Therefore, we cannot call this code in that scenario.
if upgrade_type != constants.UPGRADE_TYPE_NON_ROLLING or params.upgrade_direction != Direction.DOWNGRADE:
- conf_select.select(params.stack_name, "hadoop", params.version)
-
stack_select.select_packages(params.version)
def post_upgrade_restart(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/nfsgateway.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/nfsgateway.py
index ba38526..a3f9d35 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/nfsgateway.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/nfsgateway.py
@@ -24,7 +24,6 @@ from resource_management.libraries.functions.security_commons import build_expec
FILE_TYPE_XML
from hdfs_nfsgateway import nfsgateway
from hdfs import hdfs
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -44,7 +43,6 @@ class NFSGateway(Script):
env.set_params(params)
if params.stack_version_formatted and check_stack_feature(StackFeature.NFS, params.stack_version_formatted):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/snamenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/snamenode.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/snamenode.py
index 5a4cc5a..f5ff3e1 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/snamenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/snamenode.py
@@ -18,7 +18,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.security_commons import build_expectations, \
@@ -69,7 +69,6 @@ class SNameNodeDefault(SNameNode):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py
index 6ea9b52..3ff6a3d 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py
@@ -27,7 +27,7 @@ from resource_management.core.exceptions import Fail
from resource_management.core.resources.system import Directory
from resource_management.core.resources.service import Service
from resource_management.core import shell
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.security_commons import build_expectations
@@ -140,7 +140,6 @@ class ZkfcSlaveDefault(ZkfcSlave):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ZKFC_VERSION_ADVERTISED, params.version) \
and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def initialize_ha_zookeeper(params):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
index e6c9aab..2cdfc31 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
@@ -19,7 +19,7 @@ limitations under the License.
"""
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.logger import Logger
@@ -56,8 +56,6 @@ class HiveClientDefault(HiveClient):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
index 43f0c86..9b5cf43 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
@@ -22,7 +22,6 @@ import os
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute, Directory
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.format import format
@@ -105,7 +104,6 @@ class HiveMetastoreDefault(HiveMetastore):
is_upgrade = params.upgrade_direction == Direction.UPGRADE
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
stack_select.select_packages(params.version)
if is_upgrade and params.stack_version_formatted_major and \
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
index 6c76af8..080d62b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -113,7 +112,6 @@ class HiveServerDefault(HiveServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
stack_select.select_packages(params.version)
# Copy mapreduce.tar.gz and tez.tar.gz to HDFS
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
index df2a295..e8e9666 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
@@ -36,7 +36,6 @@ from resource_management.core.resources.system import Execute, Directory
# Imports needed for Rolling/Express Upgrade
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
@@ -83,7 +82,6 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
- conf_select.select(params.stack_name, "hive2", params.version)
# Copy hive.tar.gz and tez.tar.gz used by Hive Interactive to HDFS
resource_created = copy_to_hdfs(
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
index 9bd5c6e..efec613 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
@@ -19,7 +19,7 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -76,9 +76,6 @@ class WebHCatServerDefault(WebHCatServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- # webhcat has no conf, but uses hadoop home, so verify that regular hadoop conf is set
- conf_select.select(params.stack_name, "hive-hcatalog", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_client.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_client.py
index e6c9aab..2cdfc31 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_client.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_client.py
@@ -19,7 +19,7 @@ limitations under the License.
"""
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.logger import Logger
@@ -56,8 +56,6 @@ class HiveClientDefault(HiveClient):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_metastore.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_metastore.py
index 43f0c86..9b5cf43 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_metastore.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_metastore.py
@@ -22,7 +22,6 @@ import os
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute, Directory
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.format import format
@@ -105,7 +104,6 @@ class HiveMetastoreDefault(HiveMetastore):
is_upgrade = params.upgrade_direction == Direction.UPGRADE
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
stack_select.select_packages(params.version)
if is_upgrade and params.stack_version_formatted_major and \
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server.py
index 6c76af8..080d62b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -113,7 +112,6 @@ class HiveServerDefault(HiveServer):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "hive", params.version)
stack_select.select_packages(params.version)
# Copy mapreduce.tar.gz and tez.tar.gz to HDFS
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server_interactive.py
index 3b6fd36..1d2899a 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_server_interactive.py
@@ -36,7 +36,6 @@ from resource_management.core.resources.system import Execute, Directory
# Imports needed for Rolling/Express Upgrade
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
@@ -84,7 +83,6 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
- conf_select.select(params.stack_name, "hive2", params.version)
# Copy hive.tar.gz and tez.tar.gz used by Hive Interactive to HDFS
resource_created = copy_to_hdfs(
[41/50] [abbrv] ambari git commit: AMBARI-21679. Service Checks Will
Run Multiple Times In Patch/Service Upgrades, part 2 (ncole)
Posted by ab...@apache.org.
AMBARI-21679. Service Checks Will Run Multiple Times In Patch/Service Upgrades, part 2 (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78778ad5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78778ad5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78778ad5
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 78778ad5709ccee4cd4171fbe358373ed88e4fca
Parents: b234649
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Aug 9 11:55:40 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Aug 9 11:55:40 2017 -0400
----------------------------------------------------------------------
.../org/apache/ambari/server/state/stack/UpgradePackTest.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/78778ad5/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
index c7a761d..616139c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -210,10 +210,12 @@ public class UpgradePackTest {
"SERVICE_CHECK_1",
"CORE_SLAVES",
"SERVICE_CHECK_2",
+ "OOZIE",
"POST_CLUSTER");
List<String> expected_down = Arrays.asList(
"PRE_CLUSTER",
+ "OOZIE",
"CORE_SLAVES",
"SERVICE_CHECK_2",
"CORE_MASTER",
[07/50] [abbrv] ambari git commit: AMBARI-21639. When Adding a New
Service the Repository ID is Required (ncole)
Posted by ab...@apache.org.
AMBARI-21639. When Adding a New Service the Repository ID is Required (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9e91639b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9e91639b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9e91639b
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 9e91639ba3579e3f0d9e74b8c9c42990ef59b553
Parents: ea57a6b
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Aug 2 15:40:10 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Aug 2 15:40:10 2017 -0400
----------------------------------------------------------------------
.../internal/ServiceResourceProvider.java | 27 +++
.../internal/ServiceResourceProviderTest.java | 232 ++++++++++++++++++-
2 files changed, 255 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9e91639b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index daab1aa..89f75f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -74,6 +74,7 @@ import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
@@ -1066,6 +1067,32 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
}
Long desiredRepositoryVersion = request.getDesiredRepositoryVersionId();
+
+ if (null == desiredRepositoryVersion) {
+ Set<Long> repoIds = new HashSet<>();
+
+ for (Service service : cluster.getServices().values()) {
+ RepositoryVersionEntity serviceRepo = service.getDesiredRepositoryVersion();
+ if (null != serviceRepo.getParentId()) {
+ repoIds.add(serviceRepo.getParentId());
+ } else {
+ repoIds.add(serviceRepo.getId());
+ }
+ }
+
+ LOG.info("{} was not specified; the following repository ids were found: {}",
+ SERVICE_DESIRED_REPO_VERSION_ID_PROPERTY_ID, StringUtils.join(repoIds, ','));
+
+ if (CollectionUtils.isEmpty(repoIds)) {
+ throw new IllegalArgumentException("No repositories were found for service installation");
+ } else if (repoIds.size() > 1) {
+ throw new IllegalArgumentException(String.format("%s was not specified, and the cluster " +
+ "contains more than one standard-type repository", SERVICE_DESIRED_REPO_VERSION_ID_PROPERTY_ID));
+ } else {
+ desiredRepositoryVersion = repoIds.iterator().next();
+ }
+ }
+
if (null == desiredRepositoryVersion) {
throw new IllegalArgumentException(String.format("%s is required when adding a service.", SERVICE_DESIRED_REPO_VERSION_ID_PROPERTY_ID));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9e91639b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
index a0c58ea..2bb7b7a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
@@ -70,6 +70,7 @@ import org.apache.ambari.server.serveraction.kerberos.KerberosAdminAuthenticatio
import org.apache.ambari.server.serveraction.kerberos.KerberosMissingAdminCredentialsException;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
@@ -85,6 +86,8 @@ import org.junit.Test;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
+import com.google.common.collect.ImmutableMap;
+
/**
* ServiceResourceProvider tests.
*/
@@ -140,7 +143,7 @@ public class ServiceResourceProviderTest {
SecurityContextHolder.getContext().setAuthentication(authentication);
- ResourceProvider provider = getServiceProvider(managementController, true);
+ ResourceProvider provider = getServiceProvider(managementController, true, null);
// add the property map to a set for the request. add more maps for multiple creates
Set<Map<String, Object>> propertySet = new LinkedHashSet<>();
@@ -1149,7 +1152,224 @@ public class ServiceResourceProviderTest {
}
}
- private static ServiceResourceProvider getServiceProvider(AmbariManagementController managementController, boolean mockFindByStack) throws AmbariException {
+ @Test
+ public void testCreateWithNoRepositoryId() throws Exception {
+ AmbariManagementController managementController = createNiceMock(AmbariManagementController.class);
+ Clusters clusters = createNiceMock(Clusters.class);
+ Cluster cluster = createNiceMock(Cluster.class);
+ Service service1 = createNiceMock(Service.class);
+ Service service2 = createNiceMock(Service.class);
+
+ RepositoryVersionEntity repoVersion = createNiceMock(RepositoryVersionEntity.class);
+ expect(repoVersion.getId()).andReturn(500L).anyTimes();
+ expect(service1.getDesiredRepositoryVersion()).andReturn(repoVersion).atLeastOnce();
+
+ StackId stackId = new StackId("HDP-2.5");
+ ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
+ AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
+ ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
+
+ expect(managementController.getClusters()).andReturn(clusters).anyTimes();
+ expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
+
+ expect(cluster.addService(eq("Service200"), EasyMock.anyObject(RepositoryVersionEntity.class))).andReturn(service2);
+
+ expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
+
+ expect(cluster.getServices()).andReturn(
+ ImmutableMap.<String, Service>builder()
+ .put("Service100", service1).build()).atLeastOnce();
+
+ expect(cluster.getDesiredStackVersion()).andReturn(stackId).anyTimes();
+ expect(cluster.getClusterId()).andReturn(2L).anyTimes();
+
+ expect(ambariMetaInfo.isValidService( (String) anyObject(), (String) anyObject(), (String) anyObject())).andReturn(true);
+ expect(ambariMetaInfo.getService((String)anyObject(), (String)anyObject(), (String)anyObject())).andReturn(serviceInfo).anyTimes();
+
+ // replay
+ replay(managementController, clusters, cluster, service1, service2,
+ ambariMetaInfo, serviceFactory, serviceInfo, repoVersion);
+
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+
+ Capture<Long> pkCapture = Capture.newInstance();
+ ResourceProvider provider = getServiceProvider(managementController, true, pkCapture);
+
+ // add the property map to a set for the request. add more maps for multiple creates
+ Set<Map<String, Object>> propertySet = new LinkedHashSet<>();
+
+ // Service 1: create a map of properties for the request
+ Map<String, Object> properties = new LinkedHashMap<>();
+
+ // add properties to the request map
+ properties.put(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, "Cluster100");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID, "Service200");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
+ properties.put(ServiceResourceProvider.SERVICE_DESIRED_STACK_PROPERTY_ID, "HDP-1.1");
+
+ propertySet.add(properties);
+
+ // create the request
+ Request request = PropertyHelper.getCreateRequest(propertySet, null);
+
+ provider.createResources(request);
+
+ // verify
+ verify(managementController, clusters, cluster, service1, service2,
+ ambariMetaInfo, serviceFactory, serviceInfo);
+
+ Assert.assertTrue(pkCapture.hasCaptured());
+ Assert.assertEquals(Long.valueOf(500L), pkCapture.getValue());
+ }
+
+ @Test
+ public void testCreateWithNoRepositoryIdAndPatch() throws Exception {
+ AmbariManagementController managementController = createNiceMock(AmbariManagementController.class);
+ Clusters clusters = createNiceMock(Clusters.class);
+ Cluster cluster = createNiceMock(Cluster.class);
+ Service service1 = createNiceMock(Service.class);
+ Service service2 = createNiceMock(Service.class);
+
+ RepositoryVersionEntity repoVersion = createNiceMock(RepositoryVersionEntity.class);
+ expect(repoVersion.getId()).andReturn(500L).anyTimes();
+ expect(repoVersion.getParentId()).andReturn(600L).anyTimes();
+ expect(repoVersion.getType()).andReturn(RepositoryType.PATCH).anyTimes();
+ expect(service1.getDesiredRepositoryVersion()).andReturn(repoVersion).atLeastOnce();
+
+ StackId stackId = new StackId("HDP-2.5");
+ ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
+ AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
+ ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
+
+ expect(managementController.getClusters()).andReturn(clusters).anyTimes();
+ expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
+
+ expect(cluster.addService(eq("Service200"), EasyMock.anyObject(RepositoryVersionEntity.class))).andReturn(service2);
+
+ expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
+
+ expect(cluster.getServices()).andReturn(
+ ImmutableMap.<String, Service>builder()
+ .put("Service100", service1).build()).atLeastOnce();
+
+ expect(cluster.getDesiredStackVersion()).andReturn(stackId).anyTimes();
+ expect(cluster.getClusterId()).andReturn(2L).anyTimes();
+
+ expect(ambariMetaInfo.isValidService( (String) anyObject(), (String) anyObject(), (String) anyObject())).andReturn(true);
+ expect(ambariMetaInfo.getService((String)anyObject(), (String)anyObject(), (String)anyObject())).andReturn(serviceInfo).anyTimes();
+
+ // replay
+ replay(managementController, clusters, cluster, service1, service2,
+ ambariMetaInfo, serviceFactory, serviceInfo, repoVersion);
+
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+
+ Capture<Long> pkCapture = Capture.newInstance();
+ ResourceProvider provider = getServiceProvider(managementController, true, pkCapture);
+
+ // add the property map to a set for the request. add more maps for multiple creates
+ Set<Map<String, Object>> propertySet = new LinkedHashSet<>();
+
+ // Service 1: create a map of properties for the request
+ Map<String, Object> properties = new LinkedHashMap<>();
+
+ // add properties to the request map
+ properties.put(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, "Cluster100");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID, "Service200");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
+ properties.put(ServiceResourceProvider.SERVICE_DESIRED_STACK_PROPERTY_ID, "HDP-1.1");
+
+ propertySet.add(properties);
+
+ // create the request
+ Request request = PropertyHelper.getCreateRequest(propertySet, null);
+
+ provider.createResources(request);
+
+ // verify
+ verify(managementController, clusters, cluster, service1, service2,
+ ambariMetaInfo, serviceFactory, serviceInfo);
+
+ Assert.assertTrue(pkCapture.hasCaptured());
+ Assert.assertEquals(Long.valueOf(600L), pkCapture.getValue());
+ }
+
+ @Test
+ public void testCreateWithNoRepositoryIdAndMultiBase() throws Exception {
+ AmbariManagementController managementController = createNiceMock(AmbariManagementController.class);
+ Clusters clusters = createNiceMock(Clusters.class);
+ Cluster cluster = createNiceMock(Cluster.class);
+ Service service1 = createNiceMock(Service.class);
+ Service service2 = createNiceMock(Service.class);
+ Service service3 = createNiceMock(Service.class);
+
+ RepositoryVersionEntity repoVersion1 = createNiceMock(RepositoryVersionEntity.class);
+ expect(repoVersion1.getId()).andReturn(500L).anyTimes();
+ expect(service1.getDesiredRepositoryVersion()).andReturn(repoVersion1).atLeastOnce();
+
+ RepositoryVersionEntity repoVersion2 = createNiceMock(RepositoryVersionEntity.class);
+ expect(repoVersion2.getId()).andReturn(600L).anyTimes();
+ expect(service2.getDesiredRepositoryVersion()).andReturn(repoVersion2).atLeastOnce();
+
+ StackId stackId = new StackId("HDP-2.5");
+ ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
+ AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
+ ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class);
+
+ expect(managementController.getClusters()).andReturn(clusters).anyTimes();
+ expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
+
+ expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
+
+ expect(cluster.getServices()).andReturn(
+ ImmutableMap.<String, Service>builder()
+ .put("Service100", service1)
+ .put("Service200", service2).build()).atLeastOnce();
+
+ expect(cluster.getDesiredStackVersion()).andReturn(stackId).anyTimes();
+ expect(cluster.getClusterId()).andReturn(2L).anyTimes();
+
+ // replay
+ replay(managementController, clusters, cluster, service1, service2, service3,
+ ambariMetaInfo, serviceFactory, serviceInfo, repoVersion1, repoVersion2);
+
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+
+ Capture<Long> pkCapture = Capture.newInstance();
+ ResourceProvider provider = getServiceProvider(managementController, true, pkCapture);
+
+ // add the property map to a set for the request. add more maps for multiple creates
+ Set<Map<String, Object>> propertySet = new LinkedHashSet<>();
+
+ // Service 1: create a map of properties for the request
+ Map<String, Object> properties = new LinkedHashMap<>();
+
+ // add properties to the request map
+ properties.put(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, "Cluster100");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_NAME_PROPERTY_ID, "Service200");
+ properties.put(ServiceResourceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
+ properties.put(ServiceResourceProvider.SERVICE_DESIRED_STACK_PROPERTY_ID, "HDP-1.1");
+
+ propertySet.add(properties);
+
+ // create the request
+ Request request = PropertyHelper.getCreateRequest(propertySet, null);
+
+ try {
+ provider.createResources(request);
+ Assert.fail("Expected an exception when more than one base version was found");
+ } catch (IllegalArgumentException expected) {
+ // !!! expected
+ }
+
+ // verify
+ verify(managementController, clusters, cluster, service1, service2, service3,
+ ambariMetaInfo, serviceFactory, serviceInfo);
+
+ }
+
+ private static ServiceResourceProvider getServiceProvider(AmbariManagementController managementController,
+ boolean mockFindByStack, Capture<Long> pkCapture) throws AmbariException {
MaintenanceStateHelper maintenanceStateHelperMock = createNiceMock(MaintenanceStateHelper.class);
RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
expect(maintenanceStateHelperMock.isOperationAllowed(anyObject(Resource.Type.class), anyObject(Service.class))).andReturn(true).anyTimes();
@@ -1158,7 +1378,11 @@ public class ServiceResourceProviderTest {
if (mockFindByStack) {
RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
- expect(repositoryVersionDAO.findByPK(EasyMock.anyLong())).andReturn(repositoryVersion).atLeastOnce();
+ if (null != pkCapture) {
+ expect(repositoryVersionDAO.findByPK(capture(pkCapture))).andReturn(repositoryVersion).atLeastOnce();
+ } else {
+ expect(repositoryVersionDAO.findByPK(EasyMock.anyLong())).andReturn(repositoryVersion).atLeastOnce();
+ }
expect(repositoryVersion.getStackId()).andReturn(new StackId("HDP-2.2")).anyTimes();
replay(repositoryVersion);
@@ -1173,7 +1397,7 @@ public class ServiceResourceProviderTest {
* It's useful in most cases (when we don't care about Maintenance State)
*/
public static ServiceResourceProvider getServiceProvider(AmbariManagementController managementController) throws AmbariException {
- return getServiceProvider(managementController, false);
+ return getServiceProvider(managementController, false, null);
}
/**
[31/50] [abbrv] ambari git commit: AMBARI-21664. HDFS namenode rpc
and connection load metrics are not showing. (swagle)
Posted by ab...@apache.org.
AMBARI-21664. HDFS namenode rpc and connection load metrics are not showing. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7a90a260
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7a90a260
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7a90a260
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 7a90a260497fccafcefaca209bd9bbd1f07a948a
Parents: 555f241
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Mon Aug 7 15:57:36 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Mon Aug 7 15:57:36 2017 -0700
----------------------------------------------------------------------
.../HDP/2.0.6/hooks/before-START/scripts/params.py | 11 ++++++++---
.../stacks/HDP/3.0/hooks/before-START/scripts/params.py | 12 ++++++++++--
2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a90a260/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
index a5bc849..2449d66 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/params.py
@@ -299,7 +299,6 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
hdfs_principal_name = default('/configurations/hadoop-env/hdfs_principal_name', None)
hdfs_site = config['configurations']['hdfs-site']
-default_fs = config['configurations']['core-site']['fs.defaultFS']
smoke_user = config['configurations']['cluster-env']['smokeuser']
smoke_hdfs_user_dir = format("/user/{smoke_user}")
smoke_hdfs_user_mode = 0770
@@ -338,11 +337,17 @@ if dfs_ha_enabled:
namenode_rpc = nn_host
pass
pass
+elif 'dfs.namenode.rpc-address' in config['configurations']['hdfs-site']:
+ namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
else:
- namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
+ namenode_rpc = default_fs
if namenode_rpc:
- nn_rpc_client_port = namenode_rpc.split(':')[1].strip()
+ port_str = namenode_rpc.split(':')[-1].strip()
+ try:
+ nn_rpc_client_port = int(port_str)
+ except ValueError:
+ nn_rpc_client_port = None
if dfs_ha_enabled:
dfs_service_rpc_address = default(format('/configurations/hdfs-site/dfs.namenode.servicerpc-address.{dfs_ha_nameservices}.{namenode_id}'), None)
http://git-wip-us.apache.org/repos/asf/ambari/blob/7a90a260/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
index a0259af..ecbb6a4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/before-START/scripts/params.py
@@ -273,7 +273,6 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
hdfs_principal_name = default('/configurations/hadoop-env/hdfs_principal_name', None)
hdfs_site = config['configurations']['hdfs-site']
-default_fs = config['configurations']['core-site']['fs.defaultFS']
smoke_user = config['configurations']['cluster-env']['smokeuser']
smoke_hdfs_user_dir = format("/user/{smoke_user}")
smoke_hdfs_user_mode = 0770
@@ -312,8 +311,17 @@ if dfs_ha_enabled:
namenode_rpc = nn_host
pass
pass
+elif 'dfs.namenode.rpc-address' in config['configurations']['hdfs-site']:
+ namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
else:
- namenode_rpc = default('/configurations/hdfs-site/dfs.namenode.rpc-address', None)
+ namenode_rpc = default_fs
+
+if namenode_rpc:
+ port_str = namenode_rpc.split(':')[-1].strip()
+ try:
+ nn_rpc_client_port = int(port_str)
+ except ValueError:
+ nn_rpc_client_port = None
if namenode_rpc:
nn_rpc_client_port = namenode_rpc.split(':')[1].strip()
[42/50] [abbrv] ambari git commit: Revert "AMBARI-21642. Add hadoop
LZO jars if installed in the cluster for DRUID. (Slim Bouguerra via Swapan
Shridhar)"
Posted by ab...@apache.org.
Revert "AMBARI-21642. Add hadoop LZO jars if installed in the cluster for DRUID. (Slim Bouguerra via Swapan Shridhar)"
This reverts commit 5442231e4e8e517f1e47f4c177cbe5799e8f96b8.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b4de6207
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b4de6207
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b4de6207
Branch: refs/heads/branch-feature-logsearch-ui
Commit: b4de62079ae9c0533f85b34d7d49589e62119759
Parents: 78778ad
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Wed Aug 9 10:32:40 2017 -0700
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Wed Aug 9 10:32:40 2017 -0700
----------------------------------------------------------------------
.../DRUID/0.9.2/package/scripts/druid.py | 6 ------
.../DRUID/0.9.2/package/scripts/params.py | 13 -------------
2 files changed, 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4de6207/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
index 4e1ced1..cc02519 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/druid.py
@@ -113,12 +113,6 @@ def druid(upgrade_type=None, nodeType=None):
node_jvm_opts=druid_env_config[format('druid.{node_type_lowercase}.jvm.opts')])
)
Logger.info(format("Created druid-{node_type_lowercase} jvm.config"))
- # Handling hadoop Lzo jars if enable and node type is hadoop related eg Overlords and MMs
- if params.lzo_enabled and len(params.lzo_packages) > 0 and (
- node_type == 'middleManager' or node_type == 'overlord'):
- Logger.info(
- format("Copying hadoop lzo jars from {hadoop_lib_home} to {hadoop_dependencies_dir}/hadoop-client/*/"))
- Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {hadoop_dependencies_dir}/hadoop-client/*/'))
# All druid nodes have dependency on hdfs_client
ensure_hadoop_directories()
http://git-wip-us.apache.org/repos/asf/ambari/blob/b4de6207/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
index 9e766cd..d47e604 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.9.2/package/scripts/params.py
@@ -18,7 +18,6 @@ limitations under the License.
"""
from ambari_commons import OSCheck
-from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -27,7 +26,6 @@ from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import format
from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
from resource_management.libraries.functions.default import default
-from ambari_commons.constants import AMBARI_SUDO_BINARY
import status_params
@@ -52,14 +50,10 @@ stack_name = default("/hostLevelParams/stack_name", None)
# stack version
stack_version = default("/commandParams/version", None)
-# un-formatted stack version
-stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
-
# default role to coordinator needed for service checks
component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "DRUID_COORDINATOR")
hostname = config['hostname']
-sudo = AMBARI_SUDO_BINARY
# default druid parameters
druid_home = format("{stack_root}/current/{component_directory}")
@@ -236,10 +230,3 @@ if not len(druid_router_hosts) == 0:
druid_router_host = druid_router_hosts[0]
druid_coordinator_port = config['configurations']['druid-coordinator']['druid.port']
druid_router_port = config['configurations']['druid-router']['druid.port']
-
-# Create current Hadoop Clients Libs
-stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
-io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
-lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-lzo_packages = get_lzo_packages(stack_version_unformatted)
-hadoop_lib_home = stack_root + '/' + stack_version + '/hadoop'
[28/50] [abbrv] ambari git commit: AMBARI-21670. Log Search cleanup:
all configurations should be spring managed (oleewere)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
index dd85da8..68b697f 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/resources/log4j.xml
@@ -16,112 +16,70 @@
limitations under the License.
-->
-<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+<!DOCTYPE log4j:configuration SYSTEM
+ "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
+ <param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
+ <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n"/>
</layout>
</appender>
- <!-- <appender name="rolling_file" class="org.apache.log4j.RollingFileAppender">
- <param name="file" value="logs/logsearch-app.log" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
- </layout>
- </appender>
-
- <appender name="audit_rolling_file" class="org.apache.log4j.RollingFileAppender">
- <param name="file" value="logs/logsearch-audit.log" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
- </layout>
+ <appender name="rolling_file_json"
+ class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+ <param name="file" value="target/logs/logsearch-app.json"/>
+ <param name="Threshold" value="info"/>
+ <param name="append" value="true"/>
+ <param name="maxFileSize" value="10MB"/>
+ <param name="maxBackupIndex" value="10"/>
+ <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
</appender>
- <appender name="performance_analyzer" class="org.apache.log4j.RollingFileAppender">
- <param name="file" value="logs/logsearch-performance.log" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
- </layout>
- </appender>
- -->
-
-<!-- logsearch appender config for the all above appender -->
-
- <appender name="rolling_file_json"
- class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
- <param name="file" value="target/logs/logsearch-app.json" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
- <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
-</appender>
-
<appender name="audit_rolling_file_json"
- class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
- <param name="file" value="target/logs/logsearch-audit.json" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
- <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+ class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+ <param name="file" value="target/logs/logsearch-audit.json"/>
+ <param name="Threshold" value="info"/>
+ <param name="append" value="true"/>
+ <param name="maxFileSize" value="10MB"/>
+ <param name="maxBackupIndex" value="10"/>
+ <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
</appender>
<appender name="performance_analyzer_json"
- class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
- <param name="file" value="target/logs/logsearch-performance.json" />
- <param name="Threshold" value="info" />
- <param name="append" value="true" />
- <param name="maxFileSize" value="10MB" />
- <param name="maxBackupIndex" value="10" />
- <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
+ class="org.apache.ambari.logsearch.appender.LogsearchRollingFileAppender">
+ <param name="file" value="target/logs/logsearch-performance.json"/>
+ <param name="Threshold" value="info"/>
+ <param name="append" value="true"/>
+ <param name="maxFileSize" value="10MB"/>
+ <param name="maxBackupIndex" value="10"/>
+ <layout class="org.apache.ambari.logsearch.appender.LogsearchConversion"/>
</appender>
-
- <!-- Logs to suppress BEGIN -->
+
<category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
- <priority value="error" />
- <appender-ref ref="console" />
+ <priority value="error"/>
+ <appender-ref ref="console"/>
</category>
- <!-- Logs to suppress END -->
<logger name="org.apache.ambari.logsearch.audit"
- additivity="true">
- <!-- <appender-ref ref="audit_rolling_file" />-->
- <appender-ref ref="audit_rolling_file_json" />
+ additivity="true">
+ <appender-ref ref="audit_rolling_file_json"/>
</logger>
<logger name="org.apache.ambari.logsearch.performance"
- additivity="false">
- <!-- <appender-ref ref="performance_analyzer" />-->
- <appender-ref ref="performance_analyzer_json" />
+ additivity="false">
+ <appender-ref ref="performance_analyzer_json"/>
</logger>
<logger name="org.apache.ambari.logsearch" additivity="false">
- <!-- <appender-ref ref="console" /> -->
- <!-- <appender-ref ref="rolling_file" />-->
- <appender-ref ref="rolling_file_json" />
+ <appender-ref ref="rolling_file_json"/>
</logger>
<root>
- <level value="warn" />
- <!-- <appender-ref ref="console" /> -->
- <!--<appender-ref ref="rolling_file" />-->
- <appender-ref ref="rolling_file_json" />
+ <level value="info"/>
+ <appender-ref ref="console"/>
+ <appender-ref ref="rolling_file_json"/>
</root>
+
</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml b/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml
deleted file mode 100644
index 049172a..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch-admin-site.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<!-- Licensed 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.
- See accompanying LICENSE file. -->
-
-
-<configuration>
- <property>
- <name>authentication.ldap.primaryUrl</name>
- <value></value>
- <display-name></display-name>
- <description>The hostname and port for the LDAP or AD server. Example: my.ldap.server:389</description>
- </property>
- <property>
- <name>authentication.ldap.useSSL</name>
- <value>false</value>
- <display-name></display-name>
- <description>If true, use SSL when connecting to the LDAP or AD server.</description>
- </property>
- <property>
- <name>authentication.ldap.baseDn</name>
- <value>dc=example,dc=com</value>
- <display-name></display-name>
- <description>The root Distinguished Name to search in the directory for users. Example: ou=people,dc=hadoop,dc=apache,dc=org</description>
- </property>
- <property>
- <name>authentication.ldap.bindAnonymously</name>
- <value>false</value>
- <display-name></display-name>
- <description>If true, bind to the LDAP or AD server anonymously</description>
- </property>
- <property>
- <name>authentication.ldap.managerDn</name>
- <value>cn=Manager,dc=example,dc=com</value>
- <display-name></display-name>
- <description>If Bind anonymous is set to false, the Distinguished Name (“DN”) for the manager.
- Example: uid=hdfs,ou=people,dc=hadoop,dc=apache,dc=org</description>
- </property>
- <property>
- <name>authentication.ldap.managerPassword</name>
- <value></value>
- <display-name></display-name>
- <property-type>PASSWORD</property-type>
- <description>If Bind anonymous is set to false, the password for the manager</description>
- </property>
- <property>
- <name>authentication.ldap.dnAttribute</name>
- <value>dn</value>
- <display-name></display-name>
- <description></description>
- </property>
- <property>
- <name>authentication.ldap.usernameAttribute</name>
- <value>uid</value>
- <display-name></display-name>
- <description>The attribute for username. Example: uid</description>
- </property>
- <property>
- <name>authentication.ldap.userBase</name>
- <value>ou=people,dc=example,dc=com</value>
- <display-name></display-name>
- <description></description>
- </property>
- <property>
- <name>authentication.ldap.userObjectClass</name>
- <value>person</value>
- <display-name></display-name>
- <description>The object class that is used for users. Example: organizationalPerson</description>
- </property>
- <property>
- <name>authentication.ldap.groupBase</name>
- <value>ou=groups,dc=example,dc=com"</value>
- <display-name></display-name>
- <description></description>
- </property>
- <property>
- <name>authentication.ldap.groupObjectClass</name>
- <value>group</value>
- <display-name></display-name>
- <description>The object class that is used for groups. Example: groupOfUniqueNames</description>
- </property>
- <property>
- <name>authentication.ldap.groupNamingAttr</name>
- <value>cn</value>
- <display-name></display-name>
- <description>The attribute for group name.</description>
- </property>
- <property>
- <name>authentication.ldap.groupMembershipAttr</name>
- <value>member</value>
- <display-name></display-name>
- <description>The attribute for group membership. Example: uniqueMember</description>
- </property>
- <property>
- <name>authorization.ldap.adminGroupMappingRules</name>
- <value>Logsearch Administrators</value>
- <display-name></display-name>
- <description></description>
- </property>
- <property>
- <name>authorization.ldap.groupSearchFilter</name>
- <value></value>
- <display-name></display-name>
- <description></description>
- </property>
- <property>
- <name>authentication.ldap.referral</name>
- <value>ignore</value>
- <display-name></display-name>
- <description>Determines if LDAP referrals should be followed, or ignored.</description>
- </property>
-</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties b/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties
index 3e59163..db8a0a2 100755
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/resources/logsearch.properties
@@ -46,13 +46,13 @@ logsearch.auth.external_auth.login_url=/api/v1/users/$USERNAME/privileges?fields
logsearch.roles.allowed=AMBARI.ADMINISTRATOR
-#communication protocol i.e http or https etc.
-logsearch.protocol=
+logsearch.http.port=61888
+logsearch.https.port=61889
+logsearch.protocol=http
logsearch.solr.kerberos.enable=false
logsearch.solr.jaas.file=/usr/lib/ambari-logsearch-portal/logsearch_solr_jaas.conf
-
#portal Kerberos
logsearch.spnego.kerberos.enabled=false
logsearch.spnego.kerberos.keytab=
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html b/ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html
index 33346d3..0f7ba4b 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/resources/swagger/swagger.html
@@ -18,24 +18,24 @@
<html>
<head>
<title>Log Search REST API</title>
- <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
- <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
- <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
- <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
- <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
- <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
- <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
- <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
- <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
- <script src='lib/underscore-min.js' type='text/javascript'></script>
- <script src='lib/backbone-min.js' type='text/javascript'></script>
- <script src='swagger-ui.js' type='text/javascript'></script>
- <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
- <script src='lib/marked.js' type='text/javascript'></script>
- <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+ <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-32x32.png" sizes="32x32" />
+ <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-16x16.png" sizes="16x16" />
+ <link href='swagger-ui/2.1.0/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/print.css' media='print' rel='stylesheet' type='text/css'/>
+ <script src='swagger-ui/2.1.0/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.slideto.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.wiggle.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/handlebars-2.0.0.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/underscore-min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/backbone-min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/swagger-ui.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/highlight.7.3.pack.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/marked.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
index b8fd6c4..241b32f 100755
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
@@ -96,5 +96,4 @@ LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH
echo "Starting logsearch. Output file=$LOGFILE pid_file=$PID_FILE"
#LOGSEARCH_CLI_CLASSPATH=
#set -x
-nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $LOGSEARCH_PORT $* > $LOGFILE 2>&1 &
-echo $! > $PID_FILE
+nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $* > $LOGFILE 2>&1 &
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
index c6a5ba5..a6817da 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProviderTest.java
@@ -43,8 +43,7 @@ public class LogsearchAuthenticationProviderTest {
}
private LogsearchAuthenticationProvider provider;
-
- private LogsearchLdapAuthenticationProvider mockLdapProvider;
+
private LogsearchFileAuthenticationProvider mockFileProvider;
private LogsearchExternalServerAuthenticationProvider mockExternalServerProvider;
private LogsearchSimpleAuthenticationProvider mockSimpleProvider;
@@ -52,16 +51,11 @@ public class LogsearchAuthenticationProviderTest {
@Before
public void resetContext() throws Exception {
provider = new LogsearchAuthenticationProvider();
-
- mockLdapProvider = strictMock(LogsearchLdapAuthenticationProvider.class);
+
mockFileProvider = strictMock(LogsearchFileAuthenticationProvider.class);
mockExternalServerProvider = strictMock(LogsearchExternalServerAuthenticationProvider.class);
mockSimpleProvider = strictMock(LogsearchSimpleAuthenticationProvider.class);
- Field ldapProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("ldapAuthenticationProvider");
- ldapProviderField.setAccessible(true);
- ldapProviderField.set(provider, mockLdapProvider);
-
Field fileProviderField = LogsearchAuthenticationProvider.class.getDeclaredField("fileAuthenticationProvider");
fileProviderField.setAccessible(true);
fileProviderField.set(provider, mockFileProvider);
@@ -76,102 +70,83 @@ public class LogsearchAuthenticationProviderTest {
}
@Test
- public void testLdapAuthenticates() {
- Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
-
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
-
- Authentication authenticationResult = provider.authenticate(authentication);
- assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
-
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
- }
-
- @Test
public void testFileAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
-
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+
Authentication authenticationResult = provider.authenticate(authentication);
assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testExternalAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockExternalServerProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
Authentication authenticationResult = provider.authenticate(authentication);
assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testSimpleAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockSimpleProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
Authentication authenticationResult = provider.authenticate(authentication);
assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testNoOneAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
Authentication authenticationResult = provider.authenticate(authentication);
assertSame(authenticationResult, FAILED_AUTHENTICATION);
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testOneExceptionAndAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("") {});
expect(mockFileProvider.authenticate(authentication)).andReturn(SUCCESSFUL_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
Authentication authenticationResult = provider.authenticate(authentication);
assertSame(authenticationResult, SUCCESSFUL_AUTHENTICATION);
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testOneExceptionNoOneAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
expect(mockFileProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
- expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+ expect(mockExternalServerProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
try {
provider.authenticate(authentication);
@@ -180,18 +155,17 @@ public class LogsearchAuthenticationProviderTest {
assertEquals(e.getMessage(), "msg1");
}
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
@Test
public void testTwoExceptionNoOneAuthenticates() {
Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
- expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
- expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
+ expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
+ expect(mockExternalServerProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
-
- replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+
+ replay(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
try {
provider.authenticate(authentication);
@@ -200,6 +174,6 @@ public class LogsearchAuthenticationProviderTest {
assertEquals(e.getMessage(), "msg1");
}
- verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
+ verify(mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java b/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
deleted file mode 100644
index c6af3e2..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/test/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProviderTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.security.authentication.TestingAuthenticationToken;
-import org.springframework.security.core.Authentication;
-
-import static junit.framework.Assert.assertSame;
-import static org.easymock.EasyMock.strictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.lang.reflect.Field;
-
-public class LogsearchLdapAuthenticationProviderTest {
-
- private LogsearchLdapAuthenticationProvider provider;
- private AuthPropsConfig mockAuthPropsConfig;
-
- @Before
- public void init() throws Exception {
- provider = new LogsearchLdapAuthenticationProvider();
- mockAuthPropsConfig = strictMock(AuthPropsConfig.class);
-
- Field f = LogsearchLdapAuthenticationProvider.class.getDeclaredField("authPropsConfig");
- f.setAccessible(true);
- f.set(provider, mockAuthPropsConfig);
- }
-
- @Test
- public void testAuthenticationDisabled() {
- expect(mockAuthPropsConfig.isAuthLdapEnabled()).andReturn(false);
-
- replay(mockAuthPropsConfig);
-
- Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
- assertSame(provider.authenticate(authentication), authentication);
-
- verify(mockAuthPropsConfig);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-web/build.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/build.properties b/ambari-logsearch/ambari-logsearch-web/build.properties
index d943501..1656934 100644
--- a/ambari-logsearch/ambari-logsearch-web/build.properties
+++ b/ambari-logsearch/ambari-logsearch-web/build.properties
@@ -9,4 +9,4 @@
# 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.
-app.target.dir=${builddir}/target/classes/webapps/app
\ No newline at end of file
+app.target.dir=${builddir}/target/classes/static
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/pom.xml b/ambari-logsearch/ambari-logsearch-web/pom.xml
index 5f44553..5c193f8 100644
--- a/ambari-logsearch/ambari-logsearch-web/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-web/pom.xml
@@ -90,7 +90,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/classes/webapps/app</outputDirectory>
+ <outputDirectory>${basedir}/target/classes/static</outputDirectory>
<resources>
<resource>
<directory>src/main/webapp</directory>
@@ -127,7 +127,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
- <outputDirectory>${basedir}/target/classes/webapps/app/libs/bower</outputDirectory>
+ <outputDirectory>${basedir}/target/classes/static/libs/bower</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/libs</directory>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/docker/logsearch-docker.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-docker.sh b/ambari-logsearch/docker/logsearch-docker.sh
index fc3524d..9d73eae 100755
--- a/ambari-logsearch/docker/logsearch-docker.sh
+++ b/ambari-logsearch/docker/logsearch-docker.sh
@@ -69,8 +69,8 @@ function start_logsearch_container() {
-v $AMBARI_LOCATION:/root/ambari -v $MAVEN_REPOSITORY_LOCATION:/root/.m2 $LOGSEARCH_EXPOSED_PORTS $LOGSEARCH_ENV_OPTS $LOGSEARCH_EXTRA_OPTS $LOGSEARCH_VOLUME_OPTS -p 9983:9983 -p 4444:4444 -p 5910:5910 \
-v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes \
-v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes \
- -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/src/main/webapp:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app \
- -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/target/libs:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/webapps/app/libs/bower \
+ -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/src/main/webapp:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/static \
+ -v $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-web/target/libs:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/static/libs/bower \
ambari-logsearch:v1.0
ip_address=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logsearch)
echo "Log Search container started on $ip_address (for Mac OSX route to boot2docker/docker-machine VM address, e.g.: 'sudo route add -net 172.17.0.0/16 192.168.59.103')"
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/docker/test-config/logsearch/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/log4j.xml b/ambari-logsearch/docker/test-config/logsearch/log4j.xml
index d0e26ed..f10522b 100644
--- a/ambari-logsearch/docker/test-config/logsearch/log4j.xml
+++ b/ambari-logsearch/docker/test-config/logsearch/log4j.xml
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF 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. -->
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+-->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
@@ -29,15 +35,14 @@
</layout>
</appender>
- <!-- Logs to suppress BEGIN -->
- <category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
- <priority value="error" />
+ <category name="org.apache.ambari.logsearch" additivity="false">
+ <priority value="info" />
<appender-ref ref="console" />
+ <appender-ref ref="rolling_file" />
</category>
- <!-- Logs to suppress END -->
<root>
- <level value="debug" />
+ <level value="info" />
<appender-ref ref="console" />
<appender-ref ref="rolling_file" />
</root>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
index 6409f0f..80f9c4c 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
@@ -16,14 +16,11 @@
set -e
-export LOGSEARCH_PORT=61888
-
-# path containing LogSearch.jar file
export LOGSEARCH_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package
export LOGSEARCH_CONF_DIR=/root/config/logsearch
-export LOGFILE=/var/log/ambari-logsearch-portal/logsearch.log
+export LOGFILE=/var/log/ambari-logsearch-portal/logsearch-app.log
export PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
index 782b16a..5e7853d 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
@@ -51,4 +51,5 @@ logsearch.auth.ldap.enable=false
logsearch.auth.simple.enable=false
logsearch.auth.external_auth.enable=false
+logsearch.https.port=61888
logsearch.protocol=https
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java
index 4d0ee89..d4c2856 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImpl.java
@@ -36,15 +36,19 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
private static final Logger LOG = Logger.getLogger(LoggingRequestHelperFactoryImpl.class);
- private static final String LOGSEARCH_ENV_CONFIG_TYPE_NAME = "logsearch-env";
+ private static final String LOGSEARCH_PROPERTIES_CONFIG_TYPE_NAME = "logsearch-properties";
private static final String LOGSEARCH_SERVICE_NAME = "LOGSEARCH";
private static final String LOGSEARCH_SERVER_COMPONENT_NAME = "LOGSEARCH_SERVER";
- private static final String LOGSEARCH_UI_PORT_PROPERTY_NAME = "logsearch_ui_port";
+ private static final String LOGSEARCH_HTTP_PORT_PROPERTY_NAME = "logsearch.http.port";
- private static final String LOGSEARCH_UI_PROTOCOL = "logsearch_ui_protocol";
+ private static final String LOGSEARCH_HTTPS_PORT_PROPERTY_NAME = "logsearch.https.port";
+
+ private static final String LOGSEARCH_UI_PROTOCOL = "logsearch.protocol";
+
+ private static final String LOGSEARCH_HTTPS_PROTOCOL_VALUE = "https";
@Inject
private Configuration ambariServerConfiguration;
@@ -73,7 +77,7 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
}
Config logSearchEnvConfig =
- cluster.getDesiredConfigByType(LOGSEARCH_ENV_CONFIG_TYPE_NAME);
+ cluster.getDesiredConfigByType(LOGSEARCH_PROPERTIES_CONFIG_TYPE_NAME);
List<ServiceComponentHost> listOfMatchingHosts =
cluster.getServiceComponentHosts(LOGSEARCH_SERVICE_NAME, LOGSEARCH_SERVER_COMPONENT_NAME);
@@ -97,11 +101,14 @@ public class LoggingRequestHelperFactoryImpl implements LoggingRequestHelperFact
}
final String logSearchHostName = serviceComponentHost.getHostName();
- final String logSearchPortNumber =
- logSearchEnvConfig.getProperties().get(LOGSEARCH_UI_PORT_PROPERTY_NAME);
+
final String logSearchProtocol =
logSearchEnvConfig.getProperties().get(LOGSEARCH_UI_PROTOCOL);
+ final String logSearchPortNumber = LOGSEARCH_HTTPS_PROTOCOL_VALUE.equalsIgnoreCase(logSearchProtocol)
+ ? logSearchEnvConfig.getProperties().get(LOGSEARCH_HTTPS_PORT_PROPERTY_NAME)
+ : logSearchEnvConfig.getProperties().get(LOGSEARCH_HTTP_PORT_PROPERTY_NAME);
+
final LoggingRequestHelperImpl loggingRequestHelper = new LoggingRequestHelperImpl(logSearchHostName, logSearchPortNumber, logSearchProtocol, ambariManagementController.getCredentialStoreService(), cluster);
// set configured timeouts for the Ambari connection to the LogSearch Portal service
loggingRequestHelper.setLogSearchConnectTimeoutInMilliseconds(ambariServerConfiguration.getLogSearchPortalConnectTimeout());
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index 5f6640a..230cd95 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@ -350,6 +350,15 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
removeConfigurationPropertiesFromCluster(cluster, configType, removeProperties);
}
+ Config logSearchEnv = cluster.getDesiredConfigByType("logsearch-env");
+
+ String oldProtocolProperty = null;
+ String oldPortProperty = null;
+ if (logSearchEnv != null) {
+ oldProtocolProperty = logSearchEnv.getProperties().get("logsearch_ui_port");
+ oldPortProperty = logSearchEnv.getProperties().get("logsearch_ui_protocol");
+ }
+
Config logSearchProperties = cluster.getDesiredConfigByType("logsearch-properties");
Config logFeederProperties = cluster.getDesiredConfigByType("logfeeder-properties");
if (logSearchProperties != null && logFeederProperties != null) {
@@ -358,9 +367,22 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
Set<String> removeProperties = Sets.newHashSet("logsearch.logfeeder.include.default.level");
removeConfigurationPropertiesFromCluster(cluster, "logsearch-properties", removeProperties);
- Map<String, String> newProperties = new HashMap<>();
- newProperties.put("logfeeder.include.default.level", defaultLogLevels);
- updateConfigurationPropertiesForCluster(cluster, "logfeeder-properties", newProperties, true, true);
+ Map<String, String> newLogSearchProperties = new HashMap<>();
+ if (oldProtocolProperty != null) {
+ newLogSearchProperties.put("logsearch.protocol", oldProtocolProperty);
+ }
+
+ if (oldPortProperty != null) {
+ newLogSearchProperties.put("logsearch.http.port", oldPortProperty);
+ newLogSearchProperties.put("logsearch.https.port", oldPortProperty);
+ }
+ if (!newLogSearchProperties.isEmpty()) {
+ updateConfigurationPropertiesForCluster(cluster, "logsearch-properties", newLogSearchProperties, true, true);
+ }
+
+ Map<String, String> newLogfeederProperties = new HashMap<>();
+ newLogfeederProperties.put("logfeeder.include.default.level", defaultLogLevels);
+ updateConfigurationPropertiesForCluster(cluster, "logfeeder-properties", newLogfeederProperties, true, true);
}
Config logFeederLog4jProperties = cluster.getDesiredConfigByType("logfeeder-log4j");
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json
index d2926c8..4cb2651 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/alerts.json
@@ -10,9 +10,9 @@
"source": {
"type": "WEB",
"uri": {
- "http": "{{logsearch-env/logsearch_ui_port}}",
- "https": "{{logsearch-env/logsearch_ui_port}}",
- "https_property": "{{logsearch-env/logsearch_ui_protocol}}",
+ "http": "{{logsearch-properties/logsearch.http.port}}",
+ "https": "{{logsearch-properties/logsearch.https.port}}",
+ "https_property": "{{logsearch-properties/logsearch.protocol}}",
"https_property_value": "https",
"default_port": 61888,
"connection_timeout": 5.0
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
index f1e871d..e861b6e 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
@@ -22,20 +22,6 @@
<!-- This is a special config file for properties used to monitor status of the service -->
<configuration supports_adding_forbidden="true">
<property>
- <name>logsearch_ui_protocol</name>
- <value>http</value>
- <description>Protocol (http or https)</description>
- <display-name>Log Search UI Protocol</display-name>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
- <name>logsearch_ui_port</name>
- <value>61888</value>
- <description>Default port for Log Search UI</description>
- <display-name>Log Search UI Port</display-name>
- <on-ambari-upgrade add="true"/>
- </property>
- <property>
<name>logsearch_pid_dir</name>
<value>/var/run/ambari-logsearch-portal</value>
<description>Log Search Process ID Directory</description>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
index be586fd..0bac71b 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml
@@ -21,6 +21,27 @@
-->
<configuration>
<property>
+ <name>logsearch.http.port</name>
+ <value>61888</value>
+ <description>Default port for Log Search UI (HTTP)</description>
+ <display-name>Log Search UI Http Port</display-name>
+ <on-ambari-upgrade add="true"/>
+ </property>
+ <property>
+ <name>logsearch.https.port</name>
+ <value>61888</value>
+ <description>Default port for Log Search UI (HTTPS)</description>
+ <display-name>Log Search UI Https Port</display-name>
+ <on-ambari-upgrade add="true"/>
+ </property>
+ <property>
+ <name>logsearch.protocol</name>
+ <value>http</value>
+ <description>Protocol (http or https)</description>
+ <display-name>Log Search UI Protocol</display-name>
+ <on-ambari-upgrade add="true"/>
+ </property>
+ <property>
<name>logsearch.collection.service.logs.numshards</name>
<value>5</value>
<display-name>Log Search Solr Service Logs Shards</display-name>
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 1b77999..0048020 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -171,8 +171,6 @@ zookeeper_quorum = logsearch_solr_zk_quorum
logsearch_user = config['configurations']['logsearch-env']['logsearch_user']
logsearch_log_dir = config['configurations']['logsearch-env']['logsearch_log_dir']
logsearch_log = logsearch_log_dir + '/logsearch.out'
-logsearch_ui_protocol = config['configurations']['logsearch-env']["logsearch_ui_protocol"]
-logsearch_ui_port = config['configurations']['logsearch-env']["logsearch_ui_port"]
logsearch_debug_enabled = str(config['configurations']['logsearch-env']["logsearch_debug_enabled"]).lower()
logsearch_debug_port = config['configurations']['logsearch-env']["logsearch_debug_port"]
logsearch_app_max_memory = config['configurations']['logsearch-env']['logsearch_app_max_memory']
@@ -233,6 +231,10 @@ else:
# Logsearch propreties
+logsearch_protocol = config['configurations']['logsearch-properties']["logsearch.protocol"]
+logsearch_http_port = config['configurations']['logsearch-properties']["logsearch.http.port"]
+logsearch_https_port = config['configurations']['logsearch-properties']["logsearch.https.port"]
+
logsearch_properties = {}
# default values
@@ -251,8 +253,6 @@ logsearch_properties['logsearch.auth.file.enabled'] = 'true'
logsearch_properties['logsearch.auth.ldap.enabled'] = 'false'
logsearch_properties['logsearch.auth.simple.enabled'] = 'false'
-logsearch_properties['logsearch.protocol'] = logsearch_ui_protocol
-
# load config values
logsearch_properties = dict(logsearch_properties.items() +\
@@ -288,7 +288,7 @@ logsearch_collection_audit_logs_numshards = logsearch_properties['logsearch.coll
# check if logsearch uses ssl in any way
-logsearch_use_ssl = logsearch_solr_ssl_enabled or logsearch_ui_protocol == 'https' or ambari_server_use_ssl
+logsearch_use_ssl = logsearch_solr_ssl_enabled or logsearch_protocol == 'https' or ambari_server_use_ssl
#####################################
# Logfeeder configs
@@ -397,6 +397,7 @@ if 'infra-solr-env' in config['configurations'] and security_enabled and not log
logsearch_server_hosts = default('/clusterHostInfo/logsearch_server_hosts', None)
logsearch_server_host = ""
+logsearch_ui_port = logsearch_https_port if logsearch_protocol == 'https' else logsearch_http_port
if logsearch_server_hosts is not None and len(logsearch_server_hosts) > 0:
logsearch_server_host = logsearch_server_hosts[0]
-smoke_logsearch_cmd = format('curl -k -s -o /dev/null -w "%{{http_code}}" {logsearch_ui_protocol}://{logsearch_server_host}:{logsearch_ui_port}/login.html | grep 200')
+smoke_logsearch_cmd = format('curl -k -s -o /dev/null -w "%{{http_code}}" {logsearch_protocol}://{logsearch_server_host}:{logsearch_ui_port}/login.html | grep 200')
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
index f21b7be..7d9b5de 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
@@ -16,8 +16,6 @@
set -e
-export LOGSEARCH_PORT={{logsearch_ui_port}}
-
# path containing LogSearch.jar file
export LOGSEARCH_PATH={{logsearch_dir}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json
index f3f376a..1057967 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/quicklinks/quicklinks.json
@@ -6,9 +6,9 @@
"type":"https",
"checks":[
{
- "property":"logsearch_ui_protocol",
+ "property":"logsearch.protocol",
"desired":"https",
- "site":"logsearch-env"
+ "site":"logsearch-properties"
}
]
},
@@ -21,12 +21,12 @@
"requires_user_name": "false",
"attributes": ["authenticated", "sso"],
"port": {
- "http_property": "logsearch_ui_port",
+ "http_property": "logsearch.http.port",
"http_default_port": "8888",
- "https_property": "logsearch_ui_port",
+ "https_property": "logsearch.https.port",
"https_default_port": "8888",
"regex": "^(\\d+)$",
- "site": "logsearch-env"
+ "site": "logsearch-properties"
}
}
]
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java
index b759738..adc79b4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java
@@ -77,12 +77,12 @@ public class LoggingRequestHelperFactoryImplTest {
Map<String, String> testProperties =
new HashMap<>();
- testProperties.put("logsearch_ui_port", expectedPortNumber);
+ testProperties.put("logsearch.http.port", expectedPortNumber);
expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
expect(controllerMock.getCredentialStoreService()).andReturn(credentialStoreServiceMock).atLeastOnce();
expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
- expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+ expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.singletonList(serviceComponentHostMock)).atLeastOnce();
expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service) null)).atLeastOnce();
expect(logSearchEnvConfig.getProperties()).andReturn(testProperties).atLeastOnce();
@@ -145,11 +145,11 @@ public class LoggingRequestHelperFactoryImplTest {
Map<String, String> testProperties =
new HashMap<>();
- testProperties.put("logsearch_ui_port", expectedPortNumber);
+ testProperties.put("logsearch.http.port", expectedPortNumber);
expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
- expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+ expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.singletonList(serviceComponentHostMock)).atLeastOnce();
expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service) null)).atLeastOnce();
@@ -198,7 +198,7 @@ public class LoggingRequestHelperFactoryImplTest {
expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce();
expect(clustersMock.getCluster(expectedClusterName)).andReturn(clusterMock).atLeastOnce();
- expect(clusterMock.getDesiredConfigByType("logsearch-env")).andReturn(logSearchEnvConfig).atLeastOnce();
+ expect(clusterMock.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchEnvConfig).atLeastOnce();
expect(clusterMock.getServiceComponentHosts("LOGSEARCH", "LOGSEARCH_SERVER")).andReturn(Collections.<ServiceComponentHost>emptyList()).atLeastOnce();
expect(clusterMock.getServices()).andReturn(Collections.singletonMap("LOGSEARCH", (Service)null)).atLeastOnce();
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
index afdc42f..db19e0f 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
@@ -100,6 +100,8 @@ class TestLogSearch(RMFTestCase):
'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181',
'logsearch.login.credentials.file': 'logsearch-admin.json',
'logsearch.protocol': 'http',
+ 'logsearch.http.port': '61888',
+ 'logsearch.https.port': '61888',
'logsearch.roles.allowed': 'AMBARI.ADMINISTRATOR,CLUSTER.ADMINISTRATOR',
'logsearch.service.logs.split.interval.mins': '1',
'logsearch.solr.audit.logs.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index 1863c02..9966f3e 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -276,8 +276,6 @@
"logsearch_log_dir": "/var/log/ambari-logsearch-portal",
"logsearch_debug_enabled": "false",
"logsearch_debug_port": "5005",
- "logsearch_ui_protocol": "http",
- "logsearch_ui_port" : "61888",
"logsearch_keystore_password" : "bigdata",
"logsearch_truststore_password" : "bigdata",
"logsearch_solr_audit_logs_use_ranger": "false",
@@ -296,6 +294,9 @@
"common-property": "common-value"
},
"logsearch-properties": {
+ "logsearch.protocol": "http",
+ "logsearch.http.port" : "61888",
+ "logsearch.https.port" : "61888",
"logsearch.spnego.kerberos.host" : "localhost",
"logsearch.solr.collection.service.logs" : "hadoop_logs",
"logsearch.solr.collection.audit.logs" : "audit_logs",
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-web/app/data/configs/services/logsearch_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/configs/services/logsearch_properties.js b/ambari-web/app/data/configs/services/logsearch_properties.js
index 3b1a9e8..a11601a 100644
--- a/ambari-web/app/data/configs/services/logsearch_properties.js
+++ b/ambari-web/app/data/configs/services/logsearch_properties.js
@@ -245,111 +245,97 @@ module.exports = [
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
"index": 1,
- "name": "logsearch_ui_protocol",
- "serviceName": "LOGSEARCH"
- },
- {
- "category": "Advanced logsearch-env",
- "filename": "logsearch-env.xml",
- "index": 2,
- "name": "logsearch_ui_port",
- "serviceName": "LOGSEARCH"
- },
- {
- "category": "Advanced logsearch-env",
- "filename": "logsearch-env.xml",
- "index": 3,
"name": "logsearch_log_dir",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 4,
+ "index": 2,
"name": "logsearch_pid_dir",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 5,
+ "index": 3,
"name": "logsearch_app_max_memory",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 6,
+ "index": 4,
"name": "logsearch_debug_enabled",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 7,
+ "index": 5,
"name": "logsearch_debug_port",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 8,
+ "index": 6,
"name": "logsearch_truststore_location",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 9,
+ "index": 7,
"name": "logsearch_truststore_type",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 10,
+ "index": 8,
"name": "logsearch_truststore_password",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 11,
+ "index": 9,
"name": "logsearch_keystore_location",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 12,
+ "index": 10,
"name": "logsearch_keystore_type",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 13,
+ "index": 11,
"name": "logsearch_keystore_password",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 14,
+ "index": 12,
"name": "logsearch_kerberos_keytab",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 15,
+ "index": 13,
"name": "logsearch_kerberos_principal",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-env",
"filename": "logsearch-env.xml",
- "index": 16,
+ "index": 14,
"name": "content",
"serviceName": "LOGSEARCH"
},
@@ -441,76 +427,97 @@ module.exports = [
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 1,
- "name": "logsearch.solr.collection.service.logs",
+ "name": "logsearch.http.port",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 2,
- "name": "logsearch.service.logs.fields",
+ "name": "logsearch.https.port",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 3,
- "name": "logsearch.service.logs.split.interval.mins",
+ "name": "logsearch.protocol",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 4,
- "name": "logsearch.solr.collection.audit.logs",
+ "name": "logsearch.solr.collection.service.logs",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 5,
- "name": "logsearch.audit.logs.split.interval.mins",
+ "name": "logsearch.service.logs.fields",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 6,
- "name": "logsearch.solr.audit.logs.use.ranger",
+ "name": "logsearch.service.logs.split.interval.mins",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 7,
- "name": "logsearch.ranger.audit.logs.collection.name",
+ "name": "logsearch.solr.collection.audit.logs",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 8,
- "name": "logsearch.solr.metrics.collector.hosts",
+ "name": "logsearch.audit.logs.split.interval.mins",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 9,
- "name": "logsearch.auth.external_auth.enable",
+ "name": "logsearch.solr.audit.logs.use.ranger",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 10,
- "name": "logsearch.auth.external_auth.host_url",
+ "name": "logsearch.ranger.audit.logs.collection.name",
"serviceName": "LOGSEARCH"
},
{
"category": "Advanced logsearch-properties",
"filename": "logsearch-properties.xml",
"index": 11,
+ "name": "logsearch.solr.metrics.collector.hosts",
+ "serviceName": "LOGSEARCH"
+ },
+ {
+ "category": "Advanced logsearch-properties",
+ "filename": "logsearch-properties.xml",
+ "index": 12,
+ "name": "logsearch.auth.external_auth.enable",
+ "serviceName": "LOGSEARCH"
+ },
+ {
+ "category": "Advanced logsearch-properties",
+ "filename": "logsearch-properties.xml",
+ "index": 13,
+ "name": "logsearch.auth.external_auth.host_url",
+ "serviceName": "LOGSEARCH"
+ },
+ {
+ "category": "Advanced logsearch-properties",
+ "filename": "logsearch-properties.xml",
+ "index": 14,
"name": "logsearch.auth.external_auth.login_url",
"serviceName": "LOGSEARCH"
},
@@ -519,55 +526,55 @@ module.exports = [
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 12
+ "index": 15
},
{
"name": "logsearch.auth.jwt.audiances",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 13
+ "index": 16
},
{
"name": "logsearch.auth.jwt.cookie.name",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 14
+ "index": 17
},
{
"name": "logsearch.auth.jwt.query.param.original_url",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 15
+ "index": 18
},
{
"name": "logsearch.spnego.kerberos.enabled",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 16
+ "index": 19
},
{
"name": "logsearch.spnego.kerberos.keytab",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 17
+ "index": 20
},
{
"name": "logsearch.spnego.kerberos.principal",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 18
+ "index": 21
},
{
"name": "logsearch.spnego.kerberos.host",
"serviceName": "LOGSEARCH",
"filename": "logsearch-properties.xml",
"category": "Advanced logsearch-properties",
- "index": 19
+ "index": 22
}
];
[29/50] [abbrv] ambari git commit: AMBARI-21670. Log Search cleanup:
all configurations should be spring managed (oleewere)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java
new file mode 100644
index 0000000..f4e2947
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SslConfigurer.java
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.configurer;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.net.ssl.SSLContext;
+
+import org.apache.ambari.logsearch.conf.LogSearchSslConfig;
+import org.apache.ambari.logsearch.util.FileUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.bouncycastle.asn1.ASN1InputStream;
+import org.bouncycastle.asn1.x500.X500Name;
+import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
+import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.operator.ContentSigner;
+import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
+import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
+import org.bouncycastle.operator.OperatorCreationException;
+import org.bouncycastle.operator.bc.BcContentSignerBuilder;
+import org.bouncycastle.operator.bc.BcRSAContentSignerBuilder;
+import org.bouncycastle.cert.X509CertificateHolder;
+import org.bouncycastle.cert.X509v3CertificateBuilder;
+import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
+import org.bouncycastle.crypto.params.RSAKeyParameters;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.security.InvalidKeyException;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.SignatureException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPublicKey;
+import java.util.Date;
+
+import static org.apache.ambari.logsearch.conf.LogSearchSslConfig.CREDENTIAL_STORE_PROVIDER_PATH;
+import static org.apache.ambari.logsearch.conf.LogSearchSslConfig.LOGSEARCH_CERT_DEFAULT_FOLDER;
+
+@Named
+public class SslConfigurer {
+ private static final Logger LOG = LoggerFactory.getLogger(SslConfigurer.class);
+
+ private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
+ private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
+ private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
+ private static final String DEFAULT_KEYSTORE_TYPE = "JKS";
+ private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
+ private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
+ private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
+ private static final String DEFAULT_TRUSTSTORE_TYPE = "JKS";
+ private static final String KEYSTORE_PASSWORD_PROPERTY_NAME = "logsearch_keystore_password";
+ private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "logsearch_truststore_password";
+ private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
+ private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
+
+ private static final String LOGSEARCH_CERT_FILENAME = "logsearch.crt";
+ private static final String LOGSEARCH_KEYSTORE_FILENAME = "logsearch.jks";
+ private static final String LOGSEARCH_KEYSTORE_PRIVATE_KEY = "logsearch.private.key";
+ private static final String LOGSEARCH_KEYSTORE_PUBLIC_KEY = "logsearch.public.key";
+
+ private static final String LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD = "bigdata";
+
+ @Inject
+ private LogSearchSslConfig logSearchSslConfig;
+
+ private String getKeyStoreLocation() {
+ return System.getProperty(KEYSTORE_LOCATION_ARG);
+ }
+
+ private String getKeyStorePassword() {
+ return System.getProperty(KEYSTORE_PASSWORD_ARG);
+ }
+
+ private String getKeyStoreType() {
+ return System.getProperty(KEYSTORE_TYPE_ARG, DEFAULT_KEYSTORE_TYPE);
+ }
+
+ private String getTrustStoreLocation() {
+ return System.getProperty(TRUSTSTORE_LOCATION_ARG);
+ }
+
+ private String getTrustStorePassword() {
+ return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
+ }
+
+ private String getTrustStoreType() {
+ return System.getProperty(TRUSTSTORE_TYPE_ARG, DEFAULT_TRUSTSTORE_TYPE);
+ }
+
+ public boolean isKeyStoreSpecified() {
+ return StringUtils.isNotEmpty(getKeyStoreLocation());
+ }
+
+ private boolean isTrustStoreSpecified() {
+ return StringUtils.isNotEmpty(getTrustStoreLocation());
+ }
+
+ public SslContextFactory getSslContextFactory() {
+ SslContextFactory sslContextFactory = new SslContextFactory();
+ sslContextFactory.setKeyStorePath(getKeyStoreLocation());
+ sslContextFactory.setKeyStorePassword(getKeyStorePassword());
+ sslContextFactory.setKeyStoreType(getKeyStoreType());
+ if (isTrustStoreSpecified()) {
+ sslContextFactory.setTrustStorePath(getTrustStoreLocation());
+ sslContextFactory.setTrustStorePassword(getTrustStorePassword());
+ sslContextFactory.setTrustStoreType(getTrustStoreType());
+ }
+
+ return sslContextFactory;
+ }
+
+ public SSLContext getSSLContext() {
+ SslContextFactory sslContextFactory = getSslContextFactory();
+
+ try {
+ sslContextFactory.start();
+ return sslContextFactory.getSslContext();
+ } catch (Exception e) {
+ LOG.error("Could not create SSL Context", e);
+ return null;
+ } finally {
+ try {
+ sslContextFactory.stop();
+ } catch (Exception e) {
+ LOG.error("Could not stop sslContextFactory", e);
+ }
+ }
+ }
+
+ private String getPasswordFromFile(String fileName) {
+ try {
+ File pwdFile = new File(LOGSEARCH_CERT_DEFAULT_FOLDER, fileName);
+ if (!pwdFile.exists()) {
+ FileUtils.writeStringToFile(pwdFile, LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD);
+ return LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD;
+ } else {
+ return FileUtils.readFileToString(pwdFile);
+ }
+ } catch (Exception e) {
+ LOG.warn("Exception occurred during read/write password file for keystore/truststore.", e);
+ return null;
+ }
+ }
+
+ private String getPasswordFromCredentialStore(String propertyName) {
+ try {
+ String providerPath = logSearchSslConfig.getCredentialStoreProviderPath();
+ if (StringUtils.isEmpty(providerPath)) {
+ return null;
+ }
+
+ Configuration config = new Configuration();
+ config.set(CREDENTIAL_STORE_PROVIDER_PATH, providerPath);
+ char[] passwordChars = config.getPassword(propertyName);
+ return (ArrayUtils.isNotEmpty(passwordChars)) ? new String(passwordChars) : null;
+ } catch (Exception e) {
+ LOG.warn(String.format("Could not load password %s from credential store, using default password", propertyName), e);
+ return null;
+ }
+ }
+
+ private String getPassword(String propertyName, String fileName) {
+ String credentialStorePassword = getPasswordFromCredentialStore(propertyName);
+ if (credentialStorePassword != null) {
+ return credentialStorePassword;
+ }
+
+ String filePassword = getPasswordFromFile(fileName);
+ if (filePassword != null) {
+ return filePassword;
+ }
+
+ return LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD;
+ }
+
+ /**
+ * Put private key into in-memory keystore and write it to a file (JKS file)
+ */
+ private void setKeyAndCertInKeystore(X509Certificate cert, KeyPair keyPair, KeyStore keyStore, String keyStoreLocation, char[] password)
+ throws Exception {
+ Certificate[] certChain = new Certificate[1];
+ certChain[0] = cert;
+ try (FileOutputStream fos = new FileOutputStream(keyStoreLocation)) {
+ keyStore.setKeyEntry("logsearch.alias", keyPair.getPrivate(), password, certChain);
+ keyStore.store(fos, password);
+ } catch (Exception e) {
+ LOG.error("Could not write certificate to Keystore", e);
+ throw e;
+ }
+ }
+
+ /**
+ * Create in-memory keypair with bouncy castle
+ */
+ private KeyPair createKeyPair(String encryptionType, int byteCount)
+ throws NoSuchProviderException, NoSuchAlgorithmException {
+ Security.addProvider(new BouncyCastleProvider());
+ KeyPairGenerator keyPairGenerator = createKeyPairGenerator(encryptionType, byteCount);
+ return keyPairGenerator.genKeyPair();
+ }
+
+ /**
+ * Generate X509 certificate if it does not exist
+ */
+ private X509Certificate generateCertificate(String certificateLocation, KeyPair keyPair, String algorithm) throws Exception {
+ try {
+ File certFile = new File(certificateLocation);
+ if (certFile.exists()) {
+ LOG.info("Certificate file exists ({}), skip the generation.", certificateLocation);
+ return getCertFile(certificateLocation);
+ } else {
+ Security.addProvider(new BouncyCastleProvider());
+ X509Certificate cert = createCert(keyPair, algorithm, InetAddress.getLocalHost().getCanonicalHostName());
+ FileUtils.writeByteArrayToFile(certFile, cert.getEncoded());
+ return cert;
+ }
+ } catch (Exception e) {
+ LOG.error("Could not create certificate.", e);
+ throw e;
+ }
+ }
+
+ private void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
+ if (StringUtils.isNotEmpty(System.getProperty(locationArg)) && StringUtils.isEmpty(System.getProperty(pwdArg))) {
+ String password = getPassword(propertyName, fileName);
+ System.setProperty(pwdArg, password);
+ }
+ }
+
+ public void ensureStorePasswords() {
+ ensureStorePassword(KEYSTORE_LOCATION_ARG, KEYSTORE_PASSWORD_ARG, KEYSTORE_PASSWORD_PROPERTY_NAME, KEYSTORE_PASSWORD_FILE);
+ ensureStorePassword(TRUSTSTORE_LOCATION_ARG, TRUSTSTORE_PASSWORD_ARG, TRUSTSTORE_PASSWORD_PROPERTY_NAME, TRUSTSTORE_PASSWORD_FILE);
+ }
+
+ private X509Certificate getCertFile(String location) throws Exception {
+ try (FileInputStream fos = new FileInputStream(location)) {
+ CertificateFactory factory = CertificateFactory.getInstance("X.509");
+ return (X509Certificate) factory.generateCertificate(fos);
+ } catch (Exception e) {
+ LOG.error("Cannot read cert file. ('" + location + "')", e);
+ throw e;
+ }
+ }
+
+ private X509Certificate createCert(KeyPair keyPair, String signatureAlgoritm, String domainName)
+ throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, OperatorCreationException, CertificateException, IOException {
+
+ RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
+ RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
+
+ AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find(signatureAlgoritm);
+ AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);
+ BcContentSignerBuilder sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId);
+
+ ASN1InputStream publicKeyStream = new ASN1InputStream(rsaPublicKey.getEncoded());
+ SubjectPublicKeyInfo pubKey = SubjectPublicKeyInfo.getInstance(publicKeyStream.readObject());
+ publicKeyStream.close();
+
+ X509v3CertificateBuilder v3CertBuilder = new X509v3CertificateBuilder(
+ new X500Name("CN=" + domainName + ", OU=None, O=None L=None, C=None"),
+ BigInteger.valueOf(Math.abs(new SecureRandom().nextInt())),
+ new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30),
+ new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10)),
+ new X500Name("CN=" + domainName + ", OU=None, O=None L=None, C=None"),
+ pubKey);
+
+ RSAKeyParameters keyParams = new RSAKeyParameters(true, rsaPrivateKey.getPrivateExponent(), rsaPrivateKey.getModulus());
+ ContentSigner contentSigner = sigGen.build(keyParams);
+
+ X509CertificateHolder certificateHolder = v3CertBuilder.build(contentSigner);
+
+ JcaX509CertificateConverter certConverter = new JcaX509CertificateConverter().setProvider("BC");
+ return certConverter.getCertificate(certificateHolder);
+ }
+
+ private KeyPairGenerator createKeyPairGenerator(String algorithmIdentifier, int bitCount)
+ throws NoSuchProviderException, NoSuchAlgorithmException {
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithmIdentifier, BouncyCastleProvider.PROVIDER_NAME);
+ kpg.initialize(bitCount);
+ return kpg;
+ }
+
+ /**
+ * Create keystore with keys and certificate (only if the keystore does not exist or if you have no permissions on the keystore file)
+ */
+ public void loadKeystore() {
+ try {
+ String certFolder = logSearchSslConfig.getCertFolder();
+ String certAlgorithm = logSearchSslConfig.getCertAlgorithm();
+ String certLocation = String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_CERT_FILENAME);
+ String keyStoreLocation = StringUtils.isNotEmpty(getKeyStoreLocation()) ? getKeyStoreLocation()
+ : String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_KEYSTORE_FILENAME);
+ char[] password = StringUtils.isNotEmpty(getKeyStorePassword()) ?
+ getKeyStorePassword().toCharArray() : LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD.toCharArray();
+ boolean keyStoreFileExists = new File(keyStoreLocation).exists();
+ if (!keyStoreFileExists) {
+ FileUtil.createDirectory(certFolder);
+ LOG.warn("Keystore file ('{}') does not exist, creating new one. " +
+ "If the file exists, make sure you have proper permissions on that.", keyStoreLocation);
+ if (isKeyStoreSpecified() && !"JKS".equalsIgnoreCase(getKeyStoreType())) {
+ throw new RuntimeException(String.format("Keystore does not exist. Only JKS keystore can be auto generated. (%s)", keyStoreLocation));
+ }
+ LOG.info("SSL keystore is not specified. Generating it with certificate ... (using default format: JKS)");
+ Security.addProvider(new BouncyCastleProvider());
+ KeyPair keyPair = createKeyPair("RSA", 2048);
+ File privateKeyFile = new File(String.format("%s/%s", certFolder, LOGSEARCH_KEYSTORE_PRIVATE_KEY));
+ if (!privateKeyFile.exists()) {
+ FileUtils.writeByteArrayToFile(privateKeyFile, keyPair.getPrivate().getEncoded());
+ }
+ File file = new File(String.format("%s/%s", certFolder, LOGSEARCH_KEYSTORE_PUBLIC_KEY));
+ if (!file.exists()) {
+ FileUtils.writeByteArrayToFile(file, keyPair.getPublic().getEncoded());
+ }
+ X509Certificate cert = generateCertificate(certLocation, keyPair, certAlgorithm);
+ KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ keyStore.load(null, password);
+ setKeyAndCertInKeystore(cert, keyPair, keyStore, keyStoreLocation, password);
+ FileUtil.setPermissionOnDirectory(certFolder, "600");
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
deleted file mode 100644
index b0b893f..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/SSLUtil.java
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.logsearch.util;
-
-import javax.net.ssl.SSLContext;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.x500.X500Name;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.operator.ContentSigner;
-import org.bouncycastle.operator.DefaultDigestAlgorithmIdentifierFinder;
-import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
-import org.bouncycastle.operator.OperatorCreationException;
-import org.bouncycastle.operator.bc.BcContentSignerBuilder;
-import org.bouncycastle.operator.bc.BcRSAContentSignerBuilder;
-import org.bouncycastle.cert.X509CertificateHolder;
-import org.bouncycastle.cert.X509v3CertificateBuilder;
-import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.security.InvalidKeyException;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.SignatureException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.util.Date;
-
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
-
-public class SSLUtil {
- private static final Logger LOG = LoggerFactory.getLogger(SSLUtil.class);
-
- private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
- private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
- private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
- private static final String DEFAULT_KEYSTORE_TYPE = "JKS";
- private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
- private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
- private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
- private static final String DEFAULT_TRUSTSTORE_TYPE = "JKS";
- private static final String KEYSTORE_PASSWORD_PROPERTY_NAME = "logsearch_keystore_password";
- private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "logsearch_truststore_password";
- private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
- private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
-
- @LogSearchPropertyDescription(
- name = "hadoop.security.credential.provider.path",
- description = "Path to interrogate for protected credentials. (see: https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/CredentialProviderAPI.html)",
- examples = {"localjceks://file/home/mypath/my.jceks"},
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String CREDENTIAL_STORE_PROVIDER_PATH = "hadoop.security.credential.provider.path";
-
- @LogSearchPropertyDescription(
- name = "logsearch.cert.folder.location",
- description = "Folder where the generated certificates (SSL) will be located. Make sure the user of Log Search Server can access it.",
- examples = {"/etc/mypath/keys"},
- defaultValue = "/etc/ambari-logsearch-portal/conf/keys",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String LOGSEARCH_CERT_FOLDER_LOCATION = "logsearch.cert.folder.location";
-
- @LogSearchPropertyDescription(
- name = "logsearch.cert.algorithm",
- description = "Algorithm to generate certificates for SSL (if needed).",
- examples = {"sha256WithRSA"},
- defaultValue = "sha256WithRSA",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String LOGSEARCH_CERT_ALGORITHM = "logsearch.cert.algorithm";
-
- private static final String LOGSEARCH_CERT_FILENAME = "logsearch.crt";
- private static final String LOGSEARCH_KEYSTORE_FILENAME = "logsearch.jks";
- private static final String LOGSEARCH_KEYSTORE_PRIVATE_KEY = "logsearch.private.key";
- private static final String LOGSEARCH_KEYSTORE_PUBLIC_KEY = "logsearch.public.key";
- private static final String LOGSEARCH_CERT_DEFAULT_ALGORITHM = "sha256WithRSA";
-
- private static final String LOGSEARCH_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
- private static final String LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD = "bigdata";
-
- private SSLUtil() {
- throw new UnsupportedOperationException();
- }
-
- public static String getKeyStoreLocation() {
- return System.getProperty(KEYSTORE_LOCATION_ARG);
- }
-
- public static String getKeyStorePassword() {
- return System.getProperty(KEYSTORE_PASSWORD_ARG);
- }
-
- public static String getKeyStoreType() {
- return System.getProperty(KEYSTORE_TYPE_ARG, DEFAULT_KEYSTORE_TYPE);
- }
-
- public static String getTrustStoreLocation() {
- return System.getProperty(TRUSTSTORE_LOCATION_ARG);
- }
-
- public static String getTrustStorePassword() {
- return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
- }
-
- public static String getTrustStoreType() {
- return System.getProperty(TRUSTSTORE_TYPE_ARG, DEFAULT_TRUSTSTORE_TYPE);
- }
-
- public static boolean isKeyStoreSpecified() {
- return StringUtils.isNotEmpty(getKeyStoreLocation());
- }
-
- private static boolean isTrustStoreSpecified() {
- return StringUtils.isNotEmpty(getTrustStoreLocation());
- }
-
- public static SslContextFactory getSslContextFactory() {
- SslContextFactory sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStorePath(getKeyStoreLocation());
- sslContextFactory.setKeyStorePassword(getKeyStorePassword());
- sslContextFactory.setKeyStoreType(getKeyStoreType());
- if (isTrustStoreSpecified()) {
- sslContextFactory.setTrustStorePath(getTrustStoreLocation());
- sslContextFactory.setTrustStorePassword(getTrustStorePassword());
- sslContextFactory.setTrustStoreType(getTrustStoreType());
- }
-
- return sslContextFactory;
- }
-
- public static SSLContext getSSLContext() {
- SslContextFactory sslContextFactory = getSslContextFactory();
-
- try {
- sslContextFactory.start();
- return sslContextFactory.getSslContext();
- } catch (Exception e) {
- LOG.error("Could not create SSL Context", e);
- return null;
- } finally {
- try {
- sslContextFactory.stop();
- } catch (Exception e) {
- LOG.error("Could not stop sslContextFactory", e);
- }
- }
- }
-
- private static String getPasswordFromFile(String fileName) {
- try {
- File pwdFile = new File(LOGSEARCH_CERT_DEFAULT_FOLDER, fileName);
- if (!pwdFile.exists()) {
- FileUtils.writeStringToFile(pwdFile, LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD);
- return LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD;
- } else {
- return FileUtils.readFileToString(pwdFile);
- }
- } catch (Exception e) {
- LOG.warn("Exception occurred during read/write password file for keystore/truststore.", e);
- return null;
- }
- }
-
- private static String getPasswordFromCredentialStore(String propertyName) {
- try {
- String providerPath = PropertiesHelper.getProperty(CREDENTIAL_STORE_PROVIDER_PATH);
- if (providerPath == null) {
- return null;
- }
-
- Configuration config = new Configuration();
- config.set(CREDENTIAL_STORE_PROVIDER_PATH, providerPath);
- char[] passwordChars = config.getPassword(propertyName);
- return (ArrayUtils.isNotEmpty(passwordChars)) ? new String(passwordChars) : null;
- } catch (Exception e) {
- LOG.warn(String.format("Could not load password %s from credential store, using default password", propertyName), e);
- return null;
- }
- }
-
- private static String getPassword(String propertyName, String fileName) {
- String credentialStorePassword = getPasswordFromCredentialStore(propertyName);
- if (credentialStorePassword != null) {
- return credentialStorePassword;
- }
-
- String filePassword = getPasswordFromFile(fileName);
- if (filePassword != null) {
- return filePassword;
- }
-
- return LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD;
- }
-
- /**
- * Put private key into in-memory keystore and write it to a file (JKS file)
- */
- private static void setKeyAndCertInKeystore(X509Certificate cert, KeyPair keyPair, KeyStore keyStore, String keyStoreLocation, char[] password)
- throws Exception {
- Certificate[] certChain = new Certificate[1];
- certChain[0] = cert;
- try (FileOutputStream fos = new FileOutputStream(keyStoreLocation)) {
- keyStore.setKeyEntry("logsearch.alias", keyPair.getPrivate(), password, certChain);
- keyStore.store(fos, password);
- } catch (Exception e) {
- LOG.error("Could not write certificate to Keystore", e);
- throw e;
- }
- }
-
- /**
- * Create in-memory keypair with bouncy castle
- */
- private static KeyPair createKeyPair(String encryptionType, int byteCount)
- throws NoSuchProviderException, NoSuchAlgorithmException {
- Security.addProvider(new BouncyCastleProvider());
- KeyPairGenerator keyPairGenerator = createKeyPairGenerator(encryptionType, byteCount);
- return keyPairGenerator.genKeyPair();
- }
-
- /**
- * Generate X509 certificate if it does not exist
- */
- private static X509Certificate generateCertificate(String certificateLocation, KeyPair keyPair, String algorithm) throws Exception {
- try {
- File certFile = new File(certificateLocation);
- if (certFile.exists()) {
- LOG.info("Certificate file exists ({}), skip the generation.", certificateLocation);
- return getCertFile(certificateLocation);
- } else {
- Security.addProvider(new BouncyCastleProvider());
- X509Certificate cert = createCert(keyPair, algorithm, InetAddress.getLocalHost().getCanonicalHostName());
- FileUtils.writeByteArrayToFile(certFile, cert.getEncoded());
- return cert;
- }
- } catch (Exception e) {
- LOG.error("Could not create certificate.", e);
- throw e;
- }
- }
-
- private static void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
- if (StringUtils.isNotEmpty(System.getProperty(locationArg)) && StringUtils.isEmpty(System.getProperty(pwdArg))) {
- String password = getPassword(propertyName, fileName);
- System.setProperty(pwdArg, password);
- }
- }
-
- public static void ensureStorePasswords() {
- ensureStorePassword(KEYSTORE_LOCATION_ARG, KEYSTORE_PASSWORD_ARG, KEYSTORE_PASSWORD_PROPERTY_NAME, KEYSTORE_PASSWORD_FILE);
- ensureStorePassword(TRUSTSTORE_LOCATION_ARG, TRUSTSTORE_PASSWORD_ARG, TRUSTSTORE_PASSWORD_PROPERTY_NAME, TRUSTSTORE_PASSWORD_FILE);
- }
-
- private static X509Certificate getCertFile(String location) throws Exception {
- try (FileInputStream fos = new FileInputStream(location)) {
- CertificateFactory factory = CertificateFactory.getInstance("X.509");
- return (X509Certificate) factory.generateCertificate(fos);
- } catch (Exception e) {
- LOG.error("Cannot read cert file. ('" + location + "')", e);
- throw e;
- }
- }
-
- private static X509Certificate createCert(KeyPair keyPair, String signatureAlgoritm, String domainName)
- throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, OperatorCreationException, CertificateException, IOException {
-
- RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
- RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
-
- AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find(signatureAlgoritm);
- AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);
- BcContentSignerBuilder sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId);
-
- ASN1InputStream publicKeyStream = new ASN1InputStream(rsaPublicKey.getEncoded());
- SubjectPublicKeyInfo pubKey = SubjectPublicKeyInfo.getInstance(publicKeyStream.readObject());
- publicKeyStream.close();
-
- X509v3CertificateBuilder v3CertBuilder = new X509v3CertificateBuilder(
- new X500Name("CN=" + domainName + ", OU=None, O=None L=None, C=None"),
- BigInteger.valueOf(Math.abs(new SecureRandom().nextInt())),
- new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30),
- new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10)),
- new X500Name("CN=" + domainName + ", OU=None, O=None L=None, C=None"),
- pubKey);
-
- RSAKeyParameters keyParams = new RSAKeyParameters(true, rsaPrivateKey.getPrivateExponent(), rsaPrivateKey.getModulus());
- ContentSigner contentSigner = sigGen.build(keyParams);
-
- X509CertificateHolder certificateHolder = v3CertBuilder.build(contentSigner);
-
- JcaX509CertificateConverter certConverter = new JcaX509CertificateConverter().setProvider("BC");
- return certConverter.getCertificate(certificateHolder);
- }
-
- private static KeyPairGenerator createKeyPairGenerator(String algorithmIdentifier, int bitCount)
- throws NoSuchProviderException, NoSuchAlgorithmException {
- KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithmIdentifier, BouncyCastleProvider.PROVIDER_NAME);
- kpg.initialize(bitCount);
- return kpg;
- }
-
- /**
- * Create keystore with keys and certificate (only if the keystore does not exist or if you have no permissions on the keystore file)
- */
- public static void loadKeystore() {
- try {
- String certFolder = PropertiesHelper.getProperty(LOGSEARCH_CERT_FOLDER_LOCATION, LOGSEARCH_CERT_DEFAULT_FOLDER);
- String certAlgorithm = PropertiesHelper.getProperty(LOGSEARCH_CERT_ALGORITHM, LOGSEARCH_CERT_DEFAULT_ALGORITHM);
- String certLocation = String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_CERT_FILENAME);
- String keyStoreLocation = StringUtils.isNotEmpty(getKeyStoreLocation()) ? getKeyStoreLocation()
- : String.format("%s/%s", LOGSEARCH_CERT_DEFAULT_FOLDER, LOGSEARCH_KEYSTORE_FILENAME);
- char[] password = StringUtils.isNotEmpty(getKeyStorePassword()) ?
- getKeyStorePassword().toCharArray() : LOGSEARCH_KEYSTORE_DEFAULT_PASSWORD.toCharArray();
- boolean keyStoreFileExists = new File(keyStoreLocation).exists();
- if (!keyStoreFileExists) {
- FileUtil.createDirectory(certFolder);
- LOG.warn("Keystore file ('{}') does not exist, creating new one. " +
- "If the file exists, make sure you have proper permissions on that.", keyStoreLocation);
- if (isKeyStoreSpecified() && !"JKS".equalsIgnoreCase(getKeyStoreType())) {
- throw new RuntimeException(String.format("Keystore does not exist. Only JKS keystore can be auto generated. (%s)", keyStoreLocation));
- }
- LOG.info("SSL keystore is not specified. Generating it with certificate ... (using default format: JKS)");
- Security.addProvider(new BouncyCastleProvider());
- KeyPair keyPair = createKeyPair("RSA", 2048);
- File privateKeyFile = new File(String.format("%s/%s", certFolder, LOGSEARCH_KEYSTORE_PRIVATE_KEY));
- if (!privateKeyFile.exists()) {
- FileUtils.writeByteArrayToFile(privateKeyFile, keyPair.getPrivate().getEncoded());
- }
- File file = new File(String.format("%s/%s", certFolder, LOGSEARCH_KEYSTORE_PUBLIC_KEY));
- if (!file.exists()) {
- FileUtils.writeByteArrayToFile(file, keyPair.getPublic().getEncoded());
- }
- X509Certificate cert = generateCertificate(certLocation, keyPair, certAlgorithm);
- KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
- keyStore.load(null, password);
- setKeyAndCertInKeystore(cert, keyPair, keyStore, keyStoreLocation, password);
- FileUtil.setPermissionOnDirectory(certFolder, "600");
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java
deleted file mode 100644
index 36865ad..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/util/WebUtil.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.logsearch.util;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebUtil {
- private static final Logger LOG = LoggerFactory.getLogger(WebUtil.class);
-
- private static final String WEB_RESOURCE_FOLDER = "webapps/app";
-
- private WebUtil() {
- throw new UnsupportedOperationException();
- }
-
- public static URI findWebResourceBase() {
- URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(WEB_RESOURCE_FOLDER);
- String errorMessage = "Web Resource Folder " + WEB_RESOURCE_FOLDER + " not found in classpath";
- if (fileCompleteUrl != null) {
- try {
- return fileCompleteUrl.toURI().normalize();
- } catch (URISyntaxException e) {
- LOG.error(errorMessage, e);
- System.exit(1);
- }
- } else {
- LOG.error(errorMessage);
- System.exit(1);
- }
- throw new IllegalStateException(errorMessage);
- }
-
- public static void checkPort(int port) {
- try (ServerSocket serverSocket = new ServerSocket(port)) {
- } catch (IOException ex) {
- LOG.error(ex.getLocalizedMessage() + " PORT :" + port);
- System.exit(1);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
index ec3075c..e50fab5 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKRBAuthenticationFilter.java
@@ -30,6 +30,8 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
@@ -40,7 +42,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.ambari.logsearch.conf.LogSearchSpnegoConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AbstractAuthenticationToken;
@@ -54,7 +56,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextImpl;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
-import org.apache.ambari.logsearch.common.PropertiesHelper;
import org.apache.commons.collections.iterators.IteratorEnumeration;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
@@ -63,83 +64,12 @@ import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHand
import org.apache.hadoop.security.authentication.util.KerberosName;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
-import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_PROPERTIES_FILE;
public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
private static final Logger logger = LoggerFactory.getLogger(LogsearchKRBAuthenticationFilter.class);
- @LogSearchPropertyDescription(
- name = "logsearch.hadoop.security.auth_to_local",
- description = "Rules that will be applied on authentication names and map them into local usernames.",
- examples = {"RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//", "DEFAULT"},
- defaultValue = "DEFAULT",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String NAME_RULES = "logsearch.hadoop.security.auth_to_local";
-
- @LogSearchPropertyDescription(
- name = "logsearch.admin.kerberos.token.valid.seconds",
- description = "Kerberos token validity in seconds.",
- examples = {"30"},
- defaultValue = "30",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String TOKEN_VALID = "logsearch.admin.kerberos.token.valid.seconds";
-
- @LogSearchPropertyDescription(
- name = "logsearch.admin.kerberos.cookie.domain",
- description = "Domain for Kerberos cookie.",
- examples = {"c6401.ambari.apache.org", "localhost"},
- defaultValue = "localhost",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String COOKIE_DOMAIN = "logsearch.admin.kerberos.cookie.domain";
-
- @LogSearchPropertyDescription(
- name = "logsearch.admin.kerberos.cookie.path",
- description = "Cookie path of the kerberos cookie",
- examples = {"/"},
- defaultValue = "/",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String COOKIE_PATH = "logsearch.admin.kerberos.cookie.path";
-
- @LogSearchPropertyDescription(
- name = "logsearch.spnego.kerberos.principal",
- description = "Principal for SPNEGO authentication for Http requests",
- examples = {"myuser@EXAMPLE.COM"},
- defaultValue = "",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String PRINCIPAL = "logsearch.spnego.kerberos.principal";
-
- @LogSearchPropertyDescription(
- name = "logsearch.spnego.kerberos.keytab",
- description = "Keytab for SPNEGO authentication for Http requests.",
- examples = {"/etc/security/keytabs/mykeytab.keytab"},
- defaultValue = "",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String KEYTAB = "logsearch.spnego.kerberos.keytab";
-
- @LogSearchPropertyDescription(
- name = "logsearch.spnego.kerberos.host",
- description = "",
- examples = {"c6401.ambari.apache.org", "localhost"},
- defaultValue = "localhost",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String HOST_NAME = "logsearch.spnego.kerberos.host";
-
- @LogSearchPropertyDescription(
- name = "logsearch.spnego.kerberos.enabled",
- description = "Enable SPNEGO based authentication for Log Search Server.",
- examples = {"true", "false"},
- defaultValue = "false",
- sources = {LOGSEARCH_PROPERTIES_FILE}
- )
- private static final String KERBEROS_ENABLED = "logsearch.spnego.kerberos.enabled";
-
+ @Inject
+ private LogSearchSpnegoConfig logSearchSpnegoConfig;
private static final String NAME_RULES_PARAM = "kerberos.name.rules";
private static final String TOKEN_VALID_PARAM = "token.validity";
@@ -157,7 +87,8 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
private String authType = PseudoAuthenticationHandler.TYPE;
private static boolean spnegoEnable = false;
- public LogsearchKRBAuthenticationFilter() {
+ @PostConstruct
+ public void postConstruct() {
try {
isSpnegoEnable();
init(null);
@@ -169,18 +100,18 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
@Override
public void init(FilterConfig conf) throws ServletException {
final FilterConfig globalConf = conf;
- String hostName = PropertiesHelper.getProperty(HOST_NAME, "localhost");
+ String hostName = logSearchSpnegoConfig.getHostName();
final Map<String, String> params = new HashMap<String, String>();
if (spnegoEnable) {
authType = KerberosAuthenticationHandler.TYPE;
}
params.put(AUTH_TYPE,authType);
- params.put(NAME_RULES_PARAM,PropertiesHelper.getProperty(NAME_RULES, "DEFAULT"));
- params.put(TOKEN_VALID_PARAM, PropertiesHelper.getProperty(TOKEN_VALID, "30"));
- params.put(COOKIE_DOMAIN_PARAM, PropertiesHelper.getProperty(COOKIE_DOMAIN, hostName));
- params.put(COOKIE_PATH_PARAM, PropertiesHelper.getProperty(COOKIE_PATH, "/"));
- params.put(PRINCIPAL_PARAM,PropertiesHelper.getProperty(PRINCIPAL,""));
- params.put(KEYTAB_PARAM,PropertiesHelper.getProperty(KEYTAB,""));
+ params.put(NAME_RULES_PARAM, logSearchSpnegoConfig.getNameRules());
+ params.put(TOKEN_VALID_PARAM, logSearchSpnegoConfig.getTokenValid());
+ params.put(COOKIE_DOMAIN_PARAM, logSearchSpnegoConfig.getCookieDomain());
+ params.put(COOKIE_PATH_PARAM, logSearchSpnegoConfig.getCookiePath());
+ params.put(PRINCIPAL_PARAM, logSearchSpnegoConfig.getPrincipal());
+ params.put(KEYTAB_PARAM, logSearchSpnegoConfig.getKeyTab());
FilterConfig myConf = new FilterConfig() {
@Override
public ServletContext getServletContext() {
@@ -263,7 +194,7 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
}
if (!isLoginRequest(httpRequest) && spnegoEnable
&& (existingAuth == null || !existingAuth.isAuthenticated())) {
- KerberosName.setRules(PropertiesHelper.getProperty(NAME_RULES, "DEFAULT"));
+ KerberosName.setRules(logSearchSpnegoConfig.getNameRules());
String userName = getUsernameFromRequest(httpRequest);
if ((existingAuth == null || !existingAuth.isAuthenticated())
&& (StringUtils.isNotEmpty(userName))) {
@@ -297,12 +228,12 @@ public class LogsearchKRBAuthenticationFilter extends LogsearchKrbFilter {
}
private void isSpnegoEnable() {
- spnegoEnable = PropertiesHelper.getBooleanProperty(KERBEROS_ENABLED, false);
+ spnegoEnable = logSearchSpnegoConfig.isKerberosEnabled();
if (spnegoEnable) {
spnegoEnable = false;
- String keytab = PropertiesHelper.getProperty(KEYTAB);
- String principal = PropertiesHelper.getProperty(PRINCIPAL);
- String hostname = PropertiesHelper.getProperty(HOST_NAME);
+ String keytab = logSearchSpnegoConfig.getKeyTab();
+ String principal = logSearchSpnegoConfig.getPrincipal();
+ String hostname = logSearchSpnegoConfig.getHostName();
if (StringUtils.isNotEmpty(keytab) && StringUtils.isNotEmpty(principal)
&& StringUtils.isNotEmpty(hostname)) {
spnegoEnable = true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java
index 9fa5c80..55101db 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/listener/LogSearchSessionListener.java
@@ -35,7 +35,7 @@ public class LogSearchSessionListener implements HttpSessionListener {
synchronized (this) {
numberOfSessions++;
}
- LOG.debug(String.format("New session is created (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
+ LOG.info(String.format("New session is created (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
}
@Override
@@ -43,6 +43,6 @@ public class LogSearchSessionListener implements HttpSessionListener {
synchronized (this) {
numberOfSessions--;
}
- LOG.debug(String.format("Session destroyed (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
+ LOG.info(String.format("Session destroyed (Id: %s). Number of sessions: %d", event.getSession().getId(), numberOfSessions));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
deleted file mode 100644
index 82e71fe..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapProperties.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Describes LDAP Server connection parameters
- */
-public class LdapProperties {
- private String primaryUrl;
- private String secondaryUrl;
- private boolean useSsl;
- private boolean anonymousBind;
- private String managerDn;
- private String managerPassword;
- private String baseDN;
- private String dnAttribute;
- private String referralMethod;
-
- // LDAP group properties
- private String groupBase;
- private String groupObjectClass;
- private String groupMembershipAttr;
- private String groupNamingAttr;
- private String adminGroupMappingRules;
- private boolean groupMappingEnabled;
-
- // LDAP user properties
- private String userBase;
- private String userObjectClass;
- private String usernameAttribute;
- private String userSearchBase = "";
-
- private String groupSearchFilter;
- private static final String userSearchFilter = "({attribute}={0})";
-
- public List<String> getLdapUrls() {
- String protocol = useSsl ? "ldaps://" : "ldap://";
-
- if (StringUtils.isEmpty(primaryUrl) || primaryUrl.equalsIgnoreCase("none")) {
- return Collections.emptyList();
- } else {
- List<String> list = new ArrayList<String>();
- list.add(protocol + primaryUrl);
- if (StringUtils.isNotEmpty(secondaryUrl)) {
- list.add(protocol + secondaryUrl);
- }
- return list;
- }
- }
-
- public String getPrimaryUrl() {
- return primaryUrl;
- }
-
- public void setPrimaryUrl(String primaryUrl) {
- this.primaryUrl = primaryUrl;
- }
-
- public String getSecondaryUrl() {
- return secondaryUrl;
- }
-
- public void setSecondaryUrl(String secondaryUrl) {
- this.secondaryUrl = secondaryUrl;
- }
-
- public boolean isUseSsl() {
- return useSsl;
- }
-
- public void setUseSsl(boolean useSsl) {
- this.useSsl = useSsl;
- }
-
- public boolean isAnonymousBind() {
- return anonymousBind;
- }
-
- public void setAnonymousBind(boolean anonymousBind) {
- this.anonymousBind = anonymousBind;
- }
-
- public String getManagerDn() {
- return managerDn;
- }
-
- public void setManagerDn(String managerDn) {
- this.managerDn = managerDn;
- }
-
- public String getManagerPassword() {
- return managerPassword;
- }
-
- public void setManagerPassword(String managerPassword) {
- this.managerPassword = managerPassword;
- }
-
- public String getBaseDN() {
- return baseDN;
- }
-
- public void setBaseDN(String baseDN) {
- this.baseDN = baseDN;
- }
-
- public String getUserSearchBase() {
- return userSearchBase;
- }
-
- public void setUserSearchBase(String userSearchBase) {
- this.userSearchBase = userSearchBase;
- }
-
- public String getUserSearchFilter() {
- return userSearchFilter.replace("{attribute}", usernameAttribute);
- }
-
- public String getUsernameAttribute() {
- return usernameAttribute;
- }
-
- public void setUsernameAttribute(String usernameAttribute) {
- this.usernameAttribute = usernameAttribute;
- }
-
- public String getGroupBase() {
- return groupBase;
- }
-
- public void setGroupBase(String groupBase) {
- this.groupBase = groupBase;
- }
-
- public String getGroupObjectClass() {
- return groupObjectClass;
- }
-
- public void setGroupObjectClass(String groupObjectClass) {
- this.groupObjectClass = groupObjectClass;
- }
-
- public String getGroupMembershipAttr() {
- return groupMembershipAttr;
- }
-
- public void setGroupMembershipAttr(String groupMembershipAttr) {
- this.groupMembershipAttr = groupMembershipAttr;
- }
-
- public String getGroupNamingAttr() {
- return groupNamingAttr;
- }
-
- public void setGroupNamingAttr(String groupNamingAttr) {
- this.groupNamingAttr = groupNamingAttr;
- }
-
- public String getAdminGroupMappingRules() {
- return adminGroupMappingRules;
- }
-
- public void setAdminGroupMappingRules(String adminGroupMappingRules) {
- this.adminGroupMappingRules = adminGroupMappingRules;
- }
-
- public String getGroupSearchFilter() {
- return groupSearchFilter;
- }
-
- public void setGroupSearchFilter(String groupSearchFilter) {
- this.groupSearchFilter = groupSearchFilter;
- }
-
- public boolean isGroupMappingEnabled() {
- return groupMappingEnabled;
- }
-
- public void setGroupMappingEnabled(boolean groupMappingEnabled) {
- this.groupMappingEnabled = groupMappingEnabled;
- }
-
- public void setUserBase(String userBase) {
- this.userBase = userBase;
- }
-
- public void setUserObjectClass(String userObjectClass) {
- this.userObjectClass = userObjectClass;
- }
-
- public String getUserBase() {
- return userBase;
- }
-
- public String getUserObjectClass() {
- return userObjectClass;
- }
-
- public String getDnAttribute() {
- return dnAttribute;
- }
-
- public void setDnAttribute(String dnAttribute) {
- this.dnAttribute = dnAttribute;
- }
-
- public void setReferralMethod(String referralMethod) {
- this.referralMethod = referralMethod;
- }
-
- public String getReferralMethod() {
- return referralMethod;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
-
- LdapProperties that = (LdapProperties) obj;
-
- if (primaryUrl != null ? !primaryUrl.equals(that.primaryUrl)
- : that.primaryUrl != null)
- return false;
- if (secondaryUrl != null ? !secondaryUrl.equals(that.secondaryUrl)
- : that.secondaryUrl != null)
- return false;
- if (useSsl != that.useSsl)
- return false;
- if (anonymousBind != that.anonymousBind)
- return false;
- if (managerDn != null ? !managerDn.equals(that.managerDn)
- : that.managerDn != null)
- return false;
- if (managerPassword != null ? !managerPassword
- .equals(that.managerPassword) : that.managerPassword != null)
- return false;
- if (baseDN != null ? !baseDN.equals(that.baseDN) : that.baseDN != null)
- return false;
- if (userBase != null ? !userBase.equals(that.userBase)
- : that.userBase != null)
- return false;
- if (userObjectClass != null ? !userObjectClass
- .equals(that.userObjectClass) : that.userObjectClass != null)
- return false;
- if (usernameAttribute != null ? !usernameAttribute
- .equals(that.usernameAttribute)
- : that.usernameAttribute != null)
- return false;
- if (groupBase != null ? !groupBase.equals(that.groupBase)
- : that.groupBase != null)
- return false;
- if (groupObjectClass != null ? !groupObjectClass
- .equals(that.groupObjectClass) : that.groupObjectClass != null)
- return false;
- if (groupMembershipAttr != null ? !groupMembershipAttr
- .equals(that.groupMembershipAttr)
- : that.groupMembershipAttr != null)
- return false;
- if (groupNamingAttr != null ? !groupNamingAttr
- .equals(that.groupNamingAttr) : that.groupNamingAttr != null)
- return false;
- if (adminGroupMappingRules != null ? !adminGroupMappingRules
- .equals(that.adminGroupMappingRules)
- : that.adminGroupMappingRules != null)
- return false;
- if (groupSearchFilter != null ? !groupSearchFilter
- .equals(that.groupSearchFilter)
- : that.groupSearchFilter != null)
- return false;
- if (dnAttribute != null ? !dnAttribute.equals(that.dnAttribute)
- : that.dnAttribute != null)
- return false;
- if (referralMethod != null ? !referralMethod
- .equals(that.referralMethod) : that.referralMethod != null)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = primaryUrl != null ? primaryUrl.hashCode() : 0;
- result = 31 * result
- + (secondaryUrl != null ? secondaryUrl.hashCode() : 0);
- result = 31 * result + (useSsl ? 1 : 0);
- result = 31 * result + (anonymousBind ? 1 : 0);
- result = 31 * result + (managerDn != null ? managerDn.hashCode() : 0);
- result = 31 * result
- + (managerPassword != null ? managerPassword.hashCode() : 0);
- result = 31 * result + (baseDN != null ? baseDN.hashCode() : 0);
- result = 31 * result + (userBase != null ? userBase.hashCode() : 0);
- result = 31 * result
- + (userObjectClass != null ? userObjectClass.hashCode() : 0);
- result = 31
- * result
- + (usernameAttribute != null ? usernameAttribute.hashCode() : 0);
- result = 31 * result + (groupBase != null ? groupBase.hashCode() : 0);
- result = 31 * result
- + (groupObjectClass != null ? groupObjectClass.hashCode() : 0);
- result = 31
- * result
- + (groupMembershipAttr != null ? groupMembershipAttr.hashCode()
- : 0);
- result = 31 * result
- + (groupNamingAttr != null ? groupNamingAttr.hashCode() : 0);
- result = 31
- * result
- + (adminGroupMappingRules != null ? adminGroupMappingRules
- .hashCode() : 0);
- result = 31
- * result
- + (groupSearchFilter != null ? groupSearchFilter.hashCode() : 0);
- result = 31 * result
- + (dnAttribute != null ? dnAttribute.hashCode() : 0);
- result = 31 * result
- + (referralMethod != null ? referralMethod.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return "LdapProperties [primaryUrl=" + primaryUrl + ", secondaryUrl="
- + secondaryUrl + ", useSsl=" + useSsl + ", anonymousBind="
- + anonymousBind + ", managerDn=" + managerDn
- + ", managerPassword=" + managerPassword == null ? "null"
- : "****" + ", baseDN=" + baseDN + ", dnAttribute="
- + dnAttribute + ", referralMethod=" + referralMethod
- + ", groupBase=" + groupBase + ", groupObjectClass="
- + groupObjectClass + ", groupMembershipAttr="
- + groupMembershipAttr + ", groupNamingAttr="
- + groupNamingAttr + ", adminGroupMappingRules="
- + adminGroupMappingRules + ", groupMappingEnabled="
- + groupMappingEnabled + ", userBase=" + userBase
- + ", userObjectClass=" + userObjectClass
- + ", usernameAttribute=" + usernameAttribute
- + ", userSearchBase=" + userSearchBase
- + ", groupSearchFilter=" + groupSearchFilter + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java
deleted file mode 100644
index 370c94b..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapPropertyName.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-public class LdapPropertyName {
-
- public static final String LDAP_USE_SSL_KEY = "authentication.ldap.useSSL";
- public static final String LDAP_PRIMARY_URL_KEY = "authentication.ldap.primaryUrl";
- public static final String LDAP_SECONDARY_URL_KEY = "authentication.ldap.secondaryUrl";
- public static final String LDAP_BASE_DN_KEY = "authentication.ldap.baseDn";
- public static final String LDAP_BIND_ANONYMOUSLY_KEY = "authentication.ldap.bindAnonymously";
- public static final String LDAP_MANAGER_DN_KEY = "authentication.ldap.managerDn";
- public static final String LDAP_MANAGER_PASSWORD_KEY = "authentication.ldap.managerPassword";
- public static final String LDAP_DN_ATTRIBUTE_KEY = "authentication.ldap.dnAttribute";
- public static final String LDAP_USERNAME_ATTRIBUTE_KEY = "authentication.ldap.usernameAttribute";
- public static final String LDAP_USER_BASE_KEY = "authentication.ldap.userBase";
- public static final String LDAP_USER_OBJECT_CLASS_KEY = "authentication.ldap.userObjectClass";
- public static final String LDAP_GROUP_BASE_KEY = "authentication.ldap.groupBase";
- public static final String LDAP_GROUP_OBJECT_CLASS_KEY = "authentication.ldap.groupObjectClass";
- public static final String LDAP_GROUP_NAMING_ATTR_KEY = "authentication.ldap.groupNamingAttr";
- public static final String LDAP_GROUP_MEMEBERSHIP_ATTR_KEY = "authentication.ldap.groupMembershipAttr";
- public static final String LDAP_ADMIN_GROUP_MAPPING_RULES_KEY = "authorization.ldap.adminGroupMappingRules";
- public static final String LDAP_GROUP_SEARCH_FILTER_KEY = "authorization.ldap.groupSearchFilter";
- public static final String LDAP_REFERRAL_KEY = "authentication.ldap.referral";
-
- // default
- public static final String LDAP_BIND_ANONYMOUSLY_DEFAULT = "true";
- public static final String LDAP_PRIMARY_URL_DEFAULT = "localhost:389";
- public static final String LDAP_BASE_DN_DEFAULT = "dc=example,dc=com";
- public static final String LDAP_USERNAME_ATTRIBUTE_DEFAULT = "uid";
- public static final String LDAP_DN_ATTRIBUTE_DEFAULT = "dn";
- public static final String LDAP_USER_BASE_DEFAULT = "ou=people,dc=example,dc=com";
- public static final String LDAP_USER_OBJECT_CLASS_DEFAULT = "person";
- public static final String LDAP_GROUP_BASE_DEFAULT = "ou=groups,dc=example,dc=com";
- public static final String LDAP_GROUP_OBJECT_CLASS_DEFAULT = "group";
- public static final String LDAP_GROUP_NAMING_ATTR_DEFAULT = "cn";
- public static final String LDAP_GROUP_MEMBERSHIP_ATTR_DEFAULT = "member";
- public static final String LDAP_ADMIN_GROUP_MAPPING_RULES_DEFAULT = "Logsearch Administrators";
- public static final String LDAP_GROUP_SEARCH_FILTER_DEFAULT = "";
- public static final String LDAP_REFERRAL_DEFAULT = "ignore";
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java
deleted file mode 100644
index 6248e74..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LdapUtil.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.ambari.logsearch.common.PropertiesHelper;
-import org.apache.ambari.logsearch.common.XMLPropertiesHelper;
-import org.apache.log4j.Logger;
-import org.springframework.core.io.ClassPathResource;
-
-public class LdapUtil {
-
- private static Logger logger = Logger.getLogger(LdapUtil.class);
-
- /**
- * Gets parameters of LDAP server to connect to
- *
- * @return LdapServerProperties object representing connection parameters
- */
- public static LdapProperties getLdapServerProperties(Properties properties) {
- LdapProperties ldapServerProperties = new LdapProperties();
-
- ldapServerProperties.setPrimaryUrl(properties.getProperty(LdapPropertyName.LDAP_PRIMARY_URL_KEY,
- LdapPropertyName.LDAP_PRIMARY_URL_DEFAULT));
- ldapServerProperties.setSecondaryUrl(properties.getProperty(LdapPropertyName.LDAP_SECONDARY_URL_KEY));
- ldapServerProperties.setUseSsl("true".equalsIgnoreCase(properties
- .getProperty(LdapPropertyName.LDAP_USE_SSL_KEY)));
- ldapServerProperties.setAnonymousBind("true".equalsIgnoreCase(properties.getProperty(
- LdapPropertyName.LDAP_BIND_ANONYMOUSLY_KEY, LdapPropertyName.LDAP_BIND_ANONYMOUSLY_DEFAULT)));
- ldapServerProperties.setManagerDn(properties.getProperty(LdapPropertyName.LDAP_MANAGER_DN_KEY));
- String ldapPasswordProperty = properties.getProperty(LdapPropertyName.LDAP_MANAGER_PASSWORD_KEY);
- // TODO read password from password file
- ldapServerProperties.setManagerPassword(ldapPasswordProperty);
- ldapServerProperties.setBaseDN(properties.getProperty(LdapPropertyName.LDAP_BASE_DN_KEY,
- LdapPropertyName.LDAP_BASE_DN_DEFAULT));
- ldapServerProperties.setUsernameAttribute(properties.getProperty(LdapPropertyName.LDAP_USERNAME_ATTRIBUTE_KEY,
- LdapPropertyName.LDAP_USERNAME_ATTRIBUTE_DEFAULT));
-
- ldapServerProperties.setUserBase(properties.getProperty(LdapPropertyName.LDAP_USER_BASE_KEY,
- LdapPropertyName.LDAP_USER_BASE_DEFAULT));
- ldapServerProperties.setUserObjectClass(properties.getProperty(LdapPropertyName.LDAP_USER_OBJECT_CLASS_KEY,
- LdapPropertyName.LDAP_USER_OBJECT_CLASS_DEFAULT));
- ldapServerProperties.setDnAttribute(properties.getProperty(LdapPropertyName.LDAP_DN_ATTRIBUTE_KEY,
- LdapPropertyName.LDAP_DN_ATTRIBUTE_DEFAULT));
-
- ldapServerProperties.setGroupBase(properties.getProperty(LdapPropertyName.LDAP_GROUP_BASE_KEY,
- LdapPropertyName.LDAP_GROUP_BASE_DEFAULT));
- ldapServerProperties.setGroupObjectClass(properties.getProperty(LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_KEY,
- LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_DEFAULT));
- ldapServerProperties.setGroupMembershipAttr(properties.getProperty(
- LdapPropertyName.LDAP_GROUP_MEMEBERSHIP_ATTR_KEY, LdapPropertyName.LDAP_GROUP_MEMBERSHIP_ATTR_DEFAULT));
- ldapServerProperties.setGroupNamingAttr(properties.getProperty(LdapPropertyName.LDAP_GROUP_NAMING_ATTR_KEY,
- LdapPropertyName.LDAP_GROUP_NAMING_ATTR_DEFAULT));
- ldapServerProperties.setAdminGroupMappingRules(properties.getProperty(
- LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_KEY,
- LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_DEFAULT));
- ldapServerProperties.setGroupSearchFilter(properties.getProperty(LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_KEY,
- LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_DEFAULT));
- ldapServerProperties.setReferralMethod(properties.getProperty(LdapPropertyName.LDAP_REFERRAL_KEY,
- LdapPropertyName.LDAP_REFERRAL_DEFAULT));
-
- if (properties.containsKey(LdapPropertyName.LDAP_GROUP_BASE_KEY)
- || properties.containsKey(LdapPropertyName.LDAP_GROUP_OBJECT_CLASS_KEY)
- || properties.containsKey(LdapPropertyName.LDAP_GROUP_MEMEBERSHIP_ATTR_KEY)
- || properties.containsKey(LdapPropertyName.LDAP_GROUP_NAMING_ATTR_KEY)
- || properties.containsKey(LdapPropertyName.LDAP_ADMIN_GROUP_MAPPING_RULES_KEY)
- || properties.containsKey(LdapPropertyName.LDAP_GROUP_SEARCH_FILTER_KEY)) {
- ldapServerProperties.setGroupMappingEnabled(true);
- }
-
- return ldapServerProperties;
- }
-
- /**
- * @return
- */
- public static LdapProperties loadLdapProperties() {
- LdapProperties ldapServerProperties = null;
- String ldapConfigFileName = PropertiesHelper.getProperty("logsearch.login.ldap.config", "logsearch-admin-site.xml");
- Properties props = null;
- ClassPathResource resource = new ClassPathResource(ldapConfigFileName);
- if (resource != null) {
- try {
- props = new Properties();
- new XMLPropertiesHelper().loadFromXml(props, resource.getInputStream());
- ldapServerProperties = getLdapServerProperties(props);
- } catch (IOException e) {
- logger.error("Ldap configudation file loading failed : " + e.getMessage());
- }
- }
- if (ldapServerProperties == null) {
- logger.error("ldapServerProperties object is not created.");
- }
- return ldapServerProperties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
index 1c7bf3b..88f8c3b 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAbstractAuthenticationProvider.java
@@ -29,7 +29,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
abstract class LogsearchAbstractAuthenticationProvider implements AuthenticationProvider {
protected enum AuthMethod {
- LDAP, FILE, EXTERNAL_AUTH, SIMPLE
+ FILE, EXTERNAL_AUTH, SIMPLE
};
@Override
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
index 711e3ec..09c05fc 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchAuthenticationProvider.java
@@ -37,9 +37,6 @@ public class LogsearchAuthenticationProvider extends LogsearchAbstractAuthentica
private static final Logger auditLogger = Logger.getLogger("org.apache.ambari.logsearch.audit");
@Inject
- private LogsearchLdapAuthenticationProvider ldapAuthenticationProvider;
-
- @Inject
private LogsearchFileAuthenticationProvider fileAuthenticationProvider;
@Inject
@@ -106,7 +103,6 @@ public class LogsearchAuthenticationProvider extends LogsearchAbstractAuthentica
private Authentication doAuth(Authentication authentication, AuthMethod authMethod) {
switch (authMethod) {
- case LDAP: return ldapAuthenticationProvider.authenticate(authentication);
case FILE: return fileAuthenticationProvider.authenticate(authentication);
case EXTERNAL_AUTH: return externalServerAuthenticationProvider.authenticate(authentication);
case SIMPLE: return simpleAuthenticationProvider.authenticate(authentication);
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
deleted file mode 100644
index ed4d7ef..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapAuthenticationProvider.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import java.util.List;
-
-import org.apache.ambari.logsearch.conf.AuthPropsConfig;
-import org.apache.log4j.Logger;
-import org.springframework.ldap.CommunicationException;
-import org.springframework.ldap.core.support.LdapContextSource;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.ldap.authentication.LdapAuthenticationProvider;
-import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-public class LogsearchLdapAuthenticationProvider extends
- LogsearchAbstractAuthenticationProvider {
-
- private static Logger logger = Logger
- .getLogger(LogsearchLdapAuthenticationProvider.class);
-
- private static LdapProperties ldapServerProperties = null;
- private static LdapAuthenticationProvider ldapAuthProvider = null;
- private String logStatement = "";
-
- @Inject
- private AuthPropsConfig authPropsConfig;
-
- public LogsearchLdapAuthenticationProvider() {
- }
-
- @PostConstruct
- public void postConstruct() {
- logger.debug("Creating object of ldap auth provider ");
- if (authPropsConfig.isAuthLdapEnabled()) {
- ldapAuthProvider = loadLdapAuthenticationProvider();
- } else {
- logger.info("Ldap auth is disabled");
- }
- }
-
- @Override
- public Authentication authenticate(Authentication authentication)
- throws AuthenticationException {
- if (!authPropsConfig.isAuthLdapEnabled()) {
- logger.debug("Ldap auth is disabled");
- return authentication;
- }
- try {
- LdapAuthenticationProvider authProvider = loadLdapAuthenticationProvider();
- if (authProvider != null) {
- return authProvider.authenticate(authentication);
- } else {
- return authentication;
- }
- } catch (AuthenticationException e) {
- logger.info("Got exception during LDAP authentication attempt", e);
- // Try to help in troubleshooting
- Throwable cause = e.getCause();
- if (cause != null) {
- if ((cause != e)
- && (cause instanceof org.springframework.ldap.AuthenticationException)) {
- logger.warn(
- "Looks like LDAP manager credentials (that are used for "
- + "connecting to LDAP server) are invalid.",
- e);
- }
- }
- } catch (CommunicationException e) {
- logger.error(e);
- } catch (Exception e) {
- logger.error(e, e.getCause());
- }
- if (authentication != null && !authentication.isAuthenticated()) {
- logger.warn("Ldap authentication failed. username="
- + authentication.getName() + ", details="
- + authentication.getDetails());
- throw new BadCredentialsException("Invalid credentials!!");
- }
- return authentication;
- }
-
- /**
- * Reloads LDAP Context Source and depending objects if properties were
- * changed
- *
- * @return corresponding LDAP authentication provider
- */
- private LdapAuthenticationProvider loadLdapAuthenticationProvider() {
- if (reloadLdapServerProperties()) {
- logger.info("LDAP Properties changed - rebuilding Context");
- LdapContextSource springSecurityContextSource = new LdapContextSource();
- List<String> ldapUrls = ldapServerProperties.getLdapUrls();
- logStatement = "ldapUrls=" + ldapUrls;
- if (ldapUrls == null || ldapUrls.size() == 0) {
- logger.info("LDAP URL is empty. So won't initialize LDAP provider");
- return null;
- }
-
- springSecurityContextSource.setUrls(ldapUrls
- .toArray(new String[ldapUrls.size()]));
- springSecurityContextSource.setBase(ldapServerProperties
- .getBaseDN());
- logStatement = logStatement + ", baseDN="
- + ldapServerProperties.getBaseDN();
-
- if (!ldapServerProperties.isAnonymousBind()) {
- springSecurityContextSource.setUserDn(ldapServerProperties
- .getManagerDn());
- logStatement = logStatement + ", managerDN="
- + ldapServerProperties.getManagerDn();
- springSecurityContextSource.setPassword(ldapServerProperties
- .getManagerPassword());
- }
-
- try {
- springSecurityContextSource.afterPropertiesSet();
- } catch (Exception e) {
- logger.error("LDAP Context Source not loaded ", e);
- throw new UsernameNotFoundException(
- "LDAP Context Source not loaded. ldapDetails="
- + logStatement, e);
- }
-
- String userSearchBase = ldapServerProperties.getUserSearchBase();
- logStatement = logStatement + ", userSearchBase=" + userSearchBase;
- String userSearchFilter = ldapServerProperties
- .getUserSearchFilter();
- logStatement = logStatement + ", userSearchFilter="
- + userSearchFilter;
-
- logger.info("LDAP properties=" + logStatement);
- FilterBasedLdapUserSearch userSearch = new FilterBasedLdapUserSearch(
- userSearchBase, userSearchFilter,
- springSecurityContextSource);
-
- LogsearchLdapBindAuthenticator bindAuthenticator = new LogsearchLdapBindAuthenticator(
- springSecurityContextSource, ldapServerProperties);
- bindAuthenticator.setUserSearch(userSearch);
-
- LdapAuthenticationProvider authenticationProvider = new LdapAuthenticationProvider(
- bindAuthenticator);
- ldapAuthProvider = authenticationProvider;
-
- }
- return ldapAuthProvider;
- }
-
- /**
- * Reloads LDAP Server properties from configuration
- *
- * @return true if properties were reloaded
- */
- private boolean reloadLdapServerProperties() {
- LdapProperties properties = LdapUtil.loadLdapProperties();
- if (!properties.equals(ldapServerProperties)) {
- logger.info("Reloading properties");
- ldapServerProperties = properties;
- return true;
- }
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
deleted file mode 100644
index 10f7507..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/web/security/LogsearchLdapBindAuthenticator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.logsearch.web.security;
-
-import org.apache.log4j.Logger;
-import org.springframework.ldap.core.DirContextOperations;
-import org.springframework.ldap.core.support.BaseLdapPathContextSource;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.ldap.authentication.BindAuthenticator;
-
-public class LogsearchLdapBindAuthenticator extends BindAuthenticator {
- private static Logger logger = Logger
- .getLogger(LogsearchLdapBindAuthenticator.class);
-
- LdapProperties ldapServerProperties;
-
- public LogsearchLdapBindAuthenticator(
- BaseLdapPathContextSource contextSource,
- LdapProperties ldapServerProperties) {
- super(contextSource);
- this.ldapServerProperties = ldapServerProperties;
- logger.info("LDAP properties=" + ldapServerProperties);
- }
-
- @Override
- public DirContextOperations authenticate(Authentication authentication) {
- return super.authenticate(authentication);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/555f241c/ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties b/ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties
index cd1f22a..4c74142 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/resources/default.properties
@@ -21,7 +21,6 @@ logsearch.auth.simple.enable=false
#login config
logsearch.login.credentials.file=user_pass.json
-logsearch.login.ldap.config=logsearch-admin-site.xml
logsearch.cert.folder.location=/etc/ambari-logsearch-portal/conf/keys
logsearch.cert.algorithm=sha256WithRSAEncryption
[47/50] [abbrv] ambari git commit: AMBARI-21695. Problem in starting
accumulo in upgraded cluster (IOP-HDP). Addendum. (swagle)
Posted by ab...@apache.org.
AMBARI-21695. Problem in starting accumulo in upgraded cluster (IOP-HDP). Addendum. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/655c3c6a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/655c3c6a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/655c3c6a
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 655c3c6aa1ece4b16e2bc6ae6bcee3061252747d
Parents: 3136abe
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Aug 9 20:07:24 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Aug 9 20:07:24 2017 -0700
----------------------------------------------------------------------
.../listeners/upgrade/StackUpgradeFinishListener.java | 13 +++++++++++++
.../metadata/CachedRoleCommandOrderProvider.java | 1 -
.../serveraction/upgrades/FinalizeUpgradeAction.java | 13 -------------
3 files changed, 13 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/655c3c6a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
index 53ec23d..f1168a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
@@ -23,6 +23,8 @@ import org.apache.ambari.server.EagerSingleton;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.events.StackUpgradeFinishEvent;
import org.apache.ambari.server.events.publishers.VersionEventPublisher;
+import org.apache.ambari.server.metadata.CachedRoleCommandOrderProvider;
+import org.apache.ambari.server.metadata.RoleCommandOrderProvider;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
@@ -46,9 +48,13 @@ public class StackUpgradeFinishListener {
* Logger.
*/
private final static Logger LOG = LoggerFactory.getLogger(StackUpgradeFinishListener.class);
+
@Inject
Provider<AmbariMetaInfo> ambariMetaInfo;
+ @Inject
+ RoleCommandOrderProvider roleCommandOrderProvider;
+
/**
* Constructor.
*
@@ -80,6 +86,13 @@ public class StackUpgradeFinishListener {
}
}
}
+
+ // Clear the RoleCommandOrder cache on upgrade
+ if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+ LOG.info("Clearing RCO cache");
+ CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+ cachedRcoProvider.clearRoleCommandOrderCache();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/655c3c6a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
index 0a5d301..1ef415a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/CachedRoleCommandOrderProvider.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.metadata;
-import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
http://git-wip-us.apache.org/repos/asf/ambari/blob/655c3c6a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index 8471d7b..26dcf27 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -35,7 +35,6 @@ import org.apache.ambari.server.agent.CommandReport;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.events.StackUpgradeFinishEvent;
import org.apache.ambari.server.events.publishers.VersionEventPublisher;
-import org.apache.ambari.server.metadata.CachedRoleCommandOrderProvider;
import org.apache.ambari.server.metadata.RoleCommandOrderProvider;
import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
import org.apache.ambari.server.orm.dao.HostVersionDAO;
@@ -202,12 +201,6 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
// Reset upgrade state
cluster.setUpgradeEntity(null);
- // Clear any cached RCO data after version upgrade
- if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
- CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider) roleCommandOrderProvider;
- cachedRcoProvider.clearRoleCommandOrderCache();
- }
-
// the upgrade is done!
versionEventPublisher.publish(new StackUpgradeFinishEvent(cluster));
@@ -330,12 +323,6 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
// Reset upgrade state
cluster.setUpgradeEntity(null);
- // Clear any cached RCO data after version upgrade
- if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
- CachedRoleCommandOrderProvider cachedRcoProvider = (CachedRoleCommandOrderProvider) roleCommandOrderProvider;
- cachedRcoProvider.clearRoleCommandOrderCache();
- }
-
message = String.format("The downgrade from %s has completed.", downgradeFromVersion);
outSB.append(message).append(System.lineSeparator());
[13/50] [abbrv] ambari git commit: AMBARI-21643 - Annotate upgrade
packs for scope (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21643 - Annotate upgrade packs for scope (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b487b450
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b487b450
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b487b450
Branch: refs/heads/branch-feature-logsearch-ui
Commit: b487b450ac9ff00a3be3b61a1399b710aa21a5d6
Parents: 66410e5
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Aug 3 08:26:57 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 3 13:37:53 2017 -0400
----------------------------------------------------------------------
.../upgrades/upgrade_nonrolling_new_stack.xml | 6 +-
.../2.1.1/upgrades/upgrade_test_nonrolling.xml | 4 +-
.../api/services/WidgetLayoutService.java | 1 -
.../internal/UpgradeResourceProvider.java | 4 +-
.../upgrades/UpdateDesiredRepositoryAction.java | 189 +++++++++++++++++++
.../upgrades/UpdateDesiredStackAction.java | 189 -------------------
.../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 6 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 7 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 7 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 7 +-
.../stacks/HDP/2.3/upgrades/upgrade-2.4.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.5.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 6 +-
.../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 6 +-
.../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 6 +-
.../stacks/HDP/2.4/upgrades/upgrade-2.5.xml | 1 +
.../stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 6 +-
.../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 6 +-
.../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 6 +-
.../1.0/upgrades/nonrolling-upgrade-2.0.xml | 6 +-
.../upgrades/UpgradeActionTest.java | 6 +-
.../server/state/stack/UpgradePackTest.java | 4 +-
.../upgrades/upgrade_nonrolling_new_stack.xml | 6 +-
.../2.1.1/upgrades/upgrade_test_nonrolling.xml | 4 +-
26 files changed, 247 insertions(+), 240 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
----------------------------------------------------------------------
diff --git a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
index d0f3e16..a44759e 100644
--- a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
+++ b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
@@ -237,9 +237,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack" service="" component="">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories" service="" component="">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
----------------------------------------------------------------------
diff --git a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
index 9f57ca8..f7dd720 100644
--- a/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
+++ b/ambari-funtest/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
@@ -105,9 +105,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Desired Stack Id">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Desired Stack Id">
<execute-stage title="Update Desired Stack Id" service="" component="">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
index 61167d6..0a3c720 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java
@@ -69,7 +69,6 @@ public class WidgetLayoutService extends BaseService {
@GET @ApiIgnore // until documented
@Produces("text/plain")
public Response getServices(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
- System.out.println("###########");
return handleRequest(headers, body, ui, Request.Type.GET,
createResource(null));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 6b1fe05..ea3cf65 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -647,7 +647,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
throw new AmbariException("There are no groupings available");
}
- // Non Rolling Upgrades require a group with name "UPDATE_DESIRED_STACK_ID".
+ // Non Rolling Upgrades require a group with name "UPDATE_DESIRED_REPOSITORY_ID".
// This is needed as a marker to indicate which version to use when an upgrade is paused.
if (pack.getType() == UpgradeType.NON_ROLLING) {
boolean foundUpdateDesiredRepositoryIdGrouping = false;
@@ -690,7 +690,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
During a {@link UpgradeType.NON_ROLLING} upgrade, the stack is applied during the middle of the upgrade (after
stopping all services), and the configs are applied immediately before starting the services.
- The Upgrade Pack is responsible for calling {@link org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction}
+ The Upgrade Pack is responsible for calling {@link org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction}
at the appropriate moment during the orchestration.
*/
if (pack.getType() == UpgradeType.ROLLING) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
new file mode 100644
index 0000000..10d6630
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.orm.dao.HostVersionDAO;
+import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.serveraction.ServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.UpgradeContext;
+import org.apache.ambari.server.state.stack.upgrade.Direction;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+import com.google.inject.persist.Transactional;
+
+/**
+ * Action that represents updating the Desired Stack Id during the middle of a stack upgrade (typically NonRolling).
+ * In a {@link org.apache.ambari.server.state.stack.upgrade.UpgradeType#NON_ROLLING}, the effective Stack Id is
+ * actually changed half-way through calculating the Actions, and this serves to update the database to make it
+ * evident to the user at which point it changed.
+ */
+public class UpdateDesiredRepositoryAction extends AbstractUpgradeServerAction {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(UpdateDesiredRepositoryAction.class);
+
+
+ /**
+ * The Cluster that this ServerAction implementation is executing on.
+ */
+ @Inject
+ private Clusters clusters;
+
+ /**
+ * The Ambari configuration.
+ */
+ @Inject
+ private Configuration m_configuration;
+
+ /**
+ * Used for restting host version states on downgrade.
+ */
+ @Inject
+ private HostVersionDAO m_hostVersionDAO;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
+ throws AmbariException, InterruptedException {
+
+ String clusterName = getExecutionCommand().getClusterName();
+ Cluster cluster = clusters.getCluster(clusterName);
+ UpgradeContext upgradeContext = getUpgradeContext(cluster);
+
+ Map<String, String> roleParams = getExecutionCommand().getRoleParams();
+
+ // Make a best attempt at setting the username
+ String userName;
+ if (roleParams != null && roleParams.containsKey(ServerAction.ACTION_USER_NAME)) {
+ userName = roleParams.get(ServerAction.ACTION_USER_NAME);
+ } else {
+ userName = m_configuration.getAnonymousAuditName();
+ LOG.warn(String.format("Did not receive role parameter %s, will save configs using anonymous username %s", ServerAction.ACTION_USER_NAME, userName));
+ }
+
+ return updateDesiredRepositoryVersion(cluster, upgradeContext, userName);
+ }
+
+ /**
+ * Sets the desired repository version for services participating in the
+ * upgrade.
+ *
+ * @param cluster
+ * the cluster
+ * @param upgradeContext
+ * the upgrade context
+ * @param userName
+ * username performing the action
+ * @return the command report to return
+ */
+ @Transactional
+ CommandReport updateDesiredRepositoryVersion(
+ Cluster cluster, UpgradeContext upgradeContext, String userName)
+ throws AmbariException, InterruptedException {
+
+ StringBuilder out = new StringBuilder();
+ StringBuilder err = new StringBuilder();
+
+ try {
+ // the desired repository message to put in the command report - this will
+ // change based on the type of upgrade and the services participating
+ if (upgradeContext.getDirection() == Direction.UPGRADE) {
+ final String message;
+ RepositoryVersionEntity targetRepositoryVersion = upgradeContext.getRepositoryVersion();
+
+ if (upgradeContext.getOrchestrationType() == RepositoryType.STANDARD) {
+ message = MessageFormat.format(
+ "Updating the desired repository version to {0} for all cluster services.",
+ targetRepositoryVersion.getVersion());
+ } else {
+ Set<String> servicesInUpgrade = upgradeContext.getSupportedServices();
+ message = MessageFormat.format(
+ "Updating the desired repository version to {0} for the following services: {1}",
+ targetRepositoryVersion.getVersion(), StringUtils.join(servicesInUpgrade, ','));
+ }
+
+ out.append(message).append(System.lineSeparator());
+ }
+
+ if( upgradeContext.getDirection() == Direction.DOWNGRADE ){
+ String message = "Updating the desired repository back their original values for the following services:";
+ out.append(message).append(System.lineSeparator());
+
+ Map<String, RepositoryVersionEntity> targetVersionsByService = upgradeContext.getTargetVersions();
+ for (String serviceName : targetVersionsByService.keySet()) {
+ RepositoryVersionEntity repositoryVersion = targetVersionsByService.get(serviceName);
+
+ message = String.format(" %s to %s", serviceName, repositoryVersion.getVersion());
+ out.append(message).append(System.lineSeparator());
+ }
+ }
+
+ // move repositories to the right version and create/revert configs
+ m_upgradeHelper.updateDesiredRepositoriesAndConfigs(upgradeContext);
+
+ // a downgrade must force host versions back to INSTALLED for the
+ // repository which failed to be upgraded.
+ if (upgradeContext.getDirection() == Direction.DOWNGRADE) {
+ RepositoryVersionEntity downgradeFromRepositoryVersion = upgradeContext.getRepositoryVersion();
+ out.append(String.format("Setting host versions back to %s for repository version %s",
+ RepositoryVersionState.INSTALLED, downgradeFromRepositoryVersion.getVersion()));
+
+ List<HostVersionEntity> hostVersionsToReset = m_hostVersionDAO.findHostVersionByClusterAndRepository(
+ cluster.getClusterId(), downgradeFromRepositoryVersion);
+
+ for (HostVersionEntity hostVersion : hostVersionsToReset) {
+ if( hostVersion.getState() != RepositoryVersionState.NOT_REQUIRED ){
+ hostVersion.setState(RepositoryVersionState.INSTALLED);
+ }
+ }
+ }
+
+ return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", out.toString(), err.toString());
+ } catch (Exception e) {
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ err.append(sw);
+
+ return createCommandReport(-1, HostRoleStatus.FAILED, "{}", out.toString(), err.toString());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
deleted file mode 100644
index ff0becc..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-package org.apache.ambari.server.serveraction.upgrades;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.actionmanager.HostRoleStatus;
-import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.orm.dao.HostVersionDAO;
-import org.apache.ambari.server.orm.entities.HostVersionEntity;
-import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.serveraction.ServerAction;
-import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
-import org.apache.ambari.server.state.RepositoryType;
-import org.apache.ambari.server.state.RepositoryVersionState;
-import org.apache.ambari.server.state.UpgradeContext;
-import org.apache.ambari.server.state.stack.upgrade.Direction;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Inject;
-import com.google.inject.persist.Transactional;
-
-/**
- * Action that represents updating the Desired Stack Id during the middle of a stack upgrade (typically NonRolling).
- * In a {@link org.apache.ambari.server.state.stack.upgrade.UpgradeType#NON_ROLLING}, the effective Stack Id is
- * actually changed half-way through calculating the Actions, and this serves to update the database to make it
- * evident to the user at which point it changed.
- */
-public class UpdateDesiredStackAction extends AbstractUpgradeServerAction {
-
- /**
- * Logger.
- */
- private static final Logger LOG = LoggerFactory.getLogger(UpdateDesiredStackAction.class);
-
-
- /**
- * The Cluster that this ServerAction implementation is executing on.
- */
- @Inject
- private Clusters clusters;
-
- /**
- * The Ambari configuration.
- */
- @Inject
- private Configuration m_configuration;
-
- /**
- * Used for restting host version states on downgrade.
- */
- @Inject
- private HostVersionDAO m_hostVersionDAO;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
- throws AmbariException, InterruptedException {
-
- String clusterName = getExecutionCommand().getClusterName();
- Cluster cluster = clusters.getCluster(clusterName);
- UpgradeContext upgradeContext = getUpgradeContext(cluster);
-
- Map<String, String> roleParams = getExecutionCommand().getRoleParams();
-
- // Make a best attempt at setting the username
- String userName;
- if (roleParams != null && roleParams.containsKey(ServerAction.ACTION_USER_NAME)) {
- userName = roleParams.get(ServerAction.ACTION_USER_NAME);
- } else {
- userName = m_configuration.getAnonymousAuditName();
- LOG.warn(String.format("Did not receive role parameter %s, will save configs using anonymous username %s", ServerAction.ACTION_USER_NAME, userName));
- }
-
- return updateDesiredRepositoryVersion(cluster, upgradeContext, userName);
- }
-
- /**
- * Sets the desired repository version for services participating in the
- * upgrade.
- *
- * @param cluster
- * the cluster
- * @param upgradeContext
- * the upgrade context
- * @param userName
- * username performing the action
- * @return the command report to return
- */
- @Transactional
- CommandReport updateDesiredRepositoryVersion(
- Cluster cluster, UpgradeContext upgradeContext, String userName)
- throws AmbariException, InterruptedException {
-
- StringBuilder out = new StringBuilder();
- StringBuilder err = new StringBuilder();
-
- try {
- // the desired repository message to put in the command report - this will
- // change based on the type of upgrade and the services participating
- if (upgradeContext.getDirection() == Direction.UPGRADE) {
- final String message;
- RepositoryVersionEntity targetRepositoryVersion = upgradeContext.getRepositoryVersion();
-
- if (upgradeContext.getOrchestrationType() == RepositoryType.STANDARD) {
- message = MessageFormat.format(
- "Updating the desired repository version to {0} for all cluster services.",
- targetRepositoryVersion.getVersion());
- } else {
- Set<String> servicesInUpgrade = upgradeContext.getSupportedServices();
- message = MessageFormat.format(
- "Updating the desired repository version to {0} for the following services: {1}",
- targetRepositoryVersion.getVersion(), StringUtils.join(servicesInUpgrade, ','));
- }
-
- out.append(message).append(System.lineSeparator());
- }
-
- if( upgradeContext.getDirection() == Direction.DOWNGRADE ){
- String message = "Updating the desired repository back their original values for the following services:";
- out.append(message).append(System.lineSeparator());
-
- Map<String, RepositoryVersionEntity> targetVersionsByService = upgradeContext.getTargetVersions();
- for (String serviceName : targetVersionsByService.keySet()) {
- RepositoryVersionEntity repositoryVersion = targetVersionsByService.get(serviceName);
-
- message = String.format(" %s to %s", serviceName, repositoryVersion.getVersion());
- out.append(message).append(System.lineSeparator());
- }
- }
-
- // move repositories to the right version and create/revert configs
- m_upgradeHelper.updateDesiredRepositoriesAndConfigs(upgradeContext);
-
- // a downgrade must force host versions back to INSTALLED for the
- // repository which failed to be upgraded.
- if (upgradeContext.getDirection() == Direction.DOWNGRADE) {
- RepositoryVersionEntity downgradeFromRepositoryVersion = upgradeContext.getRepositoryVersion();
- out.append(String.format("Setting host versions back to %s for repository version %s",
- RepositoryVersionState.INSTALLED, downgradeFromRepositoryVersion.getVersion()));
-
- List<HostVersionEntity> hostVersionsToReset = m_hostVersionDAO.findHostVersionByClusterAndRepository(
- cluster.getClusterId(), downgradeFromRepositoryVersion);
-
- for (HostVersionEntity hostVersion : hostVersionsToReset) {
- if( hostVersion.getState() != RepositoryVersionState.NOT_REQUIRED ){
- hostVersion.setState(RepositoryVersionState.INSTALLED);
- }
- }
- }
-
- return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", out.toString(), err.toString());
- } catch (Exception e) {
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- err.append(sw);
-
- return createCommandReport(-1, HostRoleStatus.FAILED, "{}", out.toString(), err.toString());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index ff1d87d..07b34cd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -242,9 +242,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
index 41cab3f..331306f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -241,9 +241,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
@@ -450,6 +450,7 @@
that are installed on the hosts but not known by Ambari.
-->
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <scope>COMPLETE</scope>
<skippable>true</skippable>
<supports-auto-skip-failure>false</supports-auto-skip-failure>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 76c4ed5..7f9d9d2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -258,9 +258,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
@@ -606,6 +606,7 @@
that are installed on the hosts but not known by Ambari.
-->
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <scope>COMPLETE</scope>
<skippable>true</skippable>
<supports-auto-skip-failure>false</supports-auto-skip-failure>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 5aa08c5..4034f4b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -260,9 +260,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
@@ -704,6 +704,7 @@
that are installed on the hosts but not known by Ambari.
-->
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Set Version On All Hosts">
+ <scope>COMPLETE</scope>
<skippable>true</skippable>
<supports-auto-skip-failure>false</supports-auto-skip-failure>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
index 8cfaa52..11fb0c5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
@@ -427,6 +427,7 @@
</group>
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <scope>COMPLETE</scope>
<execute-stage title="Update remaining HDP stack to {{version}}">
<task xsi:type="execute">
<script>scripts/ru_set_all.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index f7192ae..56c1552 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -495,6 +495,7 @@
</group>
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <scope>COMPLETE</scope>
<execute-stage title="Update remaining HDP stack to {{version}}">
<task xsi:type="execute">
<script>scripts/ru_set_all.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index d98bb53..2e2c9c3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -497,6 +497,7 @@
</group>
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <scope>COMPLETE</scope>
<execute-stage title="Update remaining HDP stack to {{version}}">
<task xsi:type="execute">
<script>scripts/ru_set_all.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
index 4e66b7c..ed0d2f8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -240,9 +240,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index 9969a59..77ec871 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -252,9 +252,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index 4a2a502..4703709 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -254,9 +254,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index ad9ae33..e2c7557 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -480,6 +480,7 @@
</group>
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <scope>COMPLETE</scope>
<execute-stage title="Update remaining HDP stack to {{version}}">
<task xsi:type="execute">
<script>scripts/ru_set_all.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index 1eb9836..35187c7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -486,6 +486,7 @@
</group>
<group xsi:type="cluster" name="ALL_HOST_OPS" title="Finalize Hosts">
+ <scope>COMPLETE</scope>
<execute-stage title="Update remaining HDP stack to {{version}}">
<task xsi:type="execute">
<script>scripts/ru_set_all.py</script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index c8cb0b3..b79f644 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -260,9 +260,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index cfd429f..e9490b2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -266,9 +266,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction"/>
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction"/>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index df609cd..86b3956 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -277,9 +277,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
index 7078a6e..5d24ff8 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/upgrades/nonrolling-upgrade-2.0.xml
@@ -72,9 +72,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction"/>
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction"/>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index da6d2b2..82d5481 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -289,12 +289,12 @@ public class UpgradeActionTest {
}
/***
- * During an Express Upgrade that crosses a stack version, Ambari calls UpdateDesiredStackAction
+ * During an Express Upgrade that crosses a stack version, Ambari calls UpdateDesiredRepositoryAction
* in order to change the stack and apply configs.
* The configs that are applied must be saved with the username that is passed in the role params.
*/
@Test
- public void testExpressUpgradeUpdateDesiredStackAction() throws Exception {
+ public void testExpressUpgradeUpdateDesiredRepositoryAction() throws Exception {
StackId sourceStack = HDP_21_STACK;
StackId targetStack = HDP_22_STACK;
String sourceRepo = HDP_2_1_1_0;
@@ -349,7 +349,7 @@ public class UpgradeActionTest {
hostRoleCommand.setExecutionCommandWrapper(new ExecutionCommandWrapper(executionCommand));
// Call the action to change the desired stack and apply the configs from the Config Pack called by the Upgrade Pack.
- UpdateDesiredStackAction action = m_injector.getInstance(UpdateDesiredStackAction.class);
+ UpdateDesiredRepositoryAction action = m_injector.getInstance(UpdateDesiredRepositoryAction.class);
action.setExecutionCommand(executionCommand);
action.setHostRoleCommand(hostRoleCommand);
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
index d682244..c7a761d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java
@@ -272,7 +272,7 @@ public class UpgradePackTest {
"Stop High-Level Daemons",
"Backups",
"Stop Low-Level Daemons",
- "UPDATE_DESIRED_STACK_ID",
+ "UPDATE_DESIRED_REPOSITORY_ID",
"ALL_HOST_OPS",
"ZOOKEEPER",
"HDFS",
@@ -281,7 +281,7 @@ public class UpgradePackTest {
List<String> expected_down = Arrays.asList(
"Restore Backups",
- "UPDATE_DESIRED_STACK_ID",
+ "UPDATE_DESIRED_REPOSITORY_ID",
"ALL_HOST_OPS",
"ZOOKEEPER",
"HDFS",
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
index a397be9..2a1c889 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_nonrolling_new_stack.xml
@@ -237,9 +237,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Target Stack">
- <execute-stage title="Update Target Stack">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
+ <execute-stage title="Update Target Repositories">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b487b450/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
index dcddbc5..3dd4bc5 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/upgrades/upgrade_test_nonrolling.xml
@@ -107,9 +107,9 @@
</group>
<!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
- <group xsi:type="update-stack" name="UPDATE_DESIRED_STACK_ID" title="Update Desired Stack Id">
+ <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Desired Stack Id">
<execute-stage title="Update Desired Stack Id">
- <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredStackAction">
+ <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
</task>
</execute-stage>
</group>
[11/50] [abbrv] ambari git commit: AMBARI-21640 : Certain templated
Grafana dashboards not showing data. (avijayan)
Posted by ab...@apache.org.
AMBARI-21640 : Certain templated Grafana dashboards not showing data. (avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/07d6ec30
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/07d6ec30
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/07d6ec30
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 07d6ec308dd2d54c0af720a181759391ffc22192
Parents: 4a122a2
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Aug 3 09:40:40 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Aug 3 09:40:48 2017 -0700
----------------------------------------------------------------------
.../ambari-metrics/datasource.js | 35 ++++++++++++++------
.../HDF/grafana-nifi-hosts.json | 17 +++++++++-
2 files changed, 41 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/07d6ec30/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
index b4a339e..07e76af 100644
--- a/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
+++ b/ambari-metrics/ambari-metrics-grafana/ambari-metrics/datasource.js
@@ -216,11 +216,12 @@ define([
var getHostAppIdData = function(target) {
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
+ var instanceId = typeof target.cluster == 'undefined' ? '' : '&instanceId=' + target.cluster;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform +
- metricAggregator + "&hostname=" + target.hosts + '&appId=' + target.app + '&instanceId=' + target.cluster + '&startTime=' + from +
+ metricAggregator + "&hostname=" + target.hosts + '&appId=' + target.app + instanceId + '&startTime=' + from +
'&endTime=' + to + precision + seriesAggregator }).then(
getMetricsData(target)
);
@@ -240,6 +241,7 @@ define([
var getServiceAppIdData = function(target) {
var tCluster = (_.isEmpty(templateSrv.variables))? templatedCluster : '';
+ var instanceId = typeof tCluster == 'undefined' ? '' : '&instanceId=' + tCluster;
var tHost = (_.isEmpty(templateSrv.variables)) ? templatedHost : target.templatedHost;
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
@@ -247,13 +249,14 @@ define([
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform
- + metricAggregator + '&hostname=' + tHost + '&appId=' + target.app + '&instanceId=' + tCluster + '&startTime=' + from +
+ + metricAggregator + '&hostname=' + tHost + '&appId=' + target.app + instanceId + '&startTime=' + from +
'&endTime=' + to + precision + seriesAggregator }).then(
getMetricsData(target)
);
};
// To speed up querying on templatized dashboards.
var getAllHostData = function(target) {
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
@@ -269,7 +272,7 @@ define([
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
var templatedComponent = (_.isEmpty(tComponent)) ? target.app : tComponent;
return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.metric + metricTransform
- + metricAggregator + '&hostname=' + target.templatedHost + '&appId=' + templatedComponent + '&instanceId=' + target.templatedCluster
+ + metricAggregator + '&hostname=' + target.templatedHost + '&appId=' + templatedComponent + instanceId
+ '&startTime=' + from + '&endTime=' + to + precision + topN + seriesAggregator }).then(
allHostMetricsData(target)
);
@@ -288,10 +291,11 @@ define([
);
};
var getHbaseAppIdData = function(target) {
- var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
+ var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
- return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.hbMetric + + '&instanceId=' + target.templatedCluster + '&appId=hbase&startTime='
+ return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.hbMetric + instanceId + '&appId=hbase&startTime='
+ from + '&endTime=' + to + precision + seriesAggregator }).then(
allHostMetricsData(target)
);
@@ -300,22 +304,25 @@ define([
var getKafkaAppIdData = function(target) {
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
- return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.kbMetric + metricTransform + + '&instanceId=' + target.templatedCluster
+ return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.kbMetric + metricTransform + instanceId
+ metricAggregator + '&appId=kafka_broker&startTime=' + from +
'&endTime=' + to + precision + seriesAggregator }).then(
getMetricsData(target)
);
};
var getNnAppIdData = function(target) {
+
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
- return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.nnMetric + metricTransform + '&instanceId=' + target.templatedCluster
+ return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.nnMetric + metricTransform + instanceId
+ metricAggregator + '&appId=namenode&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
allHostMetricsData(target)
);
@@ -323,12 +330,13 @@ define([
// Storm Topology calls.
var getStormData = function(target) {
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
- return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sTopoMetric + metricTransform + '&instanceId=' + target.templatedCluster
+ return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sTopoMetric + metricTransform + instanceId
+ metricAggregator + '&appId=nimbus&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
allHostMetricsData(target)
);
@@ -336,12 +344,13 @@ define([
// Druid calls.
var getDruidData = function(target) {
+ var instanceId = typeof target.templatedCluster == 'undefined' ? '' : '&instanceId=' + target.templatedCluster;
var precision = target.precision === 'default' || typeof target.precision == 'undefined' ? '' : '&precision='
+ target.precision;
var metricAggregator = target.aggregator === "none" ? '' : '._' + target.aggregator;
var metricTransform = !target.transform || target.transform === "none" ? '' : '._' + target.transform;
var seriesAggregator = !target.seriesAggregator || target.seriesAggregator === "none" ? '' : '&seriesAggregateFunction=' + target.seriesAggregator;
- return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sDataSourceMetric + metricTransform + '&instanceId=' + target.templatedCluster
+ return self.doAmbariRequest({ url: '/ws/v1/timeline/metrics?metricNames=' + target.sDataSourceMetric + metricTransform + instanceId
+ metricAggregator + '&appId=druid&startTime=' + from + '&endTime=' + to + precision + seriesAggregator }).then(
allHostMetricsData(target)
);
@@ -512,7 +521,13 @@ define([
});
}
// To speed up querying on templatized dashboards.
- if (templateSrv.variables[2] && templateSrv.variables[2].name === "hosts") {
+ var indexOfHosts = -1;
+ for (var i = 0; i < templateSrv.variables.length; i++) {
+ if (templateSrv.variables[i].name == 'hosts') {
+ indexOfHosts = i;
+ }
+ }
+ if (indexOfHosts >= 0) {
var allHosts = templateSrv._values.hosts.lastIndexOf('}') > 0 ? templateSrv._values.hosts.slice(1,-1) :
templateSrv._values.hosts;
allHosts = templateSrv._texts.hosts === "All" ? '%' : allHosts;
http://git-wip-us.apache.org/repos/asf/ambari/blob/07d6ec30/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
index 94aa285..e491a38 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-nifi-hosts.json
@@ -965,7 +965,7 @@
"includeAll": false,
"multi": false,
"multiFormat": "glob",
- "name": "component",
+ "name": "components",
"options": [
{
"selected": true,
@@ -979,6 +979,21 @@
},
{
"allFormat": "glob",
+ "current": null,
+ "datasource": null,
+ "includeAll": false,
+ "label": "Cluster",
+ "multi": false,
+ "multiFormat": "glob",
+ "name": "cluster",
+ "options": [],
+ "query": "cluster",
+ "refresh": true,
+ "regex": "",
+ "type": "query"
+ },
+ {
+ "allFormat": "glob",
"current": {
"text": "All",
"value": ""
[24/50] [abbrv] ambari git commit: AMBARI-21623 ADDENDUM Log Search
Config should be separated into a Server and Log Feeder interface (mgergely)
Posted by ab...@apache.org.
AMBARI-21623 ADDENDUM Log Search Config should be separated into a Server and Log Feeder interface (mgergely)
Change-Id: I9e4c00c38ff3fc17852e589e88067fae911e1a53
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/afa1b488
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/afa1b488
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/afa1b488
Branch: refs/heads/branch-feature-logsearch-ui
Commit: afa1b488c1118b7f54da97cd611a317c3d385a3a
Parents: aa9e16d
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Sun Aug 6 14:23:22 2017 +0200
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Sun Aug 6 14:23:46 2017 +0200
----------------------------------------------------------------------
.../ambari/logsearch/configurer/SolrCollectionConfigurer.java | 1 +
.../main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java | 1 -
.../java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java | 1 -
.../src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java | 2 +-
.../apache/ambari/logsearch/handler/CreateCollectionHandler.java | 1 -
5 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/afa1b488/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
index ff828a3..7b67482 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/configurer/SolrCollectionConfigurer.java
@@ -219,6 +219,7 @@ public class SolrCollectionConfigurer implements Configurer {
boolean reloadCollectionNeeded) {
try {
List<String> allCollectionList = new ListCollectionHandler().handle(solrClient, null);
+ solrDaoBase.waitForLogSearchConfig();
CreateCollectionHandler handler = new CreateCollectionHandler(solrDaoBase.getLogSearchConfig(), allCollectionList);
boolean collectionCreated = handler.handle(solrClient, solrPropsConfig);
boolean collectionReloaded = true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/afa1b488/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
index 4142176..3eea08f 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/AuditSolrDao.java
@@ -69,7 +69,6 @@ public class AuditSolrDao extends SolrDaoBase {
String rangerAuditCollection = solrAuditLogPropsConfig.getRangerCollection();
try {
- waitForLogSearchConfig();
new SolrCollectionConfigurer(this, true).start();
boolean createAlias = (aliasNameIn != null && StringUtils.isNotBlank(rangerAuditCollection));
if (createAlias) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/afa1b488/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
index 0752ac0..308ef1f 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/ServiceLogsSolrDao.java
@@ -65,7 +65,6 @@ public class ServiceLogsSolrDao extends SolrDaoBase {
public void postConstructor() {
LOG.info("postConstructor() called.");
try {
- waitForLogSearchConfig();
new SolrCollectionConfigurer(this, true).start();
} catch (Exception e) {
LOG.error("error while connecting to Solr for service logs : solrUrl=" + solrServiceLogPropsConfig.getSolrUrl()
http://git-wip-us.apache.org/repos/asf/ambari/blob/afa1b488/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
index ef5e697..05217d9 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/dao/SolrDaoBase.java
@@ -67,7 +67,7 @@ public abstract class SolrDaoBase {
this.logType = logType;
}
- protected void waitForLogSearchConfig() {
+ public void waitForLogSearchConfig() {
while (!logSearchConfigState.isLogSearchConfigAvailable()) {
LOG.info("Log Search config not available yet, waiting...");
try { Thread.sleep(1000); } catch (Exception e) { LOG.warn("Exception during waiting for Log Search Config", e); }
http://git-wip-us.apache.org/repos/asf/ambari/blob/afa1b488/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
index a988856..6c259cd 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/handler/CreateCollectionHandler.java
@@ -22,7 +22,6 @@ import org.apache.ambari.logsearch.conf.SolrPropsConfig;
import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
import org.apache.ambari.logsearch.config.zookeeper.model.outputconfig.impl.OutputSolrPropertiesImpl;
-import org.apache.ambari.logsearch.configurer.LogSearchConfigConfigurer;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
[33/50] [abbrv] ambari git commit: AMBARI-21678 Configs page doesnt
load when switched to another service while Restart is in progress.(atkach)
Posted by ab...@apache.org.
AMBARI-21678 Configs page doesnt load when switched to another service while Restart is in progress.(atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d69fc7e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d69fc7e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d69fc7e
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 2d69fc7e043c47fb115bee03c55792f5e575e597
Parents: e88b61e
Author: Andrii Tkach <at...@apache.org>
Authored: Tue Aug 8 13:43:56 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Tue Aug 8 14:06:46 2017 +0300
----------------------------------------------------------------------
ambari-web/app/views/common/configs/config_history_flow.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d69fc7e/ambari-web/app/views/common/configs/config_history_flow.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js
index 6ff5587..6903e8e 100644
--- a/ambari-web/app/views/common/configs/config_history_flow.js
+++ b/ambari-web/app/views/common/configs/config_history_flow.js
@@ -82,7 +82,7 @@ App.ConfigHistoryFlowView = Em.View.extend({
isSaveDisabled: Em.computed.or('controller.isSubmitDisabled', '!controller.versionLoaded', '!controller.isPropertiesChanged'),
- serviceName: Em.computed.alias('controller.selectedService.serviceName'),
+ serviceName: Em.computed.alias('controller.content.serviceName'),
displayedServiceVersion: Em.computed.findBy('serviceVersions', 'isDisplayed', true),
/**
[37/50] [abbrv] ambari git commit: AMBARI-21685. Component fails to
install with error,
'The stack packages are not defined on the command. Unable to load packages
for the stack-select tool' (alejandro)
Posted by ab...@apache.org.
AMBARI-21685. Component fails to install with error, 'The stack packages are not defined on the command. Unable to load packages for the stack-select tool' (alejandro)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea2c432f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea2c432f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea2c432f
Branch: refs/heads/branch-feature-logsearch-ui
Commit: ea2c432fcff5807b3cffc5cb94e0764cb8f94aa7
Parents: 64cae8e
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Tue Aug 8 13:41:28 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Tue Aug 8 13:41:28 2017 -0700
----------------------------------------------------------------------
.../resources/stacks/HDP/3.0/configuration/cluster-env.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea2c432f/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
index 2fa33bd..1b903b1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
@@ -262,14 +262,14 @@ gpgcheck=0</value>
</value-attributes>
<on-ambari-upgrade add="true"/>
</property>
- <!-- Define stack_select_packages property in the base stack. DO NOT override this property for each stack version -->
+ <!-- Define stack_packages property in the base stack. DO NOT override this property for each stack version -->
<property>
- <name>stack_select_packages</name>
+ <name>stack_packages</name>
<value/>
<description>Associations between component and stack-select tools.</description>
<property-type>VALUE_FROM_PROPERTY_FILE</property-type>
<value-attributes>
- <property-file-name>stack_select_packages.json</property-file-name>
+ <property-file-name>stack_packages.json</property-file-name>
<property-file-type>json</property-file-type>
<read-only>true</read-only>
<overridable>false</overridable>
[21/50] [abbrv] ambari git commit: AMBARI-21659. Remove obsolete
security_state data (amagyar)
Posted by ab...@apache.org.
AMBARI-21659. Remove obsolete security_state data (amagyar)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2258b106
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2258b106
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2258b106
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 2258b10639d510f879953b41dc4709b9e12ed05a
Parents: e89e950
Author: Attila Magyar <am...@hortonworks.com>
Authored: Fri Aug 4 16:09:32 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Fri Aug 4 16:09:32 2017 +0200
----------------------------------------------------------------------
.../checks/DatabaseConsistencyCheckHelper.java | 2 -
.../server/controller/KerberosHelperImpl.java | 160 +------------------
.../HostComponentDesiredStateEntity.java | 14 --
.../orm/entities/HostComponentStateEntity.java | 13 --
.../orm/entities/ServiceDesiredStateEntity.java | 13 --
.../kerberos/FinalizeKerberosServerAction.java | 39 -----
.../PrepareDisableKerberosServerAction.java | 8 +-
.../ambari/server/state/SecurityState.java | 83 ----------
.../org/apache/ambari/server/state/Service.java | 18 ---
.../server/state/ServiceComponentHost.java | 39 -----
.../apache/ambari/server/state/ServiceImpl.java | 21 ---
.../svccomphost/ServiceComponentHostImpl.java | 60 -------
.../server/upgrade/UpgradeCatalog300.java | 11 ++
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 3 -
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 3 -
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 3 -
.../resources/Ambari-DDL-Postgres-CREATE.sql | 3 -
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 3 -
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 3 -
.../server/agent/HeartbeatProcessorTest.java | 5 -
.../server/agent/TestHeartbeatHandler.java | 9 +-
.../server/controller/KerberosHelperTest.java | 51 ------
.../FinalizeKerberosServerActionTest.java | 6 -
.../apache/ambari/server/state/ServiceTest.java | 41 -----
.../svccomphost/ServiceComponentHostTest.java | 52 ------
.../server/upgrade/UpgradeCatalog300Test.java | 8 +
26 files changed, 25 insertions(+), 646 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 2559339..b440c93 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -60,7 +60,6 @@ import org.apache.ambari.server.orm.entities.MetainfoEntity;
import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
import org.apache.ambari.server.state.ClientConfigFileDefinition;
import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.UpgradeState;
@@ -723,7 +722,6 @@ public class DatabaseConsistencyCheckHelper {
stateEntity.setHostEntity(hostComponentDesiredStateEntity.getHostEntity());
stateEntity.setCurrentState(State.UNKNOWN);
stateEntity.setUpgradeState(UpgradeState.NONE);
- stateEntity.setSecurityState(SecurityState.UNKNOWN);
stateEntity.setServiceComponentDesiredStateEntity(hostComponentDesiredStateEntity.getServiceComponentDesiredStateEntity());
LOG.error("Trying to add missing record in hostcomponentstate: {}", stateEntity);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index 6b50ea4..7b8f58d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -96,7 +96,6 @@ import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
@@ -1700,7 +1699,6 @@ public class KerberosHelperImpl implements KerberosHelper {
throws AmbariException, KerberosOperationException {
final KerberosDescriptor kerberosDescriptor = getKerberosDescriptor(cluster);
- final SecurityState desiredSecurityState = handler.getNewServiceSecurityState();
List<ServiceComponentHost> schToProcess = getServiceComponentHostsToProcess(
cluster,
@@ -1708,12 +1706,7 @@ public class KerberosHelperImpl implements KerberosHelper {
serviceComponentFilter,
hostFilter,
identityFilter,
- new Command<Boolean, ServiceComponentHost>() {
- @Override
- public Boolean invoke(ServiceComponentHost arg) throws AmbariException {
- return handler.shouldProcess(desiredSecurityState, arg);
- }
- });
+ arg -> true);
// While iterating over all the ServiceComponentHosts find hosts that have KERBEROS_CLIENT
@@ -1782,34 +1775,6 @@ public class KerberosHelperImpl implements KerberosHelper {
handler.addFinalizeOperationStage(cluster, clusterHostInfoJson, hostParamsJson, event,
dataDirectory, roleCommandOrder, requestStageContainer, kerberosDetails);
- // If all goes well, set the appropriate states on the relevant ServiceComponentHosts
- for (ServiceComponentHost sch : schToProcess) {
- // Update the desired and current states for the ServiceComponentHost
- // using new state information from the the handler implementation
- SecurityState newSecurityState;
-
- newSecurityState = handler.getNewDesiredSCHSecurityState();
- if (newSecurityState != null) {
- sch.setDesiredSecurityState(newSecurityState);
- }
-
- newSecurityState = handler.getNewSCHSecurityState();
- if (newSecurityState != null) {
- sch.setSecurityState(newSecurityState);
- }
- }
-
- // If all goes well, set all services to _desire_ to be secured or unsecured, depending on handler
- if (desiredSecurityState != null) {
- Map<String, Service> services = cluster.getServices();
-
- for (Service service : services.values()) {
- if ((serviceComponentFilter == null) || serviceComponentFilter.containsKey(service.getName())) {
- service.setSecurityState(desiredSecurityState);
- }
- }
- }
-
return requestStageContainer;
}
@@ -2755,42 +2720,7 @@ public class KerberosHelperImpl implements KerberosHelper {
* "right" thing for the task at hand.
*/
private abstract class Handler {
- /**
- * Tests the Service and ServiceComponentHost to see if they are in the appropriate security
- * state to be processed for the relevant task.
- *
- * @param desiredSecurityState the SecurityState to be transitioned to
- * @param sch the ServiceComponentHost to test
- * @return true if both the Service and ServiceComponentHost are in the appropriate security
- * state to be processed; otherwise false
- * @throws AmbariException of an error occurs while testing
- */
- abstract boolean shouldProcess(SecurityState desiredSecurityState, ServiceComponentHost sch) throws AmbariException;
- /**
- * Returns the new SecurityState to be set as the ServiceComponentHost's _desired_ SecurityState.
- *
- * @return a SecurityState to be set as the ServiceComponentHost's _desired_ SecurityState;
- * or null if no state change is desired
- */
- abstract SecurityState getNewDesiredSCHSecurityState();
-
- /**
- * Returns the new SecurityState to be set as the ServiceComponentHost's _current_ SecurityState.
- *
- * @return a SecurityState to be set as the ServiceComponentHost's _current_ SecurityState;
- * or null if no state change is desired
- */
- abstract SecurityState getNewSCHSecurityState();
-
-
- /**
- * Returns the new SecurityState to be set as the Service's SecurityState.
- *
- * @return a SecurityState to be set as the Service's SecurityState;
- * or null if no state change is desired
- */
- abstract SecurityState getNewServiceSecurityState();
/**
* Creates the necessary stages to complete the relevant task and stores them in the supplied
@@ -3308,10 +3238,6 @@ public class KerberosHelperImpl implements KerberosHelper {
* EnableKerberosHandler is an implementation of the Handler interface used to enable Kerberos
* on the relevant cluster
* <p/>
- * This implementation attempts to set the Service and ServiceComponentHost _desired_ security
- * states to {@link org.apache.ambari.server.state.SecurityState#SECURED_KERBEROS} and the
- * ServiceComponentHost _current_ security state to {@link org.apache.ambari.server.state.SecurityState#SECURING}.
- * <p/>
* To complete the process, this implementation creates the following stages:
* <ol>
* <li>create principals</li>
@@ -3321,25 +3247,6 @@ public class KerberosHelperImpl implements KerberosHelper {
* </ol>
*/
private class EnableKerberosHandler extends Handler {
- @Override
- public boolean shouldProcess(SecurityState desiredSecurityState, ServiceComponentHost sch) throws AmbariException {
- return (desiredSecurityState == SecurityState.SECURED_KERBEROS);
- }
-
- @Override
- public SecurityState getNewDesiredSCHSecurityState() {
- return SecurityState.SECURED_KERBEROS;
- }
-
- @Override
- public SecurityState getNewSCHSecurityState() {
- return SecurityState.SECURING;
- }
-
- @Override
- public SecurityState getNewServiceSecurityState() {
- return SecurityState.SECURED_KERBEROS;
- }
@Override
public long createStages(Cluster cluster,
@@ -3431,10 +3338,6 @@ public class KerberosHelperImpl implements KerberosHelper {
* DisableKerberosHandler is an implementation of the Handler interface used to disable Kerberos
* on the relevant cluster
* <p/>
- * This implementation attempts to set the Service and ServiceComponentHost _desired_ security
- * states to {@link org.apache.ambari.server.state.SecurityState#UNSECURED} and the ServiceComponentHost
- * _current_ security state to {@link org.apache.ambari.server.state.SecurityState#UNSECURING}.
- * <p/>
* To complete the process, this implementation creates the following stages:
* <ol>
* <li>update relevant configurations</li>
@@ -3444,27 +3347,6 @@ public class KerberosHelperImpl implements KerberosHelper {
* </ol>
*/
private class DisableKerberosHandler extends Handler {
- @Override
- public boolean shouldProcess(SecurityState desiredSecurityState, ServiceComponentHost sch) throws AmbariException {
- return (desiredSecurityState == SecurityState.UNSECURED) &&
- ((sch.getDesiredSecurityState() != SecurityState.UNSECURED) || (sch.getSecurityState() != SecurityState.UNSECURED)) &&
- (sch.getSecurityState() != SecurityState.UNSECURING);
- }
-
- @Override
- public SecurityState getNewDesiredSCHSecurityState() {
- return SecurityState.UNSECURED;
- }
-
- @Override
- public SecurityState getNewSCHSecurityState() {
- return SecurityState.UNSECURING;
- }
-
- @Override
- public SecurityState getNewServiceSecurityState() {
- return SecurityState.UNSECURED;
- }
@Override
public long createStages(Cluster cluster,
@@ -3593,26 +3475,6 @@ public class KerberosHelperImpl implements KerberosHelper {
}
@Override
- public boolean shouldProcess(SecurityState desiredSecurityState, ServiceComponentHost sch) throws AmbariException {
- return true;
- }
-
- @Override
- public SecurityState getNewDesiredSCHSecurityState() {
- return null;
- }
-
- @Override
- public SecurityState getNewSCHSecurityState() {
- return null;
- }
-
- @Override
- public SecurityState getNewServiceSecurityState() {
- return null;
- }
-
- @Override
public long createStages(Cluster cluster,
String clusterHostInfoJson, String hostParamsJson,
ServiceComponentHostServerActionEvent event,
@@ -3723,26 +3585,6 @@ public class KerberosHelperImpl implements KerberosHelper {
private class DeletePrincipalsAndKeytabsHandler extends Handler {
@Override
- public boolean shouldProcess(SecurityState desiredSecurityState, ServiceComponentHost sch) throws AmbariException {
- return true;
- }
-
- @Override
- public SecurityState getNewDesiredSCHSecurityState() {
- return null;
- }
-
- @Override
- public SecurityState getNewSCHSecurityState() {
- return null;
- }
-
- @Override
- public SecurityState getNewServiceSecurityState() {
- return null;
- }
-
- @Override
public long createStages(Cluster cluster,
String clusterHostInfoJson, String hostParamsJson,
ServiceComponentHostServerActionEvent event,
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
index 05ae532..36a7a25 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
@@ -38,7 +38,6 @@ import javax.persistence.UniqueConstraint;
import org.apache.ambari.server.state.HostComponentAdminState;
import org.apache.ambari.server.state.MaintenanceState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.State;
import com.google.common.base.Objects;
@@ -94,11 +93,6 @@ public class HostComponentDesiredStateEntity {
@Enumerated(value = EnumType.STRING)
private State desiredState = State.INIT;
- @Basic
- @Column(name = "security_state", nullable = false, insertable = true, updatable = true)
- @Enumerated(value = EnumType.STRING)
- private SecurityState securityState = SecurityState.UNSECURED;
-
@Enumerated(value = EnumType.STRING)
@Column(name = "admin_state", nullable = true, insertable = true, updatable = true)
private HostComponentAdminState adminState;
@@ -160,14 +154,6 @@ public class HostComponentDesiredStateEntity {
this.desiredState = desiredState;
}
- public SecurityState getSecurityState() {
- return securityState;
- }
-
- public void setSecurityState(SecurityState securityState) {
- this.securityState = securityState;
- }
-
public HostComponentAdminState getAdminState() {
return adminState;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
index 2a63bba..0d295a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
@@ -33,7 +33,6 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.UpgradeState;
@@ -105,10 +104,6 @@ public class HostComponentStateEntity {
@Column(name = "upgrade_state", nullable = false, insertable = true, updatable = true)
private UpgradeState upgradeState = UpgradeState.NONE;
- @Enumerated(value = EnumType.STRING)
- @Column(name = "security_state", nullable = false, insertable = true, updatable = true)
- private SecurityState securityState = SecurityState.UNSECURED;
-
@ManyToOne
@JoinColumns({
@JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false),
@@ -164,14 +159,6 @@ public class HostComponentStateEntity {
this.currentState = currentState;
}
- public SecurityState getSecurityState() {
- return securityState;
- }
-
- public void setSecurityState(SecurityState securityState) {
- this.securityState = securityState;
- }
-
public UpgradeState getUpgradeState() {
return upgradeState;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
index 0124d3e..fc26478 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
@@ -31,7 +31,6 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import org.apache.ambari.server.state.MaintenanceState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.State;
import org.apache.commons.lang.builder.EqualsBuilder;
@@ -60,10 +59,6 @@ public class ServiceDesiredStateEntity {
@Enumerated(value = EnumType.STRING)
private MaintenanceState maintenanceState = MaintenanceState.OFF;
- @Column(name = "security_state", nullable = false, insertable = true, updatable = true)
- @Enumerated(value = EnumType.STRING)
- private SecurityState securityState = SecurityState.UNSECURED;
-
@Column(name = "credential_store_enabled", nullable = false, insertable = true, updatable = true)
private short credentialStoreEnabled = 0;
@@ -126,14 +121,6 @@ public class ServiceDesiredStateEntity {
maintenanceState = state;
}
- public SecurityState getSecurityState() {
- return securityState;
- }
-
- public void setSecurityState(SecurityState securityState) {
- this.securityState = securityState;
- }
-
/**
* Gets a value indicating if credential store use is enabled or not.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerAction.java
index 10ad48b..bfd5e40 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerAction.java
@@ -19,7 +19,6 @@
package org.apache.ambari.server.serveraction.kerberos;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
@@ -27,11 +26,6 @@ import java.util.concurrent.ConcurrentMap;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.HostRoleStatus;
import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.audit.event.kerberos.ChangeSecurityStateKerberosAuditEvent;
-import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.SecurityState;
-import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.utils.ShellCommandUtil;
import org.apache.ambari.server.utils.StageUtils;
import org.apache.commons.lang.StringUtils;
@@ -164,39 +158,6 @@ public class FinalizeKerberosServerAction extends KerberosServerAction {
@Override
public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
String dataDirectoryPath = getCommandParameterValue(DATA_DIRECTORY);
-
- // Set the ServiceComponentHost from a transitional state to the desired endpoint state
- Map<String, Host> hosts = getClusters().getHostsForCluster(getClusterName());
- if ((hosts != null) && !hosts.isEmpty()) {
- Cluster cluster = getCluster();
- for (String hostname : hosts.keySet()) {
- List<ServiceComponentHost> serviceComponentHosts = cluster.getServiceComponentHosts(hostname);
-
- for (ServiceComponentHost sch : serviceComponentHosts) {
- SecurityState securityState = sch.getSecurityState();
- if (securityState.isTransitional()) {
- String message = String.format("Setting securityState for %s/%s on host %s to state %s",
- sch.getServiceName(), sch.getServiceComponentName(), sch.getHostName(),
- sch.getDesiredSecurityState().toString());
- LOG.info(message);
- actionLog.writeStdOut(message);
-
- sch.setSecurityState(sch.getDesiredSecurityState());
- ChangeSecurityStateKerberosAuditEvent auditEvent = ChangeSecurityStateKerberosAuditEvent.builder()
- .withTimestamp(System.currentTimeMillis())
- .withService(sch.getServiceName())
- .withComponent(sch.getServiceComponentName())
- .withHostName(sch.getHostName())
- .withState(sch.getDesiredSecurityState().toString())
- .withRequestId(getHostRoleCommand().getRequestId())
- .withTaskId(getHostRoleCommand().getTaskId())
- .build();
- auditLog(auditEvent);
- }
- }
- }
- }
-
if(getKDCType(getCommandParameters()) != KDCType.NONE) {
// Ensure the keytab files for the Ambari identities have the correct permissions
// This is important in the event a secure cluster was created via Blueprints since some
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
index c85d58f..60523cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
@@ -34,7 +34,6 @@ import org.apache.ambari.server.controller.KerberosHelper;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.ambari.server.state.PropertyInfo;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.StackId;
@@ -85,12 +84,7 @@ public class PrepareDisableKerberosServerAction extends AbstractPrepareKerberosS
kerberosDescriptor,
getServiceComponentFilter(),
null, identityFilter,
- new KerberosHelper.Command<Boolean, ServiceComponentHost>() {
- @Override
- public Boolean invoke(ServiceComponentHost sch) throws AmbariException {
- return (sch.getDesiredSecurityState() == SecurityState.UNSECURED) && (sch.getSecurityState() != SecurityState.UNSECURED);
- }
- });
+ sch -> true);
Map<String, Map<String, String>> kerberosConfigurations = new HashMap<>();
Map<String, String> commandParameters = getCommandParameters();
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/state/SecurityState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/SecurityState.java b/ambari-server/src/main/java/org/apache/ambari/server/state/SecurityState.java
deleted file mode 100644
index 8d8b136..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/SecurityState.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.server.state;
-
-import java.util.EnumSet;
-
-/**
- * Indicates the security state of a service or component.
- */
-public enum SecurityState {
- /**
- * Indicates that it is not known whether the service or component is secured or not
- */
- UNKNOWN,
- /**
- * Indicates service or component is not or should not be secured
- */
- UNSECURED,
- /**
- * Indicates component is or should be secured using Kerberos
- */
- SECURED_KERBEROS,
- /**
- * Indicates the component is in the process of being secured
- */
- SECURING,
- /**
- * Indicates the component is in the process of being unsecured
- */
- UNSECURING,
- /**
- * Indicates the component is not secured due to an error condition
- */
- ERROR;
-
- /**
- * The subset of states that are considered endpoints, meaning they do not indicate the state is
- * in transition.
- */
- public static final EnumSet<SecurityState> ENDPOINT_STATES =
- EnumSet.of(UNKNOWN, UNSECURED, ERROR, SECURED_KERBEROS);
-
- /**
- * The subset of states that are considered transitional, meaning they indicate a task is in
- * process to reach some endpoint state
- */
- public static final EnumSet<SecurityState> TRANSITIONAL_STATES =
- EnumSet.of(SECURING, UNSECURING);
-
- /**
- * Tests this SecurityState to see if it is an endpoint state.
- *
- * @return true if this state is an endpoint state; otherwise false
- */
- public boolean isEndpoint() {
- return ENDPOINT_STATES.contains(this);
- }
-
- /**
- * Tests this SecurityState to see if it is a transitional state.
- *
- * @return true if this state is a transitional state; otherwise false
- */
- public boolean isTransitional() {
- return TRANSITIONAL_STATES.contains(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
index b151278..8651fee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
@@ -47,24 +47,6 @@ public interface Service {
void setDesiredState(State state);
- /**
- * Gets this Service's security state.
- *
- * @return this services desired SecurityState
- */
- SecurityState getSecurityState();
-
- /**
- * Sets this Service's desired security state
- * <p/>
- * It is expected that the new SecurityState is a valid endpoint state such that
- * SecurityState.isEndpoint() == true.
- *
- * @param securityState the desired SecurityState for this Service
- * @throws AmbariException if the new state is not an endpoint state
- */
- void setSecurityState(SecurityState securityState) throws AmbariException;
-
StackId getDesiredStackId();
ServiceResponse convertToResponse();
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
index 3c314d8..5ff9e37 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentHost.java
@@ -96,24 +96,6 @@ public interface ServiceComponentHost {
void setState(State state);
/**
- * Gets the current security state for this ServiceComponent
- * <p/>
- * The returned SecurityState may be any endpoint or transitional state.
- *
- * @return the current SecurityState for this ServiceComponent
- */
- SecurityState getSecurityState();
-
- /**
- * Sets the current security state for this ServiceComponent
- * <p/>
- * The new SecurityState may be any endpoint or transitional state.
- *
- * @param state the current SecurityState for this ServiceComponent
- */
- void setSecurityState(SecurityState state);
-
- /**
* Gets the version of the component.
*
* @return component version
@@ -128,27 +110,6 @@ public interface ServiceComponentHost {
void setVersion(String version);
/**
- * Gets the desired security state for this ServiceComponent
- * <p/>
- * The returned SecurityState is a valid endpoint state where
- * SecurityState.isEndpoint() == true.
- *
- * @return the desired SecurityState for this ServiceComponent
- */
- SecurityState getDesiredSecurityState();
-
- /**
- * Sets the desired security state for this ServiceComponent
- * <p/>
- * It is expected that the new SecurityState is a valid endpoint state such that
- * SecurityState.isEndpoint() == true.
- *
- * @param securityState the desired SecurityState for this ServiceComponent
- * @throws AmbariException if the new state is not an endpoint state
- */
- void setDesiredSecurityState(SecurityState securityState) throws AmbariException;
-
- /**
* @param upgradeState the upgrade state
*/
void setUpgradeState(UpgradeState upgradeState);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 63e1e69..4ed0429 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -276,27 +276,6 @@ public class ServiceImpl implements Service {
serviceDesiredStateDAO.merge(serviceDesiredStateEntity);
}
- @Override
- public SecurityState getSecurityState() {
- ServiceDesiredStateEntity serviceDesiredStateEntity = getServiceDesiredStateEntity();
- return serviceDesiredStateEntity.getSecurityState();
- }
-
- @Override
- public void setSecurityState(SecurityState securityState) throws AmbariException {
- if(!securityState.isEndpoint()) {
- throw new AmbariException("The security state must be an endpoint state");
- }
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Setting DesiredSecurityState of Service, clusterName={}, clusterId={}, serviceName={}, oldDesiredSecurityState={}, newDesiredSecurityState={}",
- cluster.getClusterName(), cluster.getClusterId(), getName(), getSecurityState(), securityState);
- }
- ServiceDesiredStateEntity serviceDesiredStateEntity = getServiceDesiredStateEntity();
- serviceDesiredStateEntity.setSecurityState(securityState);
- serviceDesiredStateDAO.merge(serviceDesiredStateEntity);
- }
-
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index f9d3cfc..230b031 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -64,7 +64,6 @@ import org.apache.ambari.server.state.HostConfig;
import org.apache.ambari.server.state.HostState;
import org.apache.ambari.server.state.MaintenanceState;
import org.apache.ambari.server.state.RepositoryVersionState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.ServiceComponentHostEvent;
@@ -912,61 +911,6 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
}
}
- @Override
- public SecurityState getSecurityState() {
- HostComponentStateEntity stateEntity = getStateEntity();
- if (stateEntity != null) {
- return stateEntity.getSecurityState();
- } else {
- LOG.warn("Trying to fetch a member from an entity object that may "
- + "have been previously deleted, serviceName = " + getServiceName() + ", "
- + "componentName = " + getServiceComponentName() + ", " + "hostName = " + getHostName());
- }
-
- return null;
- }
-
- @Override
- @Transactional
- public void setSecurityState(SecurityState securityState) {
- HostComponentStateEntity stateEntity = getStateEntity();
- if (stateEntity != null) {
- stateEntity.setSecurityState(securityState);
- stateEntity = hostComponentStateDAO.merge(stateEntity);
- } else {
- LOG.warn("Setting a member on an entity object that may have been "
- + "previously deleted, serviceName = " + getServiceName() + ", " + "componentName = "
- + getServiceComponentName() + ", " + "hostName = " + getHostName());
- }
- }
-
- @Override
- public SecurityState getDesiredSecurityState() {
- HostComponentDesiredStateEntity desiredStateEntity = getDesiredStateEntity();
- if (desiredStateEntity != null) {
- return desiredStateEntity.getSecurityState();
- } else {
- LOG.warn("Trying to fetch a member from an entity object that may "
- + "have been previously deleted, serviceName = " + getServiceName() + ", "
- + "componentName = " + getServiceComponentName() + ", " + "hostName = " + getHostName());
- }
- return null;
- }
-
- @Override
- public void setDesiredSecurityState(SecurityState securityState) throws AmbariException {
- if(!securityState.isEndpoint()) {
- throw new AmbariException("The security state must be an endpoint state");
- }
-
- LOG.debug("Set DesiredSecurityState on serviceName = {} componentName = {} hostName = {} to {}",
- getServiceName(), getServiceComponentName(), getHostName(), securityState);
-
- HostComponentDesiredStateEntity desiredStateEntity = getDesiredStateEntity();
- desiredStateEntity.setSecurityState(securityState);
- hostComponentDesiredStateDAO.merge(desiredStateEntity);
- }
-
/**
* To be called during the upgrade of a specific Component in a host.
* The potential upgrade states are NONE (default), PENDING, IN_PROGRESS, FAILED.
@@ -1262,10 +1206,6 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
.append(getVersion())
.append(", state=")
.append(getState())
- .append(", securityState=")
- .append(getSecurityState())
- .append(", desiredSecurityState=")
- .append(getDesiredSecurityState())
.append(" }");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index 6caa770..5f6640a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@ -77,6 +77,10 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
protected static final String HOST_ROLE_COMMAND_TABLE = "host_role_command";
protected static final String HRC_OPS_DISPLAY_NAME_COLUMN = "ops_display_name";
protected static final String COMPONENT_TABLE = "servicecomponentdesiredstate";
+ protected static final String COMPONENT_DESIRED_STATE_TABLE = "hostcomponentdesiredstate";
+ protected static final String COMPONENT_STATE_TABLE = "hostcomponentstate";
+ protected static final String SERVICE_DESIRED_STATE_TABLE = "servicedesiredstate";
+ protected static final String SECURITY_STATE_COLUMN = "security_state";
@Inject
DaoUtils daoUtils;
@@ -125,6 +129,7 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
updateStageTable();
updateClusterConfigurationTable();
addOpsDisplayNameColumnToHostRoleCommand();
+ removeSecurityState();
}
protected void updateStageTable() throws SQLException {
@@ -311,6 +316,12 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
new DBAccessor.DBColumnInfo(HRC_OPS_DISPLAY_NAME_COLUMN, String.class, 255, null, true));
}
+ private void removeSecurityState() throws SQLException {
+ dbAccessor.dropColumn(COMPONENT_DESIRED_STATE_TABLE, SECURITY_STATE_COLUMN);
+ dbAccessor.dropColumn(COMPONENT_STATE_TABLE, SECURITY_STATE_COLUMN);
+ dbAccessor.dropColumn(SERVICE_DESIRED_STATE_TABLE, SECURITY_STATE_COLUMN);
+ }
+
/**
* Updates Log Search configs.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index bbb4af0..89bc4a4 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -187,7 +187,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR(255) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
@@ -204,7 +203,6 @@ CREATE TABLE hostcomponentstate (
host_id BIGINT NOT NULL,
service_name VARCHAR(255) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -239,7 +237,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 5cdbd26..22dad9b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -207,7 +207,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR(100) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required TINYINT(1) NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
@@ -224,7 +223,6 @@ CREATE TABLE hostcomponentstate (
host_id BIGINT NOT NULL,
service_name VARCHAR(100) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -259,7 +257,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 732e2c4..ea9de0f 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -188,7 +188,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR2(255) NOT NULL,
admin_state VARCHAR2(32) NULL,
maintenance_state VARCHAR2(32) NOT NULL,
- security_state VARCHAR2(32) DEFAULT 'UNSECURED' NOT NULL,
restart_required NUMBER(1) DEFAULT 0 NOT NULL,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
@@ -204,7 +203,6 @@ CREATE TABLE hostcomponentstate (
host_id NUMBER(19) NOT NULL,
service_name VARCHAR2(255) NOT NULL,
upgrade_state VARCHAR2(32) DEFAULT 'NONE' NOT NULL,
- security_state VARCHAR2(32) DEFAULT 'UNSECURED' NOT NULL,
CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -239,7 +237,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR2(255) NOT NULL,
service_name VARCHAR2(255) NOT NULL,
maintenance_state VARCHAR2(32) NOT NULL,
- security_state VARCHAR2(32) DEFAULT 'UNSECURED' NOT NULL,
credential_store_enabled SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 62a3f00..4f37438 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -186,7 +186,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR(255) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
@@ -202,7 +201,6 @@ CREATE TABLE hostcomponentstate (
host_id BIGINT NOT NULL,
service_name VARCHAR(255) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT pk_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -237,7 +235,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index da46ec4..aa5242c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -185,7 +185,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR(255) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required BIT NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE (component_name, service_name, host_id, cluster_id),
@@ -201,7 +200,6 @@ CREATE TABLE hostcomponentstate (
host_id NUMERIC(19) NOT NULL,
service_name VARCHAR(255) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT PK_hostcomponentstate PRIMARY KEY (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -236,7 +234,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY (cluster_id, service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index c64355e..5008471 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -199,7 +199,6 @@ CREATE TABLE hostcomponentdesiredstate (
service_name VARCHAR(255) NOT NULL,
admin_state VARCHAR(32),
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
restart_required BIT NOT NULL DEFAULT 0,
CONSTRAINT PK_hostcomponentdesiredstate PRIMARY KEY CLUSTERED (id),
CONSTRAINT UQ_hcdesiredstate_name UNIQUE NONCLUSTERED (component_name, service_name, host_id, cluster_id),
@@ -216,7 +215,6 @@ CREATE TABLE hostcomponentstate (
host_id BIGINT NOT NULL,
service_name VARCHAR(255) NOT NULL,
upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
CONSTRAINT PK_hostcomponentstate PRIMARY KEY CLUSTERED (id),
CONSTRAINT FK_hostcomponentstate_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT hstcomponentstatecomponentname FOREIGN KEY (component_name, service_name, cluster_id) REFERENCES servicecomponentdesiredstate (component_name, service_name, cluster_id));
@@ -241,7 +239,6 @@ CREATE TABLE servicedesiredstate (
desired_state VARCHAR(255) NOT NULL,
service_name VARCHAR(255) NOT NULL,
maintenance_state VARCHAR(32) NOT NULL,
- security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
credential_store_enabled SMALLINT NOT NULL DEFAULT 0,
CONSTRAINT PK_servicedesiredstate PRIMARY KEY CLUSTERED (cluster_id,service_name),
CONSTRAINT FK_repo_version_id FOREIGN KEY (desired_repo_version_id) REFERENCES repo_version (repo_version_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
index 9ef3fe1..db611fa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
@@ -73,7 +73,6 @@ import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.StackId;
@@ -469,9 +468,7 @@ public class HeartbeatProcessorTest {
ServiceComponentHost serviceComponentHost3 = clusters.getCluster(DummyCluster).getService(HDFS).
getServiceComponent(SECONDARY_NAMENODE).getServiceComponentHost(DummyHostname1);
serviceComponentHost1.setState(State.INSTALLED);
- serviceComponentHost1.setSecurityState(SecurityState.UNSECURED);
serviceComponentHost2.setState(State.INSTALLED);
- serviceComponentHost2.setSecurityState(SecurityState.SECURING);
serviceComponentHost3.setState(State.STARTING);
HeartBeat hb = new HeartBeat();
@@ -516,10 +513,8 @@ public class HeartbeatProcessorTest {
State componentState3 = serviceComponentHost3.getState();
assertEquals(State.STARTED, componentState1);
assertEquals(State.INSTALLED, componentState2);
- assertEquals(SecurityState.SECURING, serviceComponentHost2.getSecurityState());
//starting state will not be overridden by status command
assertEquals(State.STARTING, componentState3);
- assertEquals(SecurityState.UNSECURED, serviceComponentHost3.getSecurityState());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index 4235b11..77c90eb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -88,7 +88,6 @@ import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostHealthStatus;
import org.apache.ambari.server.state.HostState;
import org.apache.ambari.server.state.MaintenanceState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentHost;
@@ -945,11 +944,11 @@ public class TestHeartbeatHandler {
ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = createComponentStatus(DummyCluster, HDFS, DummyHostStatus, State.STARTED,
- SecurityState.UNSECURED, DATANODE, "{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}");
+ DATANODE, "{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}");
ComponentStatus componentStatus2 =
- createComponentStatus(DummyCluster, HDFS, DummyHostStatus, State.STARTED, SecurityState.UNSECURED, NAMENODE, "");
+ createComponentStatus(DummyCluster, HDFS, DummyHostStatus, State.STARTED, NAMENODE, "");
ComponentStatus componentStatus3 = createComponentStatus(DummyCluster, HDFS, DummyHostStatus, State.INSTALLED,
- SecurityState.UNSECURED, HDFS_CLIENT, "{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}");
+ HDFS_CLIENT, "{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}");
componentStatuses.add(componentStatus1);
componentStatuses.add(componentStatus2);
@@ -1363,7 +1362,7 @@ public class TestHeartbeatHandler {
private ComponentStatus createComponentStatus(String clusterName, String serviceName, String message,
- State state, SecurityState securityState,
+ State state,
String componentName, String stackVersion) {
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(clusterName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 0196069..abab90f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -103,7 +103,6 @@ import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.SecurityType;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
@@ -964,37 +963,21 @@ public class KerberosHelperTest extends EasyMockSupport {
final ServiceComponentHost schKerberosClient = createMock(ServiceComponentHost.class);
expect(schKerberosClient.getServiceName()).andReturn(Service.Type.KERBEROS.name()).anyTimes();
expect(schKerberosClient.getServiceComponentName()).andReturn(Role.KERBEROS_CLIENT.name()).anyTimes();
- expect(schKerberosClient.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(schKerberosClient.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(schKerberosClient.getHostName()).andReturn("host1").anyTimes();
expect(schKerberosClient.getState()).andReturn(State.INSTALLED).anyTimes();
final ServiceComponentHost sch1 = createMock(ServiceComponentHost.class);
expect(sch1.getServiceName()).andReturn("SERVICE1").anyTimes();
expect(sch1.getServiceComponentName()).andReturn("COMPONENT1").anyTimes();
- expect(sch1.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(sch1.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(sch1.getHostName()).andReturn("host1").anyTimes();
expect(sch1.getState()).andReturn(State.INSTALLED).anyTimes();
- sch1.setDesiredSecurityState(SecurityState.SECURED_KERBEROS);
- expect(expectLastCall()).once();
- sch1.setSecurityState(SecurityState.SECURING);
- expect(expectLastCall()).once();
-
final ServiceComponentHost sch2 = createMock(ServiceComponentHost.class);
expect(sch2.getServiceName()).andReturn("SERVICE2").anyTimes();
expect(sch2.getServiceComponentName()).andReturn("COMPONENT2").anyTimes();
- expect(sch2.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(sch2.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(sch2.getHostName()).andReturn("host1").anyTimes();
expect(sch2.getState()).andReturn(State.INSTALLED).anyTimes();
- sch2.setDesiredSecurityState(SecurityState.SECURED_KERBEROS);
- expect(expectLastCall()).once();
- sch2.setSecurityState(SecurityState.SECURING);
- expect(expectLastCall()).once();
-
final Host host = createMockHost("host1");
final ServiceComponent serviceComponentKerberosClient = createNiceMock(ServiceComponent.class);
@@ -1007,8 +990,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(serviceKerberos.getServiceComponents())
.andReturn(Collections.singletonMap(Role.KERBEROS_CLIENT.name(), serviceComponentKerberosClient))
.anyTimes();
- serviceKerberos.setSecurityState(SecurityState.SECURED_KERBEROS);
- expectLastCall().once();
final Service service1 = createNiceMock(Service.class);
expect(service1.getDesiredStackId()).andReturn(stackId).anyTimes();
@@ -1016,8 +997,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(service1.getServiceComponents())
.andReturn(Collections.<String, ServiceComponent>emptyMap())
.anyTimes();
- service1.setSecurityState(SecurityState.SECURED_KERBEROS);
- expectLastCall().once();
final Service service2 = createNiceMock(Service.class);
expect(service2.getName()).andReturn("SERVICE2").anyTimes();
@@ -1025,8 +1004,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(service2.getServiceComponents())
.andReturn(Collections.<String, ServiceComponent>emptyMap())
.anyTimes();
- service2.setSecurityState(SecurityState.SECURED_KERBEROS);
- expectLastCall().once();
final Map<String, String> kerberosEnvProperties = createMock(Map.class);
expect(kerberosEnvProperties.get("kdc_type")).andReturn(kdcType).anyTimes();
@@ -1165,37 +1142,21 @@ public class KerberosHelperTest extends EasyMockSupport {
final ServiceComponentHost schKerberosClient = createMock(ServiceComponentHost.class);
expect(schKerberosClient.getServiceName()).andReturn(Service.Type.KERBEROS.name()).anyTimes();
expect(schKerberosClient.getServiceComponentName()).andReturn(Role.KERBEROS_CLIENT.name()).anyTimes();
- expect(schKerberosClient.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(schKerberosClient.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(schKerberosClient.getHostName()).andReturn("host1").anyTimes();
expect(schKerberosClient.getState()).andReturn(State.INSTALLED).anyTimes();
final ServiceComponentHost sch1 = createMock(ServiceComponentHost.class);
expect(sch1.getServiceName()).andReturn("SERVICE1").times(1);
expect(sch1.getServiceComponentName()).andReturn("COMPONENT1").once();
- expect(sch1.getSecurityState()).andReturn(SecurityState.SECURED_KERBEROS).anyTimes();
- expect(sch1.getDesiredSecurityState()).andReturn(SecurityState.SECURED_KERBEROS).anyTimes();
expect(sch1.getHostName()).andReturn("host1").anyTimes();
expect(sch1.getState()).andReturn(State.INSTALLED).anyTimes();
- sch1.setDesiredSecurityState(SecurityState.UNSECURED);
- expect(expectLastCall()).once();
- sch1.setSecurityState(SecurityState.UNSECURING);
- expect(expectLastCall()).once();
-
final ServiceComponentHost sch2 = createMock(ServiceComponentHost.class);
expect(sch2.getServiceName()).andReturn("SERVICE2").times(1);
expect(sch2.getServiceComponentName()).andReturn("COMPONENT2").anyTimes();
- expect(sch2.getSecurityState()).andReturn(SecurityState.SECURED_KERBEROS).anyTimes();
- expect(sch2.getDesiredSecurityState()).andReturn(SecurityState.SECURED_KERBEROS).anyTimes();
expect(sch2.getHostName()).andReturn("host1").anyTimes();
expect(sch2.getState()).andReturn(State.INSTALLED).anyTimes();
- sch2.setDesiredSecurityState(SecurityState.UNSECURED);
- expect(expectLastCall()).once();
- sch2.setSecurityState(SecurityState.UNSECURING);
- expect(expectLastCall()).once();
-
final Host host = createMockHost("host1");
final ServiceComponent serviceComponentKerberosClient = createNiceMock(ServiceComponent.class);
@@ -1208,8 +1169,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(serviceKerberos.getServiceComponents())
.andReturn(Collections.singletonMap(Role.KERBEROS_CLIENT.name(), serviceComponentKerberosClient))
.anyTimes();
- serviceKerberos.setSecurityState(SecurityState.UNSECURED);
- expectLastCall().once();
final Service service1 = createNiceMock(Service.class);
expect(service1.getDesiredStackId()).andReturn(new StackId("HDP-2.2")).anyTimes();
@@ -1217,8 +1176,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(service1.getServiceComponents())
.andReturn(Collections.<String, ServiceComponent>emptyMap())
.anyTimes();
- service1.setSecurityState(SecurityState.UNSECURED);
- expectLastCall().once();
final Service service2 = createNiceMock(Service.class);
expect(service2.getDesiredStackId()).andReturn(new StackId("HDP-2.2")).anyTimes();
@@ -1226,8 +1183,6 @@ public class KerberosHelperTest extends EasyMockSupport {
expect(service2.getServiceComponents())
.andReturn(Collections.<String, ServiceComponent>emptyMap())
.anyTimes();
- service2.setSecurityState(SecurityState.UNSECURED);
- expectLastCall().once();
final Map<String, String> kerberosEnvProperties = createMock(Map.class);
expect(kerberosEnvProperties.get("kdc_type")).andReturn("mit-kdc").anyTimes();
@@ -1378,15 +1333,11 @@ public class KerberosHelperTest extends EasyMockSupport {
final ServiceComponentHost sch1 = createMock(ServiceComponentHost.class);
expect(sch1.getServiceName()).andReturn("SERVICE1").anyTimes();
expect(sch1.getServiceComponentName()).andReturn("COMPONENT1").anyTimes();
- expect(sch1.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(sch1.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(sch1.getHostName()).andReturn("host1").anyTimes();
final ServiceComponentHost sch2 = createMock(ServiceComponentHost.class);
expect(sch2.getServiceName()).andReturn("SERVICE2").anyTimes();
expect(sch2.getServiceComponentName()).andReturn("COMPONENT2").anyTimes();
- expect(sch2.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(sch2.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(sch2.getHostName()).andReturn("host1").anyTimes();
final Host host = createMockHost("host1");
@@ -1404,8 +1355,6 @@ public class KerberosHelperTest extends EasyMockSupport {
sch1a = createMock(ServiceComponentHost.class);
expect(sch1a.getServiceName()).andReturn("SERVICE1").anyTimes();
expect(sch1a.getServiceComponentName()).andReturn("COMPONENT1").anyTimes();
- expect(sch1a.getSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
- expect(sch1a.getDesiredSecurityState()).andReturn(SecurityState.UNSECURED).anyTimes();
expect(sch1a.getHostName()).andReturn("host2").anyTimes();
hostInvalid = createMockHost("host1");
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
index 8d6ecc3..53d2a1b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
@@ -19,7 +19,6 @@
package org.apache.ambari.server.serveraction.kerberos;
import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
import java.io.File;
import java.io.IOException;
@@ -44,7 +43,6 @@ import org.apache.ambari.server.security.credential.PrincipalKeyCredential;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Host;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.ServiceComponentHost;
import org.easymock.EasyMockSupport;
import org.junit.Rule;
@@ -173,13 +171,9 @@ public class FinalizeKerberosServerActionTest extends EasyMockSupport {
clusterHostMap.put("host1", createMock(Host.class));
final ServiceComponentHost serviceComponentHost = createMock(ServiceComponentHost.class);
- expect(serviceComponentHost.getSecurityState()).andReturn(SecurityState.SECURING).anyTimes();
expect(serviceComponentHost.getServiceName()).andReturn("SERVICE1").anyTimes();
expect(serviceComponentHost.getServiceComponentName()).andReturn("COMPONENT1A").anyTimes();
expect(serviceComponentHost.getHostName()).andReturn("host1").anyTimes();
- expect(serviceComponentHost.getDesiredSecurityState()).andReturn(SecurityState.SECURED_KERBEROS).anyTimes();
- serviceComponentHost.setSecurityState(SecurityState.SECURED_KERBEROS);
- expectLastCall().once();
final List<ServiceComponentHost> serviceComponentHosts = new ArrayList<>();
serviceComponentHosts.add(serviceComponentHost);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
index d4b91f1..f4d0a9a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
@@ -164,7 +164,6 @@ public class ServiceTest {
Assert.assertEquals(cluster.getClusterName(),
service.getCluster().getClusterName());
Assert.assertEquals(State.INIT, service.getDesiredState());
- Assert.assertEquals(SecurityState.UNSECURED, service.getSecurityState());
Assert.assertFalse(
service.getDesiredStackId().getStackId().isEmpty());
@@ -291,46 +290,6 @@ public class ServiceTest {
Assert.assertEquals(MaintenanceState.ON, entity.getServiceDesiredStateEntity().getMaintenanceState());
}
- @Test
- public void testSecurityState() throws Exception {
- String serviceName = "HDFS";
- Service s = serviceFactory.createNew(cluster, serviceName, repositoryVersion);
- cluster.addService(s);
-
- Service service = cluster.getService(serviceName);
- Assert.assertNotNull(service);
-
- ClusterServiceDAO dao = injector.getInstance(ClusterServiceDAO.class);
- ClusterServiceEntity entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
- Assert.assertNotNull(entity);
- Assert.assertEquals(SecurityState.UNSECURED, entity.getServiceDesiredStateEntity().getSecurityState());
- Assert.assertEquals(SecurityState.UNSECURED, service.getSecurityState());
-
- service.setSecurityState(SecurityState.SECURED_KERBEROS);
- Assert.assertEquals(SecurityState.SECURED_KERBEROS, service.getSecurityState());
-
- entity = dao.findByClusterAndServiceNames(clusterName, serviceName);
- Assert.assertNotNull(entity);
- Assert.assertEquals(SecurityState.SECURED_KERBEROS, entity.getServiceDesiredStateEntity().getSecurityState());
-
- // Make sure there are no issues setting all endpoint values...
- for(SecurityState state: SecurityState.ENDPOINT_STATES) {
- service.setSecurityState(state);
- Assert.assertEquals(state, service.getSecurityState());
- }
-
- // Make sure there transitional states are not allowed
- for(SecurityState state: SecurityState.TRANSITIONAL_STATES) {
- try {
- service.setSecurityState(state);
- Assert.fail(String.format("SecurityState %s is not a valid desired service state", state.toString()));
- }
- catch (AmbariException e) {
- // this is acceptable
- }
- }
- }
-
private void addHostToCluster(String hostname,
String clusterName) throws AmbariException {
clusters.addHost(hostname);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
index dbf0c8f..54fd733 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
@@ -41,7 +41,6 @@ import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
import org.apache.ambari.server.orm.dao.HostDAO;
import org.apache.ambari.server.orm.entities.ClusterEntity;
import org.apache.ambari.server.orm.entities.HostComponentDesiredStateEntity;
-import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
import org.apache.ambari.server.orm.entities.HostEntity;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.state.Cluster;
@@ -51,7 +50,6 @@ import org.apache.ambari.server.state.ConfigFactory;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostConfig;
import org.apache.ambari.server.state.MaintenanceState;
-import org.apache.ambari.server.state.SecurityState;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -196,8 +194,6 @@ public class ServiceComponentHostTest {
Assert.assertEquals(State.INIT, impl.getState());
Assert.assertEquals(State.INIT, impl.getDesiredState());
- Assert.assertEquals(SecurityState.UNSECURED, impl.getSecurityState());
- Assert.assertEquals(SecurityState.UNSECURED, impl.getDesiredSecurityState());
Assert.assertEquals(c.getClusterName(), impl.getClusterName());
Assert.assertEquals(c.getClusterId(), impl.getClusterId());
Assert.assertEquals(s.getName(), impl.getServiceName());
@@ -1054,52 +1050,4 @@ public class ServiceComponentHostTest {
);
Assert.assertEquals(MaintenanceState.ON, entity.getMaintenanceState());
}
-
-
- @Test
- public void testSecurityState() throws Exception {
- String stackVersion = "HDP-2.0.6";
- StackId stackId = new StackId(stackVersion);
- String clusterName = "c2";
- createCluster(stackId, clusterName);
-
- final String hostName = "h3";
- Set<String> hostNames = new HashSet<>();
- hostNames.add(hostName);
- addHostsToCluster(clusterName, hostAttributes, hostNames);
-
- Cluster cluster = clusters.getCluster(clusterName);
-
- helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion());
-
- HostEntity hostEntity = hostDAO.findByName(hostName);
- ServiceComponentHost sch1 = createNewServiceComponentHost(cluster, "HDFS", "NAMENODE", hostName);
-
- HostComponentDesiredStateEntity entityHostComponentDesiredState;
- HostComponentStateEntity entityHostComponentState;
-
- for(SecurityState state: SecurityState.values()) {
- sch1.setSecurityState(state);
- entityHostComponentState = hostComponentStateDAO.findByIndex(cluster.getClusterId(),
- sch1.getServiceName(), sch1.getServiceComponentName(), hostEntity.getHostId());
-
- Assert.assertNotNull(entityHostComponentState);
- Assert.assertEquals(state, entityHostComponentState.getSecurityState());
-
- try {
- sch1.setDesiredSecurityState(state);
- Assert.assertTrue(state.isEndpoint());
- entityHostComponentDesiredState = hostComponentDesiredStateDAO.findByIndex(
- cluster.getClusterId(),
- sch1.getServiceName(),
- sch1.getServiceComponentName(),
- hostEntity.getHostId()
- );
- Assert.assertNotNull(entityHostComponentDesiredState);
- Assert.assertEquals(state, entityHostComponentDesiredState.getSecurityState());
- } catch (AmbariException e) {
- Assert.assertFalse(state.isEndpoint());
- }
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2258b106/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index a7417d4..b7d78ae 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@ -17,6 +17,10 @@
*/
package org.apache.ambari.server.upgrade;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.COMPONENT_DESIRED_STATE_TABLE;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.COMPONENT_STATE_TABLE;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.SECURITY_STATE_COLUMN;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.SERVICE_DESIRED_STATE_TABLE;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.anyString;
import static org.easymock.EasyMock.capture;
@@ -177,6 +181,10 @@ public class UpgradeCatalog300Test {
dbAccessor.addColumn(eq(UpgradeCatalog300.CLUSTER_CONFIG_TABLE), capture(clusterConfigSelectedTimestampColumn));
dbAccessor.addColumn(eq(UpgradeCatalog300.HOST_ROLE_COMMAND_TABLE), capture(hrcOpsDisplayNameColumn));
+ dbAccessor.dropColumn(COMPONENT_DESIRED_STATE_TABLE, SECURITY_STATE_COLUMN); expectLastCall().once();
+ dbAccessor.dropColumn(COMPONENT_STATE_TABLE, SECURITY_STATE_COLUMN); expectLastCall().once();
+ dbAccessor.dropColumn(SERVICE_DESIRED_STATE_TABLE, SECURITY_STATE_COLUMN); expectLastCall().once();
+
// component table
Capture<DBAccessor.DBColumnInfo> componentStateColumn = newCapture();
dbAccessor.addColumn(eq(UpgradeCatalog300.COMPONENT_TABLE), capture(componentStateColumn));
[20/50] [abbrv] ambari git commit: AMBARI-21656 - Patch/Service
Downgrades Are Not Correctly Scoped (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21656 - Patch/Service Downgrades Are Not Correctly Scoped (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e89e9505
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e89e9505
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e89e9505
Branch: refs/heads/branch-feature-logsearch-ui
Commit: e89e9505b1d509eda027cfe8bd7784976c6c0434
Parents: 4cd9657
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Aug 3 16:15:29 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Aug 4 10:01:04 2017 -0400
----------------------------------------------------------------------
.../VersionDefinitionResourceProvider.java | 4 +-
.../ambari/server/state/RepositoryType.java | 22 ++-
.../ambari/server/state/UpgradeContext.java | 17 +-
.../ambari/server/state/UpgradeContextTest.java | 173 +++++++++++++++++++
4 files changed, 208 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e89e9505/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
index e41e3da..5d65f35 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
@@ -426,7 +426,9 @@ public class VersionDefinitionResourceProvider extends AbstractAuthorizedResourc
*/
private void checkForParent(XmlHolder holder) throws AmbariException {
RepositoryVersionEntity entity = holder.entity;
- if (entity.getType() != RepositoryType.PATCH) {
+
+ // only STANDARD types don't have a parent
+ if (entity.getType() == RepositoryType.STANDARD) {
return;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e89e9505/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
index da99908..3f7d447 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
@@ -43,6 +43,26 @@ public enum RepositoryType {
/**
* Repository is used to update services.
*/
- SERVICE
+ SERVICE;
+
+ /**
+ * Gets whether applications of this repository are revertable after they have
+ * been finalized.
+ *
+ * @return {@code true} if the repository can be revert, {@code false}
+ * otherwise.
+ */
+ public boolean isRevertable() {
+ switch (this) {
+ case MAINT:
+ case PATCH:
+ return true;
+ case SERVICE:
+ case STANDARD:
+ return false;
+ default:
+ return false;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e89e9505/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
index 59a1b02..0e409a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
@@ -296,8 +296,9 @@ public class UpgradeContext {
throw new AmbariException(String.format("Could not find Upgrade with id %s to revert.", revertUpgradeId));
}
- if (revertUpgrade.getOrchestration() != RepositoryType.PATCH) {
- throw new AmbariException("Can only revert upgrades that have been done as a patch.");
+ if (!revertUpgrade.getOrchestration().isRevertable()) {
+ throw new AmbariException(String.format("The %s repository type is not revertable",
+ revertUpgrade.getOrchestration()));
}
if (revertUpgrade.getDirection() != Direction.UPGRADE) {
@@ -330,7 +331,7 @@ public class UpgradeContext {
// !!! direction can ONLY be an downgrade on revert
m_direction = Direction.DOWNGRADE;
- m_orchestration = RepositoryType.PATCH;
+ m_orchestration = revertUpgrade.getOrchestration();
} else {
// determine direction
@@ -404,6 +405,7 @@ public class UpgradeContext {
cluster.getClusterId(), Direction.UPGRADE);
m_repositoryVersion = upgrade.getRepositoryVersion();
+ m_orchestration = upgrade.getOrchestration();
// populate the repository maps for all services in the upgrade
for (UpgradeHistoryEntity history : upgrade.getHistory()) {
@@ -511,8 +513,8 @@ public class UpgradeContext {
m_resolver = new MasterHostResolver(m_cluster, configHelper, this);
m_orchestration = upgradeEntity.getOrchestration();
- m_isRevert = upgradeEntity.getOrchestration() == RepositoryType.PATCH &&
- upgradeEntity.getDirection() == Direction.DOWNGRADE;
+ m_isRevert = upgradeEntity.getOrchestration().isRevertable()
+ && upgradeEntity.getDirection() == Direction.DOWNGRADE;
}
/**
@@ -787,9 +789,12 @@ public class UpgradeContext {
switch (m_orchestration) {
case PATCH:
case SERVICE:
+ case MAINT:
return scope == UpgradeScope.PARTIAL;
case STANDARD:
return scope == UpgradeScope.COMPLETE;
+ default:
+ break;
}
return false;
@@ -1207,4 +1212,4 @@ public class UpgradeContext {
return hostOrderItems;
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/e89e9505/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
new file mode 100644
index 0000000..e2bb27e
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
@@ -0,0 +1,173 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+package org.apache.ambari.server.state;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.server.controller.internal.UpgradeResourceProvider;
+import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.orm.dao.UpgradeDAO;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.orm.entities.UpgradeEntity;
+import org.apache.ambari.server.orm.entities.UpgradeHistoryEntity;
+import org.apache.ambari.server.state.stack.UpgradePack;
+import org.apache.ambari.server.state.stack.upgrade.Direction;
+import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.hadoop.metrics2.sink.relocated.google.common.collect.Lists;
+import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests {@link UpgradeContext}.
+ */
+public class UpgradeContextTest extends EasyMockSupport {
+
+ @Mock
+ private UpgradeEntity m_completedRevertableUpgrade;
+
+ @Mock
+ private RepositoryVersionEntity m_completedUpgradeTargetRepositoryVersion;
+
+ @Mock
+ private RepositoryVersionEntity m_completedUpgradeSourceRepositoryVersion;
+
+
+ @Mock
+ private UpgradeDAO m_upgradeDAO;
+
+ @Before
+ public void setup() {
+ injectMocks(this);
+
+ expect(m_completedUpgradeSourceRepositoryVersion.getId()).andReturn(1L).anyTimes();
+ expect(m_completedUpgradeSourceRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
+ expect(m_completedUpgradeTargetRepositoryVersion.getId()).andReturn(1L).anyTimes();
+ expect(m_completedUpgradeTargetRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
+
+ UpgradeHistoryEntity upgradeHistoryEntity = createNiceMock(UpgradeHistoryEntity.class);
+ expect(upgradeHistoryEntity.getServiceName()).andReturn("HDFS").atLeastOnce();
+ expect(upgradeHistoryEntity.getFromReposistoryVersion()).andReturn(m_completedUpgradeSourceRepositoryVersion).anyTimes();
+ expect(upgradeHistoryEntity.getTargetRepositoryVersion()).andReturn(m_completedUpgradeTargetRepositoryVersion).anyTimes();
+ List<UpgradeHistoryEntity> upgradeHistory = Lists.newArrayList(upgradeHistoryEntity);
+
+ expect(m_upgradeDAO.findUpgrade(1L)).andReturn(m_completedRevertableUpgrade).anyTimes();
+
+ expect(
+ m_upgradeDAO.findLastUpgradeForCluster(EasyMock.anyLong(),
+ eq(Direction.UPGRADE))).andReturn(m_completedRevertableUpgrade).anyTimes();
+
+ expect(m_completedRevertableUpgrade.getDirection()).andReturn(Direction.UPGRADE).anyTimes();
+ expect(m_completedRevertableUpgrade.getRepositoryVersion()).andReturn(m_completedUpgradeTargetRepositoryVersion).anyTimes();
+ expect(m_completedRevertableUpgrade.getOrchestration()).andReturn(RepositoryType.PATCH).anyTimes();
+ expect(m_completedRevertableUpgrade.getHistory()).andReturn(upgradeHistory).anyTimes();
+ expect(m_completedRevertableUpgrade.getUpgradePackage()).andReturn(null).anyTimes();
+ }
+
+ /**
+ * Tests that the {@link UpgradeContext} for a reversion has the correct
+ * parameters set.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testRevert() throws Exception {
+ Cluster cluster = createNiceMock(Cluster.class);
+ UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+ ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+ RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
+ RepositoryVersionEntity hdfsRepositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+
+ Service service = createNiceMock(Service.class);
+ UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+ expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+ EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+ EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+ expect(service.getDesiredRepositoryVersion()).andReturn(hdfsRepositoryVersion).once();
+ expect(cluster.getService("HDFS")).andReturn(service).atLeastOnce();
+
+ Map<String, Object> requestMap = new HashMap<>();
+ requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.ROLLING.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_REVERT_UPGRADE_ID, "1");
+
+ replayAll();
+
+ UpgradeContext context = new UpgradeContext(cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, repositoryVersionDAO, configHelper);
+
+ assertEquals(Direction.DOWNGRADE, context.getDirection());
+ assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
+ assertEquals(1, context.getSupportedServices().size());
+ assertTrue(context.isPatchRevert());
+
+ verifyAll();
+ }
+
+ /**
+ * Tests that the {@link UpgradeContext} for a patch downgrade has the
+ * correcting scope/orchestration set.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testDowngradeScope() throws Exception {
+ Cluster cluster = createNiceMock(Cluster.class);
+ UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+ ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+ RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
+ RepositoryVersionEntity hdfsRepositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+ Service service = createNiceMock(Service.class);
+ UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+ expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+ EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+ EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+ expect(service.getDesiredRepositoryVersion()).andReturn(hdfsRepositoryVersion).once();
+ expect(cluster.getService("HDFS")).andReturn(service).atLeastOnce();
+
+ Map<String, Object> requestMap = new HashMap<>();
+ requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.NON_ROLLING.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.DOWNGRADE.name());
+
+ replayAll();
+
+ UpgradeContext context = new UpgradeContext(cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, repositoryVersionDAO, configHelper);
+
+ assertEquals(Direction.DOWNGRADE, context.getDirection());
+ assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
+ assertEquals(1, context.getSupportedServices().size());
+ assertFalse(context.isPatchRevert());
+
+ verifyAll();
+ }
+
+}
[09/50] [abbrv] ambari git commit: AMBARI-21613. Dynamically
determine what keytab files have been distributed (amagyar)
Posted by ab...@apache.org.
AMBARI-21613. Dynamically determine what keytab files have been distributed (amagyar)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a45e8f4f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a45e8f4f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a45e8f4f
Branch: refs/heads/branch-feature-logsearch-ui
Commit: a45e8f4f5e6a214cab98896092bc7d7d588a518b
Parents: b17225d
Author: Attila Magyar <am...@hortonworks.com>
Authored: Thu Aug 3 12:01:04 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Thu Aug 3 12:01:04 2017 +0200
----------------------------------------------------------------------
.../resource_management/core/resources/klist.py | 45 ++++++++++++++++++
.../ambari/server/agent/HeartBeatHandler.java | 10 ++--
.../ambari/server/agent/HeartbeatProcessor.java | 34 ++++++++++++-
.../server/controller/KerberosHelperImpl.java | 45 +++++++++++++++++-
.../KERBEROS/1.10.3-10/metainfo.xml | 8 ++++
.../package/scripts/kerberos_client.py | 3 ++
.../package/scripts/kerberos_common.py | 50 +++++++++++++++++++-
.../PERF/1.0/services/KERBEROS/metainfo.xml | 8 ++++
.../KERBEROS/package/scripts/kerberos_client.py | 2 +
.../KERBEROS/package/scripts/kerberos_common.py | 48 +++++++++++++++++++
.../server/agent/TestHeartbeatHandler.java | 5 +-
.../server/controller/KerberosHelperTest.java | 24 ++++++++--
.../stacks/2.2/KERBEROS/test_kerberos_client.py | 23 +++++++++
13 files changed, 290 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-common/src/main/python/resource_management/core/resources/klist.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/resources/klist.py b/ambari-common/src/main/python/resource_management/core/resources/klist.py
new file mode 100644
index 0000000..ec6fca8
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/core/resources/klist.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF 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.
+
+Ambari Agent
+
+"""
+
+from resource_management.core import shell
+from resource_management import functions
+from resource_management.libraries.functions.default import default
+from subprocess import PIPE
+
+class Klist:
+ @staticmethod
+ def find_in_search_path():
+ return Klist(functions.get_klist_path(default('/configurations/kerberos-env/executable_search_paths', None)))
+
+ def __init__(self, klist_cmd="klist"):
+ self.klist_cmd = klist_cmd
+
+ def list_principals(self, keytab_path):
+ code, out, err = shell.call(self._command('-k', keytab_path), stdout = PIPE, stderr = PIPE, timeout = 5, sudo=True)
+ if code != 0 or (not out.startswith("Keytab name")):
+ raise Exception('Cannot run klist: %s. Exit code: %d. Error: %s' % (self.klist_cmd, code, err))
+ return set(line.split()[1] for line in out.split("\n")[3:])
+
+ def _command(self, *args):
+ cmd = [self.klist_cmd]
+ cmd.extend(args)
+ return cmd
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index 1bc4c36..92ab3de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -17,6 +17,10 @@
*/
package org.apache.ambari.server.agent;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.CHECK_KEYTABS;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.REMOVE_KEYTAB;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.SET_KEYTAB;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -294,7 +298,7 @@ public class HeartBeatHandler {
Map<String, String> hlp = ec.getHostLevelParams();
if (hlp != null) {
String customCommand = hlp.get("custom_command");
- if ("SET_KEYTAB".equalsIgnoreCase(customCommand) || "REMOVE_KEYTAB".equalsIgnoreCase(customCommand)) {
+ if (SET_KEYTAB.equalsIgnoreCase(customCommand) || REMOVE_KEYTAB.equalsIgnoreCase(customCommand) || CHECK_KEYTABS.equalsIgnoreCase(customCommand)) {
LOG.info(String.format("%s called", customCommand));
try {
injectKeytab(ec, customCommand, hostname);
@@ -593,7 +597,7 @@ public class HeartBeatHandler {
if (targetHost.equalsIgnoreCase(hostName)) {
- if ("SET_KEYTAB".equalsIgnoreCase(command)) {
+ if (SET_KEYTAB.equalsIgnoreCase(command)) {
String keytabFilePath = record.get(KerberosIdentityDataFileReader.KEYTAB_FILE_PATH);
if (keytabFilePath != null) {
@@ -629,7 +633,7 @@ public class HeartBeatHandler {
kcp.add(keytabMap);
}
}
- } else if ("REMOVE_KEYTAB".equalsIgnoreCase(command)) {
+ } else if (REMOVE_KEYTAB.equalsIgnoreCase(command) || CHECK_KEYTABS.equalsIgnoreCase(command)) {
Map<String, String> keytabMap = new HashMap<>();
keytabMap.put(KerberosIdentityDataFileReader.HOSTNAME, hostName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
index a08abab..2690008 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java
@@ -18,6 +18,10 @@
package org.apache.ambari.server.agent;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.CHECK_KEYTABS;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.REMOVE_KEYTAB;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.SET_KEYTAB;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -420,8 +424,8 @@ public class HeartbeatProcessor extends AbstractService{
String customCommand = report.getCustomCommand();
- boolean adding = "SET_KEYTAB".equalsIgnoreCase(customCommand);
- if (adding || "REMOVE_KEYTAB".equalsIgnoreCase(customCommand)) {
+ boolean adding = SET_KEYTAB.equalsIgnoreCase(customCommand);
+ if (adding || REMOVE_KEYTAB.equalsIgnoreCase(customCommand)) {
WriteKeytabsStructuredOut writeKeytabsStructuredOut;
try {
writeKeytabsStructuredOut = gson.fromJson(report.getStructuredOut(), WriteKeytabsStructuredOut.class);
@@ -445,6 +449,12 @@ public class HeartbeatProcessor extends AbstractService{
}
}
}
+ } else if (CHECK_KEYTABS.equalsIgnoreCase(customCommand)) {
+ ListKeytabsStructuredOut structuredOut = gson.fromJson(report.getStructuredOut(), ListKeytabsStructuredOut.class);
+ for (MissingKeytab each : structuredOut.missingKeytabs){
+ LOG.info("Missing keytab: {} on host: {} principal: {}", each.keytabFilePath, hostname, each.principal);
+ kerberosPrincipalHostDAO.remove(each.principal, host.getHostId());
+ }
}
}
@@ -702,6 +712,26 @@ public class HeartbeatProcessor extends AbstractService{
}
}
+ private static class ListKeytabsStructuredOut {
+ @SerializedName("missing_keytabs")
+ private final List<MissingKeytab> missingKeytabs;
+
+ public ListKeytabsStructuredOut(List<MissingKeytab> missingKeytabs) {
+ this.missingKeytabs = missingKeytabs;
+ }
+ }
+
+ private static class MissingKeytab {
+ @SerializedName("principal")
+ private final String principal;
+ @SerializedName("keytab_file_path")
+ private final String keytabFilePath;
+
+ public MissingKeytab(String principal, String keytabFilePath) {
+ this.principal = principal;
+ this.keytabFilePath = keytabFilePath;
+ }
+ }
/**
* This class is used for mapping json of structured output for component START action.
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index e5b7afd..6b50ea4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -142,6 +142,9 @@ public class KerberosHelperImpl implements KerberosHelper {
* These values are important when trying to determine the state of the cluster when adding new components
*/
private static final Set<State> PREVIOUSLY_INSTALLED_STATES = EnumSet.of(State.INSTALLED, State.STARTED, State.DISABLED);
+ public static final String CHECK_KEYTABS = "CHECK_KEYTABS";
+ public static final String SET_KEYTAB = "SET_KEYTAB";
+ public static final String REMOVE_KEYTAB = "REMOVE_KEYTAB";
@Inject
private AmbariCustomCommandExecutionHelper customCommandExecutionHelper;
@@ -3027,7 +3030,7 @@ public class KerberosHelperImpl implements KerberosHelper {
ActionExecutionContext actionExecContext = new ActionExecutionContext(
cluster.getClusterName(),
- "SET_KEYTAB",
+ SET_KEYTAB,
requestResourceFilters,
requestParams);
customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
@@ -3042,6 +3045,39 @@ public class KerberosHelperImpl implements KerberosHelper {
}
/**
+ * Send a custom command to the KERBEROS_CLIENT to check if there are missing keytabs on each hosts.
+ */
+ public void addCheckMissingKeytabsStage(Cluster cluster, String clusterHostInfoJson, String hostParamsJson, ServiceComponentHostServerActionEvent event, Map<String, String> commandParameters, RoleCommandOrder roleCommandOrder, RequestStageContainer requestStageContainer, List<ServiceComponentHost> serviceComponentHosts) throws AmbariException {
+ Stage stage = createNewStage(requestStageContainer.getLastStageId(),
+ cluster,
+ requestStageContainer.getId(),
+ "Checking keytabs",
+ StageUtils.getGson().toJson(commandParameters),
+ hostParamsJson);
+
+ Collection<ServiceComponentHost> filteredComponents = filterServiceComponentHostsForHosts(
+ new ArrayList<>(serviceComponentHosts), getHostsWithValidKerberosClient(cluster));
+
+ List<String> hostsToUpdate = createUniqueHostList(filteredComponents, Collections.singleton(HostState.HEALTHY));
+ Map<String, String> requestParams = new HashMap<>();
+ List<RequestResourceFilter> requestResourceFilters = new ArrayList<>();
+ RequestResourceFilter reqResFilter = new RequestResourceFilter(Service.Type.KERBEROS.name(), Role.KERBEROS_CLIENT.name(), hostsToUpdate);
+ requestResourceFilters.add(reqResFilter);
+
+ ActionExecutionContext actionExecContext = new ActionExecutionContext(
+ cluster.getClusterName(),
+ CHECK_KEYTABS,
+ requestResourceFilters,
+ requestParams);
+ customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage, requestParams, null);
+ RoleGraph roleGraph = roleGraphFactory.createNew(roleCommandOrder);
+ roleGraph.build(stage);
+
+ requestStageContainer.setClusterHostInfo(clusterHostInfoJson);
+ requestStageContainer.addStages(roleGraph.getStages());
+ }
+
+ /**
* Filter out ServiceComponentHosts that are on on hosts in the specified set of host names.
* <p/>
* It is expected that the supplied collection is modifiable. It will be modified inplace.
@@ -3170,7 +3206,7 @@ public class KerberosHelperImpl implements KerberosHelper {
ActionExecutionContext actionExecContext = new ActionExecutionContext(
cluster.getClusterName(),
- "REMOVE_KEYTAB",
+ REMOVE_KEYTAB,
requestResourceFilters,
requestParams);
customCommandExecutionHelper.addExecutionCommandsToStage(actionExecContext, stage,
@@ -3635,6 +3671,11 @@ public class KerberosHelperImpl implements KerberosHelper {
if (kerberosDetails.manageIdentities()) {
commandParameters.put(KerberosServerAction.KDC_TYPE, kerberosDetails.getKdcType().name());
+ if (!regenerateAllKeytabs) {
+ addCheckMissingKeytabsStage(cluster, clusterHostInfoJson, hostParamsJson, event,
+ commandParameters, roleCommandOrder, requestStageContainer, serviceComponentHosts);
+ }
+
// *****************************************************************
// Create stage to create principals
addCreatePrincipalsStage(cluster, clusterHostInfoJson, hostParamsJson, event,
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml
index 6a2dd09..191028a 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml
@@ -60,6 +60,14 @@
<timeout>1000</timeout>
</commandScript>
</customCommand>
+ <customCommand>
+ <name>CHECK_KEYTABS</name>
+ <commandScript>
+ <script>scripts/kerberos_client.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>1000</timeout>
+ </commandScript>
+ </customCommand>
</customCommands>
<configFiles>
<configFile>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py
index 39fdcf5..691c4b8 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py
@@ -49,5 +49,8 @@ class KerberosClient(KerberosScript):
def remove_keytab(self, env):
self.delete_keytab_file()
+ def check_keytabs(self, env):
+ self.find_missing_keytabs()
+
if __name__ == "__main__":
KerberosClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
index fcd57af..21accdd 100644
--- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
+++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py
@@ -36,6 +36,9 @@ from resource_management.core.source import InlineTemplate, Template, DownloadSo
from utils import get_property_value
from ambari_commons.os_utils import remove_file
from ambari_agent import Constants
+from collections import namedtuple
+from resource_management.core import sudo
+from resource_management.core.resources.klist import Klist
class KerberosScript(Script):
KRB5_REALM_PROPERTIES = [
@@ -443,4 +446,49 @@ class KerberosScript(Script):
curr_content['keytabs'][principal.replace("_HOST", params.hostname)] = '_REMOVED_'
- self.put_structured_out(curr_content)
\ No newline at end of file
+ self.put_structured_out(curr_content)
+
+ def find_missing_keytabs(self):
+ import params
+ missing_keytabs = MissingKeytabs.fromKerberosRecords(params.kerberos_command_params, params.hostname)
+ Logger.info(str(missing_keytabs))
+ curr_content = Script.structuredOut
+ curr_content['missing_keytabs'] = missing_keytabs.as_dict()
+ self.put_structured_out(curr_content)
+
+class MissingKeytabs:
+ class Identity(namedtuple('Identity', ['principal', 'keytab_file_path'])):
+ @staticmethod
+ def fromKerberosRecord(item, hostname):
+ return MissingKeytabs.Identity(
+ get_property_value(item, 'principal').replace("_HOST", hostname),
+ get_property_value(item, 'keytab_file_path'))
+
+ def __str__(self):
+ return "Keytab: %s Principal: %s" % (self.keytab_file_path, self.principal)
+
+ @classmethod
+ def fromKerberosRecords(self, kerberos_record, hostname):
+ with_missing_keytab = (each for each in kerberos_record \
+ if not self.keytab_exists(each) or not self.keytab_has_principal(each, hostname))
+ return MissingKeytabs(set(MissingKeytabs.Identity.fromKerberosRecord(each, hostname) for each in with_missing_keytab))
+
+ @staticmethod
+ def keytab_exists(kerberos_record):
+ return sudo.path_exists(get_property_value(kerberos_record, 'keytab_file_path'))
+
+ @staticmethod
+ def keytab_has_principal(kerberos_record, hostname):
+ principal = get_property_value(kerberos_record, 'principal').replace("_HOST", hostname)
+ keytab = get_property_value(kerberos_record, 'keytab_file_path')
+ klist = Klist.find_in_search_path()
+ return principal in klist.list_principals(keytab)
+
+ def __init__(self, items):
+ self.items = items
+
+ def as_dict(self):
+ return [each._asdict() for each in self.items]
+
+ def __str__(self):
+ return "Missing keytabs:\n%s" % ("\n".join(map(str, self.items))) if self.items else 'No missing keytabs'
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/metainfo.xml b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/metainfo.xml
index 0e42bda..6f833c7 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/metainfo.xml
@@ -60,6 +60,14 @@
<timeout>1000</timeout>
</commandScript>
</customCommand>
+ <customCommand>
+ <name>CHECK_KEYTABS</name>
+ <commandScript>
+ <script>scripts/kerberos_client.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>1000</timeout>
+ </commandScript>
+ </customCommand>
</customCommands>
<configFiles>
<configFile>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_client.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_client.py
index b2cdaa6..691c4b8 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_client.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_client.py
@@ -49,6 +49,8 @@ class KerberosClient(KerberosScript):
def remove_keytab(self, env):
self.delete_keytab_file()
+ def check_keytabs(self, env):
+ self.find_missing_keytabs()
if __name__ == "__main__":
KerberosClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
index abf58ee..d959f11 100644
--- a/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
+++ b/ambari-server/src/main/resources/stacks/PERF/1.0/services/KERBEROS/package/scripts/kerberos_common.py
@@ -30,6 +30,9 @@ from resource_management import *
from utils import get_property_value
from ambari_commons.os_utils import remove_file
from ambari_agent import Constants
+from collections import namedtuple
+from resource_management.core import sudo
+from resource_management.core.resources.klist import Klist
class KerberosScript(Script):
KRB5_REALM_PROPERTIES = [
@@ -430,3 +433,48 @@ class KerberosScript(Script):
curr_content['keytabs'][principal.replace("_HOST", params.hostname)] = '_REMOVED_'
self.put_structured_out(curr_content)
+
+ def find_missing_keytabs(self):
+ import params
+ missing_keytabs = MissingKeytabs.fromKerberosRecords(params.kerberos_command_params, params.hostname)
+ Logger.info(str(missing_keytabs))
+ curr_content = Script.structuredOut
+ curr_content['missing_keytabs'] = missing_keytabs.as_dict()
+ self.put_structured_out(curr_content)
+
+class MissingKeytabs:
+ class Identity(namedtuple('Identity', ['principal', 'keytab_file_path'])):
+ @staticmethod
+ def fromKerberosRecord(item, hostname):
+ return MissingKeytabs.Identity(
+ get_property_value(item, 'principal').replace("_HOST", hostname),
+ get_property_value(item, 'keytab_file_path'))
+
+ def __str__(self):
+ return "Keytab: %s Principal: %s" % (self.keytab_file_path, self.principal)
+
+ @classmethod
+ def fromKerberosRecords(self, kerberos_record, hostname):
+ with_missing_keytab = (each for each in kerberos_record \
+ if not self.keytab_exists(each) or not self.keytab_has_principal(each, hostname))
+ return MissingKeytabs(set(MissingKeytabs.Identity.fromKerberosRecord(each, hostname) for each in with_missing_keytab))
+
+ @staticmethod
+ def keytab_exists(kerberos_record):
+ return sudo.path_exists(get_property_value(kerberos_record, 'keytab_file_path'))
+
+ @staticmethod
+ def keytab_has_principal(kerberos_record, hostname):
+ principal = get_property_value(kerberos_record, 'principal').replace("_HOST", hostname)
+ keytab = get_property_value(kerberos_record, 'keytab_file_path')
+ klist = Klist.find_in_search_path()
+ return principal in klist.list_principals(keytab)
+
+ def __init__(self, items):
+ self.items = items
+
+ def as_dict(self):
+ return [each._asdict() for each in self.items]
+
+ def __str__(self):
+ return "Missing keytabs:\n%s" % ("\n".join(map(str, self.items))) if self.items else 'No missing keytabs'
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index baa9bae..4235b11 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -30,6 +30,7 @@ import static org.apache.ambari.server.agent.DummyHeartbeatConstants.HDFS;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.HDFS_CLIENT;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.NAMENODE;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.SECONDARY_NAMENODE;
+import static org.apache.ambari.server.controller.KerberosHelperImpl.SET_KEYTAB;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
@@ -1476,7 +1477,7 @@ public class TestHeartbeatHandler {
ExecutionCommand executionCommand = new ExecutionCommand();
Map<String, String> hlp = new HashMap<>();
- hlp.put("custom_command", "SET_KEYTAB");
+ hlp.put("custom_command", SET_KEYTAB);
executionCommand.setHostLevelParams(hlp);
Map<String, String> commandparams = new HashMap<>();
@@ -1496,7 +1497,7 @@ public class TestHeartbeatHandler {
}});
replay(am);
- heartbeatTestHelper.getHeartBeatHandler(am, aq).injectKeytab(executionCommand, "SET_KEYTAB", targetHost);
+ heartbeatTestHelper.getHeartBeatHandler(am, aq).injectKeytab(executionCommand, SET_KEYTAB, targetHost);
return executionCommand.getKerberosCommandParams();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 4508527..0196069 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -2824,23 +2824,23 @@ public class KerberosHelperTest extends EasyMockSupport {
add(schKerberosClientC);
}
})
- .once();
+ .anyTimes();
final Clusters clusters = injector.getInstance(Clusters.class);
if ((filteredHosts == null) || filteredHosts.contains("hostA")) {
expect(clusters.getHost("hostA"))
.andReturn(hostA)
- .once();
+ .anyTimes();
}
if ((filteredHosts == null) || filteredHosts.contains("hostB")) {
expect(clusters.getHost("hostB"))
.andReturn(hostB)
- .once();
+ .anyTimes();
}
if ((filteredHosts == null) || filteredHosts.contains("hostC")) {
expect(clusters.getHost("hostC"))
.andReturn(hostC)
- .once();
+ .anyTimes();
}
final AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
@@ -2917,6 +2917,13 @@ public class KerberosHelperTest extends EasyMockSupport {
expectLastCall().once();
requestStageContainer.addStages(EasyMock.<List<Stage>>anyObject());
expectLastCall().once();
+ // Getting missing keytabs
+ expect(requestStageContainer.getLastStageId()).andReturn(-1L).anyTimes();
+ expect(requestStageContainer.getId()).andReturn(1L).once();
+ requestStageContainer.setClusterHostInfo(anyString());
+ expectLastCall().once();
+ requestStageContainer.addStages(EasyMock.<List<Stage>>anyObject());
+ expectLastCall().once();
// Create Principals Stage
expect(requestStageContainer.getLastStageId()).andReturn(-1L).anyTimes();
expect(requestStageContainer.getId()).andReturn(1L).once();
@@ -3268,7 +3275,7 @@ public class KerberosHelperTest extends EasyMockSupport {
final Clusters clusters = injector.getInstance(Clusters.class);
expect(clusters.getHost("host1"))
.andReturn(host)
- .once();
+ .anyTimes();
final AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
expect(ambariManagementController.findConfigurationTagsWithOverrides(cluster, null))
@@ -3302,6 +3309,13 @@ public class KerberosHelperTest extends EasyMockSupport {
expectLastCall().once();
requestStageContainer.addStages(EasyMock.<List<Stage>>anyObject());
expectLastCall().once();
+ // Getting missing keytabs
+ expect(requestStageContainer.getLastStageId()).andReturn(-1L).anyTimes();
+ expect(requestStageContainer.getId()).andReturn(1L).once();
+ requestStageContainer.setClusterHostInfo(anyString());
+ expectLastCall().once();
+ requestStageContainer.addStages(EasyMock.<List<Stage>>anyObject());
+ expectLastCall().once();
// Create Principals Stage
expect(requestStageContainer.getLastStageId()).andReturn(-1L).anyTimes();
expect(requestStageContainer.getId()).andReturn(1L).once();
http://git-wip-us.apache.org/repos/asf/ambari/blob/a45e8f4f/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py b/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py
index f638845..cb2db3a 100644
--- a/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py
+++ b/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py
@@ -23,6 +23,8 @@ import os
import sys
import use_cases
from stacks.utils.RMFTestCase import *
+from resource_management import Script
+from collections import OrderedDict
from only_for_platform import not_for_platform, PLATFORM_WINDOWS
@@ -353,3 +355,24 @@ class TestKerberosClient(RMFTestCase):
# The kdc_host is expected to generated using kdc_hosts, but only the first host is used since
# previous versions only knew how to handle a single KDC host
self.assertEquals('c6401.ambari.apache.org', sys.modules['params'].kdc_host)
+
+ @patch("resource_management.core.sudo.path_exists")
+ def test_find_missing_keytabs(self, path_exists):
+ path_exists.side_effect = [False]
+ json_data = use_cases.get_managed_kdc_use_case()
+ json_data['kerberosCommandParams'] = [
+ {
+ "keytab_file_path": '/deleted_keytab',
+ "principal": "HTTP/_HOST@EXAMPLE.COM"
+ }
+ ]
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/kerberos_client.py",
+ classname="KerberosClient",
+ command="check_keytabs",
+ config_dict=json_data,
+ stack_version=self.STACK_VERSION,
+ target=RMFTestCase.TARGET_COMMON_SERVICES)
+ self.assertEquals(Script.structuredOut['missing_keytabs'], [OrderedDict({
+ 'keytab_file_path' : '/deleted_keytab',
+ 'principal' : 'HTTP/c6401.ambari.apache.org@EXAMPLE.COM'
+ })])
\ No newline at end of file
[12/50] [abbrv] ambari git commit: AMBARI-21653. Create VDF and xsd
to support MAINT upgrades (ncole)
Posted by ab...@apache.org.
AMBARI-21653. Create VDF and xsd to support MAINT upgrades (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/66410e5e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/66410e5e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/66410e5e
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 66410e5e9a977142756c0189d4582f101a8808af
Parents: 07d6ec3
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Aug 3 12:11:30 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu Aug 3 12:54:07 2017 -0400
----------------------------------------------------------------------
.../ambari/server/state/RepositoryType.java | 14 +--
.../state/repository/AvailableVersion.java | 21 ++++-
.../state/repository/ManifestService.java | 10 ++-
.../ambari/server/state/repository/Release.java | 2 +-
.../state/repository/VersionDefinitionXml.java | 21 +++--
.../src/main/resources/version_definition.xsd | 2 +
.../state/repository/VersionDefinitionTest.java | 95 ++++++++++++++++++++
.../resources/version_definition_test_maint.xml | 62 +++++++++++++
contrib/version-builder/example.py | 1 +
contrib/version-builder/example.sh | 3 +-
contrib/version-builder/version_builder.py | 13 ++-
11 files changed, 222 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
index 1d9ec09..da99908 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
@@ -24,21 +24,25 @@ public enum RepositoryType {
/**
* Repository should be considered to have all components for a cluster
- * deployment
+ * deployment.
*/
STANDARD,
/**
* Repository may have only minimum components and is used for patching
- * purposes
+ * purposes.
*/
PATCH,
/**
- * Repository is used to update services
+ * Repository is used as Maintenance release, which could be several patches rolled up in one.
+ * Orchestration should treat Maintenance just as it does for Patch..
*/
- SERVICE
-
+ MAINT,
+ /**
+ * Repository is used to update services.
+ */
+ SERVICE
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/java/org/apache/ambari/server/state/repository/AvailableVersion.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/AvailableVersion.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/AvailableVersion.java
index 3aca519..dd2cb33 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/AvailableVersion.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/AvailableVersion.java
@@ -33,6 +33,10 @@ public class AvailableVersion {
@JsonProperty("version")
private String version;
+ @JsonProperty("release_version")
+ @JsonSerialize(include=Inclusion.NON_NULL)
+ private String releaseVersion;
+
@JsonProperty("version_id")
@JsonSerialize(include=Inclusion.NON_NULL)
private String versionId;
@@ -40,12 +44,27 @@ public class AvailableVersion {
@JsonProperty
private Set<Component> components;
- AvailableVersion(String version, String versionId, Set<Component> components) {
+ AvailableVersion(String version, String versionId, String releaseVersion, Set<Component> components) {
this.version = version;
this.versionId = versionId;
+ this.releaseVersion = releaseVersion;
this.components = components;
}
+ /**
+ * @return the binary version of the available service.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @return the release version of the available service.
+ */
+ public String getReleaseVersion() {
+ return releaseVersion;
+ }
+
static class Component {
@JsonProperty("name")
private String name;
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ManifestService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ManifestService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ManifestService.java
index b408a03..67f592b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ManifestService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/ManifestService.java
@@ -38,7 +38,7 @@ public class ManifestService {
public String serviceName;
/**
- * Version of the service. This is the publicly available version.
+ * Version of the service. This is the publicly available version of the binary.
*/
@XmlAttribute(name="version")
public String version;
@@ -48,4 +48,12 @@ public class ManifestService {
*/
@XmlAttribute(name="version-id")
public String versionId;
+
+ /**
+ * The release version of the service. This is not the same as {@link #version}; that is a binary version.
+ * This version is a build specific string that is independent of the binary and roughly matches
+ * {@link Release#version} for upgrade orchestration.
+ */
+ @XmlAttribute(name="release-version")
+ public String releaseVersion;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/java/org/apache/ambari/server/state/repository/Release.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/Release.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/Release.java
index b6315fb..922b9ee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/Release.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/Release.java
@@ -43,7 +43,7 @@ public class Release {
public String stackId;
/**
- * The stack version.
+ * The stack-based release version.
*/
@XmlElement(name="version")
public String version;
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
index 97f391e..f48c723 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
@@ -126,10 +126,10 @@ public class VersionDefinitionXml {
m_availableMap = new HashMap<>();
if (availableServices.isEmpty()) {
+ // !!! populate available services from the manifest
for (ManifestService ms : manifests.values()) {
addToAvailable(ms, stack, Collections.<String>emptySet());
}
-
} else {
for (AvailableServiceReference ref : availableServices) {
ManifestService ms = manifests.get(ref.serviceIdReference);
@@ -229,21 +229,24 @@ public class VersionDefinitionXml {
/**
* Helper method to use a {@link ManifestService} to generate the available services structure
- * @param ms the ManifestService instance
+ * @param manifestService the ManifestService instance
* @param stack the stack object
* @param components the set of components for the service
*/
- private void addToAvailable(ManifestService ms, StackInfo stack, Set<String> components) {
- ServiceInfo service = stack.getService(ms.serviceName);
+ private void addToAvailable(ManifestService manifestService, StackInfo stack, Set<String> components) {
+ ServiceInfo service = stack.getService(manifestService.serviceName);
- if (!m_availableMap.containsKey(ms.serviceName)) {
- String display = (null == service) ? ms.serviceName: service.getDisplayName();
+ if (!m_availableMap.containsKey(manifestService.serviceName)) {
+ String display = (null == service) ? manifestService.serviceName: service.getDisplayName();
- m_availableMap.put(ms.serviceName, new AvailableService(ms.serviceName, display));
+ AvailableService available = new AvailableService(manifestService.serviceName, display);
+ m_availableMap.put(manifestService.serviceName, available);
}
- AvailableService as = m_availableMap.get(ms.serviceName);
- as.getVersions().add(new AvailableVersion(ms.version, ms.versionId,
+ AvailableService as = m_availableMap.get(manifestService.serviceName);
+ as.getVersions().add(new AvailableVersion(manifestService.version,
+ manifestService.versionId,
+ manifestService.releaseVersion,
buildComponents(service, components)));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/main/resources/version_definition.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/version_definition.xsd b/ambari-server/src/main/resources/version_definition.xsd
index bef3739..9710c90 100644
--- a/ambari-server/src/main/resources/version_definition.xsd
+++ b/ambari-server/src/main/resources/version_definition.xsd
@@ -44,6 +44,7 @@
<xs:enumeration value="STANDARD" />
<xs:enumeration value="SERVICE" />
<xs:enumeration value="PATCH" />
+ <xs:enumeration value="MAINT" />
</xs:restriction>
</xs:simpleType>
@@ -82,6 +83,7 @@
<xs:attribute name="version" type="xs:string" use="required" />
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attribute name="version-id" type="xs:string" />
+ <xs:attribute name="release-version" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
index ac7c39a..89e8016 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/repository/VersionDefinitionTest.java
@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.RepositoryType;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackInfo;
@@ -308,7 +309,74 @@ public class VersionDefinitionTest {
assertNotNull(xml.getPackageVersion("redhat6"));
assertEquals("2_3_4_0_3396", xml.getPackageVersion("redhat6"));
assertNull(xml.getPackageVersion("suse11"));
+ }
+
+ @Test
+ public void testMaintVersion() throws Exception {
+ File f = new File("src/test/resources/version_definition_test_maint.xml");
+
+ VersionDefinitionXml xml = VersionDefinitionXml.load(f.toURI().toURL());
+
+ String xmlString = xml.toXml();
+
+ xml = VersionDefinitionXml.load(xmlString);
+
+ assertEquals(RepositoryType.MAINT, xml.release.repositoryType);
+ assertEquals("2.3.4.1", xml.release.version);
+ assertEquals("1234", xml.release.build);
+ assertEquals("redhat6", xml.repositoryInfo.getOses().get(0).getFamily());
+
+
+
+ List<AvailableServiceReference> availableServices = xml.availableServices;
+ assertEquals(3, availableServices.size());
+
+ List<ManifestService> manifestServices = xml.manifestServices;
+ assertEquals(4, manifestServices.size());
+
+ ManifestService hdfs = null;
+ ManifestService hive = null;
+ for (ManifestService as : manifestServices) {
+ if (as.serviceId.equals("HDFS-271")) {
+ hdfs = as;
+ } else if (as.serviceId.equals("HIVE-200")) {
+ hive = as;
+ }
+ }
+
+ assertNotNull(hdfs);
+ assertNotNull(hive);
+
+ assertEquals("2.3.3", hdfs.releaseVersion);
+ assertNull(hive.releaseVersion);
+
+ StackInfo stack = new StackInfo() {
+ @Override
+ public ServiceInfo getService(String name) {
+ return makeService("HIVE", "HIVE_METASTORE");
+ }
+ };
+ Collection<AvailableService> availables = xml.getAvailableServices(stack);
+
+ assertEquals(2, availables.size());
+
+ boolean found = false;
+ for (AvailableService available : availables) {
+ if (available.getName().equals("HIVE")) {
+ found = true;
+ assertEquals(2, available.getVersions().size());
+ for (AvailableVersion version : available.getVersions()) {
+ if (version.getVersion().equals("1.1.0")) {
+ assertEquals("1.0.9", version.getReleaseVersion());
+ } else {
+ assertNull(version.getReleaseVersion());
+ }
+ }
+ }
+ }
+
+ assertTrue("Found available version for HIVE", found);
}
@@ -334,4 +402,31 @@ public class VersionDefinitionTest {
};
}
+ private static ServiceInfo makeService(final String name, final String component) {
+ return new ServiceInfo() {
+ @Override
+ public String getName() {
+ return name;
+ }
+ @Override
+ public String getDisplayName() {
+ return name + " Display";
+ }
+ @Override
+ public String getVersion() {
+ return "1.1.1";
+ }
+ @Override
+ public String getComment() {
+ return name + " Comment";
+ }
+
+ @Override
+ public ComponentInfo getComponentByName(String name) {
+ return null;
+ }
+
+ };
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/ambari-server/src/test/resources/version_definition_test_maint.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/version_definition_test_maint.xml b/ambari-server/src/test/resources/version_definition_test_maint.xml
new file mode 100644
index 0000000..ac21045
--- /dev/null
+++ b/ambari-server/src/test/resources/version_definition_test_maint.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+-->
+
+<repository-version xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="version_definition.xsd">
+
+ <release>
+ <type>MAINT</type>
+ <stack-id>HDP-2.3</stack-id>
+ <version>2.3.4.1</version>
+ <build>1234</build>
+ <compatible-with>2.3.4.[1-9]</compatible-with>
+ <release-notes>http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.4/</release-notes>
+ </release>
+
+ <manifest>
+ <service id="HDFS-271" name="HDFS" version="2.7.1" version-id="10" release-version="2.3.3" />
+ <service id="HIVE-200" name="HIVE" version="2.0.0" />
+ <service id="HIVE-110" name="HIVE" version="1.1.0" release-version="1.0.9" />
+ <service id="HBASE-899" name="HBASE" version="8.9.9" />
+ </manifest>
+
+ <available-services>
+ <service idref="HDFS-271" />
+ <service idref="HIVE-200" />
+ <service idref="HIVE-110">
+ <component>HIVE_METASTORE</component>
+ </service>
+ </available-services>
+
+ <repository-info>
+ <os family="redhat6">
+ <repo>
+ <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0</baseurl>
+ <repoid>HDP-2.3</repoid>
+ <reponame>HDP</reponame>
+ <unique>true</unique>
+ </repo>
+ <repo>
+ <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6</baseurl>
+ <repoid>HDP-UTILS-1.1.0.20</repoid>
+ <reponame>HDP-UTILS</reponame>
+ <unique>false</unique>
+ </repo>
+ </os>
+ </repository-info>
+</repository-version>
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/contrib/version-builder/example.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.py b/contrib/version-builder/example.py
index 8c7be5f..8f87981 100644
--- a/contrib/version-builder/example.py
+++ b/contrib/version-builder/example.py
@@ -27,6 +27,7 @@ def main(args):
vb.set_os("redhat6", package_version="2_4_2_0_12345")
vb.add_manifest("HDFS-271", "HDFS", "2.7.1.2.4.0")
+ vb.add_manifest("YARN-271", "HDFS", "2.7.1.2.4.0", version_id = "1", release_version = "2.4.1.0")
vb.add_repo("redhat6", "HDP-2.4", "HDP", "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.4.2.0", "true")
vb.add_repo("redhat6", "HDP-UTILS-1.1.0.20", "HDP-UTILS", "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", "false")
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/contrib/version-builder/example.sh
----------------------------------------------------------------------
diff --git a/contrib/version-builder/example.sh b/contrib/version-builder/example.sh
index 11689cd..7d82d68 100755
--- a/contrib/version-builder/example.sh
+++ b/contrib/version-builder/example.sh
@@ -30,11 +30,12 @@ python version_builder.py --file $filename --release-display HDP-2.4.1.1-1234
python version_builder.py --file $filename --release-compatible 2.4.[0-1].0
# call any number of times for each service in the repo
-python version_builder.py --file $filename --manifest --manifest-id HDFS-271 --manifest-service HDFS --manifest-version 2.7.1.2.4
+python version_builder.py --file $filename --manifest --manifest-id HDFS-271 --manifest-service HDFS --manifest-version 2.7.1.2.4 --manifest-release-version 2.4.0.0
python version_builder.py --file $filename --manifest --manifest-id HBASE-132 --manifest-service HBASE --manifest-version 1.3.2.4.3
#call any number of times for the target services to upgrade
python version_builder.py --file $filename --available --manifest-id HDFS-271
+python version_builder.py --file $filename --available --manifest-id HBASE-132 --release-version 2.4.0
# must be before repo calls
python version_builder.py --file $filename --os --os-family redhat6 --os-package-version 2_4_1_1_12345
http://git-wip-us.apache.org/repos/asf/ambari/blob/66410e5e/contrib/version-builder/version_builder.py
----------------------------------------------------------------------
diff --git a/contrib/version-builder/version_builder.py b/contrib/version-builder/version_builder.py
index 6d1689a..feea329 100644
--- a/contrib/version-builder/version_builder.py
+++ b/contrib/version-builder/version_builder.py
@@ -122,7 +122,7 @@ class VersionBuilder:
pv_element.text = package_version
- def add_manifest(self, id, service_name, version, version_id = None):
+ def add_manifest(self, id, service_name, version, version_id=None, release_version=None):
"""
Add a manifest service. A manifest lists all services in a repo, whether they are to be
upgraded or not.
@@ -143,6 +143,9 @@ class VersionBuilder:
if version_id:
service_element.set('version-id', version_id)
+ if release_version:
+ service_element.set('release-version', release_version)
+
def add_available(self, manifest_id, available_components=None):
"""
Adds services available to upgrade for patches
@@ -296,7 +299,8 @@ def process_manifest(vb, options):
if not options.manifest:
return
- vb.add_manifest(options.manifest_id, options.manifest_service, options.manifest_version, options.manifest_version_id)
+ vb.add_manifest(options.manifest_id, options.manifest_service, options.manifest_version, options.manifest_version_id,
+ options.manifest_release_version)
def process_available(vb, options):
"""
@@ -411,15 +415,16 @@ def main(argv):
help="Identifier to use when installing packages, generally a part of the package name")
parser.add_option('--manifest', action='store_true', dest='manifest',
- help="Add a manifest service with other options: --manifest-id, --manifest-service, --manifest-version, --manifest-version-id")
+ help="Add a manifest service with other options: --manifest-id, --manifest-service, --manifest-version, --manifest-version-id, --manifest-release-version")
parser.add_option('--manifest-id', dest='manifest_id',
help="Unique ID for a service in a manifest. Required when specifying --manifest and --available")
parser.add_option('--manifest-service', dest='manifest_service')
parser.add_option('--manifest-version', dest='manifest_version')
parser.add_option('--manifest-version-id', dest='manifest_version_id')
+ parser.add_option('--manifest-release-version', dest='manifest_release_version')
parser.add_option('--available', action='store_true', dest='available',
- help="Add an available service with other options: --manifest-id, --available-components")
+ help="Add an available service with other options: --manifest-id, --available-components --service-release-version")
parser.add_option('--available-components', dest='available_components',
help="A CSV of service components that are intended to be upgraded via patch. \
Omitting this implies the entire service should be upgraded")
[36/50] [abbrv] ambari git commit: AMBARI-21629 Update Include and
Exclude Files for [HDFS]/Refreshnodes is called even if manage.include.files
is set to false (dsen)
Posted by ab...@apache.org.
AMBARI-21629 Update Include and Exclude Files for [HDFS]/Refreshnodes is called even if manage.include.files is set to false (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64cae8e0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64cae8e0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64cae8e0
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 64cae8e0e17d146ebc1d9f85b13b0ba137f2484b
Parents: 4dee0f0
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Aug 8 18:36:16 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Aug 8 18:36:16 2017 +0300
----------------------------------------------------------------------
.../controller/AmbariCustomCommandExecutionHelper.java | 11 ++++++++---
.../controller/AmbariManagementControllerImpl.java | 4 ++--
.../controller/AmbariManagementControllerTest.java | 4 ++--
3 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/64cae8e0/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 5f02baa..6d97854 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -138,7 +138,7 @@ public class AmbariCustomCommandExecutionHelper {
public final static String DECOM_SLAVE_COMPONENT = "slave_type";
public final static String HBASE_MARK_DRAINING_ONLY = "mark_draining_only";
public final static String UPDATE_FILES_ONLY = "update_files_only";
- public final static String MULTI_SERVICES_DECOM_REQUEST = "multi_services_decom_request";
+ public final static String IS_ADD_OR_DELETE_SLAVE_REQUEST = "is_add_or_delete_slave_request";
private final static String ALIGN_MAINTENANCE_STATE = "align_maintenance_state";
@@ -856,8 +856,8 @@ public class AmbariCustomCommandExecutionHelper {
Set<String> includedHosts = getHostList(actionExecutionContext.getParameters(),
DECOM_INCLUDED_HOSTS);
- if (actionExecutionContext.getParameters().get(MULTI_SERVICES_DECOM_REQUEST) != null &&
- actionExecutionContext.getParameters().get(MULTI_SERVICES_DECOM_REQUEST).equalsIgnoreCase("true")) {
+ if (actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST) != null &&
+ actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST).equalsIgnoreCase("true")) {
includedHosts = getHostList(actionExecutionContext.getParameters(), masterCompType + "_" + DECOM_INCLUDED_HOSTS);
}
@@ -1065,6 +1065,11 @@ public class AmbariCustomCommandExecutionHelper {
List<String> listOfExcludedHosts) {
StringBuilder commandDetail = new StringBuilder();
commandDetail.append(actionExecutionContext.getActionName());
+ if (actionExecutionContext.getParameters().containsKey(IS_ADD_OR_DELETE_SLAVE_REQUEST) &&
+ actionExecutionContext.getParameters().get(IS_ADD_OR_DELETE_SLAVE_REQUEST).equalsIgnoreCase("true")) {
+ commandDetail.append(", Update Include/Exclude Files");
+ return commandDetail;
+ }
if (listOfExcludedHosts.size() > 0) {
commandDetail.append(", Excluded: ").append(StringUtils.join(listOfExcludedHosts, ','));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/64cae8e0/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 9f0fa34..b4d9608 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3722,7 +3722,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
LOG.debug("Refresh include/exclude files action will be executed for " + serviceMasterMap);
HashMap<String, String> requestProperties = new HashMap<>();
- requestProperties.put("context", "Update Include and Exclude Files for " + serviceMasterMap.keySet().toString());
+ requestProperties.put("context", "Update Include/Exclude Files for " + serviceMasterMap.keySet().toString());
requestProperties.put("exclusive", "true");
HashMap<String, String> params = new HashMap<>();
params.put(AmbariCustomCommandExecutionHelper.UPDATE_FILES_ONLY, String.valueOf(isDecommission));
@@ -3733,7 +3733,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
- params.put(AmbariCustomCommandExecutionHelper.MULTI_SERVICES_DECOM_REQUEST, "true");
+ params.put(AmbariCustomCommandExecutionHelper.IS_ADD_OR_DELETE_SLAVE_REQUEST, "true");
//Create filter for command
List<RequestResourceFilter> resourceFilters = new ArrayList<>(serviceMasterMap.size());
http://git-wip-us.apache.org/repos/asf/ambari/blob/64cae8e0/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index bda9576..a3bbe68 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -9387,11 +9387,11 @@ public class AmbariManagementControllerTest {
List<Long> requestIDs = actionDB.getRequestsByStatus(null, 1, false);
Request request = actionDB.getRequest(requestIDs.get(0));
- assertEquals("Update Include and Exclude Files for [HDFS]", request.getRequestContext());
+ assertEquals("Update Include/Exclude Files for [HDFS]", request.getRequestContext());
Type type = new TypeToken<Map<String, String>>(){}.getType();
Map<String, String> requestParams = StageUtils.getGson().fromJson(request.getInputs(), type);
assertEquals(2, requestParams.size());
- assertEquals("true", requestParams.get("multi_services_decom_request"));
+ assertEquals("true", requestParams.get("is_add_or_delete_slave_request"));
assertEquals("true", requestParams.get("update_files_only"));
assertEquals(1, request.getResourceFilters().size());
RequestResourceFilter resourceFilter = request.getResourceFilters().get(0);
[02/50] [abbrv] ambari git commit: AMBARI-21581 - Replace Hard Coded
conf-select Structures (jonathanhurley)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
new file mode 100644
index 0000000..0ef41a6
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
@@ -0,0 +1,1042 @@
+{
+ "HDP": {
+ "stack-select": {
+ "ACCUMULO": {
+ "ACCUMULO_CLIENT": {
+ "STACK-SELECT-PACKAGE": "accumulo-client",
+ "INSTALL": [
+ "accumulo-client"
+ ],
+ "PATCH": [
+ "accumulo-client"
+ ],
+ "STANDARD": [
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_GC": {
+ "STACK-SELECT-PACKAGE": "accumulo-gc",
+ "INSTALL": [
+ "accumulo-gc"
+ ],
+ "PATCH": [
+ "accumulo-gc"
+ ],
+ "STANDARD": [
+ "accumulo-gc",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_MASTER": {
+ "STACK-SELECT-PACKAGE": "accumulo-master",
+ "INSTALL": [
+ "accumulo-master"
+ ],
+ "PATCH": [
+ "accumulo-master"
+ ],
+ "STANDARD": [
+ "accumulo-master",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_MONITOR": {
+ "STACK-SELECT-PACKAGE": "accumulo-monitor",
+ "INSTALL": [
+ "accumulo-monitor"
+ ],
+ "PATCH": [
+ "accumulo-monitor"
+ ],
+ "STANDARD": [
+ "accumulo-monitor",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_TRACER": {
+ "STACK-SELECT-PACKAGE": "accumulo-tracer",
+ "INSTALL": [
+ "accumulo-tracer"
+ ],
+ "PATCH": [
+ "accumulo-tracer"
+ ],
+ "STANDARD": [
+ "accumulo-tracer",
+ "accumulo-client"
+ ]
+ },
+ "ACCUMULO_TSERVER": {
+ "STACK-SELECT-PACKAGE": "accumulo-tablet",
+ "INSTALL": [
+ "accumulo-tablet"
+ ],
+ "PATCH": [
+ "accumulo-tablet"
+ ],
+ "STANDARD": [
+ "accumulo-tablet",
+ "accumulo-client"
+ ]
+ }
+ },
+ "ATLAS": {
+ "ATLAS_CLIENT": {
+ "STACK-SELECT-PACKAGE": "atlas-client",
+ "INSTALL": [
+ "atlas-client"
+ ],
+ "PATCH": [
+ "atlas-client"
+ ],
+ "STANDARD": [
+ "atlas-client"
+ ]
+ },
+ "ATLAS_SERVER": {
+ "STACK-SELECT-PACKAGE": "atlas-server",
+ "INSTALL": [
+ "atlas-server"
+ ],
+ "PATCH": [
+ "atlas-server"
+ ],
+ "STANDARD": [
+ "atlas-server"
+ ]
+ }
+ },
+ "DRUID": {
+ "DRUID_COORDINATOR": {
+ "STACK-SELECT-PACKAGE": "druid-coordinator",
+ "INSTALL": [
+ "druid-coordinator"
+ ],
+ "PATCH": [
+ "druid-coordinator"
+ ],
+ "STANDARD": [
+ "druid-coordinator"
+ ]
+ },
+ "DRUID_OVERLORD": {
+ "STACK-SELECT-PACKAGE": "druid-overlord",
+ "INSTALL": [
+ "druid-overlord"
+ ],
+ "PATCH": [
+ "druid-overlord"
+ ],
+ "STANDARD": [
+ "druid-overlord"
+ ]
+ },
+ "DRUID_HISTORICAL": {
+ "STACK-SELECT-PACKAGE": "druid-historical",
+ "INSTALL": [
+ "druid-historical"
+ ],
+ "PATCH": [
+ "druid-historical"
+ ],
+ "STANDARD": [
+ "druid-historical"
+ ]
+ },
+ "DRUID_BROKER": {
+ "STACK-SELECT-PACKAGE": "druid-broker",
+ "INSTALL": [
+ "druid-broker"
+ ],
+ "PATCH": [
+ "druid-broker"
+ ],
+ "STANDARD": [
+ "druid-broker"
+ ]
+ },
+ "DRUID_MIDDLEMANAGER": {
+ "STACK-SELECT-PACKAGE": "druid-middlemanager",
+ "INSTALL": [
+ "druid-middlemanager"
+ ],
+ "PATCH": [
+ "druid-middlemanager"
+ ],
+ "STANDARD": [
+ "druid-middlemanager"
+ ]
+ },
+ "DRUID_ROUTER": {
+ "STACK-SELECT-PACKAGE": "druid-router",
+ "INSTALL": [
+ "druid-router"
+ ],
+ "PATCH": [
+ "druid-router"
+ ],
+ "STANDARD": [
+ "druid-router"
+ ]
+ },
+ "DRUID_SUPERSET": {
+ "STACK-SELECT-PACKAGE": "druid-superset",
+ "INSTALL": [
+ "druid-superset"
+ ],
+ "PATCH": [
+ "druid-superset"
+ ],
+ "STANDARD": [
+ "druid-superset"
+ ]
+ }
+ },
+ "FALCON": {
+ "FALCON_CLIENT": {
+ "STACK-SELECT-PACKAGE": "falcon-client",
+ "INSTALL": [
+ "falcon-client"
+ ],
+ "PATCH": [
+ "falcon-client"
+ ],
+ "STANDARD": [
+ "falcon-client"
+ ]
+ },
+ "FALCON_SERVER": {
+ "STACK-SELECT-PACKAGE": "falcon-server",
+ "INSTALL": [
+ "falcon-server"
+ ],
+ "PATCH": [
+ "falcon-server"
+ ],
+ "STANDARD": [
+ "falcon-server"
+ ]
+ }
+ },
+ "FLUME": {
+ "FLUME_HANDLER": {
+ "STACK-SELECT-PACKAGE": "flume-server",
+ "INSTALL": [
+ "flume-server"
+ ],
+ "PATCH": [
+ "flume-server"
+ ],
+ "STANDARD": [
+ "flume-server"
+ ]
+ }
+ },
+ "HBASE": {
+ "HBASE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hbase-client",
+ "INSTALL": [
+ "hbase-client"
+ ],
+ "PATCH": [
+ "hbase-client"
+ ],
+ "STANDARD": [
+ "hbase-client",
+ "phoenix-client",
+ "hadoop-client"
+ ]
+ },
+ "HBASE_MASTER": {
+ "STACK-SELECT-PACKAGE": "hbase-master",
+ "INSTALL": [
+ "hbase-master"
+ ],
+ "PATCH": [
+ "hbase-master"
+ ],
+ "STANDARD": [
+ "hbase-master"
+ ]
+ },
+ "HBASE_REGIONSERVER": {
+ "STACK-SELECT-PACKAGE": "hbase-regionserver",
+ "INSTALL": [
+ "hbase-regionserver"
+ ],
+ "PATCH": [
+ "hbase-regionserver"
+ ],
+ "STANDARD": [
+ "hbase-regionserver"
+ ]
+ },
+ "PHOENIX_QUERY_SERVER": {
+ "STACK-SELECT-PACKAGE": "phoenix-server",
+ "INSTALL": [
+ "phoenix-server"
+ ],
+ "PATCH": [
+ "phoenix-server"
+ ],
+ "STANDARD": [
+ "phoenix-server"
+ ]
+ }
+ },
+ "HDFS": {
+ "DATANODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-datanode",
+ "INSTALL": [
+ "hadoop-hdfs-datanode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-datanode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-datanode"
+ ]
+ },
+ "HDFS_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ },
+ "NAMENODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-namenode",
+ "INSTALL": [
+ "hadoop-hdfs-namenode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-namenode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-namenode"
+ ]
+ },
+ "NFS_GATEWAY": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-nfs3",
+ "INSTALL": [
+ "hadoop-hdfs-nfs3"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-nfs3"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-nfs3"
+ ]
+ },
+ "JOURNALNODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-journalnode",
+ "INSTALL": [
+ "hadoop-hdfs-journalnode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-journalnode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-journalnode"
+ ]
+ },
+ "SECONDARY_NAMENODE": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-secondarynamenode",
+ "INSTALL": [
+ "hadoop-hdfs-secondarynamenode"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-secondarynamenode"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-secondarynamenode"
+ ]
+ },
+ "ZKFC": {
+ "STACK-SELECT-PACKAGE": "hadoop-hdfs-zkfc",
+ "INSTALL": [
+ "hadoop-hdfs-zkfc"
+ ],
+ "PATCH": [
+ "hadoop-hdfs-zkfc"
+ ],
+ "STANDARD": [
+ "hadoop-hdfs-zkfc"
+ ]
+ }
+ },
+ "HIVE": {
+ "HCAT": {
+ "STACK-SELECT-PACKAGE": "hive-webhcat",
+ "INSTALL": [
+ "hive-webhcat"
+ ],
+ "PATCH": [
+ "hive-webhcat"
+ ],
+ "STANDARD": [
+ "hive-webhcat"
+ ]
+ },
+ "HIVE_METASTORE": {
+ "STACK-SELECT-PACKAGE": "hive-metastore",
+ "INSTALL": [
+ "hive-metastore"
+ ],
+ "PATCH": [
+ "hive-metastore"
+ ],
+ "STANDARD": [
+ "hive-metastore"
+ ]
+ },
+ "HIVE_SERVER": {
+ "STACK-SELECT-PACKAGE": "hive-server2",
+ "INSTALL": [
+ "hive-server2"
+ ],
+ "PATCH": [
+ "hive-server2"
+ ],
+ "STANDARD": [
+ "hive-server2"
+ ]
+ },
+ "HIVE_SERVER_INTERACTIVE": {
+ "STACK-SELECT-PACKAGE": "hive-server2-hive2",
+ "INSTALL": [
+ "hive-server2-hive2"
+ ],
+ "PATCH": [
+ "hive-server2-hive2"
+ ],
+ "STANDARD": [
+ "hive-server2-hive2"
+ ]
+ },
+ "HIVE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ },
+ "WEBHCAT_SERVER": {
+ "STACK-SELECT-PACKAGE": "hive-webhcat",
+ "INSTALL": [
+ "hive-webhcat"
+ ],
+ "PATCH": [
+ "hive-webhcat"
+ ],
+ "STANDARD": [
+ "hive-webhcat"
+ ]
+ }
+ },
+ "KAFKA": {
+ "KAFKA_BROKER": {
+ "STACK-SELECT-PACKAGE": "kafka-broker",
+ "INSTALL": [
+ "kafka-broker"
+ ],
+ "PATCH": [
+ "kafka-broker"
+ ],
+ "STANDARD": [
+ "kafka-broker"
+ ]
+ }
+ },
+ "KNOX": {
+ "KNOX_GATEWAY": {
+ "STACK-SELECT-PACKAGE": "knox-server",
+ "INSTALL": [
+ "knox-server"
+ ],
+ "PATCH": [
+ "knox-server"
+ ],
+ "STANDARD": [
+ "knox-server"
+ ]
+ }
+ },
+ "MAHOUT": {
+ "MAHOUT": {
+ "STACK-SELECT-PACKAGE": "mahout-client",
+ "INSTALL": [
+ "mahout-client"
+ ],
+ "PATCH": [
+ "mahout-client"
+ ],
+ "STANDARD": [
+ "mahout-client"
+ ]
+ }
+ },
+ "MAPREDUCE2": {
+ "HISTORYSERVER": {
+ "STACK-SELECT-PACKAGE": "hadoop-mapreduce-historyserver",
+ "INSTALL": [
+ "hadoop-mapreduce-historyserver"
+ ],
+ "PATCH": [
+ "hadoop-mapreduce-historyserver"
+ ],
+ "STANDARD": [
+ "hadoop-mapreduce-historyserver"
+ ]
+ },
+ "MAPREDUCE2_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "hadoop-mapreduce-INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "OOZIE": {
+ "OOZIE_CLIENT": {
+ "STACK-SELECT-PACKAGE": "oozie-client",
+ "INSTALL": [
+ "oozie-client"
+ ],
+ "PATCH": [
+ "oozie-client"
+ ],
+ "STANDARD": [
+ "oozie-client"
+ ]
+ },
+ "OOZIE_SERVER": {
+ "STACK-SELECT-PACKAGE": "oozie-server",
+ "INSTALL": [
+ "oozie-client",
+ "oozie-server"
+ ],
+ "PATCH": [
+ "oozie-server"
+ ],
+ "STANDARD": [
+ "oozie-client",
+ "oozie-server"
+ ]
+ }
+ },
+ "PIG": {
+ "PIG": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "RANGER": {
+ "RANGER_ADMIN": {
+ "STACK-SELECT-PACKAGE": "ranger-admin",
+ "INSTALL": [
+ "ranger-admin"
+ ],
+ "PATCH": [
+ "ranger-admin"
+ ],
+ "STANDARD": [
+ "ranger-admin"
+ ]
+ },
+ "RANGER_TAGSYNC": {
+ "STACK-SELECT-PACKAGE": "ranger-tagsync",
+ "INSTALL": [
+ "ranger-tagsync"
+ ],
+ "PATCH": [
+ "ranger-tagsync"
+ ],
+ "STANDARD": [
+ "ranger-tagsync"
+ ]
+ },
+ "RANGER_USERSYNC": {
+ "STACK-SELECT-PACKAGE": "ranger-usersync",
+ "INSTALL": [
+ "ranger-usersync"
+ ],
+ "PATCH": [
+ "ranger-usersync"
+ ],
+ "STANDARD": [
+ "ranger-usersync"
+ ]
+ }
+ },
+ "RANGER_KMS": {
+ "RANGER_KMS_SERVER": {
+ "STACK-SELECT-PACKAGE": "ranger-kms",
+ "INSTALL": [
+ "ranger-kms"
+ ],
+ "PATCH": [
+ "ranger-kms"
+ ],
+ "STANDARD": [
+ "ranger-kms"
+ ]
+ }
+ },
+ "SLIDER": {
+ "SLIDER": {
+ "STACK-SELECT-PACKAGE": "slider-client",
+ "INSTALL": [
+ "slider-client"
+ ],
+ "PATCH": [
+ "slider-client"
+ ],
+ "STANDARD": [
+ "slider-client",
+ "hadoop-client"
+ ]
+ }
+ },
+ "SPARK": {
+ "LIVY_SERVER": {
+ "STACK-SELECT-PACKAGE": "livy2-server",
+ "INSTALL": [
+ "livy2-server"
+ ],
+ "PATCH": [
+ "livy2-server"
+ ],
+ "STANDARD": [
+ "livy2-server"
+ ]
+ },
+ "SPARK_CLIENT": {
+ "STACK-SELECT-PACKAGE": "spark2-client",
+ "INSTALL": [
+ "spark2-client"
+ ],
+ "PATCH": [
+ "spark2-client"
+ ],
+ "STANDARD": [
+ "spark2-client"
+ ]
+ },
+ "SPARK_JOBHISTORYSERVER": {
+ "STACK-SELECT-PACKAGE": "spark2-historyserver",
+ "INSTALL": [
+ "spark2-historyserver"
+ ],
+ "PATCH": [
+ "spark2-historyserver"
+ ],
+ "STANDARD": [
+ "spark2-historyserver"
+ ]
+ },
+ "SPARK_THRIFTSERVER": {
+ "STACK-SELECT-PACKAGE": "spark2-thriftserver",
+ "INSTALL": [
+ "spark2-thriftserver"
+ ],
+ "PATCH": [
+ "spark2-thriftserver"
+ ],
+ "STANDARD": [
+ "spark2-thriftserver"
+ ]
+ }
+ },
+ "SQOOP": {
+ "SQOOP": {
+ "STACK-SELECT-PACKAGE": "sqoop-client",
+ "INSTALL": [
+ "sqoop-client"
+ ],
+ "PATCH": [
+ "sqoop-client"
+ ],
+ "STANDARD": [
+ "sqoop-client"
+ ]
+ }
+ },
+ "STORM": {
+ "NIMBUS": {
+ "STACK-SELECT-PACKAGE": "storm-nimbus",
+ "INSTALL": [
+ "storm-client",
+ "storm-nimbus"
+ ],
+ "PATCH": [
+ "storm-client",
+ "storm-nimbus"
+ ],
+ "STANDARD": [
+ "storm-client",
+ "storm-nimbus"
+ ]
+ },
+ "SUPERVISOR": {
+ "STACK-SELECT-PACKAGE": "storm-supervisor",
+ "INSTALL": [
+ "storm-supervisor"
+ ],
+ "PATCH": [
+ "storm-supervisor"
+ ],
+ "STANDARD": [
+ "storm-client",
+ "storm-supervisor"
+ ]
+ },
+ "DRPC_SERVER": {
+ "STACK-SELECT-PACKAGE": "storm-client",
+ "INSTALL": [
+ "storm-client"
+ ],
+ "PATCH": [
+ "storm-client"
+ ],
+ "STANDARD": [
+ "storm-client"
+ ]
+ },
+ "STORM_UI_SERVER": {
+ "STACK-SELECT-PACKAGE": "storm-client",
+ "INSTALL": [
+ "storm-client"
+ ],
+ "PATCH": [
+ "storm-client"
+ ],
+ "STANDARD": [
+ "storm-client"
+ ]
+ }
+ },
+ "TEZ": {
+ "TEZ_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "YARN": {
+ "APP_TIMELINE_SERVER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-timelineserver",
+ "INSTALL": [
+ "hadoop-yarn-timelineserver"
+ ],
+ "PATCH": [
+ "hadoop-yarn-timelineserver"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-timelineserver"
+ ]
+ },
+ "NODEMANAGER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-nodemanager",
+ "INSTALL": [
+ "hadoop-yarn-nodemanager"
+ ],
+ "PATCH": [
+ "hadoop-yarn-nodemanager"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-nodemanager"
+ ]
+ },
+ "RESOURCEMANAGER": {
+ "STACK-SELECT-PACKAGE": "hadoop-yarn-resourcemanager",
+ "INSTALL": [
+ "hadoop-yarn-resourcemanager"
+ ],
+ "PATCH": [
+ "hadoop-yarn-resourcemanager"
+ ],
+ "STANDARD": [
+ "hadoop-yarn-resourcemanager"
+ ]
+ },
+ "YARN_CLIENT": {
+ "STACK-SELECT-PACKAGE": "hadoop-client",
+ "INSTALL": [
+ "hadoop-client"
+ ],
+ "PATCH": [
+ "INVALID"
+ ],
+ "STANDARD": [
+ "hadoop-client"
+ ]
+ }
+ },
+ "ZEPPELIN": {
+ "ZEPPELIN_MASTER": {
+ "STACK-SELECT-PACKAGE": "zeppelin-server",
+ "INSTALL": [
+ "zeppelin-server"
+ ],
+ "PATCH": [
+ "zeppelin-server"
+ ],
+ "STANDARD": [
+ "zeppelin-server"
+ ]
+ }
+ },
+ "ZOOKEEPER": {
+ "ZOOKEEPER_CLIENT": {
+ "STACK-SELECT-PACKAGE": "zookeeper-client",
+ "INSTALL": [
+ "zookeeper-client"
+ ],
+ "PATCH": [
+ "zookeeper-client"
+ ],
+ "STANDARD": [
+ "zookeeper-client"
+ ]
+ },
+ "ZOOKEEPER_SERVER": {
+ "STACK-SELECT-PACKAGE": "zookeeper-server",
+ "INSTALL": [
+ "zookeeper-server"
+ ],
+ "PATCH": [
+ "zookeeper-server"
+ ],
+ "STANDARD": [
+ "zookeeper-server"
+ ]
+ }
+ }
+ },
+ "conf-select": {
+ "accumulo": [
+ {
+ "conf_dir": "/etc/accumulo/conf",
+ "current_dir": "{0}/current/accumulo-client/conf"
+ }
+ ],
+ "atlas": [
+ {
+ "conf_dir": "/etc/atlas/conf",
+ "current_dir": "{0}/current/atlas-client/conf"
+ }
+ ],
+ "druid": [
+ {
+ "conf_dir": "/etc/druid/conf",
+ "current_dir": "{0}/current/druid-overlord/conf"
+ }
+ ],
+ "falcon": [
+ {
+ "conf_dir": "/etc/falcon/conf",
+ "current_dir": "{0}/current/falcon-client/conf"
+ }
+ ],
+ "flume": [
+ {
+ "conf_dir": "/etc/flume/conf",
+ "current_dir": "{0}/current/flume-server/conf"
+ }
+ ],
+ "hadoop": [
+ {
+ "conf_dir": "/etc/hadoop/conf",
+ "current_dir": "{0}/current/hadoop-client/conf"
+ }
+ ],
+ "hbase": [
+ {
+ "conf_dir": "/etc/hbase/conf",
+ "current_dir": "{0}/current/hbase-client/conf"
+ }
+ ],
+ "hive": [
+ {
+ "conf_dir": "/etc/hive/conf",
+ "current_dir": "{0}/current/hive-client/conf"
+ }
+ ],
+ "hive2": [
+ {
+ "conf_dir": "/etc/hive2/conf",
+ "current_dir": "{0}/current/hive-server2-hive2/conf"
+ }
+ ],
+ "hive-hcatalog": [
+ {
+ "conf_dir": "/etc/hive-webhcat/conf",
+ "prefix": "/etc/hive-webhcat",
+ "current_dir": "{0}/current/hive-webhcat/etc/webhcat"
+ },
+ {
+ "conf_dir": "/etc/hive-hcatalog/conf",
+ "prefix": "/etc/hive-hcatalog",
+ "current_dir": "{0}/current/hive-webhcat/etc/hcatalog"
+ }
+ ],
+ "kafka": [
+ {
+ "conf_dir": "/etc/kafka/conf",
+ "current_dir": "{0}/current/kafka-broker/conf"
+ }
+ ],
+ "knox": [
+ {
+ "conf_dir": "/etc/knox/conf",
+ "current_dir": "{0}/current/knox-server/conf"
+ }
+ ],
+ "mahout": [
+ {
+ "conf_dir": "/etc/mahout/conf",
+ "current_dir": "{0}/current/mahout-client/conf"
+ }
+ ],
+ "nifi": [
+ {
+ "conf_dir": "/etc/nifi/conf",
+ "current_dir": "{0}/current/nifi/conf"
+ }
+ ],
+ "oozie": [
+ {
+ "conf_dir": "/etc/oozie/conf",
+ "current_dir": "{0}/current/oozie-client/conf"
+ }
+ ],
+ "phoenix": [
+ {
+ "conf_dir": "/etc/phoenix/conf",
+ "current_dir": "{0}/current/phoenix-client/conf"
+ }
+ ],
+ "pig": [
+ {
+ "conf_dir": "/etc/pig/conf",
+ "current_dir": "{0}/current/pig-client/conf"
+ }
+ ],
+ "ranger-admin": [
+ {
+ "conf_dir": "/etc/ranger/admin/conf",
+ "current_dir": "{0}/current/ranger-admin/conf"
+ }
+ ],
+ "ranger-kms": [
+ {
+ "conf_dir": "/etc/ranger/kms/conf",
+ "current_dir": "{0}/current/ranger-kms/conf"
+ }
+ ],
+ "ranger-tagsync": [
+ {
+ "conf_dir": "/etc/ranger/tagsync/conf",
+ "current_dir": "{0}/current/ranger-tagsync/conf"
+ }
+ ],
+ "ranger-usersync": [
+ {
+ "conf_dir": "/etc/ranger/usersync/conf",
+ "current_dir": "{0}/current/ranger-usersync/conf"
+ }
+ ],
+ "slider": [
+ {
+ "conf_dir": "/etc/slider/conf",
+ "current_dir": "{0}/current/slider-client/conf"
+ }
+ ],
+ "spark": [
+ {
+ "conf_dir": "/etc/spark/conf",
+ "current_dir": "{0}/current/spark-client/conf"
+ }
+ ],
+ "spark2": [
+ {
+ "conf_dir": "/etc/spark2/conf",
+ "current_dir": "{0}/current/spark2-client/conf"
+ }
+ ],
+ "sqoop": [
+ {
+ "conf_dir": "/etc/sqoop/conf",
+ "current_dir": "{0}/current/sqoop-client/conf"
+ }
+ ],
+ "storm": [
+ {
+ "conf_dir": "/etc/storm/conf",
+ "current_dir": "{0}/current/storm-client/conf"
+ }
+ ],
+ "storm-slider-client": [
+ {
+ "conf_dir": "/etc/storm-slider-client/conf",
+ "current_dir": "{0}/current/storm-slider-client/conf"
+ }
+ ],
+ "superset": [
+ {
+ "conf_dir": "/etc/druid-superset/conf",
+ "current_dir": "{0}/current/druid-superset/conf"
+ }
+ ],
+ "tez": [
+ {
+ "conf_dir": "/etc/tez/conf",
+ "current_dir": "{0}/current/tez-client/conf"
+ }
+ ],
+ "zeppelin": [
+ {
+ "conf_dir": "/etc/zeppelin/conf",
+ "current_dir": "{0}/current/zeppelin-server/conf"
+ }
+ ],
+ "zookeeper": [
+ {
+ "conf_dir": "/etc/zookeeper/conf",
+ "current_dir": "{0}/current/zookeeper-client/conf"
+ }
+ ]
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_select_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_select_packages.json b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_select_packages.json
deleted file mode 100644
index 0ad2626..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_select_packages.json
+++ /dev/null
@@ -1,848 +0,0 @@
-{
- "HDP": {
- "stack-select": {
- "ACCUMULO": {
- "ACCUMULO_CLIENT": {
- "STACK-SELECT-PACKAGE": "accumulo-client",
- "INSTALL": [
- "accumulo-client"
- ],
- "PATCH": [
- "accumulo-client"
- ],
- "STANDARD": [
- "accumulo-client"
- ]
- },
- "ACCUMULO_GC": {
- "STACK-SELECT-PACKAGE": "accumulo-gc",
- "INSTALL": [
- "accumulo-gc"
- ],
- "PATCH": [
- "accumulo-gc"
- ],
- "STANDARD": [
- "accumulo-gc",
- "accumulo-client"
- ]
- },
- "ACCUMULO_MASTER": {
- "STACK-SELECT-PACKAGE": "accumulo-master",
- "INSTALL": [
- "accumulo-master"
- ],
- "PATCH": [
- "accumulo-master"
- ],
- "STANDARD": [
- "accumulo-master",
- "accumulo-client"
- ]
- },
- "ACCUMULO_MONITOR": {
- "STACK-SELECT-PACKAGE": "accumulo-monitor",
- "INSTALL": [
- "accumulo-monitor"
- ],
- "PATCH": [
- "accumulo-monitor"
- ],
- "STANDARD": [
- "accumulo-monitor",
- "accumulo-client"
- ]
- },
- "ACCUMULO_TRACER": {
- "STACK-SELECT-PACKAGE": "accumulo-tracer",
- "INSTALL": [
- "accumulo-tracer"
- ],
- "PATCH": [
- "accumulo-tracer"
- ],
- "STANDARD": [
- "accumulo-tracer",
- "accumulo-client"
- ]
- },
- "ACCUMULO_TSERVER": {
- "STACK-SELECT-PACKAGE": "accumulo-tablet",
- "INSTALL": [
- "accumulo-tablet"
- ],
- "PATCH": [
- "accumulo-tablet"
- ],
- "STANDARD": [
- "accumulo-tablet",
- "accumulo-client"
- ]
- }
- },
- "ATLAS": {
- "ATLAS_CLIENT": {
- "STACK-SELECT-PACKAGE": "atlas-client",
- "INSTALL": [
- "atlas-client"
- ],
- "PATCH": [
- "atlas-client"
- ],
- "STANDARD": [
- "atlas-client"
- ]
- },
- "ATLAS_SERVER": {
- "STACK-SELECT-PACKAGE": "atlas-server",
- "INSTALL": [
- "atlas-server"
- ],
- "PATCH": [
- "atlas-server"
- ],
- "STANDARD": [
- "atlas-server"
- ]
- }
- },
- "DRUID": {
- "DRUID_COORDINATOR": {
- "STACK-SELECT-PACKAGE": "druid-coordinator",
- "INSTALL": [
- "druid-coordinator"
- ],
- "PATCH": [
- "druid-coordinator"
- ],
- "STANDARD": [
- "druid-coordinator"
- ]
- },
- "DRUID_OVERLORD": {
- "STACK-SELECT-PACKAGE": "druid-overlord",
- "INSTALL": [
- "druid-overlord"
- ],
- "PATCH": [
- "druid-overlord"
- ],
- "STANDARD": [
- "druid-overlord"
- ]
- },
- "DRUID_HISTORICAL": {
- "STACK-SELECT-PACKAGE": "druid-historical",
- "INSTALL": [
- "druid-historical"
- ],
- "PATCH": [
- "druid-historical"
- ],
- "STANDARD": [
- "druid-historical"
- ]
- },
- "DRUID_BROKER": {
- "STACK-SELECT-PACKAGE": "druid-broker",
- "INSTALL": [
- "druid-broker"
- ],
- "PATCH": [
- "druid-broker"
- ],
- "STANDARD": [
- "druid-broker"
- ]
- },
- "DRUID_MIDDLEMANAGER": {
- "STACK-SELECT-PACKAGE": "druid-middlemanager",
- "INSTALL": [
- "druid-middlemanager"
- ],
- "PATCH": [
- "druid-middlemanager"
- ],
- "STANDARD": [
- "druid-middlemanager"
- ]
- },
- "DRUID_ROUTER": {
- "STACK-SELECT-PACKAGE": "druid-router",
- "INSTALL": [
- "druid-router"
- ],
- "PATCH": [
- "druid-router"
- ],
- "STANDARD": [
- "druid-router"
- ]
- },
- "DRUID_SUPERSET": {
- "STACK-SELECT-PACKAGE": "druid-superset",
- "INSTALL": [
- "druid-superset"
- ],
- "PATCH": [
- "druid-superset"
- ],
- "STANDARD": [
- "druid-superset"
- ]
- }
- },
- "FALCON": {
- "FALCON_CLIENT": {
- "STACK-SELECT-PACKAGE": "falcon-client",
- "INSTALL": [
- "falcon-client"
- ],
- "PATCH": [
- "falcon-client"
- ],
- "STANDARD": [
- "falcon-client"
- ]
- },
- "FALCON_SERVER": {
- "STACK-SELECT-PACKAGE": "falcon-server",
- "INSTALL": [
- "falcon-server"
- ],
- "PATCH": [
- "falcon-server"
- ],
- "STANDARD": [
- "falcon-server"
- ]
- }
- },
- "FLUME": {
- "FLUME_HANDLER": {
- "STACK-SELECT-PACKAGE": "flume-server",
- "INSTALL": [
- "flume-server"
- ],
- "PATCH": [
- "flume-server"
- ],
- "STANDARD": [
- "flume-server"
- ]
- }
- },
- "HBASE": {
- "HBASE_CLIENT": {
- "STACK-SELECT-PACKAGE": "hbase-client",
- "INSTALL": [
- "hbase-client"
- ],
- "PATCH": [
- "hbase-client"
- ],
- "STANDARD": [
- "hbase-client",
- "phoenix-client",
- "hadoop-client"
- ]
- },
- "HBASE_MASTER": {
- "STACK-SELECT-PACKAGE": "hbase-master",
- "INSTALL": [
- "hbase-master"
- ],
- "PATCH": [
- "hbase-master"
- ],
- "STANDARD": [
- "hbase-master"
- ]
- },
- "HBASE_REGIONSERVER": {
- "STACK-SELECT-PACKAGE": "hbase-regionserver",
- "INSTALL": [
- "hbase-regionserver"
- ],
- "PATCH": [
- "hbase-regionserver"
- ],
- "STANDARD": [
- "hbase-regionserver"
- ]
- },
- "PHOENIX_QUERY_SERVER": {
- "STACK-SELECT-PACKAGE": "phoenix-server",
- "INSTALL": [
- "phoenix-server"
- ],
- "PATCH": [
- "phoenix-server"
- ],
- "STANDARD": [
- "phoenix-server"
- ]
- }
- },
- "HDFS": {
- "DATANODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-datanode",
- "INSTALL": [
- "hadoop-hdfs-datanode"
- ],
- "PATCH": [
- "hadoop-hdfs-datanode"
- ],
- "STANDARD": [
- "hadoop-hdfs-datanode"
- ]
- },
- "HDFS_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- },
- "NAMENODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-namenode",
- "INSTALL": [
- "hadoop-hdfs-namenode"
- ],
- "PATCH": [
- "hadoop-hdfs-namenode"
- ],
- "STANDARD": [
- "hadoop-hdfs-namenode"
- ]
- },
- "NFS_GATEWAY": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-nfs3",
- "INSTALL": [
- "hadoop-hdfs-nfs3"
- ],
- "PATCH": [
- "hadoop-hdfs-nfs3"
- ],
- "STANDARD": [
- "hadoop-hdfs-nfs3"
- ]
- },
- "JOURNALNODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-journalnode",
- "INSTALL": [
- "hadoop-hdfs-journalnode"
- ],
- "PATCH": [
- "hadoop-hdfs-journalnode"
- ],
- "STANDARD": [
- "hadoop-hdfs-journalnode"
- ]
- },
- "SECONDARY_NAMENODE": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-secondarynamenode",
- "INSTALL": [
- "hadoop-hdfs-secondarynamenode"
- ],
- "PATCH": [
- "hadoop-hdfs-secondarynamenode"
- ],
- "STANDARD": [
- "hadoop-hdfs-secondarynamenode"
- ]
- },
- "ZKFC": {
- "STACK-SELECT-PACKAGE": "hadoop-hdfs-zkfc",
- "INSTALL": [
- "hadoop-hdfs-zkfc"
- ],
- "PATCH": [
- "hadoop-hdfs-zkfc"
- ],
- "STANDARD": [
- "hadoop-hdfs-zkfc"
- ]
- }
- },
- "HIVE": {
- "HCAT": {
- "STACK-SELECT-PACKAGE": "hive-webhcat",
- "INSTALL": [
- "hive-webhcat"
- ],
- "PATCH": [
- "hive-webhcat"
- ],
- "STANDARD": [
- "hive-webhcat"
- ]
- },
- "HIVE_METASTORE": {
- "STACK-SELECT-PACKAGE": "hive-metastore",
- "INSTALL": [
- "hive-metastore"
- ],
- "PATCH": [
- "hive-metastore"
- ],
- "STANDARD": [
- "hive-metastore"
- ]
- },
- "HIVE_SERVER": {
- "STACK-SELECT-PACKAGE": "hive-server2",
- "INSTALL": [
- "hive-server2"
- ],
- "PATCH": [
- "hive-server2"
- ],
- "STANDARD": [
- "hive-server2"
- ]
- },
- "HIVE_SERVER_INTERACTIVE": {
- "STACK-SELECT-PACKAGE": "hive-server2-hive2",
- "INSTALL": [
- "hive-server2-hive2"
- ],
- "PATCH": [
- "hive-server2-hive2"
- ],
- "STANDARD": [
- "hive-server2-hive2"
- ]
- },
- "HIVE_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- },
- "WEBHCAT_SERVER": {
- "STACK-SELECT-PACKAGE": "hive-webhcat",
- "INSTALL": [
- "hive-webhcat"
- ],
- "PATCH": [
- "hive-webhcat"
- ],
- "STANDARD": [
- "hive-webhcat"
- ]
- }
- },
- "KAFKA": {
- "KAFKA_BROKER": {
- "STACK-SELECT-PACKAGE": "kafka-broker",
- "INSTALL": [
- "kafka-broker"
- ],
- "PATCH": [
- "kafka-broker"
- ],
- "STANDARD": [
- "kafka-broker"
- ]
- }
- },
- "KNOX": {
- "KNOX_GATEWAY": {
- "STACK-SELECT-PACKAGE": "knox-server",
- "INSTALL": [
- "knox-server"
- ],
- "PATCH": [
- "knox-server"
- ],
- "STANDARD": [
- "knox-server"
- ]
- }
- },
- "MAHOUT": {
- "MAHOUT": {
- "STACK-SELECT-PACKAGE": "mahout-client",
- "INSTALL": [
- "mahout-client"
- ],
- "PATCH": [
- "mahout-client"
- ],
- "STANDARD": [
- "mahout-client"
- ]
- }
- },
- "MAPREDUCE2": {
- "HISTORYSERVER": {
- "STACK-SELECT-PACKAGE": "hadoop-mapreduce-historyserver",
- "INSTALL": [
- "hadoop-mapreduce-historyserver"
- ],
- "PATCH": [
- "hadoop-mapreduce-historyserver"
- ],
- "STANDARD": [
- "hadoop-mapreduce-historyserver"
- ]
- },
- "MAPREDUCE2_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "hadoop-mapreduce-INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "OOZIE": {
- "OOZIE_CLIENT": {
- "STACK-SELECT-PACKAGE": "oozie-client",
- "INSTALL": [
- "oozie-client"
- ],
- "PATCH": [
- "oozie-client"
- ],
- "STANDARD": [
- "oozie-client"
- ]
- },
- "OOZIE_SERVER": {
- "STACK-SELECT-PACKAGE": "oozie-server",
- "INSTALL": [
- "oozie-client",
- "oozie-server"
- ],
- "PATCH": [
- "oozie-server"
- ],
- "STANDARD": [
- "oozie-client",
- "oozie-server"
- ]
- }
- },
- "PIG": {
- "PIG": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "RANGER": {
- "RANGER_ADMIN": {
- "STACK-SELECT-PACKAGE": "ranger-admin",
- "INSTALL": [
- "ranger-admin"
- ],
- "PATCH": [
- "ranger-admin"
- ],
- "STANDARD": [
- "ranger-admin"
- ]
- },
- "RANGER_TAGSYNC": {
- "STACK-SELECT-PACKAGE": "ranger-tagsync",
- "INSTALL": [
- "ranger-tagsync"
- ],
- "PATCH": [
- "ranger-tagsync"
- ],
- "STANDARD": [
- "ranger-tagsync"
- ]
- },
- "RANGER_USERSYNC": {
- "STACK-SELECT-PACKAGE": "ranger-usersync",
- "INSTALL": [
- "ranger-usersync"
- ],
- "PATCH": [
- "ranger-usersync"
- ],
- "STANDARD": [
- "ranger-usersync"
- ]
- }
- },
- "RANGER_KMS": {
- "RANGER_KMS_SERVER": {
- "STACK-SELECT-PACKAGE": "ranger-kms",
- "INSTALL": [
- "ranger-kms"
- ],
- "PATCH": [
- "ranger-kms"
- ],
- "STANDARD": [
- "ranger-kms"
- ]
- }
- },
- "SLIDER": {
- "SLIDER": {
- "STACK-SELECT-PACKAGE": "slider-client",
- "INSTALL": [
- "slider-client"
- ],
- "PATCH": [
- "slider-client"
- ],
- "STANDARD": [
- "slider-client",
- "hadoop-client"
- ]
- }
- },
- "SPARK": {
- "LIVY_SERVER": {
- "STACK-SELECT-PACKAGE": "livy2-server",
- "INSTALL": [
- "livy2-server"
- ],
- "PATCH": [
- "livy2-server"
- ],
- "STANDARD": [
- "livy2-server"
- ]
- },
- "SPARK_CLIENT": {
- "STACK-SELECT-PACKAGE": "spark2-client",
- "INSTALL": [
- "spark2-client"
- ],
- "PATCH": [
- "spark2-client"
- ],
- "STANDARD": [
- "spark2-client"
- ]
- },
- "SPARK_JOBHISTORYSERVER": {
- "STACK-SELECT-PACKAGE": "spark2-historyserver",
- "INSTALL": [
- "spark2-historyserver"
- ],
- "PATCH": [
- "spark2-historyserver"
- ],
- "STANDARD": [
- "spark2-historyserver"
- ]
- },
- "SPARK_THRIFTSERVER": {
- "STACK-SELECT-PACKAGE": "spark2-thriftserver",
- "INSTALL": [
- "spark2-thriftserver"
- ],
- "PATCH": [
- "spark2-thriftserver"
- ],
- "STANDARD": [
- "spark2-thriftserver"
- ]
- }
- },
- "SQOOP": {
- "SQOOP": {
- "STACK-SELECT-PACKAGE": "sqoop-client",
- "INSTALL": [
- "sqoop-client"
- ],
- "PATCH": [
- "sqoop-client"
- ],
- "STANDARD": [
- "sqoop-client"
- ]
- }
- },
- "STORM": {
- "NIMBUS": {
- "STACK-SELECT-PACKAGE": "storm-nimbus",
- "INSTALL": [
- "storm-client",
- "storm-nimbus"
- ],
- "PATCH": [
- "storm-client",
- "storm-nimbus"
- ],
- "STANDARD": [
- "storm-client",
- "storm-nimbus"
- ]
- },
- "SUPERVISOR": {
- "STACK-SELECT-PACKAGE": "storm-supervisor",
- "INSTALL": [
- "storm-supervisor"
- ],
- "PATCH": [
- "storm-supervisor"
- ],
- "STANDARD": [
- "storm-client",
- "storm-supervisor"
- ]
- },
- "DRPC_SERVER": {
- "STACK-SELECT-PACKAGE": "storm-client",
- "INSTALL": [
- "storm-client"
- ],
- "PATCH": [
- "storm-client"
- ],
- "STANDARD": [
- "storm-client"
- ]
- },
- "STORM_UI_SERVER": {
- "STACK-SELECT-PACKAGE": "storm-client",
- "INSTALL": [
- "storm-client"
- ],
- "PATCH": [
- "storm-client"
- ],
- "STANDARD": [
- "storm-client"
- ]
- }
- },
- "TEZ": {
- "TEZ_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "YARN": {
- "APP_TIMELINE_SERVER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-timelineserver",
- "INSTALL": [
- "hadoop-yarn-timelineserver"
- ],
- "PATCH": [
- "hadoop-yarn-timelineserver"
- ],
- "STANDARD": [
- "hadoop-yarn-timelineserver"
- ]
- },
- "NODEMANAGER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-nodemanager",
- "INSTALL": [
- "hadoop-yarn-nodemanager"
- ],
- "PATCH": [
- "hadoop-yarn-nodemanager"
- ],
- "STANDARD": [
- "hadoop-yarn-nodemanager"
- ]
- },
- "RESOURCEMANAGER": {
- "STACK-SELECT-PACKAGE": "hadoop-yarn-resourcemanager",
- "INSTALL": [
- "hadoop-yarn-resourcemanager"
- ],
- "PATCH": [
- "hadoop-yarn-resourcemanager"
- ],
- "STANDARD": [
- "hadoop-yarn-resourcemanager"
- ]
- },
- "YARN_CLIENT": {
- "STACK-SELECT-PACKAGE": "hadoop-client",
- "INSTALL": [
- "hadoop-client"
- ],
- "PATCH": [
- "INVALID"
- ],
- "STANDARD": [
- "hadoop-client"
- ]
- }
- },
- "ZEPPELIN": {
- "ZEPPELIN_MASTER": {
- "STACK-SELECT-PACKAGE": "zeppelin-server",
- "INSTALL": [
- "zeppelin-server"
- ],
- "PATCH": [
- "zeppelin-server"
- ],
- "STANDARD": [
- "zeppelin-server"
- ]
- }
- },
- "ZOOKEEPER": {
- "ZOOKEEPER_CLIENT": {
- "STACK-SELECT-PACKAGE": "zookeeper-client",
- "INSTALL": [
- "zookeeper-client"
- ],
- "PATCH": [
- "zookeeper-client"
- ],
- "STANDARD": [
- "zookeeper-client"
- ]
- },
- "ZOOKEEPER_SERVER": {
- "STACK-SELECT-PACKAGE": "zookeeper-server",
- "INSTALL": [
- "zookeeper-server"
- ],
- "PATCH": [
- "zookeeper-server"
- ],
- "STANDARD": [
- "zookeeper-server"
- ]
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/custom_actions/test_ru_set_all.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/test_ru_set_all.py b/ambari-server/src/test/python/custom_actions/test_ru_set_all.py
index a488a96..de83f7e 100644
--- a/ambari-server/src/test/python/custom_actions/test_ru_set_all.py
+++ b/ambari-server/src/test/python/custom_actions/test_ru_set_all.py
@@ -115,10 +115,12 @@ class TestRUSetAll(RMFTestCase):
with open(json_file_path, "r") as json_file:
json_payload = json.load(json_file)
+ json_payload['hostLevelParams']['stack_name'] = "HDP"
json_payload['hostLevelParams']['stack_version'] = "2.3"
json_payload['commandParams']['version'] = "2.3.0.0-1234"
json_payload["configurations"]["cluster-env"]["stack_tools"] = self.get_stack_tools()
json_payload["configurations"]["cluster-env"]["stack_features"] = self.get_stack_features()
+ json_payload["configurations"]["cluster-env"]["stack_packages"] = self.get_stack_packages()
config_dict = ConfigDictionary(json_payload)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
index 7c5c7f5..135b239 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py
@@ -244,25 +244,8 @@ class TestHBaseClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hbase-client', version), sudo=True)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'phoenix-client', version), sudo=True)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True)
-
- self.assertEquals(3, mocks_dict['call'].call_count)
- self.assertEquals(6, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[5][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
index 42289e1..a28c3f9 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
@@ -776,18 +776,7 @@ class TestHBaseMaster(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hbase-master', version), sudo=True)
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(3, mocks_dict['checked_call'].call_count)
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
index 6a2d8fb..6f27ecc 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
@@ -586,17 +586,7 @@ class TestHbaseRegionServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None), (0, None), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hbase-regionserver', version), sudo=True)
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(3, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hbase', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
index 973e274..972aa61 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_phoenix_queryserver.py
@@ -439,10 +439,5 @@ class TestPhoenixQueryServer(RMFTestCase):
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES)
- self.assertResourceCalled('Directory', '/etc/hbase/2.3.0.0-1234/0',
- create_parents = True,
- mode = 0755,
- cd_access = 'a',
- )
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'phoenix-server', '2.3.0.0-1234'), sudo=True)
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
index 0f31ad2..966254a 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
@@ -510,22 +510,11 @@ class TestDatanode(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hadoop/conf'), to='/usr/hdp/current/hadoop-client/conf')
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-hdfs-datanode', version), sudo=True,)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
@patch("socket.gethostbyname")
@patch('time.sleep')
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
index 680c984..7a70578 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
@@ -107,21 +107,11 @@ class Test(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True,)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
def test_pre_upgrade_restart(self):
config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/default.json"
with open(config_file, "r") as f:
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
index 06c5fdd..22e4827 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
@@ -412,16 +412,7 @@ class TestJournalnode(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hadoop/conf'), to='/usr/hdp/current/hadoop-client/conf')
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-hdfs-journalnode', version), sudo=True,)
self.assertNoMoreResources()
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
index eb595c1..b26c8fb 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
@@ -1351,12 +1351,8 @@ class TestNamenode(RMFTestCase):
config_file = "nn_eu_standby.json",
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None), (0, None, ''), (0, None)] ,
mocks_dict=mocks_dict)
- calls = mocks_dict['call'].call_args_list
- self.assertTrue(len(calls) >= 1)
- self.assertTrue(calls[0].startsWith("conf-select create-conf-dir --package hadoop --stack-version 2.3.2.0-2844 --conf-version 0"))
@patch("hdfs_namenode.is_this_namenode_active")
@@ -1429,10 +1425,8 @@ class TestNamenode(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, None), (0, None), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', '/etc/hadoop/conf', to='/usr/hdp/current/hadoop-client/conf')
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-hdfs-namenode', version), sudo=True)
self.assertNoMoreResources()
@@ -1665,11 +1659,8 @@ class TestNamenode(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = itertools.cycle([(0, None, None)]),
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', '/etc/hadoop/conf',
- to = '/usr/hdp/current/hadoop-client/conf')
import sys
self.assertEquals("/usr/hdp/2.3.0.0-1234/hadoop/conf", sys.modules["params"].hadoop_conf_dir)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
index 773d3fe..4317c30 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
@@ -295,9 +295,7 @@ class TestNFSGateway(RMFTestCase):
config_dict = json_content,
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
- target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None), (0, None), (0, None)])
- self.assertResourceCalled('Link', ('/etc/hadoop/conf'), to='/usr/hdp/current/hadoop-client/conf')
+ target = RMFTestCase.TARGET_COMMON_SERVICES)
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-hdfs-nfs3', version), sudo=True,)
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
index 3bc597e..f7af5b9 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
@@ -227,25 +227,8 @@ class TestHiveClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, ''), (0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hive/conf'), to='/usr/hdp/current/hive-client/conf')
self.assertResourceCalledIgnoreEarlier('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True,)
self.assertNoMoreResources()
-
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(2, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
index fc6d14e..033680c 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
@@ -910,10 +910,8 @@ From source with checksum 150f554beae04f76f814f59549dead8b"""
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/hive/conf'), to='/usr/hdp/current/hive-client/conf')
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hive-server2', version), sudo=True,)
@@ -932,12 +930,3 @@ From source with checksum 150f554beae04f76f814f59549dead8b"""
hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf',
)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hive', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
index a6a4fa0..943c201 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
@@ -314,7 +314,6 @@ class TestWebHCatServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertTrue("params" in sys.modules)
@@ -325,20 +324,6 @@ class TestWebHCatServer(RMFTestCase):
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hive-webhcat', version), sudo=True,)
self.assertNoMoreResources()
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(2, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hive-hcatalog', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hive-hcatalog', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
@patch("resource_management.core.shell.call")
def test_rolling_restart_configure(self, call_mock):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
index 31d54ae..f160029 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py
@@ -270,19 +270,8 @@ class TestOozieClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/oozie/conf'), to='/usr/hdp/current/oozie-client/conf')
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'oozie-client', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
index 17b8abf..dfa22fd 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
@@ -1259,7 +1259,7 @@ class TestOozieServer(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.UPGRADE_STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, prepare_war_stdout)],
+ call_mocks = [(0, prepare_war_stdout)],
mocks_dict = mocks_dict)
self.assertTrue(isfile_mock.called)
@@ -1270,10 +1270,6 @@ class TestOozieServer(RMFTestCase):
self.assertEqual(glob_mock.call_count,1)
glob_mock.assert_called_with('/usr/hdp/2.3.0.0-1234/hadoop/lib/hadoop-lzo*.jar')
- self.assertResourceCalled('Link', '/etc/oozie/conf',
- to = '/usr/hdp/current/oozie-client/conf',
- )
-
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'oozie-client', '2.3.0.0-1234'), sudo = True)
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'oozie-server', '2.3.0.0-1234'), sudo = True)
@@ -1284,17 +1280,6 @@ class TestOozieServer(RMFTestCase):
self.assertResourceCalled('File', '/usr/hdp/current/oozie-server/libext/ext-2.2.zip', mode = 0644)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
@patch("os.path.isdir")
@patch("os.path.exists")
@@ -1505,7 +1490,7 @@ class TestOozieServer(RMFTestCase):
classname = "OozieServer", command = "pre_upgrade_restart", config_dict = json_content,
stack_version = self.UPGRADE_STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, prepare_war_stdout)],
+ call_mocks = [(0, prepare_war_stdout)],
mocks_dict = mocks_dict)
self.assertTrue(isfile_mock.called)
@@ -1516,7 +1501,6 @@ class TestOozieServer(RMFTestCase):
self.assertEqual(glob_mock.call_count,1)
glob_mock.assert_called_with('/usr/hdp/2.3.0.0-1234/hadoop/lib/hadoop-lzo*.jar')
- self.assertResourceCalled('Link', '/etc/oozie/conf', to = '/usr/hdp/current/oozie-client/conf')
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'oozie-client', '2.3.0.0-1234'), sudo = True)
self.assertResourceCalled('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'oozie-server', '2.3.0.0-1234'), sudo = True)
@@ -1532,14 +1516,3 @@ class TestOozieServer(RMFTestCase):
self.assertResourceCalled('Execute', 'ambari-sudo.sh chown oozie:hadoop /usr/hdp/current/oozie-server/libext/falcon-oozie-el-extension-*.jar')
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
-
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'oozie', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/PIG/test_pig_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/PIG/test_pig_client.py b/ambari-server/src/test/python/stacks/2.0.6/PIG/test_pig_client.py
index 63076f9..3c4f899 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/PIG/test_pig_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/PIG/test_pig_client.py
@@ -167,24 +167,8 @@ class TestPigClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None, '')],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(2, mocks_dict['call'].call_count)
- self.assertEquals(2, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'pig', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[1][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'pig', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[1][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/SQOOP/test_sqoop.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/SQOOP/test_sqoop.py b/ambari-server/src/test/python/stacks/2.0.6/SQOOP/test_sqoop.py
index 4622ae3..053d44a 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/SQOOP/test_sqoop.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/SQOOP/test_sqoop.py
@@ -141,17 +141,6 @@ class TestSqoop(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
- self.assertResourceCalled('Link', ('/etc/sqoop/conf'), to='/usr/hdp/current/sqoop-client/conf')
self.assertResourceCalled("Execute", ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'sqoop-client', version), sudo=True)
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'sqoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'sqoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py
index e156af2..ba3d0ab 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py
@@ -791,6 +791,3 @@ class TestHistoryServer(RMFTestCase):
)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py
index 5898355..75eff39 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_mapreduce2_client.py
@@ -416,21 +416,11 @@ class TestMapReduce2Client(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True)
self.assertNoMoreResources()
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
-
def test_stack_upgrade_save_new_config(self):
config_file = self.get_src_folder()+"/test/python/stacks/2.0.6/configs/client-upgrade.json"
with open(config_file, "r") as f:
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
index 4281696..642043d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
@@ -663,17 +663,7 @@ class TestNodeManager(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-yarn-nodemanager', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
index 652fea8..8e92116 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
@@ -552,17 +552,7 @@ class TestResourceManager(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-yarn-resourcemanager', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py
index 09a6278..375028a 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_client.py
@@ -583,17 +583,7 @@ class TestYarnClient(RMFTestCase):
config_overrides = self.CONFIG_OVERRIDES,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'hadoop-client', version), sudo=True)
self.assertNoMoreResources()
-
- self.assertEquals(1, mocks_dict['call'].call_count)
- self.assertEquals(1, mocks_dict['checked_call'].call_count)
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['checked_call'].call_args_list[0][0][0])
- self.assertEquals(
- ('ambari-python-wrap', '/usr/bin/conf-select', 'create-conf-dir', '--package', 'hadoop', '--stack-version', '2.3.0.0-1234', '--conf-version', '0'),
- mocks_dict['call'].call_args_list[0][0][0])
[32/50] [abbrv] ambari git commit: AMBARI-21673. Deploy fails with
alert_state constraint violation (Myroslav Papirkovskyy via alejandro)
Posted by ab...@apache.org.
AMBARI-21673. Deploy fails with alert_state constraint violation (Myroslav Papirkovskyy via alejandro)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e88b61e6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e88b61e6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e88b61e6
Branch: refs/heads/branch-feature-logsearch-ui
Commit: e88b61e6c7831a569876dcbac524fbe2b465c967
Parents: 7a90a26
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Mon Aug 7 17:10:05 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Mon Aug 7 17:10:05 2017 -0700
----------------------------------------------------------------------
.../stacks/HDP/3.0/configuration/cluster-env.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e88b61e6/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
index c2e2971..2fa33bd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/configuration/cluster-env.xml
@@ -220,6 +220,18 @@ gpgcheck=0</value>
</value-attributes>
<on-ambari-upgrade add="true"/>
</property>
+ <!-- Define stack_name property in the base stack. DO NOT override this property for each stack version -->
+ <property>
+ <name>stack_name</name>
+ <value>HDP</value>
+ <description>The name of the stack.</description>
+ <value-attributes>
+ <read-only>true</read-only>
+ <overridable>false</overridable>
+ <visible>false</visible>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ </property>
<!-- Define stack_tools property in the base stack. DO NOT override this property for each stack version -->
<property>
<name>stack_tools</name>
[10/50] [abbrv] ambari git commit: AMBARI-21621 Do not call
refreshnodes command after deleting a slave (dsen)
Posted by ab...@apache.org.
AMBARI-21621 Do not call refreshnodes command after deleting a slave (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a122a22
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a122a22
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a122a22
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 4a122a220d28da86da7cafdf89d00b5c09ae4193
Parents: a45e8f4
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Aug 3 14:46:51 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Aug 3 14:46:51 2017 +0300
----------------------------------------------------------------------
.../ambari/server/controller/AmbariManagementControllerImpl.java | 2 +-
.../common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../HDFS/2.1.0.2.0/package/scripts/params_windows.py | 2 +-
.../common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../HDFS/3.0.0.3.0/package/scripts/params_windows.py | 2 +-
.../stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py | 2 +-
.../ambari/server/controller/AmbariManagementControllerTest.java | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 3016027..9f0fa34 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3725,7 +3725,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
requestProperties.put("context", "Update Include and Exclude Files for " + serviceMasterMap.keySet().toString());
requestProperties.put("exclusive", "true");
HashMap<String, String> params = new HashMap<>();
- params.put(AmbariCustomCommandExecutionHelper.UPDATE_FILES_ONLY, "false");
+ params.put(AmbariCustomCommandExecutionHelper.UPDATE_FILES_ONLY, String.valueOf(isDecommission));
for (String masterName : masterSlaveHostsMap.keySet()) {
if (!isDecommission) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index c9df2b9..256211f 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -169,7 +169,7 @@ include_file_path = default("/configurations/hdfs-site/dfs.hosts", None)
hdfs_include_file = None
manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
if include_file_path and manage_include_files:
- hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+ hdfs_include_file = slave_hosts
update_files_only = default("/commandParams/update_files_only",False)
command_phase = default("/commandParams/phase","")
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
index b3ac578..d01c83a 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_windows.py
@@ -48,7 +48,7 @@ hdfs_include_file = None
manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
if include_file_path and manage_include_files:
slave_hosts = default("/clusterHostInfo/slave_hosts", [])
- hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+ hdfs_include_file = slave_hosts
update_files_only = default("/commandParams/update_files_only",False)
# HDFS High Availability properties
dfs_ha_enabled = False
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
index 1581c2a..de735f4 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_linux.py
@@ -163,7 +163,7 @@ include_file_path = default("/configurations/hdfs-site/dfs.hosts", None)
hdfs_include_file = None
manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
if include_file_path and manage_include_files:
- hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+ hdfs_include_file = slave_hosts
update_files_only = default("/commandParams/update_files_only", False)
command_phase = default("/commandParams/phase","")
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py
index 6c492d8..9d35e5b 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/params_windows.py
@@ -48,7 +48,7 @@ hdfs_include_file = None
manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
if include_file_path and manage_include_files:
slave_hosts = default("/clusterHostInfo/slave_hosts", [])
- hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+ hdfs_include_file = slave_hosts
update_files_only = default("/commandParams/update_files_only",False)
# HDFS High Availability properties
dfs_ha_enabled = False
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
index 9cf163a..3a711c7 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
@@ -60,7 +60,7 @@ include_file_path = default("/configurations/hdfs-site/dfs.hosts", None)
hdfs_include_file = None
manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
if include_file_path and manage_include_files:
- hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+ hdfs_include_file = slave_hosts
update_files_only = default("/commandParams/update_files_only",False)
kinit_path_local = functions.get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a122a22/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 5fb236b..bda9576 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -9392,7 +9392,7 @@ public class AmbariManagementControllerTest {
Map<String, String> requestParams = StageUtils.getGson().fromJson(request.getInputs(), type);
assertEquals(2, requestParams.size());
assertEquals("true", requestParams.get("multi_services_decom_request"));
- assertEquals("false", requestParams.get("update_files_only"));
+ assertEquals("true", requestParams.get("update_files_only"));
assertEquals(1, request.getResourceFilters().size());
RequestResourceFilter resourceFilter = request.getResourceFilters().get(0);
assertEquals(resourceFilter.getServiceName(), hdfsService);
[04/50] [abbrv] ambari git commit: AMBARI-21581 - Replace Hard Coded
conf-select Structures (jonathanhurley)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_server.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_server.py
index 9bd5c6e..e3a4f36 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_server.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_server.py
@@ -19,7 +19,7 @@ Ambari Agent
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -77,8 +77,6 @@ class WebHCatServerDefault(WebHCatServer):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
# webhcat has no conf, but uses hadoop home, so verify that regular hadoop conf is set
- conf_select.select(params.stack_name, "hive-hcatalog", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/kafka_broker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/kafka_broker.py b/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/kafka_broker.py
index 23fcaed..7ddd1ab 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/kafka_broker.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/kafka_broker.py
@@ -19,7 +19,6 @@ limitations under the License.
from resource_management import Script
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute, File, Directory
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import Direction
from resource_management.libraries.functions.version import format_stack_version
@@ -51,9 +50,6 @@ class KafkaBroker(Script):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
- if params.version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.version):
- conf_select.select(params.stack_name, "kafka", params.version)
-
# This is extremely important since it should only be called if crossing the HDP 2.3.4.0 boundary.
if params.current_version and params.version and params.upgrade_direction:
src_version = dst_version = None
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka_broker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka_broker.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka_broker.py
index 23fcaed..0910156 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka_broker.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/kafka_broker.py
@@ -19,7 +19,6 @@ limitations under the License.
from resource_management import Script
from resource_management.core.logger import Logger
from resource_management.core.resources.system import Execute, File, Directory
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import Direction
from resource_management.libraries.functions.version import format_stack_version
@@ -51,10 +50,7 @@ class KafkaBroker(Script):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
- if params.version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.version):
- conf_select.select(params.stack_name, "kafka", params.version)
-
- # This is extremely important since it should only be called if crossing the HDP 2.3.4.0 boundary.
+ # This is extremely important since it should only be called if crossing the HDP 2.3.4.0 boundary.
if params.current_version and params.version and params.upgrade_direction:
src_version = dst_version = None
if params.upgrade_direction == Direction.UPGRADE:
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
index b086bef..456d6b4 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox_gateway.py
@@ -22,7 +22,7 @@ import os
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.security_commons import build_expectations
from resource_management.libraries.functions.security_commons import cached_kinit_executor
@@ -116,8 +116,6 @@ class KnoxGatewayDefault(KnoxGateway):
absolute_backup_dir = upgrade.backup_data()
Logger.info("Knox data was successfully backed up to {0}".format(absolute_backup_dir))
- # <conf-selector-tool> will change the symlink to the conf folder.
- conf_select.select(params.stack_name, "knox", params.version)
stack_select.select_packages(params.version)
# seed the new Knox data directory with the keystores of yesteryear
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/knox_gateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/knox_gateway.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/knox_gateway.py
index b086bef..456d6b4 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/knox_gateway.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/knox_gateway.py
@@ -22,7 +22,7 @@ import os
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.functions.security_commons import build_expectations
from resource_management.libraries.functions.security_commons import cached_kinit_executor
@@ -116,8 +116,6 @@ class KnoxGatewayDefault(KnoxGateway):
absolute_backup_dir = upgrade.backup_data()
Logger.info("Knox data was successfully backed up to {0}".format(absolute_backup_dir))
- # <conf-selector-tool> will change the symlink to the conf folder.
- conf_select.select(params.stack_name, "knox", params.version)
stack_select.select_packages(params.version)
# seed the new Knox data directory with the keystores of yesteryear
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout_client.py b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout_client.py
index b598d17..33ec513 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout_client.py
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout_client.py
@@ -21,7 +21,6 @@ Ambari Agent
from resource_management.core.logger import Logger
from resource_management.core.exceptions import ClientComponentHasNoStatus
from resource_management.libraries.functions import stack_select
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.script import Script
from mahout import mahout
from resource_management.libraries.functions.default import default
@@ -34,7 +33,6 @@ class MahoutClient(Script):
import params
env.set_params(params)
- conf_select.select(params.stack_name, "mahout", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
index f06d90a..6fbd66a 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.logger import Logger
@@ -57,7 +57,6 @@ class OozieClient(Script):
return
Logger.info("Executing Oozie Client Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "oozie", params.version)
stack_select.select_packages(params.version)
# We substitute some configs (oozie.authentication.kerberos.principal) before generation (see oozie.py and params.py).
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
index e823941..81497bc 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.core import Logger
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -67,9 +66,6 @@ class OozieServer(Script):
# Sets the symlink : eg: <stack-root>/current/oozie-server -> <stack-root>/a.b.c.d-<version>/oozie
stack_select.select_packages(params.version)
- if params.version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.version):
- conf_select.select(params.stack_name, "oozie", params.version)
-
env.set_params(params)
oozie(is_server=True)
@@ -122,7 +118,6 @@ class OozieServerDefault(OozieServer):
Logger.info("Executing Oozie Server Stack Upgrade pre-restart")
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "oozie", params.version)
stack_select.select_packages(params.version)
OozieUpgrade.prepare_libext_directory()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_client.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_client.py
index f06d90a..6fbd66a 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_client.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.core.logger import Logger
@@ -57,7 +57,6 @@ class OozieClient(Script):
return
Logger.info("Executing Oozie Client Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "oozie", params.version)
stack_select.select_packages(params.version)
# We substitute some configs (oozie.authentication.kerberos.principal) before generation (see oozie.py and params.py).
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py
index 8af08b6..6d7766f 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.core import Logger
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -68,9 +67,6 @@ class OozieServer(Script):
# Sets the symlink : eg: <stack-root>/current/oozie-server -> <stack-root>/a.b.c.d-<version>/oozie
stack_select.select_packages(params.version)
- if params.version and check_stack_feature(StackFeature.CONFIG_VERSIONING, params.version):
- conf_select.select(params.stack_name, "oozie", params.version)
-
env.set_params(params)
oozie(is_server=True)
@@ -123,7 +119,6 @@ class OozieServerDefault(OozieServer):
Logger.info("Executing Oozie Server Stack Upgrade pre-restart")
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "oozie", params.version)
stack_select.select_packages(params.version)
OozieUpgrade.prepare_libext_directory()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
index 9a33c88..7ded264 100644
--- a/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
+++ b/ambari-server/src/main/resources/common-services/PIG/0.12.0.2.0/package/scripts/pig_client.py
@@ -22,7 +22,7 @@ Ambari Agent
import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from pig import pig
@@ -47,8 +47,6 @@ class PigClientLinux(PigClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "pig", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
index 9a33c88..7ded264 100644
--- a/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
+++ b/ambari-server/src/main/resources/common-services/PIG/0.16.1.3.0/package/scripts/pig_client.py
@@ -22,7 +22,7 @@ Ambari Agent
import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from pig import pig
@@ -47,8 +47,6 @@ class PigClientLinux(PigClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "pig", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def install(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
index e27a03e..f779c18 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.core.exceptions import Fail
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions import stack_select
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.script import Script
from resource_management.core.resources.system import Execute, File
@@ -33,7 +32,6 @@ from setup_ranger_xml import setup_ranger_audit_solr, setup_ranger_admin_passwd_
from resource_management.libraries.functions import solr_cloud_util
from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
from resource_management.libraries.functions.constants import Direction
-import upgrade
import os, errno
class RangerAdmin(Script):
@@ -75,7 +73,7 @@ class RangerAdmin(Script):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-admin")
+ stack_select.select_packages(params.version)
self.set_ru_rangeradmin_in_progress(params.upgrade_marker_file)
@@ -204,11 +202,7 @@ class RangerAdmin(Script):
if upgrade_stack is None:
raise Fail('Unable to determine the stack and stack version')
- stack_name = upgrade_stack[0]
- stack_version = upgrade_stack[1]
-
stack_select.select_packages(params.version)
- conf_select.select(stack_name, "ranger-admin", stack_version)
def get_log_folder(self):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
index c9b5c4f..3aae8ff 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
@@ -18,7 +18,6 @@ limitations under the License.
"""
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute, File
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -29,7 +28,6 @@ from resource_management.core import shell
from ranger_service import ranger_service
from setup_ranger_xml import ranger, ranger_credential_helper
from resource_management.core.exceptions import Fail
-import upgrade
class RangerTagsync(Script):
@@ -85,7 +83,6 @@ class RangerTagsync(Script):
if params.stack_supports_ranger_tagsync:
Logger.info("Executing Ranger Tagsync Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "ranger-tagsync", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
@@ -109,11 +106,8 @@ class RangerTagsync(Script):
if upgrade_stack is None:
raise Fail('Unable to determine the stack and stack version')
- stack_name = upgrade_stack[0]
- stack_version = upgrade_stack[1]
-
stack_select.select_packages(params.version)
- conf_select.select(stack_name, "ranger-tagsync", stack_version)
+
if params.stack_supports_ranger_tagsync_ssl_xml_support:
Logger.info("Upgrading Tagsync, stack support Atlas user for Tagsync, creating keystore for same.")
self.create_atlas_user_keystore(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
index 8654bc2..cc0075b 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
@@ -22,12 +22,12 @@ from resource_management.libraries.script import Script
from resource_management.core.resources.system import Execute, File
from resource_management.core.exceptions import ComponentIsNotRunning
from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions import stack_select
from resource_management.core.logger import Logger
from resource_management.core import shell
from ranger_service import ranger_service
from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
from resource_management.libraries.functions.constants import Direction
-import upgrade
import os
class RangerUsersync(Script):
@@ -107,7 +107,7 @@ class RangerUsersync(Script):
def pre_upgrade_restart(self, env, upgrade_type=None):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-usersync")
+ stack_select.select_packages(params.version)
def get_log_folder(self):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/upgrade.py
deleted file mode 100644
index ca1b2bf..0000000
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/upgrade.py
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#!/usr/bin/env python
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF 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 resource_management.core.resources.system import Execute
-from resource_management.libraries.functions import conf_select
-from resource_management.libraries.functions import stack_select
-from resource_management.libraries.functions.format import format
-
-def prestart(env, stack_component):
- import params
-
- if params.version and params.stack_supports_rolling_upgrade:
- conf_select.select(params.stack_name, stack_component, params.version)
- stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
index b13d6ed..a9e2857 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
@@ -20,7 +20,6 @@ limitations under the License.
from resource_management.core.exceptions import Fail
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions import stack_select
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions.constants import Direction
from resource_management.libraries.script import Script
from resource_management.core.resources.system import Execute, File
@@ -68,7 +67,7 @@ class RangerAdmin(Script):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-admin")
+ upgrade.prestart(env)
self.set_ru_rangeradmin_in_progress(params.upgrade_marker_file)
@@ -193,7 +192,6 @@ class RangerAdmin(Script):
stack_version = upgrade_stack[1]
stack_select.select_packages(params.version)
- conf_select.select(stack_name, "ranger-admin", stack_version)
def get_log_folder(self):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
index 35f9fe6..85963cf 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
@@ -18,7 +18,6 @@ limitations under the License.
"""
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute, File
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -85,7 +84,6 @@ class RangerTagsync(Script):
if params.stack_supports_ranger_tagsync:
Logger.info("Executing Ranger Tagsync Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "ranger-tagsync", params.version)
stack_select.select_packages(params.version)
@@ -110,11 +108,8 @@ class RangerTagsync(Script):
if upgrade_stack is None:
raise Fail('Unable to determine the stack and stack version')
- stack_name = upgrade_stack[0]
- stack_version = upgrade_stack[1]
-
stack_select.select_packages(params.version)
- conf_select.select(stack_name, "ranger-tagsync", stack_version)
+
if params.stack_supports_ranger_tagsync_ssl_xml_support:
Logger.info("Upgrading Tagsync, stack support Atlas user for Tagsync, creating keystore for same.")
self.create_atlas_user_keystore(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_usersync.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_usersync.py
index fa5a320..7d5ec29 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_usersync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_usersync.py
@@ -103,7 +103,7 @@ class RangerUsersync(Script):
def pre_upgrade_restart(self, env, upgrade_type=None):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-usersync")
+ upgrade.prestart(env)
def get_log_folder(self):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/upgrade.py
index ca1b2bf..597c868 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/upgrade.py
@@ -19,13 +19,11 @@ limitations under the License.
"""
from resource_management.core.resources.system import Execute
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
-def prestart(env, stack_component):
+def prestart(env):
import params
if params.version and params.stack_supports_rolling_upgrade:
- conf_select.select(params.stack_name, stack_component, params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
index 0bd11f3..fcf2478 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
@@ -29,7 +29,6 @@ from resource_management.core import shell
from resource_management.libraries.functions.default import default
from kms import kms, setup_kms_db, setup_java_patch, enable_kms_plugin, setup_kms_jce, update_password_configs
from kms_service import kms_service
-import upgrade
class KmsServer(Script):
@@ -94,7 +93,7 @@ class KmsServer(Script):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-kms")
+ stack_select.select_packages(params.version)
kms(upgrade_type=upgrade_type)
setup_java_patch()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/upgrade.py
deleted file mode 100644
index 73c32ff..0000000
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/upgrade.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-"""
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF 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 resource_management.core.resources.system import Execute
-from resource_management.libraries.functions import conf_select
-from resource_management.libraries.functions import stack_select
-from resource_management.libraries.functions.format import format
-
-def prestart(env, stack_component):
- import params
-
- if params.version and params.stack_supports_config_versioning:
- conf_select.select(params.stack_name, stack_component, params.version)
- stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
index 3b138fc..4c313c4 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
@@ -86,7 +86,7 @@ class KmsServer(Script):
import params
env.set_params(params)
- upgrade.prestart(env, "ranger-kms")
+ upgrade.prestart(env)
kms(upgrade_type=upgrade_type)
setup_java_patch()
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/upgrade.py
index 73c32ff..465d54e 100644
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/upgrade.py
@@ -22,9 +22,8 @@ from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
-def prestart(env, stack_component):
+def prestart(env):
import params
if params.version and params.stack_supports_config_versioning:
- conf_select.select(params.stack_name, stack_component, params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
index 9284c81..45c7785 100644
--- a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
+++ b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider_client.py
@@ -19,7 +19,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from slider import slider
@@ -38,14 +38,8 @@ class SliderClientLinux(SliderClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "slider", params.version)
stack_select.select_packages(params.version)
- # also set all of the hadoop clients since slider client is upgraded as
- # part of the final "CLIENTS" group and we need to ensure that
- # hadoop-client is also set
- conf_select.select(params.stack_name, "hadoop", params.version)
-
def install(self, env):
self.install_packages(env)
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SLIDER/0.91.0.3.0/package/scripts/slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SLIDER/0.91.0.3.0/package/scripts/slider_client.py b/ambari-server/src/main/resources/common-services/SLIDER/0.91.0.3.0/package/scripts/slider_client.py
index 9284c81..45c7785 100644
--- a/ambari-server/src/main/resources/common-services/SLIDER/0.91.0.3.0/package/scripts/slider_client.py
+++ b/ambari-server/src/main/resources/common-services/SLIDER/0.91.0.3.0/package/scripts/slider_client.py
@@ -19,7 +19,7 @@ limitations under the License.
"""
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from slider import slider
@@ -38,14 +38,8 @@ class SliderClientLinux(SliderClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "slider", params.version)
stack_select.select_packages(params.version)
- # also set all of the hadoop clients since slider client is upgraded as
- # part of the final "CLIENTS" group and we need to ensure that
- # hadoop-client is also set
- conf_select.select(params.stack_name, "hadoop", params.version)
-
def install(self, env):
self.install_packages(env)
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/job_history_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/job_history_server.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/job_history_server.py
index 9bdc4b9..009adbd 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/job_history_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/job_history_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -73,7 +73,6 @@ class JobHistoryServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark Job History Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark", params.version)
stack_select.select_packages(params.version)
# Spark 1.3.1.2.3, and higher, which was included in HDP 2.3, does not have a dependency on Tez, so it does not
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_server.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_server.py
index ae26fac..726f94f 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_server.py
@@ -31,7 +31,7 @@ from resource_management import shell
from resource_management.libraries.functions.decorator import retry
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from livy_service import livy_service
from setup_livy import setup_livy
@@ -132,7 +132,6 @@ class LivyServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Livy Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_client.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_client.py
index a2e26b8..8136a18 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_client.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_client.py
@@ -23,7 +23,7 @@ import sys
# Local imports
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -69,7 +69,6 @@ class SparkClient(Script):
# Because this script was called from ru_execute_tasks.py which already enters an Environment with its own basedir,
# must change it now so this function can find the Jinja Templates for the service.
env.config.basedir = base_dir
- conf_select.select(params.stack_name, conf_select_name, params.version)
self.configure(env, config_dir=config_dir, upgrade_type=UPGRADE_TYPE_ROLLING)
def pre_upgrade_restart(self, env, upgrade_type=None):
@@ -78,7 +77,6 @@ class SparkClient(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark Client Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark", params.version)
stack_select.select_packages(params.version)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_thrift_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_thrift_server.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_thrift_server.py
index 7d595f2..f8e571b 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_thrift_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/spark_thrift_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -68,7 +68,6 @@ class SparkThriftServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark Thrift Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/job_history_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/job_history_server.py b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/job_history_server.py
index 9935063..7cbb646 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/job_history_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/job_history_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -74,7 +74,6 @@ class JobHistoryServer(Script):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark Job History Server Stack Upgrade pre-restart")
# TODO, change to "spark" after RPM switches the name
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
# Spark 1.3.1.2.3, and higher, which was included in HDP 2.3, does not have a dependency on Tez, so it does not
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_server.py b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_server.py
index e801639..1bbb9c3 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_server.py
@@ -31,7 +31,7 @@ from resource_management import shell
from resource_management.libraries.functions.decorator import retry
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from livy_service import livy_service
from setup_livy import setup_livy
@@ -132,7 +132,6 @@ class LivyServer(Script):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Livy Server Stack Upgrade pre-restart")
# TODO, change to "spark" and "livy" after RPM switches the name
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_client.py b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_client.py
index 2ff69e7..8c3a52c 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_client.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -50,7 +50,6 @@ class SparkClient(Script):
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark Client Stack Upgrade pre-restart")
# TODO, change to "spark" after RPM switches the name
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_thrift_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_thrift_server.py b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_thrift_server.py
index 6a1bd87..aff1a34 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_thrift_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/spark_thrift_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -68,7 +68,6 @@ class SparkThriftServer(Script):
env.set_params(params)
Logger.info("Executing Spark Thrift Server Stack Upgrade pre-restart")
# TODO, change to "spark" after RPM switches the name
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/job_history_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/job_history_server.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/job_history_server.py
index b6a792a..311b6b2 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/job_history_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/job_history_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -73,7 +73,6 @@ class JobHistoryServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark2 Job History Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
# Spark 1.3.1.2.3, and higher, which was included in HDP 2.3, does not have a dependency on Tez, so it does not
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_server.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_server.py
index c710757..50604d4 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_server.py
@@ -31,7 +31,7 @@ from resource_management import shell
from resource_management.libraries.functions.decorator import retry
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from livy2_service import livy2_service
from setup_livy2 import setup_livy
@@ -131,7 +131,6 @@ class LivyServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Livy2 Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_client.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_client.py
index 6b0cd89..0c7c4c3 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_client.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_client.py
@@ -20,7 +20,7 @@ limitations under the License.
import sys
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.core.exceptions import ClientComponentHasNoStatus
@@ -49,7 +49,6 @@ class SparkClient(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
Logger.info("Executing Spark2 Client Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark", params.version)
stack_select.select_packages(params.version)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_thrift_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_thrift_server.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_thrift_server.py
index 7c7982b..a0900f9 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_thrift_server.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/spark_thrift_server.py
@@ -22,7 +22,7 @@ import sys
import os
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select, stack_select
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.check_process_status import check_process_status
@@ -67,7 +67,6 @@ class SparkThriftServer(Script):
env.set_params(params)
Logger.info("Executing Spark2 Thrift Server Stack Upgrade pre-restart")
- conf_select.select(params.stack_name, "spark2", params.version)
stack_select.select_packages(params.version)
def get_log_folder(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
index 8c7dd35..6c637b9 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py
@@ -22,7 +22,6 @@ from resource_management.core.exceptions import ClientComponentHasNoStatus
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.default import default
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions import StackFeature
@@ -50,8 +49,7 @@ class SqoopClientDefault(SqoopClient):
import params
env.set_params(params)
- if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "sqoop", params.version)
+ if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py
index 8c7dd35..6c637b9 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py
@@ -22,7 +22,6 @@ from resource_management.core.exceptions import ClientComponentHasNoStatus
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.default import default
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions import StackFeature
@@ -50,8 +49,7 @@ class SqoopClientDefault(SqoopClient):
import params
env.set_params(params)
- if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "sqoop", params.version)
+ if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/drpc_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/drpc_server.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/drpc_server.py
index 06f6de9..7d483b6 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/drpc_server.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/drpc_server.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -51,7 +50,6 @@ class DrpcServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
index bf38a2d..1d000bf 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
@@ -22,7 +22,6 @@ import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
from resource_management.libraries.functions import format
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -55,7 +54,6 @@ class NimbusDefault(Nimbus):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py
index 18d8fea..26c23d4 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py
@@ -22,7 +22,6 @@ import sys
from resource_management.libraries.script import Script
from storm import storm
from supervisord_service import supervisord_service, supervisord_check_status
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -46,7 +45,6 @@ class Nimbus(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/pacemaker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/pacemaker.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/pacemaker.py
index f111f25..c348c20 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/pacemaker.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/pacemaker.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -50,7 +49,6 @@ class PaceMaker(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py
index 6c88a9e..198d17a 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -73,7 +72,6 @@ class SupervisorDefault(Supervisor):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py
index 46626bc..c98346b 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py
@@ -23,7 +23,6 @@ from storm import storm
from service import service
from supervisord_service import supervisord_service, supervisord_check_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -47,7 +46,6 @@ class Supervisor(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
index 571784c..1f20f36 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
@@ -24,7 +24,6 @@ from service import service
from service_check import ServiceCheck
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Link
@@ -78,7 +77,6 @@ class UiServerDefault(UiServer):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def link_metrics_sink_jar(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/drpc_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/drpc_server.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/drpc_server.py
index 06f6de9..7d483b6 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/drpc_server.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/drpc_server.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -51,7 +50,6 @@ class DrpcServer(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus.py
index f641137..18823e8 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus.py
@@ -22,7 +22,6 @@ import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
from resource_management.libraries.functions import format
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -55,7 +54,6 @@ class NimbusDefault(Nimbus):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus_prod.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus_prod.py
index 18d8fea..26c23d4 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus_prod.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/nimbus_prod.py
@@ -22,7 +22,6 @@ import sys
from resource_management.libraries.script import Script
from storm import storm
from supervisord_service import supervisord_service, supervisord_check_status
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -46,7 +45,6 @@ class Nimbus(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/pacemaker.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/pacemaker.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/pacemaker.py
index f111f25..c348c20 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/pacemaker.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/pacemaker.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -50,7 +49,6 @@ class PaceMaker(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor.py
index 6c88a9e..198d17a 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor.py
@@ -21,7 +21,6 @@ limitations under the License.
import sys
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -73,7 +72,6 @@ class SupervisorDefault(Supervisor):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor_prod.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor_prod.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor_prod.py
index 46626bc..c98346b 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor_prod.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisor_prod.py
@@ -23,7 +23,6 @@ from storm import storm
from service import service
from supervisord_service import supervisord_service, supervisord_check_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Execute
@@ -47,7 +46,6 @@ class Supervisor(Script):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def start(self, env, upgrade_type=None):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/ui_server.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/ui_server.py
index 571784c..1f20f36 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/ui_server.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/ui_server.py
@@ -24,7 +24,6 @@ from service import service
from service_check import ServiceCheck
from resource_management.libraries.functions import check_process_status
from resource_management.libraries.script import Script
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format
from resource_management.core.resources.system import Link
@@ -78,7 +77,6 @@ class UiServerDefault(UiServer):
import params
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "storm", params.version)
stack_select.select_packages(params.version)
def link_metrics_sink_jar(self):
http://git-wip-us.apache.org/repos/asf/ambari/blob/97ccf3bf/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
index 8a6a6d3..ed3f5fd 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -28,7 +28,6 @@ from ambari_commons.os_utils import copy_file, extract_path_component
from resource_management.core.exceptions import ClientComponentHasNoStatus
from resource_management.core.source import InlineTemplate
-from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -72,12 +71,9 @@ class TezClientLinux(TezClient):
config_dir = self.get_config_dir_during_stack_upgrade(env, base_dir, conf_select_name)
if config_dir:
- Logger.info("stack_upgrade_save_new_config(): Calling conf-select on %s using version %s" % (conf_select_name, str(params.version)))
-
# Because this script was called from ru_execute_tasks.py which already enters an Environment with its own basedir,
# must change it now so this function can find the Jinja Templates for the service.
env.config.basedir = base_dir
- conf_select.select(params.stack_name, conf_select_name, params.version)
self.configure(env, config_dir=config_dir)
def pre_upgrade_restart(self, env, upgrade_type=None):
@@ -85,8 +81,6 @@ class TezClientLinux(TezClient):
env.set_params(params)
if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
- conf_select.select(params.stack_name, "tez", params.version)
- conf_select.select(params.stack_name, "hadoop", params.version)
stack_select.select_packages(params.version)
def install(self, env):
[15/50] [abbrv] ambari git commit: AMBARI-21648. Do not use 'dbo'
schema name in idempotent Ambari DDL generator for AzureDB. (stoader)
Posted by ab...@apache.org.
AMBARI-21648. Do not use 'dbo' schema name in idempotent Ambari DDL generator for AzureDB. (stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/98f15c94
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/98f15c94
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/98f15c94
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 98f15c94ee73c7d7ef938108772d3495e1d13e43
Parents: a5b8045
Author: Toader, Sebastian <st...@hortonworks.com>
Authored: Fri Aug 4 10:04:32 2017 +0200
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Fri Aug 4 10:04:51 2017 +0200
----------------------------------------------------------------------
ambari-server/src/main/python/azuredb_create_generator.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/98f15c94/ambari-server/src/main/python/azuredb_create_generator.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/azuredb_create_generator.py b/ambari-server/src/main/python/azuredb_create_generator.py
index 6ceaa90..1794d79 100755
--- a/ambari-server/src/main/python/azuredb_create_generator.py
+++ b/ambari-server/src/main/python/azuredb_create_generator.py
@@ -38,7 +38,7 @@ for statement in input_statements:
statement = re.sub(
create_table_re,
dedent('''\
- IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('dbo.\g<1>') AND type = 'U')
+ IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('\g<1>') AND type = 'U')
BEGIN
\g<0>
END
[34/50] [abbrv] ambari git commit: AMBARI-21672 - Update
Orchestration to support MAINT (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21672 - Update Orchestration to support MAINT (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3155a43e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3155a43e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3155a43e
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 3155a43e591499e9501ee3b2f6e5f095a9883177
Parents: 2d69fc7
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Aug 7 11:03:09 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Tue Aug 8 10:11:53 2017 -0400
----------------------------------------------------------------------
.../ambari/server/state/UpgradeContext.java | 140 +++++++----
.../ambari/server/state/UpgradeContextTest.java | 246 ++++++++++++++++---
2 files changed, 309 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3155a43e/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
index 0e409a4..a4ed080 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
@@ -65,6 +65,7 @@ import org.apache.ambari.server.orm.entities.UpgradeEntity;
import org.apache.ambari.server.orm.entities.UpgradeHistoryEntity;
import org.apache.ambari.server.stack.MasterHostResolver;
import org.apache.ambari.server.stageplanner.RoleGraphFactory;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.PrereqCheckStatus;
import org.apache.ambari.server.state.stack.UpgradePack;
@@ -114,17 +115,17 @@ public class UpgradeContext {
/*
* The cluster that the upgrade is for.
*/
- final private Cluster m_cluster;
+ private final Cluster m_cluster;
/**
* The direction of the upgrade.
*/
- final private Direction m_direction;
+ private final Direction m_direction;
/**
* The type of upgrade.
*/
- final private UpgradeType m_type;
+ private final UpgradeType m_type;
/**
* The upgrade pack for this upgrade.
@@ -187,7 +188,7 @@ public class UpgradeContext {
* A set of services which are included in this upgrade. If this is empty,
* then all cluster services are included.
*/
- private Set<String> m_services = new HashSet<>();
+ private final Set<String> m_services = new HashSet<>();
/**
* A mapping of service to target repository. On an upgrade, this will be the
@@ -252,7 +253,7 @@ public class UpgradeContext {
/**
* Used as a quick way to tell if the upgrade is to revert a patch.
*/
- private boolean m_isRevert = false;
+ private final boolean m_isRevert;
/**
* Defines orchestration type. This is not the repository type when reverting a patch.
@@ -356,48 +357,8 @@ public class UpgradeContext {
m_repositoryVersion = m_repoVersionDAO.findByPK(Long.valueOf(repositoryVersionId));
m_orchestration = m_repositoryVersion.getType();
- if (m_orchestration == RepositoryType.STANDARD) {
- m_services.addAll(cluster.getServices().keySet());
- } else {
- try {
- VersionDefinitionXml vdf = m_repositoryVersion.getRepositoryXml();
- m_services.addAll(vdf.getAvailableServiceNames());
-
- // if this is every true, then just stop the upgrade attempt and
- // throw an exception
- if (m_services.isEmpty()) {
- String message = String.format(
- "When using a VDF of type %s, the available services must be defined in the VDF",
- m_repositoryVersion.getType());
-
- throw new AmbariException(message);
- }
-
- } catch (Exception e) {
- String msg = String.format(
- "Could not parse version definition for %s. Upgrade will not proceed.",
- m_repositoryVersion.getVersion());
-
- throw new AmbariException(msg);
- }
- }
-
- Set<String> installedServices = new HashSet<>();
- // populate the target repository map for all services in the upgrade
- for (String serviceName : m_services) {
- try {
- Service service = cluster.getService(serviceName);
- m_sourceRepositoryMap.put(serviceName, service.getDesiredRepositoryVersion());
- m_targetRepositoryMap.put(serviceName, m_repositoryVersion);
- installedServices.add(serviceName);
- } catch (ServiceNotFoundException e) {
- LOG.warn("Skipping orchestraction for service {}, as it was defined to upgrade, but is not installed in cluster {}",
- serviceName, cluster.getClusterName());
- }
- }
-
- m_services = installedServices;
-
+ // add all of the services participating in the upgrade
+ m_services.addAll(getServicesForUpgrade(cluster, m_repositoryVersion));
break;
}
case DOWNGRADE:{
@@ -417,8 +378,8 @@ public class UpgradeContext {
break;
}
default:
- m_repositoryVersion = null;
- break;
+ throw new AmbariException(
+ String.format("%s is not a valid upgrade direction.", m_direction));
}
}
@@ -907,6 +868,87 @@ public class UpgradeContext {
}
/**
+ * Gets the set of services which will participate in the upgrade. The
+ * services available in the repository are comapred against those installed
+ * in the cluster to arrive at the final subset.
+ * <p/>
+ * In some cases, such as with a {@link RepositoryType#MAINT} repository, the
+ * subset can be further trimmed by determing that an installed services is
+ * already at a high enough version and doesn't need to be upgraded.
+ * <p/>
+ * This method will also populate the source ({@link #m_sourceRepositoryMap})
+ * and target ({@link #m_targetRepositoryMap}) repository maps.
+ *
+ * @param cluster
+ * the cluster (not {@code null}).
+ * @param repositoryVersion
+ * the repository to use for the upgrade (not {@code null}).
+ * @return the set of services which will participate in the upgrade.
+ * @throws AmbariException
+ */
+ private Set<String> getServicesForUpgrade(Cluster cluster,
+ RepositoryVersionEntity repositoryVersion) throws AmbariException {
+
+ // keep track of the services which will be in this upgrade
+ Set<String> servicesForUpgrade = new HashSet<>();
+
+ // standard repo types use all services of the cluster
+ if (repositoryVersion.getType() == RepositoryType.STANDARD) {
+ servicesForUpgrade = cluster.getServices().keySet();
+ } else {
+ try {
+ // use the VDF and cluster to determine what services should be in this
+ // upgrade - this will take into account the type (such as patch/maint)
+ // and the version of services installed in the cluster
+ VersionDefinitionXml vdf = repositoryVersion.getRepositoryXml();
+ ClusterVersionSummary clusterVersionSummary = vdf.getClusterSummary(cluster);
+ servicesForUpgrade = clusterVersionSummary.getAvailableServiceNames();
+
+ // if this is every true, then just stop the upgrade attempt and
+ // throw an exception
+ if (servicesForUpgrade.isEmpty()) {
+ String message = String.format(
+ "When using a VDF of type %s, the available services must be defined in the VDF",
+ repositoryVersion.getType());
+
+ throw new AmbariException(message);
+ }
+ } catch (Exception e) {
+ String msg = String.format(
+ "Could not parse version definition for %s. Upgrade will not proceed.",
+ repositoryVersion.getVersion());
+
+ throw new AmbariException(msg);
+ }
+ }
+
+ // now that we have a list of the services defined by the VDF, only include
+ // services which are actually installed
+ Iterator<String> iterator = servicesForUpgrade.iterator();
+ while (iterator.hasNext()) {
+ String serviceName = null;
+ try {
+ serviceName = iterator.next();
+ Service service = cluster.getService(serviceName);
+
+ m_sourceRepositoryMap.put(serviceName, service.getDesiredRepositoryVersion());
+ m_targetRepositoryMap.put(serviceName, repositoryVersion);
+ } catch (ServiceNotFoundException e) {
+ // remove the service which is not part of the cluster - this should
+ // never happen since the summary from the VDF does this already, but
+ // can't hurt to be safe
+ iterator.remove();
+
+ LOG.warn(
+ "Skipping orchestration for service {}, as it was defined to upgrade, but is not installed in cluster {}",
+ serviceName, cluster.getClusterName());
+ }
+ }
+
+ return servicesForUpgrade;
+ }
+
+ /**
* Builds a chain of {@link UpgradeRequestValidator}s to ensure that the
* incoming request to create a new upgrade is valid.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/3155a43e/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
index e2bb27e..e04be5e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
@@ -33,6 +33,8 @@ import org.apache.ambari.server.orm.dao.UpgradeDAO;
import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
import org.apache.ambari.server.orm.entities.UpgradeEntity;
import org.apache.ambari.server.orm.entities.UpgradeHistoryEntity;
+import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.UpgradePack;
import org.apache.ambari.server.state.stack.upgrade.Direction;
import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
@@ -43,39 +45,93 @@ import org.easymock.Mock;
import org.junit.Before;
import org.junit.Test;
+import com.google.common.collect.Sets;
+
/**
* Tests {@link UpgradeContext}.
*/
public class UpgradeContextTest extends EasyMockSupport {
+ private final static String HDFS_SERVICE_NAME = "HDFS";
+ private final static String ZOOKEEPER_SERVICE_NAME = "ZOOKEEPER";
+
+ /**
+ * An existing upgrade which can be reverted.
+ */
@Mock
private UpgradeEntity m_completedRevertableUpgrade;
+ /**
+ * The target repository of a completed upgrade.
+ */
@Mock
- private RepositoryVersionEntity m_completedUpgradeTargetRepositoryVersion;
+ private RepositoryVersionEntity m_targetRepositoryVersion;
+ /**
+ * The source repository of a completed upgrade.
+ */
@Mock
- private RepositoryVersionEntity m_completedUpgradeSourceRepositoryVersion;
+ private RepositoryVersionEntity m_sourceRepositoryVersion;
+ /**
+ * The cluster performing the upgrade.
+ */
+ @Mock
+ private Cluster m_cluster;
+
+ /**
+ * HDFS
+ */
+ @Mock
+ private Service m_hdfsService;
+
+ /**
+ * ZooKeeper
+ */
+ @Mock
+ private Service m_zookeeperService;
@Mock
private UpgradeDAO m_upgradeDAO;
+ @Mock
+ private RepositoryVersionDAO m_repositoryVersionDAO;
+
+ /**
+ * Used to mock out what services will be provided to us by the VDF/cluster.
+ */
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ /**
+ *
+ */
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ /**
+ * The cluster services.
+ */
+ private Map<String, Service> m_services = new HashMap<>();
+
@Before
- public void setup() {
+ public void setup() throws Exception {
injectMocks(this);
- expect(m_completedUpgradeSourceRepositoryVersion.getId()).andReturn(1L).anyTimes();
- expect(m_completedUpgradeSourceRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
- expect(m_completedUpgradeTargetRepositoryVersion.getId()).andReturn(1L).anyTimes();
- expect(m_completedUpgradeTargetRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
+ expect(m_sourceRepositoryVersion.getId()).andReturn(1L).anyTimes();
+ expect(m_sourceRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
+ expect(m_targetRepositoryVersion.getId()).andReturn(99L).anyTimes();
+ expect(m_targetRepositoryVersion.getStackId()).andReturn(new StackId("HDP", "2.6")).anyTimes();
UpgradeHistoryEntity upgradeHistoryEntity = createNiceMock(UpgradeHistoryEntity.class);
- expect(upgradeHistoryEntity.getServiceName()).andReturn("HDFS").atLeastOnce();
- expect(upgradeHistoryEntity.getFromReposistoryVersion()).andReturn(m_completedUpgradeSourceRepositoryVersion).anyTimes();
- expect(upgradeHistoryEntity.getTargetRepositoryVersion()).andReturn(m_completedUpgradeTargetRepositoryVersion).anyTimes();
+ expect(upgradeHistoryEntity.getServiceName()).andReturn(HDFS_SERVICE_NAME).anyTimes();
+ expect(upgradeHistoryEntity.getFromReposistoryVersion()).andReturn(m_sourceRepositoryVersion).anyTimes();
+ expect(upgradeHistoryEntity.getTargetRepositoryVersion()).andReturn(m_targetRepositoryVersion).anyTimes();
List<UpgradeHistoryEntity> upgradeHistory = Lists.newArrayList(upgradeHistoryEntity);
+ expect(m_repositoryVersionDAO.findByPK(1L)).andReturn(m_sourceRepositoryVersion).anyTimes();
+ expect(m_repositoryVersionDAO.findByPK(99L)).andReturn(m_targetRepositoryVersion).anyTimes();
+
expect(m_upgradeDAO.findUpgrade(1L)).andReturn(m_completedRevertableUpgrade).anyTimes();
expect(
@@ -83,10 +139,156 @@ public class UpgradeContextTest extends EasyMockSupport {
eq(Direction.UPGRADE))).andReturn(m_completedRevertableUpgrade).anyTimes();
expect(m_completedRevertableUpgrade.getDirection()).andReturn(Direction.UPGRADE).anyTimes();
- expect(m_completedRevertableUpgrade.getRepositoryVersion()).andReturn(m_completedUpgradeTargetRepositoryVersion).anyTimes();
+ expect(m_completedRevertableUpgrade.getRepositoryVersion()).andReturn(m_targetRepositoryVersion).anyTimes();
expect(m_completedRevertableUpgrade.getOrchestration()).andReturn(RepositoryType.PATCH).anyTimes();
expect(m_completedRevertableUpgrade.getHistory()).andReturn(upgradeHistory).anyTimes();
expect(m_completedRevertableUpgrade.getUpgradePackage()).andReturn(null).anyTimes();
+
+ RepositoryVersionEntity hdfsRepositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+
+ expect(m_hdfsService.getDesiredRepositoryVersion()).andReturn(hdfsRepositoryVersion).anyTimes();
+ expect(m_cluster.getService(HDFS_SERVICE_NAME)).andReturn(m_hdfsService).anyTimes();
+ m_services.put(HDFS_SERVICE_NAME, m_hdfsService);
+
+ expect(m_cluster.getServices()).andReturn(m_services).anyTimes();
+ expect(m_cluster.getClusterId()).andReturn(1L).anyTimes();
+ expect(m_cluster.getClusterName()).andReturn("c1").anyTimes();
+ expect(m_cluster.getUpgradeInProgress()).andReturn(null).atLeastOnce();
+
+ // VDF stuff
+ expect(m_vdfXml.getClusterSummary(EasyMock.anyObject(Cluster.class))).andReturn(
+ m_clusterVersionSummary).anyTimes();
+ }
+
+ /**
+ * Tests that the {@link UpgradeContext} for a normal upgrade.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testFullUpgrade() throws Exception {
+ UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+ ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+ UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+ expect(m_targetRepositoryVersion.getType()).andReturn(RepositoryType.STANDARD).atLeastOnce();
+
+ expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+ EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+ EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+ replayAll();
+
+ Map<String, Object> requestMap = new HashMap<>();
+ requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.ROLLING.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.UPGRADE.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_REPO_VERSION_ID,
+ m_targetRepositoryVersion.getId().toString());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, "true");
+
+ UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, m_repositoryVersionDAO, configHelper);
+
+ assertEquals(Direction.UPGRADE, context.getDirection());
+ assertEquals(RepositoryType.STANDARD, context.getOrchestrationType());
+ assertEquals(1, context.getSupportedServices().size());
+ assertFalse(context.isPatchRevert());
+
+ verifyAll();
+ }
+
+ /**
+ * Tests that the {@link UpgradeContext} for a patch upgrade.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testPatchUpgrade() throws Exception {
+ UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+ ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+ UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+ expect(m_clusterVersionSummary.getAvailableServiceNames()).andReturn(
+ Sets.newHashSet(HDFS_SERVICE_NAME)).once();
+
+ expect(m_targetRepositoryVersion.getType()).andReturn(RepositoryType.PATCH).atLeastOnce();
+ expect(m_targetRepositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).once();
+
+ expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+ EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+ EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+ // make the cluster have 2 services just for fun (the VDF only has 1
+ // service)
+ expect(m_cluster.getService(ZOOKEEPER_SERVICE_NAME)).andReturn(m_zookeeperService).anyTimes();
+ m_services.put(ZOOKEEPER_SERVICE_NAME, m_zookeeperService);
+ assertEquals(2, m_services.size());
+
+ replayAll();
+
+ Map<String, Object> requestMap = new HashMap<>();
+ requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.NON_ROLLING.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.UPGRADE.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_REPO_VERSION_ID, m_targetRepositoryVersion.getId().toString());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, "true");
+
+ UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, m_repositoryVersionDAO, configHelper);
+
+ assertEquals(Direction.UPGRADE, context.getDirection());
+ assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
+ assertEquals(1, context.getSupportedServices().size());
+ assertFalse(context.isPatchRevert());
+
+ verifyAll();
+ }
+
+ /**
+ * Tests that the {@link UpgradeContext} for a maintenance upgrade.
+ * Maintenance upgrades will only upgrade services which require it by
+ * examining the versions included in the VDF.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testMaintUpgrade() throws Exception {
+ UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+ ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+ UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+ expect(m_clusterVersionSummary.getAvailableServiceNames()).andReturn(
+ Sets.newHashSet(HDFS_SERVICE_NAME)).once();
+
+ expect(m_targetRepositoryVersion.getType()).andReturn(RepositoryType.MAINT).atLeastOnce();
+ expect(m_targetRepositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).once();
+
+ expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+ EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+ EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+ // make the cluster have 2 services - one is already upgraded to a new
+ // enough version
+ expect(m_cluster.getService(ZOOKEEPER_SERVICE_NAME)).andReturn(m_zookeeperService).anyTimes();
+ m_services.put(ZOOKEEPER_SERVICE_NAME, m_zookeeperService);
+ assertEquals(2, m_services.size());
+
+ replayAll();
+
+ Map<String, Object> requestMap = new HashMap<>();
+ requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.NON_ROLLING.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.UPGRADE.name());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_REPO_VERSION_ID, m_targetRepositoryVersion.getId().toString());
+ requestMap.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, "true");
+
+ UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, m_repositoryVersionDAO, configHelper);
+
+ assertEquals(Direction.UPGRADE, context.getDirection());
+ assertEquals(RepositoryType.MAINT, context.getOrchestrationType());
+ assertEquals(1, context.getSupportedServices().size());
+ assertFalse(context.isPatchRevert());
+
+ verifyAll();
}
/**
@@ -97,21 +299,15 @@ public class UpgradeContextTest extends EasyMockSupport {
*/
@Test
public void testRevert() throws Exception {
- Cluster cluster = createNiceMock(Cluster.class);
UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
- RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
- RepositoryVersionEntity hdfsRepositoryVersion = createNiceMock(RepositoryVersionEntity.class);
- Service service = createNiceMock(Service.class);
UpgradePack upgradePack = createNiceMock(UpgradePack.class);
expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
- expect(service.getDesiredRepositoryVersion()).andReturn(hdfsRepositoryVersion).once();
- expect(cluster.getService("HDFS")).andReturn(service).atLeastOnce();
Map<String, Object> requestMap = new HashMap<>();
requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.ROLLING.name());
@@ -119,8 +315,8 @@ public class UpgradeContextTest extends EasyMockSupport {
replayAll();
- UpgradeContext context = new UpgradeContext(cluster, requestMap, null, upgradeHelper,
- m_upgradeDAO, repositoryVersionDAO, configHelper);
+ UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, m_repositoryVersionDAO, configHelper);
assertEquals(Direction.DOWNGRADE, context.getDirection());
assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
@@ -137,21 +333,15 @@ public class UpgradeContextTest extends EasyMockSupport {
* @throws Exception
*/
@Test
- public void testDowngradeScope() throws Exception {
- Cluster cluster = createNiceMock(Cluster.class);
+ public void testDowngradeForPatch() throws Exception {
UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
- RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
- RepositoryVersionEntity hdfsRepositoryVersion = createNiceMock(RepositoryVersionEntity.class);
- Service service = createNiceMock(Service.class);
UpgradePack upgradePack = createNiceMock(UpgradePack.class);
expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
- expect(service.getDesiredRepositoryVersion()).andReturn(hdfsRepositoryVersion).once();
- expect(cluster.getService("HDFS")).andReturn(service).atLeastOnce();
Map<String, Object> requestMap = new HashMap<>();
requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.NON_ROLLING.name());
@@ -159,8 +349,8 @@ public class UpgradeContextTest extends EasyMockSupport {
replayAll();
- UpgradeContext context = new UpgradeContext(cluster, requestMap, null, upgradeHelper,
- m_upgradeDAO, repositoryVersionDAO, configHelper);
+ UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+ m_upgradeDAO, m_repositoryVersionDAO, configHelper);
assertEquals(Direction.DOWNGRADE, context.getDirection());
assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
[50/50] [abbrv] ambari git commit: Merge branch 'trunk' into
branch-feature-logsearch-ui
Posted by ab...@apache.org.
Merge branch 'trunk' into branch-feature-logsearch-ui
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f50c17b9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f50c17b9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f50c17b9
Branch: refs/heads/branch-feature-logsearch-ui
Commit: f50c17b985e25fcb0559741e2c34423aaf79e60b
Parents: af5f5d2 1433ecf
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Aug 10 13:26:29 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Aug 10 13:26:29 2017 +0300
----------------------------------------------------------------------
.../authentication/AuthenticationMainCtrl.js | 4 +-
.../controllers/groups/GroupsEditCtrl.js | 3 +
.../stackVersions/StackVersionsCreateCtrl.js | 3 +-
.../ui/admin-web/app/scripts/i18n.config.js | 7 -
.../resource_management/TestUserResource.py | 2 +-
.../python/resource_management/core/base.py | 11 +
.../resource_management/core/files/killtree.sh | 2 +-
.../core/providers/accounts.py | 6 +-
.../core/resources/accounts.py | 4 +-
.../resource_management/core/resources/klist.py | 45 +
.../libraries/functions/check_process_status.py | 20 +
.../libraries/functions/conf_select.py | 213 +---
.../libraries/functions/constants.py | 2 +
.../libraries/functions/get_stack_version.py | 4 +-
.../libraries/functions/stack_features.py | 2 +-
.../libraries/functions/stack_select.py | 169 ++-
.../libraries/functions/stack_tools.py | 15 +-
.../libraries/functions/version.py | 17 +-
.../libraries/providers/hdfs_resource.py | 48 +-
.../libraries/script/script.py | 25 +-
.../upgrades/upgrade_nonrolling_new_stack.xml | 6 +-
.../2.1.1/upgrades/upgrade_test_nonrolling.xml | 4 +-
ambari-infra/ambari-infra-solr-client/build.xml | 1 +
ambari-infra/ambari-infra-solr-client/pom.xml | 10 +
.../src/main/resources/solrIndexHelper.sh | 156 +++
.../logsearch/config/api/LogSearchConfig.java | 94 --
.../config/api/LogSearchConfigFactory.java | 61 +-
.../config/api/LogSearchConfigLogFeeder.java | 77 ++
.../config/api/LogSearchConfigServer.java | 111 ++
.../config/api/OutputConfigMonitor.java | 44 +
.../model/outputconfig/OutputProperties.java | 23 +
.../outputconfig/OutputSolrProperties.java | 26 +
.../config/api/LogSearchConfigClass1.java | 78 --
.../config/api/LogSearchConfigClass2.java | 78 --
.../config/api/LogSearchConfigFactoryTest.java | 51 +-
.../api/LogSearchConfigLogFeederClass1.java | 58 +
.../api/LogSearchConfigLogFeederClass2.java | 58 +
.../config/api/LogSearchConfigServerClass1.java | 76 ++
.../config/api/LogSearchConfigServerClass2.java | 76 ++
.../zookeeper/LogSearchConfigLogFeederZK.java | 228 ++++
.../zookeeper/LogSearchConfigServerZK.java | 138 +++
.../config/zookeeper/LogSearchConfigZK.java | 236 +---
.../impl/OutputSolrPropertiesImpl.java | 46 +
.../ambari-logsearch-logfeeder/build.properties | 2 +-
.../org/apache/ambari/logfeeder/LogFeeder.java | 22 +-
.../ambari/logfeeder/common/ConfigHandler.java | 38 +-
.../logfeeder/common/LogEntryParseTester.java | 2 +-
.../logfeeder/input/AbstractInputFile.java | 4 +-
.../apache/ambari/logfeeder/input/Input.java | 70 +-
.../logfeeder/input/InputConfigUploader.java | 27 +-
.../ambari/logfeeder/input/InputManager.java | 28 +-
.../ambari/logfeeder/input/InputSimulate.java | 78 +-
.../loglevelfilter/LogLevelFilterHandler.java | 29 +-
.../logfeeder/metrics/LogFeederAMSClient.java | 45 +-
.../apache/ambari/logfeeder/output/Output.java | 36 +-
.../ambari/logfeeder/output/OutputHDFSFile.java | 3 +-
.../ambari/logfeeder/output/OutputManager.java | 11 +
.../ambari/logfeeder/output/OutputS3File.java | 3 +-
.../ambari/logfeeder/output/OutputSolr.java | 223 ++--
.../logfeeder/util/LogFeederPropertiesUtil.java | 498 ++++++++
.../ambari/logfeeder/util/LogFeederUtil.java | 165 +--
.../apache/ambari/logfeeder/util/SSLUtil.java | 14 +-
.../logconfig/LogConfigHandlerTest.java | 4 +-
.../logfeeder/metrics/MetricsManagerTest.java | 4 +-
.../ambari/logfeeder/output/OutputSolrTest.java | 29 +-
.../ambari-logsearch-server/build.properties | 2 +-
.../ambari-logsearch-server/pom.xml | 455 ++-----
ambari-logsearch/ambari-logsearch-server/run.sh | 6 +-
.../org/apache/ambari/logsearch/LogSearch.java | 181 +--
.../logsearch/common/ExternalServerClient.java | 24 +-
.../logsearch/common/LogSearchConstants.java | 2 +-
.../logsearch/common/PropertiesHelper.java | 124 --
.../logsearch/common/XMLPropertiesHelper.java | 79 --
.../ambari/logsearch/conf/ApiDocConfig.java | 4 +-
.../logsearch/conf/ApplicationConfig.java | 2 -
.../conf/LogSearchConfigMapHolder.java | 61 +
.../logsearch/conf/LogSearchHttpConfig.java | 83 ++
.../conf/LogSearchJerseyResourceConfig.java | 37 +
.../logsearch/conf/LogSearchServletConfig.java | 95 ++
.../logsearch/conf/LogSearchSpnegoConfig.java | 173 +++
.../logsearch/conf/LogSearchSslConfig.java | 86 ++
.../ambari/logsearch/conf/SecurityConfig.java | 3 +
.../logsearch/conf/SolrAuditLogPropsConfig.java | 5 +
.../conf/SolrEventHistoryPropsConfig.java | 5 +
.../ambari/logsearch/conf/SolrPropsConfig.java | 2 +
.../conf/SolrServiceLogPropsConfig.java | 5 +
.../conf/StaticResourceConfiguration.java | 49 +
.../configurer/LogSearchConfigConfigurer.java | 24 +-
.../configurer/SolrAuditAliasConfigurer.java | 4 +-
.../configurer/SolrCollectionConfigurer.java | 13 +-
.../logsearch/configurer/SslConfigurer.java | 363 ++++++
.../ambari/logsearch/dao/SolrDaoBase.java | 22 +-
.../logsearch/dao/SolrSchemaFieldDao.java | 3 +-
.../handler/AbstractSolrConfigHandler.java | 2 +
.../handler/CreateCollectionHandler.java | 44 +-
.../handler/ReloadCollectionHandler.java | 5 +-
.../logsearch/manager/ShipperConfigManager.java | 24 +-
.../logsearch/model/common/LSServerFilter.java | 10 +-
.../logsearch/solr/ResponseDataGenerator.java | 3 +-
.../apache/ambari/logsearch/util/SSLUtil.java | 388 ------
.../apache/ambari/logsearch/util/WebUtil.java | 65 -
.../LogsearchKRBAuthenticationFilter.java | 107 +-
.../web/listener/LogSearchSessionListener.java | 4 +-
.../logsearch/web/security/LdapProperties.java | 365 ------
.../web/security/LdapPropertyName.java | 58 -
.../ambari/logsearch/web/security/LdapUtil.java | 115 --
...LogsearchAbstractAuthenticationProvider.java | 2 +-
.../LogsearchAuthenticationProvider.java | 4 -
.../LogsearchLdapAuthenticationProvider.java | 187 ---
.../LogsearchLdapBindAuthenticator.java | 46 -
.../src/main/resources/default.properties | 1 -
.../src/main/resources/log4j.xml | 118 +-
.../src/main/resources/logsearch-admin-site.xml | 116 --
.../src/main/resources/logsearch.properties | 6 +-
.../src/main/resources/swagger/swagger.html | 36 +-
.../src/main/scripts/run.sh | 3 +-
.../LogsearchAuthenticationProviderTest.java | 68 +-
...LogsearchLdapAuthenticationProviderTest.java | 61 -
.../ambari-logsearch-web/build.properties | 2 +-
ambari-logsearch/ambari-logsearch-web/pom.xml | 4 +-
ambari-logsearch/docker/logsearch-docker.sh | 26 +-
.../logfeeder/shipper-conf/output.config.json | 10 +-
.../docker/test-config/logsearch/log4j.xml | 35 +-
.../test-config/logsearch/logsearch-env.sh | 5 +-
.../logsearch/logsearch-https.properties | 1 +
.../ambari-metrics/datasource.js | 35 +-
.../kafka/KafkaTimelineMetricsReporter.java | 6 +-
.../MetricCollectorHAController.java | 42 +-
ambari-server/pom.xml | 2 +-
ambari-server/sbin/ambari-server | 6 +-
.../actionmanager/ExecutionCommandWrapper.java | 34 +-
.../ambari/server/agent/HeartBeatHandler.java | 10 +-
.../ambari/server/agent/HeartbeatProcessor.java | 34 +-
.../api/services/WidgetLayoutService.java | 1 -
.../server/checks/AbstractCheckDescriptor.java | 252 ++--
.../server/checks/AtlasPresenceCheck.java | 13 +-
.../server/checks/AutoStartDisabledCheck.java | 11 +
.../ambari/server/checks/CheckDescription.java | 53 +-
.../server/checks/ClientRetryPropertyCheck.java | 8 +-
.../checks/ComponentsExistInRepoCheck.java | 140 +++
.../checks/ComponentsInstallationCheck.java | 5 +-
.../server/checks/ConfigurationMergeCheck.java | 3 +-
.../checks/DatabaseConsistencyCheckHelper.java | 2 -
.../ambari/server/checks/HealthCheck.java | 3 +-
.../HiveDynamicServiceDiscoveryCheck.java | 15 +-
.../checks/HiveMultipleMetastoreCheck.java | 7 +-
.../server/checks/HiveNotRollingWarning.java | 11 +-
.../checks/HostsMasterMaintenanceCheck.java | 17 +-
.../checks/HostsRepositoryVersionCheck.java | 57 +-
.../server/checks/InstallPackagesCheck.java | 18 +-
.../server/checks/KafkaKerberosCheck.java | 10 +-
...apReduce2JobHistoryStatePreservingCheck.java | 7 +-
.../server/checks/RangerAuditDbCheck.java | 10 +-
.../server/checks/RangerPasswordCheck.java | 29 +-
.../server/checks/RangerSSLConfigCheck.java | 7 +-
.../checks/SecondaryNamenodeDeletedCheck.java | 24 +-
.../server/checks/ServicePresenceCheck.java | 4 +-
.../checks/ServicesMaintenanceModeCheck.java | 11 +-
.../ServicesMapReduceDistributedCacheCheck.java | 27 +-
.../ServicesNamenodeHighAvailabilityCheck.java | 11 +-
.../checks/ServicesNamenodeTruncateCheck.java | 26 +-
.../ServicesTezDistributedCacheCheck.java | 25 +-
.../ambari/server/checks/ServicesUpCheck.java | 11 +-
.../checks/ServicesYarnWorkPreservingCheck.java | 7 +-
.../server/checks/StormShutdownWarning.java | 11 +-
.../checks/YarnRMHighAvailabilityCheck.java | 8 +-
.../YarnTimelineServerStatePreservingCheck.java | 99 +-
.../server/configuration/Configuration.java | 6 +-
.../AmbariCustomCommandExecutionHelper.java | 46 +-
.../AmbariManagementControllerImpl.java | 206 ++--
.../server/controller/AuthToLocalBuilder.java | 328 +++--
.../server/controller/ClusterRequest.java | 16 -
.../server/controller/KerberosHelperImpl.java | 205 +---
.../server/controller/PrereqCheckRequest.java | 57 +-
.../server/controller/ServiceRequest.java | 24 +-
.../server/controller/ServiceResponse.java | 18 +-
.../internal/AbstractProviderModule.java | 1 +
.../BlueprintConfigurationProcessor.java | 87 +-
.../internal/ClientConfigResourceProvider.java | 3 +-
.../internal/ClusterResourceProvider.java | 6 -
.../ClusterStackVersionResourceProvider.java | 22 +-
.../internal/HostResourceProvider.java | 83 +-
.../internal/HttpPropertyProvider.java | 27 +-
.../PreUpgradeCheckResourceProvider.java | 85 +-
.../internal/ReadOnlyResourceProvider.java | 2 +-
.../internal/RequestResourceProvider.java | 4 +-
.../internal/ServiceResourceProvider.java | 79 +-
.../server/controller/internal/Stack.java | 2 +-
.../server/controller/internal/UnitUpdater.java | 150 +++
.../internal/UpgradeResourceProvider.java | 122 +-
.../VersionDefinitionResourceProvider.java | 4 +-
.../LoggingRequestHelperFactoryImpl.java | 19 +-
.../upgrade/StackUpgradeFinishListener.java | 13 +
.../listeners/upgrade/StackVersionListener.java | 33 +-
.../CachedRoleCommandOrderProvider.java | 10 +-
.../apache/ambari/server/orm/DBAccessor.java | 10 +
.../ambari/server/orm/DBAccessorImpl.java | 7 +
.../HostComponentDesiredStateEntity.java | 14 -
.../orm/entities/HostComponentStateEntity.java | 13 -
.../orm/entities/ServiceDesiredStateEntity.java | 13 -
.../server/orm/entities/UpgradeEntity.java | 22 +
.../LdapToPamMigrationHelper.java | 73 ++
.../pam/PamAuthenticationFactory.java | 35 +
.../AmbariPamAuthenticationProvider.java | 5 +-
.../server/security/authorization/Users.java | 4 +
.../kerberos/FinalizeKerberosServerAction.java | 39 -
.../PrepareDisableKerberosServerAction.java | 8 +-
.../upgrades/FinalizeUpgradeAction.java | 63 +-
.../upgrades/UpdateDesiredRepositoryAction.java | 189 +++
.../upgrades/UpdateDesiredStackAction.java | 189 ---
.../apache/ambari/server/stack/StackModule.java | 3 +
.../apache/ambari/server/state/CheckHelper.java | 4 +-
.../ambari/server/state/ConfigHelper.java | 62 +-
.../ambari/server/state/PropertyInfo.java | 2 +
.../ambari/server/state/RepositoryType.java | 32 +-
.../ambari/server/state/SecurityState.java | 83 --
.../org/apache/ambari/server/state/Service.java | 20 +-
.../server/state/ServiceComponentHost.java | 39 -
.../apache/ambari/server/state/ServiceImpl.java | 33 +-
.../ambari/server/state/UpgradeContext.java | 308 +++--
.../ambari/server/state/UpgradeHelper.java | 170 ++-
.../KerberosDescriptorUpdateHelper.java | 9 +-
.../ambari/server/state/quicklinks/Port.java | 15 +
.../state/repository/AvailableVersion.java | 21 +-
.../state/repository/ClusterVersionSummary.java | 56 +
.../state/repository/ManifestService.java | 10 +-
.../ambari/server/state/repository/Release.java | 2 +-
.../state/repository/ServiceVersionSummary.java | 79 ++
.../state/repository/VersionDefinitionXml.java | 148 ++-
.../state/stack/upgrade/ClusterGrouping.java | 6 +-
.../server/state/stack/upgrade/Grouping.java | 15 +
.../stack/upgrade/ServiceCheckGrouping.java | 60 +-
.../svccomphost/ServiceComponentHostImpl.java | 60 -
.../ambari/server/topology/AmbariContext.java | 28 +-
.../ambari/server/topology/TopologyManager.java | 6 +-
.../validators/TopologyValidatorFactory.java | 2 +-
.../validators/UnitValidatedProperty.java | 95 ++
.../topology/validators/UnitValidator.java | 79 ++
.../server/upgrade/FinalUpgradeCatalog.java | 4 +-
.../server/upgrade/UpgradeCatalog252.java | 1 +
.../server/upgrade/UpgradeCatalog300.java | 81 +-
ambari-server/src/main/python/ambari-server.py | 14 +-
.../main/python/ambari_server/setupActions.py | 1 +
.../main/python/ambari_server/setupSecurity.py | 119 +-
.../src/main/python/azuredb_create_generator.py | 2 +-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 4 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 4 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 4 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 4 +-
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 4 +-
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 4 +-
.../package/scripts/accumulo_client.py | 7 +-
.../package/scripts/accumulo_script.py | 36 +-
.../HDF/grafana-nifi-hosts.json | 17 +-
.../0.1.0/package/scripts/params_linux.py | 6 +
.../0.1.0.2.3/package/scripts/atlas_client.py | 10 +-
.../ATLAS/0.1.0.2.3/package/scripts/metadata.py | 22 +
.../package/scripts/metadata_server.py | 9 +-
.../ATLAS/0.1.0.2.3/package/scripts/params.py | 5 +-
.../0.7.0.3.0/package/scripts/atlas_client.py | 8 +-
.../package/scripts/metadata_server.py | 8 +-
.../DRUID/0.9.2/package/scripts/druid_node.py | 9 +-
.../DRUID/0.9.2/package/scripts/superset.py | 8 +-
.../0.5.0.2.1/package/scripts/falcon_client.py | 8 +-
.../0.5.0.2.1/package/scripts/falcon_server.py | 7 +-
.../1.4.0.2.0/package/scripts/flume_handler.py | 8 +-
.../0.96.0.2.0/configuration/hbase-env.xml | 4 +-
.../0.96.0.2.0/package/scripts/hbase_client.py | 18 +-
.../0.96.0.2.0/package/scripts/hbase_master.py | 5 +-
.../package/scripts/hbase_regionserver.py | 5 +-
.../0.96.0.2.0/package/scripts/params_linux.py | 3 +
.../package/scripts/phoenix_queryserver.py | 11 +-
.../HBASE/0.96.0.2.0/package/scripts/upgrade.py | 7 +-
.../HBASE/2.0.0.3.0/configuration/hbase-env.xml | 4 +-
.../2.0.0.3.0/package/scripts/hbase_client.py | 16 +-
.../2.0.0.3.0/package/scripts/hbase_master.py | 5 +-
.../package/scripts/hbase_regionserver.py | 5 +-
.../package/scripts/phoenix_queryserver.py | 8 +-
.../HBASE/2.0.0.3.0/package/scripts/upgrade.py | 7 +-
.../HDFS/2.1.0.2.0/configuration/hdfs-site.xml | 6 +
.../HDFS/2.1.0.2.0/package/scripts/datanode.py | 11 +-
.../HDFS/2.1.0.2.0/package/scripts/hdfs.py | 8 +
.../2.1.0.2.0/package/scripts/hdfs_client.py | 8 +-
.../2.1.0.2.0/package/scripts/hdfs_namenode.py | 25 +-
.../2.1.0.2.0/package/scripts/journalnode.py | 8 +-
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 18 +-
.../2.1.0.2.0/package/scripts/nfsgateway.py | 8 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 12 +-
.../2.1.0.2.0/package/scripts/params_windows.py | 7 +
.../HDFS/2.1.0.2.0/package/scripts/snamenode.py | 8 +-
.../HDFS/2.1.0.2.0/package/scripts/utils.py | 17 +
.../2.1.0.2.0/package/scripts/zkfc_slave.py | 20 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../HDFS/3.0.0.3.0/package/scripts/datanode.py | 11 +-
.../HDFS/3.0.0.3.0/package/scripts/hdfs.py | 8 +
.../3.0.0.3.0/package/scripts/hdfs_client.py | 8 +-
.../3.0.0.3.0/package/scripts/hdfs_namenode.py | 17 +-
.../3.0.0.3.0/package/scripts/journalnode.py | 8 +-
.../HDFS/3.0.0.3.0/package/scripts/namenode.py | 11 +-
.../3.0.0.3.0/package/scripts/nfsgateway.py | 7 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 8 +-
.../3.0.0.3.0/package/scripts/params_windows.py | 7 +
.../HDFS/3.0.0.3.0/package/scripts/snamenode.py | 8 +-
.../HDFS/3.0.0.3.0/package/scripts/utils.py | 16 +
.../3.0.0.3.0/package/scripts/zkfc_slave.py | 12 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../0.12.0.2.0/package/scripts/hcat_client.py | 8 +-
.../0.12.0.2.0/package/scripts/hive_client.py | 9 +-
.../package/scripts/hive_metastore.py | 8 +-
.../0.12.0.2.0/package/scripts/hive_server.py | 7 +-
.../package/scripts/hive_server_interactive.py | 8 +-
.../0.12.0.2.0/package/scripts/params_linux.py | 4 +-
.../package/scripts/webhcat_server.py | 10 +-
.../2.1.0.3.0/package/scripts/hcat_client.py | 9 +-
.../2.1.0.3.0/package/scripts/hive_client.py | 9 +-
.../2.1.0.3.0/package/scripts/hive_metastore.py | 8 +-
.../2.1.0.3.0/package/scripts/hive_server.py | 7 +-
.../package/scripts/hive_server_interactive.py | 7 +-
.../2.1.0.3.0/package/scripts/webhcat_server.py | 9 +-
.../ranger-kafka-plugin-properties.xml | 6 +
.../KAFKA/0.10.0.3.0/metainfo.xml | 1 +
.../KAFKA/0.10.0.3.0/package/scripts/kafka.py | 10 +
.../0.10.0.3.0/package/scripts/kafka_broker.py | 9 +-
.../KAFKA/0.10.0.3.0/package/scripts/params.py | 3 +
.../KAFKA/0.10.0.3.0/service_advisor.py | 5 +
.../common-services/KAFKA/0.10.0/metainfo.xml | 1 +
.../KAFKA/0.8.1/package/scripts/kafka.py | 12 +
.../KAFKA/0.8.1/package/scripts/kafka_broker.py | 11 +-
.../KAFKA/0.8.1/package/scripts/params.py | 3 +
.../KAFKA/0.9.0/configuration/kafka-broker.xml | 2 +-
.../ranger-kafka-plugin-properties.xml | 6 +
.../KERBEROS/1.10.3-10/metainfo.xml | 8 +
.../package/scripts/kerberos_client.py | 3 +
.../package/scripts/kerberos_common.py | 50 +-
.../0.5.0.2.2/package/scripts/knox_gateway.py | 9 +-
.../0.5.0.3.0/package/scripts/knox_gateway.py | 9 +-
.../common-services/LOGSEARCH/0.5.0/alerts.json | 6 +-
.../0.5.0/configuration/logsearch-env.xml | 14 -
.../configuration/logsearch-properties.xml | 21 +
.../LOGSEARCH/0.5.0/package/scripts/params.py | 13 +-
.../0.5.0/properties/logsearch-env.sh.j2 | 2 -
.../0.5.0/properties/output.config.json.j2 | 8 +-
.../LOGSEARCH/0.5.0/quicklinks/quicklinks.json | 10 +-
.../LOGSEARCH/0.5.0/service_advisor.py | 33 +-
.../1.0.0.2.3/package/scripts/mahout_client.py | 9 +-
.../OOZIE/4.0.0.2.0/package/scripts/oozie.py | 52 +-
.../4.0.0.2.0/package/scripts/oozie_client.py | 8 +-
.../4.0.0.2.0/package/scripts/oozie_server.py | 13 +-
.../package/scripts/oozie_server_upgrade.py | 36 +-
.../4.0.0.2.0/package/scripts/params_linux.py | 2 +
.../OOZIE/4.2.0.2.3/quicklinks/quicklinks.json | 9 +-
.../4.2.0.3.0/package/scripts/oozie_client.py | 8 +-
.../4.2.0.3.0/package/scripts/oozie_server.py | 12 +-
.../OOZIE/4.2.0.3.0/quicklinks/quicklinks.json | 9 +-
.../0.12.0.2.0/package/scripts/pig_client.py | 9 +-
.../0.16.1.3.0/package/scripts/pig_client.py | 9 +-
.../RANGER/0.4.0/package/scripts/params.py | 5 +-
.../0.4.0/package/scripts/ranger_admin.py | 13 +-
.../0.4.0/package/scripts/ranger_tagsync.py | 13 +-
.../0.4.0/package/scripts/ranger_usersync.py | 7 +-
.../0.4.0/package/scripts/setup_ranger_xml.py | 6 +
.../RANGER/0.4.0/package/scripts/upgrade.py | 31 -
.../1.0.0.3.0/package/scripts/ranger_admin.py | 9 +-
.../1.0.0.3.0/package/scripts/ranger_tagsync.py | 11 +-
.../package/scripts/ranger_usersync.py | 5 +-
.../RANGER/1.0.0.3.0/package/scripts/upgrade.py | 6 +-
.../0.5.0.2.3/package/scripts/kms_server.py | 6 +-
.../0.5.0.2.3/package/scripts/params.py | 5 +-
.../0.5.0.2.3/package/scripts/upgrade.py | 30 -
.../1.0.0.3.0/package/scripts/kms_server.py | 5 +-
.../1.0.0.3.0/package/scripts/upgrade.py | 5 +-
.../0.60.0.2.2/package/scripts/slider_client.py | 14 +-
.../0.91.0.3.0/package/scripts/slider_client.py | 14 +-
.../1.2.1/package/scripts/job_history_server.py | 8 +-
.../SPARK/1.2.1/package/scripts/livy_server.py | 8 +-
.../SPARK/1.2.1/package/scripts/params.py | 6 +-
.../SPARK/1.2.1/package/scripts/spark_client.py | 9 +-
.../package/scripts/spark_thrift_server.py | 8 +-
.../2.2.0/package/scripts/job_history_server.py | 9 +-
.../SPARK/2.2.0/package/scripts/livy_server.py | 9 +-
.../SPARK/2.2.0/package/scripts/spark_client.py | 9 +-
.../package/scripts/spark_thrift_server.py | 9 +-
.../2.0.0/package/scripts/job_history_server.py | 8 +-
.../2.0.0/package/scripts/livy2_server.py | 10 +-
.../SPARK2/2.0.0/package/scripts/params.py | 3 +-
.../2.0.0/package/scripts/spark_client.py | 8 +-
.../package/scripts/spark_thrift_server.py | 8 +-
.../1.4.4.2.0/package/scripts/service_check.py | 3 -
.../1.4.4.2.0/package/scripts/sqoop_client.py | 9 +-
.../1.4.4.3.0/package/scripts/service_check.py | 3 -
.../1.4.4.3.0/package/scripts/sqoop_client.py | 9 +-
.../STORM/0.9.1/package/scripts/drpc_server.py | 7 +-
.../STORM/0.9.1/package/scripts/nimbus.py | 9 +-
.../STORM/0.9.1/package/scripts/nimbus_prod.py | 8 +-
.../STORM/0.9.1/package/scripts/pacemaker.py | 7 +-
.../STORM/0.9.1/package/scripts/rest_api.py | 3 -
.../STORM/0.9.1/package/scripts/supervisor.py | 8 +-
.../0.9.1/package/scripts/supervisor_prod.py | 8 +-
.../STORM/0.9.1/package/scripts/ui_server.py | 7 +-
.../1.0.1.3.0/package/scripts/drpc_server.py | 7 +-
.../STORM/1.0.1.3.0/package/scripts/nimbus.py | 8 +-
.../1.0.1.3.0/package/scripts/nimbus_prod.py | 8 +-
.../1.0.1.3.0/package/scripts/pacemaker.py | 7 +-
.../STORM/1.0.1.3.0/package/scripts/rest_api.py | 3 -
.../1.0.1.3.0/package/scripts/supervisor.py | 8 +-
.../package/scripts/supervisor_prod.py | 8 +-
.../1.0.1.3.0/package/scripts/ui_server.py | 7 +-
.../TEZ/0.4.0.2.1/package/scripts/tez_client.py | 11 +-
.../TEZ/0.9.0.3.0/package/scripts/tez_client.py | 9 +-
.../YARN/2.1.0.2.0/configuration/yarn-site.xml | 6 +
.../scripts/application_timeline_server.py | 8 +-
.../2.1.0.2.0/package/scripts/historyserver.py | 10 +-
.../package/scripts/mapreduce2_client.py | 11 +-
.../2.1.0.2.0/package/scripts/nodemanager.py | 8 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 25 +-
.../2.1.0.2.0/package/scripts/params_windows.py | 10 +-
.../package/scripts/resourcemanager.py | 25 +-
.../YARN/2.1.0.2.0/package/scripts/service.py | 4 +
.../2.1.0.2.0/package/scripts/service_check.py | 6 +-
.../2.1.0.2.0/package/scripts/yarn_client.py | 8 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../YARN/3.0.0.3.0/configuration/yarn-site.xml | 6 +
.../scripts/application_timeline_server.py | 8 +-
.../3.0.0.3.0/package/scripts/historyserver.py | 8 +-
.../package/scripts/mapreduce2_client.py | 9 +-
.../3.0.0.3.0/package/scripts/nodemanager.py | 8 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 11 +-
.../3.0.0.3.0/package/scripts/params_windows.py | 10 +-
.../package/scripts/resourcemanager.py | 25 +-
.../3.0.0.3.0/package/scripts/yarn_client.py | 8 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../YARN/3.0.0.3.0/service_advisor.py | 7 +-
.../0.6.0.2.5/package/scripts/master.py | 8 +-
.../0.6.0.2.5/package/scripts/params.py | 3 +-
.../0.6.0.3.0/package/scripts/master.py | 7 +-
.../3.4.5/package/scripts/params_linux.py | 5 +-
.../3.4.5/package/scripts/zookeeper_client.py | 7 +-
.../3.4.5/package/scripts/zookeeper_server.py | 7 +-
.../custom_actions/scripts/install_packages.py | 4 -
.../custom_actions/scripts/ru_set_all.py | 32 -
.../services/HDFS/configuration/hdfs-site.xml | 6 +
.../HDFS/package/scripts/hdfs_namenode.py | 12 +-
.../0.8/services/HDFS/package/scripts/params.py | 11 +-
.../0.8/services/HDFS/package/scripts/utils.py | 3 +
.../package/templates/include_hosts_list.j2 | 21 +
.../services/YARN/configuration/yarn-site.xml | 6 +
.../0.8/services/YARN/package/scripts/params.py | 10 +-
.../YARN/package/scripts/resourcemanager.py | 9 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../services/YARN/configuration/yarn-site.xml | 6 +
.../services/YARN/package/scripts/params.py | 9 +-
.../YARN/package/scripts/resourcemanager.py | 9 +-
.../package/templates/exclude_hosts_list.j2 | 21 +
.../package/templates/include_hosts_list.j2 | 21 +
.../HDP/2.0.6/configuration/cluster-env.xml | 15 +
.../2.0.6/hooks/after-INSTALL/scripts/hook.py | 2 +-
.../2.0.6/hooks/after-INSTALL/scripts/params.py | 6 +-
.../scripts/shared_initialization.py | 43 +-
.../hooks/before-ANY/files/changeToSecureUid.sh | 15 +-
.../2.0.6/hooks/before-ANY/scripts/params.py | 4 +
.../before-ANY/scripts/shared_initialization.py | 40 +-
.../before-START/scripts/custom_extensions.py | 174 +++
.../2.0.6/hooks/before-START/scripts/hook.py | 3 +
.../2.0.6/hooks/before-START/scripts/params.py | 26 +-
.../HDP/2.0.6/properties/stack_features.json | 10 +
.../HDP/2.0.6/properties/stack_packages.json | 1146 ++++++++++++++++++
.../services/OOZIE/quicklinks/quicklinks.json | 9 +-
.../services/YARN/configuration/yarn-site.xml | 6 +
.../services/YARN/package/scripts/params.py | 10 +-
.../YARN/package/scripts/resourcemanager.py | 9 +-
.../package/templates/include_hosts_list.j2 | 21 +
.../services/OOZIE/quicklinks/quicklinks.json | 9 +-
.../stacks/HDP/2.3/services/stack_advisor.py | 5 +
.../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 6 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 7 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 7 +-
.../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 7 +-
.../stacks/HDP/2.3/upgrades/upgrade-2.4.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.5.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 6 +-
.../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 6 +-
.../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 6 +-
.../stacks/HDP/2.4/upgrades/upgrade-2.5.xml | 1 +
.../stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 1 +
.../stacks/HDP/2.5/services/stack_advisor.py | 13 +-
.../stacks/HDP/2.5/upgrades/config-upgrade.xml | 6 +-
.../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 6 +-
.../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 12 +-
.../stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 1 +
.../configuration/application-properties.xml | 17 +
.../stacks/HDP/2.6/services/ATLAS/metainfo.xml | 1 +
.../services/HBASE/configuration/hbase-env.xml | 87 ++
.../services/HBASE/configuration/hbase-site.xml | 8 +
.../services/HDFS/configuration/core-site.xml | 29 +
.../services/HDFS/configuration/hadoop-env.xml | 5 +
.../services/HIVE/configuration/hive-env.xml | 3 +-
.../services/HIVE/configuration/hive-site.xml | 9 +
.../stacks/HDP/2.6/services/HIVE/kerberos.json | 151 ---
.../HDP/2.6/services/SPARK2/kerberos.json | 8 +-
.../YARN/configuration-mapred/mapred-site.xml | 9 +
.../services/YARN/configuration/yarn-site.xml | 2 +-
.../stacks/HDP/2.6/services/YARN/kerberos.json | 2 +-
.../stacks/HDP/2.6/services/stack_advisor.py | 33 +-
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 4 +
.../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 10 +-
.../stacks/HDP/2.6/upgrades/upgrade-2.6.xml | 1 +
.../HDP/3.0/configuration/cluster-env.xml | 31 +-
.../HDP/3.0/hooks/after-INSTALL/scripts/hook.py | 2 +-
.../scripts/shared_initialization.py | 38 +-
.../3.0/hooks/before-START/scripts/params.py | 11 +-
.../HDP/3.0/properties/stack_features.json | 752 ++++++------
.../HDP/3.0/properties/stack_packages.json | 1042 ++++++++++++++++
.../stacks/HDP/3.0/properties/stack_tools.json | 14 +-
.../PERF/1.0/services/KERBEROS/metainfo.xml | 8 +
.../KERBEROS/package/scripts/kerberos_client.py | 2 +
.../KERBEROS/package/scripts/kerberos_common.py | 48 +
.../1.0/upgrades/nonrolling-upgrade-2.0.xml | 6 +-
.../src/main/resources/stacks/stack_advisor.py | 7 +-
.../src/main/resources/version_definition.xsd | 2 +
.../ExecutionCommandWrapperTest.java | 70 +-
.../server/agent/HeartbeatProcessorTest.java | 5 -
.../server/agent/TestHeartbeatHandler.java | 14 +-
.../server/api/services/AmbariMetaInfoTest.java | 2 +
.../checks/AbstractCheckDescriptorTest.java | 310 ++---
.../server/checks/AtlasPresenceCheckTest.java | 4 +-
.../checks/ClientRetryPropertyCheckTest.java | 42 +-
.../checks/ComponentExistsInRepoCheckTest.java | 352 ++++++
.../checks/ComponentsInstallationCheckTest.java | 62 +-
.../checks/ConfigurationMergeCheckTest.java | 13 +-
.../HiveDynamicServiceDiscoveryCheckTest.java | 25 +-
.../checks/HiveMultipleMetastoreCheckTest.java | 55 +-
.../checks/HiveNotRollingWarningTest.java | 39 +-
.../server/checks/HostsHeartbeatCheckTest.java | 16 +-
.../checks/HostsMasterMaintenanceCheckTest.java | 63 +-
.../checks/HostsRepositoryVersionCheckTest.java | 90 +-
.../server/checks/InstallPackagesCheckTest.java | 18 +-
.../server/checks/KafkaKerberosCheckTest.java | 39 +-
...duce2JobHistoryStatePreservingCheckTest.java | 42 +-
.../checks/PreviousUpgradeCompletedTest.java | 11 +-
.../server/checks/RangerAuditDbCheckTest.java | 42 +-
.../server/checks/RangerPasswordCheckTest.java | 47 +-
.../server/checks/RangerSSLConfigCheckTest.java | 38 +-
.../SecondaryNamenodeDeletedCheckTest.java | 51 +-
.../server/checks/ServicePresenceCheckTest.java | 34 +-
.../ServicesMaintenanceModeCheckTest.java | 46 +-
...vicesMapReduceDistributedCacheCheckTest.java | 50 +-
...rvicesNamenodeHighAvailabilityCheckTest.java | 39 +-
.../ServicesNamenodeTruncateCheckTest.java | 59 +-
.../ServicesTezDistributedCacheCheckTest.java | 39 +-
.../server/checks/ServicesUpCheckTest.java | 80 +-
.../ServicesYarnWorkPreservingCheckTest.java | 38 +-
.../server/checks/StormShutdownWarningTest.java | 38 +-
...nTimelineServerStatePreservingCheckTest.java | 9 +-
.../AmbariCustomCommandExecutionHelperTest.java | 4 +-
.../AmbariManagementControllerImplTest.java | 19 +-
.../AmbariManagementControllerTest.java | 312 +++--
.../controller/AuthToLocalBuilderTest.java | 45 +
.../BackgroundCustomCommandExecutionTest.java | 2 +-
.../server/controller/KerberosHelperTest.java | 75 +-
...hYarnCapacitySchedulerReleaseConfigTest.java | 2 +-
.../BlueprintConfigurationProcessorTest.java | 38 +-
.../internal/ClusterResourceProviderTest.java | 2 -
.../internal/HostResourceProviderTest.java | 27 +-
.../internal/HttpPropertyProviderTest.java | 11 +
.../internal/JMXHostProviderTest.java | 3 +-
.../PreUpgradeCheckResourceProviderTest.java | 6 +-
.../internal/RequestResourceProviderTest.java | 9 +-
.../internal/ServiceResourceProviderTest.java | 236 +++-
.../StackUpgradeConfigurationMergeTest.java | 2 +-
.../controller/internal/UnitUpdaterTest.java | 114 ++
.../internal/UpgradeResourceProviderTest.java | 105 +-
.../LoggingRequestHelperFactoryImplTest.java | 10 +-
.../upgrade/StackVersionListenerTest.java | 58 +-
.../AmbariPamAuthenticationProviderTest.java | 145 ++-
.../FinalizeKerberosServerActionTest.java | 6 -
.../upgrades/UpgradeActionTest.java | 6 +-
.../QuickLinksConfigurationModuleTest.java | 14 +
.../ambari/server/state/CheckHelperTest.java | 246 ++--
.../ambari/server/state/ConfigHelperTest.java | 22 +
.../apache/ambari/server/state/ServiceTest.java | 41 -
.../ambari/server/state/UpgradeContextTest.java | 363 ++++++
.../ambari/server/state/UpgradeHelperTest.java | 167 ++-
.../KerberosDescriptorUpdateHelperTest.java | 70 ++
.../state/repository/VersionDefinitionTest.java | 148 +++
.../server/state/stack/UpgradePackTest.java | 8 +-
.../svccomphost/ServiceComponentHostTest.java | 52 -
.../server/topology/AmbariContextTest.java | 16 +-
.../ClusterConfigurationRequestTest.java | 7 +
.../topology/validators/UnitValidatorTest.java | 114 ++
.../server/upgrade/UpgradeCatalog300Test.java | 81 +-
.../src/test/python/TestStackFeature.py | 61 +
.../LOGSEARCH/test_service_advisor.py | 30 +-
.../python/custom_actions/test_ru_set_all.py | 35 +-
.../python/stacks/2.0.6/FLUME/test_flume.py | 5 +-
.../stacks/2.0.6/HBASE/test_hbase_client.py | 20 +-
.../stacks/2.0.6/HBASE/test_hbase_master.py | 15 +-
.../2.0.6/HBASE/test_hbase_regionserver.py | 14 +-
.../2.0.6/HBASE/test_phoenix_queryserver.py | 8 +-
.../python/stacks/2.0.6/HDFS/test_datanode.py | 15 +-
.../stacks/2.0.6/HDFS/test_hdfs_client.py | 15 +-
.../stacks/2.0.6/HDFS/test_journalnode.py | 13 +-
.../python/stacks/2.0.6/HDFS/test_namenode.py | 15 +-
.../python/stacks/2.0.6/HDFS/test_nfsgateway.py | 7 +-
.../stacks/2.0.6/HIVE/test_hcat_client.py | 3 +
.../stacks/2.0.6/HIVE/test_hive_client.py | 23 +-
.../stacks/2.0.6/HIVE/test_hive_server.py | 11 -
.../stacks/2.0.6/HIVE/test_webhcat_server.py | 19 +-
.../stacks/2.0.6/OOZIE/test_oozie_client.py | 15 +-
.../stacks/2.0.6/OOZIE/test_oozie_server.py | 72 +-
.../python/stacks/2.0.6/PIG/test_pig_client.py | 20 +-
.../python/stacks/2.0.6/SQOOP/test_sqoop.py | 14 +-
.../stacks/2.0.6/YARN/test_historyserver.py | 8 +-
.../stacks/2.0.6/YARN/test_mapreduce2_client.py | 15 +-
.../stacks/2.0.6/YARN/test_nodemanager.py | 16 +-
.../stacks/2.0.6/YARN/test_resourcemanager.py | 13 +-
.../stacks/2.0.6/YARN/test_yarn_client.py | 14 +-
.../2.0.6/ZOOKEEPER/test_zookeeper_client.py | 14 +-
.../2.0.6/ZOOKEEPER/test_zookeeper_server.py | 17 +-
.../stacks/2.0.6/configs/altfs_plus_hdfs.json | 2 +-
.../python/stacks/2.0.6/configs/default.json | 2 +-
.../2.0.6/configs/default_ams_embedded.json | 2 +-
.../2.0.6/configs/default_hive_nn_ha.json | 2 +-
.../2.0.6/configs/default_hive_nn_ha_2.json | 2 +-
.../2.0.6/configs/default_hive_non_hdfs.json | 2 +-
.../2.0.6/configs/default_no_install.json | 2 +-
.../2.0.6/configs/default_oozie_mysql.json | 2 +-
.../default_update_exclude_file_only.json | 2 +-
.../2.0.6/configs/default_with_bucket.json | 2 +-
.../python/stacks/2.0.6/configs/flume_22.json | 2 +-
.../python/stacks/2.0.6/configs/flume_only.json | 2 +-
.../stacks/2.0.6/configs/hbase_no_phx.json | 2 +-
.../stacks/2.0.6/configs/hbase_with_phx.json | 2 +-
.../2.0.6/configs/oozie_existing_sqla.json | 2 +-
.../stacks/2.0.6/configs/repository_file.json | 2 +-
.../python/stacks/2.0.6/configs/secured.json | 2 +-
.../hooks/after-INSTALL/test_after_install.py | 56 +-
.../2.0.6/hooks/before-ANY/test_before_any.py | 309 +++--
.../stacks/2.1/FALCON/test_falcon_client.py | 14 +-
.../stacks/2.1/FALCON/test_falcon_server.py | 15 +-
.../stacks/2.1/HIVE/test_hive_metastore.py | 58 +-
.../stacks/2.1/STORM/test_storm_drpc_server.py | 14 +-
.../stacks/2.1/STORM/test_storm_nimbus.py | 14 +-
.../stacks/2.1/STORM/test_storm_nimbus_prod.py | 14 +-
.../stacks/2.1/STORM/test_storm_supervisor.py | 14 +-
.../2.1/STORM/test_storm_supervisor_prod.py | 15 +-
.../stacks/2.1/STORM/test_storm_ui_server.py | 15 +-
.../python/stacks/2.1/TEZ/test_tez_client.py | 19 +-
.../stacks/2.1/YARN/test_apptimelineserver.py | 13 +-
.../stacks/2.2/ACCUMULO/test_accumulo_client.py | 15 +-
.../stacks/2.2/KAFKA/test_kafka_broker.py | 15 +-
.../stacks/2.2/KERBEROS/test_kerberos_client.py | 23 +
.../python/stacks/2.2/KNOX/test_knox_gateway.py | 26 -
.../stacks/2.2/RANGER/test_ranger_admin.py | 10 -
.../stacks/2.2/RANGER/test_ranger_usersync.py | 9 -
.../stacks/2.2/SLIDER/test_slider_client.py | 21 +-
.../stacks/2.2/SPARK/test_job_history_server.py | 13 +-
.../stacks/2.2/SPARK/test_spark_client.py | 13 +-
.../stacks/2.2/common/test_conf_select.py | 30 +-
.../stacks/2.3/ATLAS/test_metadata_server.py | 6 +-
.../stacks/2.3/MAHOUT/test_mahout_client.py | 18 +-
.../2.3/SPARK/test_spark_thrift_server.py | 13 +-
.../stacks/2.3/common/test_stack_advisor.py | 22 +-
.../test/python/stacks/2.3/configs/ats_1_5.json | 2 +-
.../stacks/2.4/LOGSEARCH/test_logsearch.py | 2 +
.../test/python/stacks/2.4/configs/default.json | 5 +-
.../stacks/2.5/ATLAS/test_atlas_server.py | 2 +-
.../stacks/2.5/common/test_stack_advisor.py | 4 +-
.../python/stacks/2.5/configs/hsi_default.json | 2 +-
.../2.5/configs/hsi_default_for_restart.json | 2 +-
.../test/python/stacks/2.5/configs/hsi_ha.json | 2 +-
.../src/test/python/stacks/utils/RMFTestCase.py | 12 +
.../src/test/resources/hbase_version_test.xml | 2 +
.../src/test/resources/parent_quicklinks.json | 1 +
.../upgrades/upgrade_nonrolling_new_stack.xml | 6 +-
.../HDP/2.1.1/upgrades/upgrade_test_HDP-250.xml | 267 ++++
.../HDP/2.1.1/upgrades/upgrade_test_checks.xml | 15 +
.../2.1.1/upgrades/upgrade_test_nonrolling.xml | 4 +-
.../HDP/2.2.0/upgrades/upgrade_test_checks.xml | 2 +-
.../resources/version_definition_test_maint.xml | 62 +
.../version_definition_test_maint_partial.xml | 54 +
.../controllers/global/cluster_controller.js | 1 +
.../main/admin/stack_and_upgrade_controller.js | 9 +-
.../main/host/bulk_operations_controller.js | 2 +-
ambari-web/app/controllers/main/host/details.js | 69 ++
.../app/controllers/wizard/step1_controller.js | 2 +
.../app/controllers/wizard/step7_controller.js | 67 +
.../app/controllers/wizard/step8_controller.js | 19 +-
.../configs/services/logsearch_properties.js | 97 +-
.../configs/stack_config_properties_mapper.js | 14 +-
ambari-web/app/mappers/hosts_mapper.js | 12 +-
.../app/mixins/common/configs/configs_saver.js | 12 +-
.../mixins/common/configs/enhanced_configs.js | 36 +-
.../mixins/common/table_server_view_mixin.js | 2 +-
ambari-web/app/models/stack.js | 4 +-
ambari-web/app/routes/installer.js | 4 +-
ambari-web/app/styles/application.less | 15 +
...ontrols_service_config_usergroup_with_id.hbs | 27 +
ambari-web/app/templates/wizard/step1.hbs | 326 ++---
ambari-web/app/utils/ajax/ajax.js | 4 +-
ambari-web/app/utils/config.js | 3 +
ambari-web/app/utils/helper.js | 11 +-
.../views/common/configs/config_history_flow.js | 2 +-
.../configs/service_configs_by_category_view.js | 6 +
ambari-web/app/views/common/controls_view.js | 39 +
.../app/views/common/quick_view_link_view.js | 6 +
.../main/admin/stack_upgrade/versions_view.js | 5 +-
.../app/views/main/alert_definitions_view.js | 5 +-
ambari-web/app/views/wizard/step1_view.js | 6 +-
.../admin/stack_and_upgrade_controller_test.js | 8 +-
.../test/controllers/wizard/step1_test.js | 2 +
.../test/controllers/wizard/step8_test.js | 4 +-
.../mixins/common/configs/configs_saver_test.js | 21 +
.../common/configs/enhanced_configs_test.js | 61 +-
ambari-web/test/utils/helper_test.js | 5 +
.../test/views/common/quick_link_view_test.js | 50 +
.../admin/stack_upgrade/version_view_test.js | 101 +-
.../views/main/alert_definitions_view_test.js | 69 ++
ambari-web/test/views/wizard/step1_view_test.js | 50 +-
.../HDF/2.0/hooks/after-INSTALL/scripts/hook.py | 2 +-
.../scripts/shared_initialization.py | 35 +-
.../2.0/hooks/after-INSTALL/scripts/hook.py | 2 +-
.../scripts/shared_initialization.py | 31 +-
.../services/YARN/configuration/yarn-site.xml | 6 +
.../YARN/package/scripts/params_linux.py | 9 +-
.../YARN/package/scripts/params_windows.py | 10 +-
.../YARN/package/scripts/resourcemanager.py | 18 +-
.../package/templates/include_hosts_list.j2 | 21 +
contrib/version-builder/example.py | 1 +
contrib/version-builder/example.sh | 3 +-
contrib/version-builder/version_builder.py | 13 +-
731 files changed, 16854 insertions(+), 9462 deletions(-)
----------------------------------------------------------------------
[14/50] [abbrv] ambari git commit: AMBARI-21650: Ranger Usersync
process starts with older stack script during cross stack upgrade (mugdha)
Posted by ab...@apache.org.
AMBARI-21650: Ranger Usersync process starts with older stack script during cross stack upgrade (mugdha)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a5b8045d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a5b8045d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a5b8045d
Branch: refs/heads/branch-feature-logsearch-ui
Commit: a5b8045dfbc7e8c30fc8b0d23d38ef86243c016a
Parents: b487b45
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Thu Aug 3 17:23:33 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Fri Aug 4 11:40:15 2017 +0530
----------------------------------------------------------------------
.../RANGER/0.4.0/package/scripts/setup_ranger_xml.py | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b8045d/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 4bcf9b0..9b1f6e2 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -551,6 +551,12 @@ def setup_usersync(upgrade_type=None):
mode = 0755,
)
+ if upgrade_type is not None and params.stack_supports_config_versioning:
+ if os.path.islink('/usr/bin/ranger-usersync'):
+ Link('/usr/bin/ranger-usersync', action="delete")
+
+ Link('/usr/bin/ranger-usersync', to=params.usersync_services_file)
+
Execute(('ln','-sf', format('{usersync_services_file}'),'/usr/bin/ranger-usersync'),
not_if=format("ls /usr/bin/ranger-usersync"),
only_if=format("ls {usersync_services_file}"),
[06/50] [abbrv] ambari git commit: AMBARI-21626 - Configs For Target
Stack Are Not Created During Upgrade (jonathanhurley)
Posted by ab...@apache.org.
AMBARI-21626 - Configs For Target Stack Are Not Created During Upgrade (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea57a6ba
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea57a6ba
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea57a6ba
Branch: refs/heads/branch-feature-logsearch-ui
Commit: ea57a6bab346eb18eeb538bd86ac580ff7f07afc
Parents: 97ccf3b
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Aug 1 20:16:21 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Aug 2 11:41:55 2017 -0400
----------------------------------------------------------------------
.../org/apache/ambari/server/state/ConfigHelper.java | 14 ++++++--------
.../org/apache/ambari/server/state/UpgradeHelper.java | 2 +-
.../server/state/stack/upgrade/ClusterGrouping.java | 2 +-
.../stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml | 2 +-
4 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea57a6ba/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index 5ac4c8f..6b82273 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -1242,10 +1242,9 @@ public class ConfigHelper {
if (!defaultPropertiesByType.containsKey(type)) {
defaultPropertiesByType.put(type, new HashMap<String, String>());
}
- if (stackDefaultProperty.getPropertyStackUpgradeBehavior().isMerge()) {
- defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(),
- stackDefaultProperty.getValue());
- }
+
+ defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(),
+ stackDefaultProperty.getValue());
}
// for every installed service, populate the default service properties
@@ -1259,10 +1258,9 @@ public class ConfigHelper {
if (!defaultPropertiesByType.containsKey(type)) {
defaultPropertiesByType.put(type, new HashMap<String, String>());
}
- if (serviceDefaultProperty.getPropertyStackUpgradeBehavior().isMerge()) {
- defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(),
- serviceDefaultProperty.getValue());
- }
+
+ defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(),
+ serviceDefaultProperty.getValue());
}
return defaultPropertiesByType;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea57a6ba/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index a5b40ff..7ed70de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -892,7 +892,7 @@ public class UpgradeHelper {
// downgrade is easy - just remove the new and make the old current
if (direction == Direction.DOWNGRADE) {
cluster.applyLatestConfigurations(targetStackId, serviceName);
- return;
+ continue;
}
// upgrade is a bit harder - we have to merge new stack configurations in
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea57a6ba/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
index fa988c3..3deb7c8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
@@ -387,4 +387,4 @@ public class ClusterGrouping extends Grouping {
}
}
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/ea57a6ba/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml b/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml
index b7027c5..ef8ce70 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.2.0/upgrades/upgrade_test_checks.xml
@@ -239,4 +239,4 @@
</component>
</service>
</processing>
-</upgrade>
+</upgrade>
\ No newline at end of file
[18/50] [abbrv] ambari git commit: AMBARI-21623 Log Search Config
should be separated into a Server and Log Feeder interface (mgergely)
Posted by ab...@apache.org.
AMBARI-21623 Log Search Config should be separated into a Server and Log Feeder interface (mgergely)
Change-Id: Ie40cf3b57470c08375124d547dade2c9a3204e9f
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d1ac668
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d1ac668
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d1ac668
Branch: refs/heads/branch-feature-logsearch-ui
Commit: 2d1ac668b6ae272481668d08f4b7bd1c1b99fc45
Parents: 27386c3
Author: Miklos Gergely <mg...@hortonworks.com>
Authored: Fri Aug 4 11:27:57 2017 +0200
Committer: Miklos Gergely <mg...@hortonworks.com>
Committed: Fri Aug 4 11:27:57 2017 +0200
----------------------------------------------------------------------
.../logsearch/config/api/LogSearchConfig.java | 131 ---------
.../config/api/LogSearchConfigFactory.java | 61 +++-
.../config/api/LogSearchConfigLogFeeder.java | 77 +++++
.../config/api/LogSearchConfigServer.java | 111 +++++++
.../config/api/LogSearchConfigClass1.java | 95 ------
.../config/api/LogSearchConfigClass2.java | 95 ------
.../config/api/LogSearchConfigFactoryTest.java | 51 +++-
.../api/LogSearchConfigLogFeederClass1.java | 58 ++++
.../api/LogSearchConfigLogFeederClass2.java | 58 ++++
.../config/api/LogSearchConfigServerClass1.java | 76 +++++
.../config/api/LogSearchConfigServerClass2.java | 76 +++++
.../zookeeper/LogSearchConfigLogFeederZK.java | 228 +++++++++++++++
.../zookeeper/LogSearchConfigServerZK.java | 138 +++++++++
.../config/zookeeper/LogSearchConfigZK.java | 291 +------------------
.../org/apache/ambari/logfeeder/LogFeeder.java | 11 +-
.../ambari/logfeeder/common/ConfigHandler.java | 6 +-
.../logfeeder/input/InputConfigUploader.java | 10 +-
.../apache/ambari/logfeeder/output/Output.java | 6 +-
.../ambari/logfeeder/output/OutputSolrTest.java | 6 +-
.../configurer/LogSearchConfigConfigurer.java | 13 +-
.../configurer/SolrCollectionConfigurer.java | 3 +-
.../ambari/logsearch/dao/SolrDaoBase.java | 11 +-
.../handler/CreateCollectionHandler.java | 7 +-
.../logsearch/manager/ShipperConfigManager.java | 18 +-
.../logsearch/model/common/LSServerFilter.java | 10 +-
25 files changed, 970 insertions(+), 677 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfig.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfig.java
index 76be392..6c3b910 100644
--- a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfig.java
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfig.java
@@ -20,80 +20,14 @@
package org.apache.ambari.logsearch.config.api;
import java.io.Closeable;
-import java.util.List;
-import java.util.Map;
import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
-import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
-import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
/**
* Log Search Configuration, which uploads, retrieves configurations, and monitors it's changes.
*/
public interface LogSearchConfig extends Closeable {
/**
- * Enumeration of the components of the Log Search service.
- */
- public enum Component {
- SERVER, LOGFEEDER;
- }
-
- /**
- * Initialization of the configuration.
- *
- * @param component The component which will use the configuration.
- * @param properties The properties of that component.
- * @param clusterName The name of the cluster, only need to be specified in LOGFEEDER mode (null for SERVER mode).
- * @throws Exception
- */
- void init(Component component, Map<String, String> properties, String clusterName) throws Exception;
-
- /**
- * Returns all the service names with input configurations of a cluster. Will be used only in SERVER mode.
- *
- * @param clusterName The name of the cluster which's services are required.
- * @return List of the service names.
- */
- List<String> getServices(String clusterName);
-
- /**
- * Checks if input configuration exists. Will be used only in LOGFEEDER mode.
- *
- * @param serviceName The name of the service looked for.
- * @return If input configuration exists for the service.
- * @throws Exception
- */
- boolean inputConfigExistsLogFeeder(String serviceName) throws Exception;
-
- /**
- * Checks if input configuration exists. Will be used only in SERVER mode.
- *
- * @param clusterName The name of the cluster where the service is looked for.
- * @param serviceName The name of the service looked for.
- * @return If input configuration exists for the service.
- * @throws Exception
- */
- boolean inputConfigExistsServer(String clusterName, String serviceName) throws Exception;
-
- /**
- * Returns the global configurations of a cluster. Will be used only in SERVER mode.
- *
- * @param clusterName The name of the cluster where the service is looked for.
- * @return The global configurations of the cluster if it exists, null otherwise.
- */
- String getGlobalConfigs(String clusterName);
-
- /**
- * Returns the input configuration of a service in a cluster. Will be used only in SERVER mode.
- *
- * @param clusterName The name of the cluster where the service is looked for.
- * @param serviceName The name of the service looked for.
- * @return The input configuration for the service if it exists, null otherwise.
- */
- InputConfig getInputConfig(String clusterName, String serviceName);
-
- /**
* Uploads the input configuration for a service in a cluster.
*
* @param clusterName The name of the cluster where the service is.
@@ -104,16 +38,6 @@ public interface LogSearchConfig extends Closeable {
void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception;
/**
- * Modifies the input configuration for a service in a cluster.
- *
- * @param clusterName The name of the cluster where the service is.
- * @param serviceName The name of the service of which's input configuration is uploaded.
- * @param inputConfig The input configuration of the service.
- * @throws Exception
- */
- void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception;
-
- /**
* Uploads the log level filter of a log.
*
* @param clusterName The name of the cluster where the log is.
@@ -122,59 +46,4 @@ public interface LogSearchConfig extends Closeable {
* @throws Exception
*/
void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) throws Exception;
-
- /**
- * Modifies the log level filters for all the logs.
- *
- * @param clusterName The name of the cluster where the logs are.
- * @param filters The log level filters to set.
- * @throws Exception
- */
- void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception;
-
- /**
- * Returns the Log Level Filters of a cluster.
- *
- * @param clusterName The name of the cluster which's log level filters are required.
- * @return All the log level filters of the cluster.
- */
- LogLevelFilterMap getLogLevelFilters(String clusterName);
-
- /**
- * Starts the monitoring of the input configurations, asynchronously. Will be used only in LOGFEEDER mode.
- *
- * @param inputConfigMonitor The input config monitor to call in case of an input config change.
- * @param logLevelFilterMonitor The log level filter monitor to call in case of a log level filter change.
- * @param clusterName The name of the cluster, only need to be specified in LOGFEEDER mode (null for SERVER mode).
- * @throws Exception
- */
- void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
- String clusterName) throws Exception;
-
- /**
- * Saves the properties of an Output Solr. Will be used only in SERVER mode.
- *
- * @param type The type of the Output Solr.
- * @param outputSolrProperties The properties of the Output Solr.
- * @throws Exception
- */
- void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception;
-
- /**
- * Get the properties of an Output Solr. Will be used only in LOGFEEDER mode.
- *
- * @param type The type of the Output Solr.
- * @return The properties of the Output Solr, or null if it doesn't exist.
- * @throws Exception
- */
- OutputSolrProperties getOutputSolrProperties(String type) throws Exception;
-
- /**
- * Saves the properties of an Output Solr. Will be used only in LOGFEEDER mode.
- *
- * @param type The type of the Output Solr.
- * @param outputConfigMonitors The monitors which want to watch the output config changes.
- * @throws Exception
- */
- void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
index 77b48eb..a84a97b 100644
--- a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
@@ -21,46 +21,81 @@ package org.apache.ambari.logsearch.config.api;
import java.util.Map;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Factory class for LogSearchConfig.
+ * Factory class for LogSearchConfigServer and LogSearchConfigLogFeeder.
*/
public class LogSearchConfigFactory {
private static final Logger LOG = LoggerFactory.getLogger(LogSearchConfigFactory.class);
/**
- * Creates a Log Search Configuration instance that implements {@link org.apache.ambari.logsearch.config.api.LogSearchConfig}.
+ * Creates a Log Search Configuration instance for the Log Search Server that implements
+ * {@link org.apache.ambari.logsearch.config.api.LogSearchConfigServer}.
*
- * @param component The component of the Log Search Service to create the configuration for (SERVER/LOGFEEDER).
* @param properties The properties of the component for which the configuration is created. If the properties contain the
* "logsearch.config.class" entry than the class defined there would be used instead of the default class.
- * @param clusterName The name of the cluster, only need to be specified in LOGFEEDER mode (null for SERVER mode).
* @param defaultClass The default configuration class to use if not specified otherwise.
* @return The Log Search Configuration instance.
- * @throws Exception Throws exception if the defined class does not implement LogSearchConfig, or doesn't have an empty
+ * @throws Exception Throws exception if the defined class does not implement LogSearchConfigServer, or doesn't have an empty
* constructor, or throws an exception in it's init method.
*/
- public static LogSearchConfig createLogSearchConfig(Component component, Map<String, String> properties, String clusterName,
- Class<? extends LogSearchConfig> defaultClass) throws Exception {
+ public static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
+ Class<? extends LogSearchConfigServer> defaultClass) throws Exception {
try {
- LogSearchConfig logSearchConfig = null;
- String configClassName = properties.get("logsearch.config.class");
+ LogSearchConfigServer logSearchConfig = null;
+ String configClassName = properties.get("logsearch.config.server.class");
+ if (configClassName != null && !"".equals(configClassName.trim())) {
+ Class<?> clazz = Class.forName(configClassName);
+ if (LogSearchConfigServer.class.isAssignableFrom(clazz)) {
+ logSearchConfig = (LogSearchConfigServer) clazz.newInstance();
+ } else {
+ throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " +
+ LogSearchConfigServer.class.getName());
+ }
+ } else {
+ logSearchConfig = defaultClass.newInstance();
+ }
+
+ logSearchConfig.init(properties);
+ return logSearchConfig;
+ } catch (Exception e) {
+ LOG.error("Could not initialize logsearch config.", e);
+ throw e;
+ }
+ }
+
+ /**
+ * Creates a Log Search Configuration instance for the Log Search Server that implements
+ * {@link org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder}.
+ *
+ * @param properties The properties of the component for which the configuration is created. If the properties contain the
+ * "logsearch.config.class" entry than the class defined there would be used instead of the default class.
+ * @param clusterName The name of the cluster.
+ * @param defaultClass The default configuration class to use if not specified otherwise.
+ * @return The Log Search Configuration instance.
+ * @throws Exception Throws exception if the defined class does not implement LogSearchConfigLogFeeder, or doesn't have an empty
+ * constructor, or throws an exception in it's init method.
+ */
+ public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
+ Class<? extends LogSearchConfigLogFeeder> defaultClass) throws Exception {
+ try {
+ LogSearchConfigLogFeeder logSearchConfig = null;
+ String configClassName = properties.get("logsearch.config.logfeeder.class");
if (configClassName != null && !"".equals(configClassName.trim())) {
Class<?> clazz = Class.forName(configClassName);
if (LogSearchConfig.class.isAssignableFrom(clazz)) {
- logSearchConfig = (LogSearchConfig) clazz.newInstance();
+ logSearchConfig = (LogSearchConfigLogFeeder) clazz.newInstance();
} else {
throw new IllegalArgumentException("Class " + configClassName + " does not implement the interface " +
- LogSearchConfig.class.getName());
+ LogSearchConfigLogFeeder.class.getName());
}
} else {
logSearchConfig = defaultClass.newInstance();
}
- logSearchConfig.init(component, properties, clusterName);
+ logSearchConfig.init(properties, clusterName);
return logSearchConfig;
} catch (Exception e) {
LOG.error("Could not initialize logsearch config.", e);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
new file mode 100644
index 0000000..6ed36fd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+
+/**
+ * Log Search Configuration for Log Feeder.
+ */
+public interface LogSearchConfigLogFeeder extends LogSearchConfig {
+ /**
+ * Initialization of the configuration.
+ *
+ * @param properties The properties of that component.
+ * @param clusterName The name of the cluster.
+ * @throws Exception
+ */
+ void init(Map<String, String> properties, String clusterName) throws Exception;
+
+ /**
+ * Checks if input configuration exists.
+ *
+ * @param serviceName The name of the service looked for.
+ * @return If input configuration exists for the service.
+ * @throws Exception
+ */
+ boolean inputConfigExists(String serviceName) throws Exception;
+
+ /**
+ * Starts the monitoring of the input configurations, asynchronously.
+ *
+ * @param inputConfigMonitor The input config monitor to call in case of an input config change.
+ * @param logLevelFilterMonitor The log level filter monitor to call in case of a log level filter change.
+ * @param clusterName The name of the cluster.
+ * @throws Exception
+ */
+ void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
+ String clusterName) throws Exception;
+
+ /**
+ * Get the properties of an Output Solr.
+ *
+ * @param type The type of the Output Solr.
+ * @return The properties of the Output Solr, or null if it doesn't exist.
+ * @throws Exception
+ */
+ OutputSolrProperties getOutputSolrProperties(String type) throws Exception;
+
+ /**
+ * Saves the properties of an Output Solr.
+ *
+ * @param type The type of the Output Solr.
+ * @param outputConfigMonitors The monitors which want to watch the output config changes.
+ * @throws Exception
+ */
+ void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServer.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServer.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServer.java
new file mode 100644
index 0000000..26889be
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServer.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
+
+/**
+ * Log Search Configuration for Log Search Server.
+ */
+public interface LogSearchConfigServer extends LogSearchConfig {
+ /**
+ * Initialization of the configuration.
+ *
+ * @param properties The properties of that component.
+ * @throws Exception
+ */
+ void init(Map<String, String> properties) throws Exception;
+
+ /**
+ * Returns all the service names with input configurations of a cluster.
+ *
+ * @param clusterName The name of the cluster which's services are required.
+ * @return List of the service names.
+ */
+ List<String> getServices(String clusterName);
+
+ /**
+ * Checks if input configuration exists.
+ *
+ * @param clusterName The name of the cluster where the service is looked for.
+ * @param serviceName The name of the service looked for.
+ * @return If input configuration exists for the service.
+ * @throws Exception
+ */
+ boolean inputConfigExists(String clusterName, String serviceName) throws Exception;
+
+ /**
+ * Returns the global configurations of a cluster.
+ *
+ * @param clusterName The name of the cluster where the service is looked for.
+ * @return The global configurations of the cluster if it exists, null otherwise.
+ */
+ String getGlobalConfigs(String clusterName);
+
+ /**
+ * Modifies the input configuration for a service in a cluster.
+ *
+ * @param clusterName The name of the cluster where the service is.
+ * @param serviceName The name of the service of which's input configuration is uploaded.
+ * @param inputConfig The input configuration of the service.
+ * @throws Exception
+ */
+ void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception;
+
+ /**
+ * Returns the input configuration of a service in a cluster.
+ *
+ * @param clusterName The name of the cluster where the service is looked for.
+ * @param serviceName The name of the service looked for.
+ * @return The input configuration for the service if it exists, null otherwise.
+ */
+ InputConfig getInputConfig(String clusterName, String serviceName);
+
+ /**
+ * Modifies the log level filters for all the logs.
+ *
+ * @param clusterName The name of the cluster where the logs are.
+ * @param filters The log level filters to set.
+ * @throws Exception
+ */
+ void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception;
+
+ /**
+ * Returns the Log Level Filters of a cluster.
+ *
+ * @param clusterName The name of the cluster which's log level filters are required.
+ * @return All the log level filters of the cluster.
+ */
+ LogLevelFilterMap getLogLevelFilters(String clusterName);
+
+ /**
+ * Saves the properties of an Output Solr.
+ *
+ * @param type The type of the Output Solr.
+ * @param outputSolrProperties The properties of the Output Solr.
+ * @throws Exception
+ */
+ void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass1.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass1.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass1.java
deleted file mode 100644
index e308346..0000000
--- a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass1.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.logsearch.config.api;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
-import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
-import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
-
-public class LogSearchConfigClass1 implements LogSearchConfig {
- @Override
- public void init(Component component, Map<String, String> properties, String clusterName) {}
-
- @Override
- public boolean inputConfigExistsLogFeeder(String serviceName) throws Exception {
- return false;
- }
-
- @Override
- public boolean inputConfigExistsServer(String clusterName, String serviceName) throws Exception {
- return false;
- }
-
- @Override
- public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
-
- @Override
- public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
-
- @Override
- public void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
- String clusterName) throws Exception {}
-
- @Override
- public List<String> getServices(String clusterName) {
- return null;
- }
-
- @Override
- public String getGlobalConfigs(String clusterName) {
- return null;
- }
-
- @Override
- public InputConfig getInputConfig(String clusterName, String serviceName) {
- return null;
- }
-
- @Override
- public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
-
- @Override
- public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {}
-
- @Override
- public LogLevelFilterMap getLogLevelFilters(String clusterName) {
- return null;
- }
-
- @Override
- public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {}
-
- @Override
- public OutputSolrProperties getOutputSolrProperties(String type) {
- return null;
- }
-
- @Override
- public void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {}
-
- @Override
- public void close() {}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass2.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass2.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass2.java
deleted file mode 100644
index b64dae8..0000000
--- a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigClass2.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF 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.
- */
-
-package org.apache.ambari.logsearch.config.api;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
-import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
-import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
-
-public class LogSearchConfigClass2 implements LogSearchConfig {
- @Override
- public void init(Component component, Map<String, String> properties, String clusterName) {}
-
- @Override
- public boolean inputConfigExistsLogFeeder(String serviceName) throws Exception {
- return false;
- }
-
- @Override
- public boolean inputConfigExistsServer(String clusterName, String serviceName) throws Exception {
- return false;
- }
-
- @Override
- public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
-
- @Override
- public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
-
- @Override
- public void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
- String clusterName) throws Exception {}
-
- @Override
- public List<String> getServices(String clusterName) {
- return null;
- }
-
- @Override
- public String getGlobalConfigs(String clusterName) {
- return null;
- }
-
- @Override
- public InputConfig getInputConfig(String clusterName, String serviceName) {
- return null;
- }
-
- @Override
- public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
-
- @Override
- public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {}
-
- @Override
- public LogLevelFilterMap getLogLevelFilters(String clusterName) {
- return null;
- }
-
- @Override
- public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {}
-
- @Override
- public OutputSolrProperties getOutputSolrProperties(String type) {
- return null;
- }
-
- @Override
- public void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {}
-
- @Override
- public void close() {}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactoryTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactoryTest.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactoryTest.java
index f990c5c..d0db87f 100644
--- a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactoryTest.java
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactoryTest.java
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig.Component;
import org.junit.Test;
import junit.framework.Assert;
@@ -31,28 +30,52 @@ import junit.framework.Assert;
public class LogSearchConfigFactoryTest {
@Test
- public void testDefaultConfig() throws Exception {
- LogSearchConfig config = LogSearchConfigFactory.createLogSearchConfig(Component.SERVER,
- Collections.<String, String> emptyMap(), null, LogSearchConfigClass1.class);
+ public void testDefaultConfigServer() throws Exception {
+ LogSearchConfigServer config = LogSearchConfigFactory.createLogSearchConfigServer( Collections.<String, String> emptyMap(),
+ LogSearchConfigServerClass1.class);
- Assert.assertSame(config.getClass(), LogSearchConfigClass1.class);
+ Assert.assertSame(config.getClass(), LogSearchConfigServerClass1.class);
}
@Test
- public void testCustomConfig() throws Exception {
+ public void testCustomConfigServer() throws Exception {
Map<String, String> logsearchConfClassMap = new HashMap<>();
- logsearchConfClassMap.put("logsearch.config.class", "org.apache.ambari.logsearch.config.api.LogSearchConfigClass2");
- LogSearchConfig config = LogSearchConfigFactory.createLogSearchConfig(Component.SERVER,
- logsearchConfClassMap, null, LogSearchConfigClass1.class);
+ logsearchConfClassMap.put("logsearch.config.server.class", "org.apache.ambari.logsearch.config.api.LogSearchConfigServerClass2");
+ LogSearchConfig config = LogSearchConfigFactory.createLogSearchConfigServer(logsearchConfClassMap,
+ LogSearchConfigServerClass1.class);
- Assert.assertSame(config.getClass(), LogSearchConfigClass2.class);
+ Assert.assertSame(config.getClass(), LogSearchConfigServerClass2.class);
}
@Test(expected = IllegalArgumentException.class)
- public void testNonConfigClass() throws Exception {
+ public void testNonConfigClassServer() throws Exception {
Map<String, String> logsearchConfClassMap = new HashMap<>();
- logsearchConfClassMap.put("logsearch.config.class", "org.apache.ambari.logsearch.config.api.NonLogSearchConfigClass");
- LogSearchConfigFactory.createLogSearchConfig(Component.SERVER,
- logsearchConfClassMap, null, LogSearchConfigClass1.class);
+ logsearchConfClassMap.put("logsearch.config.server.class", "org.apache.ambari.logsearch.config.api.NonLogSearchConfigClass");
+ LogSearchConfigFactory.createLogSearchConfigServer(logsearchConfClassMap, LogSearchConfigServerClass1.class);
+ }
+
+ @Test
+ public void testDefaultConfigLogFeeder() throws Exception {
+ LogSearchConfigLogFeeder config = LogSearchConfigFactory.createLogSearchConfigLogFeeder( Collections.<String, String> emptyMap(),
+ null, LogSearchConfigLogFeederClass1.class);
+
+ Assert.assertSame(config.getClass(), LogSearchConfigLogFeederClass1.class);
+ }
+
+ @Test
+ public void testCustomConfigLogFeeder() throws Exception {
+ Map<String, String> logsearchConfClassMap = new HashMap<>();
+ logsearchConfClassMap.put("logsearch.config.logfeeder.class", "org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeederClass2");
+ LogSearchConfigLogFeeder config = LogSearchConfigFactory.createLogSearchConfigLogFeeder(logsearchConfClassMap, null,
+ LogSearchConfigLogFeederClass1.class);
+
+ Assert.assertSame(config.getClass(), LogSearchConfigLogFeederClass2.class);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testNonConfigClassLogFeeder() throws Exception {
+ Map<String, String> logsearchConfClassMap = new HashMap<>();
+ logsearchConfClassMap.put("logsearch.config.logfeeder.class", "org.apache.ambari.logsearch.config.api.NonLogSearchConfigClass");
+ LogSearchConfigFactory.createLogSearchConfigLogFeeder(logsearchConfClassMap, null, LogSearchConfigLogFeederClass1.class);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass1.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass1.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass1.java
new file mode 100644
index 0000000..b7da7fe
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass1.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+
+public class LogSearchConfigLogFeederClass1 implements LogSearchConfigLogFeeder {
+ @Override
+ public void init(Map<String, String> properties, String clusterName) {}
+
+ @Override
+ public boolean inputConfigExists(String serviceName) throws Exception {
+ return false;
+ }
+
+ @Override
+ public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
+ String clusterName) throws Exception {}
+
+ @Override
+ public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
+
+ @Override
+ public OutputSolrProperties getOutputSolrProperties(String type) {
+ return null;
+ }
+
+ @Override
+ public void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {}
+
+ @Override
+ public void close() {}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass2.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass2.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass2.java
new file mode 100644
index 0000000..b703bf8
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeederClass2.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+
+public class LogSearchConfigLogFeederClass2 implements LogSearchConfigLogFeeder {
+ @Override
+ public void init(Map<String, String> properties, String clusterName) {}
+
+ @Override
+ public boolean inputConfigExists(String serviceName) throws Exception {
+ return false;
+ }
+
+ @Override
+ public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public void monitorInputConfigChanges(InputConfigMonitor inputConfigMonitor, LogLevelFilterMonitor logLevelFilterMonitor,
+ String clusterName) throws Exception {}
+
+ @Override
+ public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
+
+ @Override
+ public OutputSolrProperties getOutputSolrProperties(String type) {
+ return null;
+ }
+
+ @Override
+ public void monitorOutputProperties(List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {}
+
+ @Override
+ public void close() {}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass1.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass1.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass1.java
new file mode 100644
index 0000000..71e924a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass1.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
+
+public class LogSearchConfigServerClass1 implements LogSearchConfigServer {
+ @Override
+ public void init(Map<String, String> properties) {}
+
+ @Override
+ public boolean inputConfigExists(String clusterName, String serviceName) throws Exception {
+ return false;
+ }
+
+ @Override
+ public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public List<String> getServices(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public String getGlobalConfigs(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public InputConfig getInputConfig(String clusterName, String serviceName) {
+ return null;
+ }
+
+ @Override
+ public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
+
+ @Override
+ public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {}
+
+ @Override
+ public LogLevelFilterMap getLogLevelFilters(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {}
+
+ @Override
+ public void close() {}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass2.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass2.java b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass2.java
new file mode 100644
index 0000000..a767ff5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/test/java/org/apache/ambari/logsearch/config/api/LogSearchConfigServerClass2.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
+
+public class LogSearchConfigServerClass2 implements LogSearchConfigServer {
+ @Override
+ public void init(Map<String, String> properties) {}
+
+ @Override
+ public boolean inputConfigExists(String clusterName, String serviceName) throws Exception {
+ return false;
+ }
+
+ @Override
+ public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {}
+
+ @Override
+ public List<String> getServices(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public String getGlobalConfigs(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public InputConfig getInputConfig(String clusterName, String serviceName) {
+ return null;
+ }
+
+ @Override
+ public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) {}
+
+ @Override
+ public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {}
+
+ @Override
+ public LogLevelFilterMap getLogLevelFilters(String clusterName) {
+ return null;
+ }
+
+ @Override
+ public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {}
+
+ @Override
+ public void close() {}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigLogFeederZK.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigLogFeederZK.java b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigLogFeederZK.java
new file mode 100644
index 0000000..c050540
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigLogFeederZK.java
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.zookeeper;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
+import org.apache.ambari.logsearch.config.api.OutputConfigMonitor;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigGson;
+import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigImpl;
+import org.apache.ambari.logsearch.config.zookeeper.model.outputconfig.impl.OutputSolrPropertiesImpl;
+import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
+import org.apache.ambari.logsearch.config.api.LogLevelFilterMonitor;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.recipes.cache.ChildData;
+import org.apache.curator.framework.recipes.cache.TreeCache;
+import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
+import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
+import org.apache.curator.framework.recipes.cache.TreeCacheListener;
+import org.apache.curator.utils.ZKPaths;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
+public class LogSearchConfigLogFeederZK extends LogSearchConfigZK implements LogSearchConfigLogFeeder {
+ private static final Logger LOG = LoggerFactory.getLogger(LogSearchConfigLogFeederZK.class);
+
+ private static final long WAIT_FOR_ROOT_SLEEP_SECONDS = 10;
+
+ private TreeCache logFeederClusterCache;
+
+ @Override
+ public void init(Map<String, String> properties, String clusterName) throws Exception {
+ super.init(properties);
+ while (client.checkExists().forPath("/") == null) {
+ LOG.info("Root node is not present yet, going to sleep for " + WAIT_FOR_ROOT_SLEEP_SECONDS + " seconds");
+ Thread.sleep(WAIT_FOR_ROOT_SLEEP_SECONDS * 1000);
+ }
+
+ logFeederClusterCache = new TreeCache(client, String.format("/%s", clusterName));
+ }
+
+ @Override
+ public boolean inputConfigExists(String serviceName) throws Exception {
+ String nodePath = String.format("/input/%s", serviceName);
+ return logFeederClusterCache.getCurrentData(nodePath) != null;
+ }
+
+ @Override
+ public void monitorInputConfigChanges(final InputConfigMonitor inputConfigMonitor,
+ final LogLevelFilterMonitor logLevelFilterMonitor, final String clusterName) throws Exception {
+ final JsonParser parser = new JsonParser();
+ final JsonArray globalConfigNode = new JsonArray();
+ for (String globalConfigJsonString : inputConfigMonitor.getGlobalConfigJsons()) {
+ JsonElement globalConfigJson = parser.parse(globalConfigJsonString);
+ globalConfigNode.add(globalConfigJson.getAsJsonObject().get("global"));
+ }
+
+ createGlobalConfigNode(globalConfigNode, clusterName);
+
+ TreeCacheListener listener = new TreeCacheListener() {
+ private final Set<Type> nodeEvents = ImmutableSet.of(Type.NODE_ADDED, Type.NODE_UPDATED, Type.NODE_REMOVED);
+
+ public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
+ if (!nodeEvents.contains(event.getType())) {
+ return;
+ }
+
+ String nodeName = ZKPaths.getNodeFromPath(event.getData().getPath());
+ String nodeData = new String(event.getData().getData());
+ Type eventType = event.getType();
+
+ String configPathStab = String.format("/%s/", clusterName);
+
+ if (event.getData().getPath().startsWith(configPathStab + "input/")) {
+ handleInputConfigChange(eventType, nodeName, nodeData);
+ } else if (event.getData().getPath().startsWith(configPathStab + "loglevelfilter/")) {
+ handleLogLevelFilterChange(eventType, nodeName, nodeData);
+ }
+ }
+
+ private void handleInputConfigChange(Type eventType, String nodeName, String nodeData) {
+ switch (eventType) {
+ case NODE_ADDED:
+ LOG.info("Node added under input ZK node: " + nodeName);
+ addInputs(nodeName, nodeData);
+ break;
+ case NODE_UPDATED:
+ LOG.info("Node updated under input ZK node: " + nodeName);
+ removeInputs(nodeName);
+ addInputs(nodeName, nodeData);
+ break;
+ case NODE_REMOVED:
+ LOG.info("Node removed from input ZK node: " + nodeName);
+ removeInputs(nodeName);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void removeInputs(String serviceName) {
+ inputConfigMonitor.removeInputs(serviceName);
+ }
+
+ private void addInputs(String serviceName, String inputConfig) {
+ try {
+ JsonElement inputConfigJson = parser.parse(inputConfig);
+ for (Map.Entry<String, JsonElement> typeEntry : inputConfigJson.getAsJsonObject().entrySet()) {
+ for (JsonElement e : typeEntry.getValue().getAsJsonArray()) {
+ for (JsonElement globalConfig : globalConfigNode) {
+ merge(globalConfig.getAsJsonObject(), e.getAsJsonObject());
+ }
+ }
+ }
+
+ inputConfigMonitor.loadInputConfigs(serviceName, InputConfigGson.gson.fromJson(inputConfigJson, InputConfigImpl.class));
+ } catch (Exception e) {
+ LOG.error("Could not load input configuration for service " + serviceName + ":\n" + inputConfig, e);
+ }
+ }
+
+ private void handleLogLevelFilterChange(Type eventType, String nodeName, String nodeData) {
+ switch (eventType) {
+ case NODE_ADDED:
+ case NODE_UPDATED:
+ LOG.info("Node added/updated under loglevelfilter ZK node: " + nodeName);
+ LogLevelFilter logLevelFilter = gson.fromJson(nodeData, LogLevelFilter.class);
+ logLevelFilterMonitor.setLogLevelFilter(nodeName, logLevelFilter);
+ break;
+ case NODE_REMOVED:
+ LOG.info("Node removed loglevelfilter input ZK node: " + nodeName);
+ logLevelFilterMonitor.removeLogLevelFilter(nodeName);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void merge(JsonObject source, JsonObject target) {
+ for (Map.Entry<String, JsonElement> e : source.entrySet()) {
+ if (!target.has(e.getKey())) {
+ target.add(e.getKey(), e.getValue());
+ } else {
+ if (e.getValue().isJsonObject()) {
+ JsonObject valueJson = (JsonObject)e.getValue();
+ merge(valueJson, target.get(e.getKey()).getAsJsonObject());
+ }
+ }
+ }
+ }
+ };
+ logFeederClusterCache.getListenable().addListener(listener);
+ logFeederClusterCache.start();
+ }
+
+ private void createGlobalConfigNode(JsonArray globalConfigNode, String clusterName) {
+ String globalConfigNodePath = String.format("/%s/global", clusterName);
+ String data = InputConfigGson.gson.toJson(globalConfigNode);
+
+ try {
+ if (logFeederClusterCache.getCurrentData(globalConfigNodePath) != null) {
+ client.setData().forPath(globalConfigNodePath, data.getBytes());
+ } else {
+ client.create().creatingParentContainersIfNeeded().withACL(getAcls()).forPath(globalConfigNodePath, data.getBytes());
+ }
+ } catch (Exception e) {
+ LOG.warn("Exception during global config node creation/update", e);
+ }
+ }
+
+ @Override
+ public OutputSolrProperties getOutputSolrProperties(String type) throws Exception {
+ String nodePath = String.format("/output/solr/%s", type);
+ ChildData currentData = outputCache.getCurrentData(nodePath);
+ return currentData == null ?
+ null :
+ gson.fromJson(new String(currentData.getData()), OutputSolrPropertiesImpl.class);
+ }
+
+ @Override
+ public void monitorOutputProperties(final List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {
+ TreeCacheListener listener = new TreeCacheListener() {
+ public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
+ if (event.getType() != Type.NODE_UPDATED) {
+ return;
+ }
+
+ LOG.info("Output config updated: " + event.getData().getPath());
+ for (OutputConfigMonitor monitor : outputConfigMonitors) {
+ String monitorPath = String.format("/output/%s/%s", monitor.getDestination(), monitor.getOutputType());
+ if (monitorPath.equals(event.getData().getPath())) {
+ String nodeData = new String(event.getData().getData());
+ OutputSolrProperties outputSolrProperties = gson.fromJson(nodeData, OutputSolrPropertiesImpl.class);
+ monitor.outputConfigChanged(outputSolrProperties);
+ }
+ }
+ }
+ };
+ outputCache.getListenable().addListener(listener);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigServerZK.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigServerZK.java b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigServerZK.java
new file mode 100644
index 0000000..9973196
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigServerZK.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF 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.
+ */
+
+package org.apache.ambari.logsearch.config.zookeeper;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.ambari.logsearch.config.api.LogSearchConfigServer;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
+import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
+import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
+import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
+import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputAdapter;
+import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigGson;
+import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigImpl;
+import org.apache.curator.framework.recipes.cache.ChildData;
+import org.apache.curator.framework.recipes.cache.TreeCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
+
+public class LogSearchConfigServerZK extends LogSearchConfigZK implements LogSearchConfigServer {
+ private static final Logger LOG = LoggerFactory.getLogger(LogSearchConfigServerZK.class);
+
+ private TreeCache serverCache;
+
+ @Override
+ public void init(Map<String, String> properties) throws Exception {
+ super.init(properties);
+
+ if (client.checkExists().forPath("/") == null) {
+ client.create().creatingParentContainersIfNeeded().forPath("/");
+ }
+ if (client.checkExists().forPath("/output") == null) {
+ client.create().creatingParentContainersIfNeeded().forPath("/output");
+ }
+ serverCache = new TreeCache(client, "/");
+ serverCache.start();
+ }
+
+ @Override
+ public boolean inputConfigExists(String clusterName, String serviceName) throws Exception {
+ String nodePath = String.format("/%s/input/%s", clusterName, serviceName);
+ return serverCache.getCurrentData(nodePath) != null;
+ }
+
+ @Override
+ public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {
+ String nodePath = String.format("/%s/input/%s", clusterName, serviceName);
+ client.setData().forPath(nodePath, inputConfig.getBytes());
+ LOG.info("Set input config for the service " + serviceName + " for cluster " + clusterName);
+ }
+
+ @Override
+ public List<String> getServices(String clusterName) {
+ String parentPath = String.format("/%s/input", clusterName);
+ Map<String, ChildData> serviceNodes = serverCache.getCurrentChildren(parentPath);
+ return serviceNodes == null ?
+ new ArrayList<>() :
+ new ArrayList<>(serviceNodes.keySet());
+ }
+
+ @Override
+ public String getGlobalConfigs(String clusterName) {
+ String globalConfigNodePath = String.format("/%s/global", clusterName);
+ return new String(serverCache.getCurrentData(globalConfigNodePath).getData());
+ }
+
+ @Override
+ public InputConfig getInputConfig(String clusterName, String serviceName) {
+ String globalConfigData = getGlobalConfigs(clusterName);
+ JsonArray globalConfigs = (JsonArray) new JsonParser().parse(globalConfigData);
+ InputAdapter.setGlobalConfigs(globalConfigs);
+
+ ChildData childData = serverCache.getCurrentData(String.format("/%s/input/%s", clusterName, serviceName));
+ return childData == null ? null : InputConfigGson.gson.fromJson(new String(childData.getData()), InputConfigImpl.class);
+ }
+
+ @Override
+ public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {
+ for (Map.Entry<String, LogLevelFilter> e : filters.getFilter().entrySet()) {
+ String nodePath = String.format("/%s/loglevelfilter/%s", clusterName, e.getKey());
+ String logLevelFilterJson = gson.toJson(e.getValue());
+ String currentLogLevelFilterJson = new String(serverCache.getCurrentData(nodePath).getData());
+ if (!logLevelFilterJson.equals(currentLogLevelFilterJson)) {
+ client.setData().forPath(nodePath, logLevelFilterJson.getBytes());
+ LOG.info("Set log level filter for the log " + e.getKey() + " for cluster " + clusterName);
+ }
+ }
+ }
+
+ @Override
+ public LogLevelFilterMap getLogLevelFilters(String clusterName) {
+ String parentPath = String.format("/%s/loglevelfilter", clusterName);
+ Map<String, ChildData> logLevelFilterNodes = serverCache.getCurrentChildren(parentPath);
+ TreeMap<String, LogLevelFilter> filters = new TreeMap<>();
+ for (Map.Entry<String, ChildData> e : logLevelFilterNodes.entrySet()) {
+ LogLevelFilter logLevelFilter = gson.fromJson(new String(e.getValue().getData()), LogLevelFilter.class);
+ filters.put(e.getKey(), logLevelFilter);
+ }
+
+ LogLevelFilterMap logLevelFilters = new LogLevelFilterMap();
+ logLevelFilters.setFilter(filters);
+ return logLevelFilters;
+ }
+
+ @Override
+ public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {
+ String nodePath = String.format("/output/solr/%s", type);
+ String data = gson.toJson(outputSolrProperties);
+ if (outputCache.getCurrentData(nodePath) == null) {
+ client.create().creatingParentContainersIfNeeded().withACL(getAcls()).forPath(nodePath, data.getBytes());
+ } else {
+ client.setData().forPath(nodePath, data.getBytes());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigZK.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigZK.java b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigZK.java
index 387d0c6..7037bef 100644
--- a/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigZK.java
+++ b/ambari-logsearch/ambari-logsearch-config-zookeeper/src/main/java/org/apache/ambari/logsearch/config/zookeeper/LogSearchConfigZK.java
@@ -22,33 +22,16 @@ package org.apache.ambari.logsearch.config.zookeeper;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.ambari.logsearch.config.api.OutputConfigMonitor;
import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilterMap;
-import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
-import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
-import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputAdapter;
-import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigGson;
-import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputConfigImpl;
-import org.apache.ambari.logsearch.config.zookeeper.model.outputconfig.impl.OutputSolrPropertiesImpl;
-import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
-import org.apache.ambari.logsearch.config.api.LogLevelFilterMonitor;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.TreeCache;
-import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
-import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
-import org.apache.curator.framework.recipes.cache.TreeCacheListener;
import org.apache.curator.retry.ExponentialBackoffRetry;
-import org.apache.curator.utils.ZKPaths;
import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
@@ -57,13 +40,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
public class LogSearchConfigZK implements LogSearchConfig {
private static final Logger LOG = LoggerFactory.getLogger(LogSearchConfigZK.class);
@@ -71,7 +49,6 @@ public class LogSearchConfigZK implements LogSearchConfig {
private static final int SESSION_TIMEOUT = 15000;
private static final int CONNECTION_TIMEOUT = 30000;
private static final String DEFAULT_ZK_ROOT = "/logsearch";
- private static final long WAIT_FOR_ROOT_SLEEP_SECONDS = 10;
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
@LogSearchPropertyDescription(
@@ -99,16 +76,12 @@ public class LogSearchConfigZK implements LogSearchConfig {
)
private static final String ZK_ROOT_NODE_PROPERTY = "logsearch.config.zk_root";
- private Map<String, String> properties;
- private CuratorFramework client;
- private Gson gson;
+ protected Map<String, String> properties;
+ protected CuratorFramework client;
+ protected TreeCache outputCache;
+ protected Gson gson;
- private TreeCache serverCache;
- private TreeCache logFeederClusterCache;
- private TreeCache outputCache;
-
- @Override
- public void init(Component component, Map<String, String> properties, String clusterName) throws Exception {
+ public void init(Map<String, String> properties) throws Exception {
this.properties = properties;
String root = MapUtils.getString(properties, ZK_ROOT_NODE_PROPERTY, DEFAULT_ZK_ROOT);
@@ -124,39 +97,10 @@ public class LogSearchConfigZK implements LogSearchConfig {
outputCache = new TreeCache(client, "/output");
outputCache.start();
- if (component == Component.SERVER) {
- if (client.checkExists().forPath("/") == null) {
- client.create().creatingParentContainersIfNeeded().forPath("/");
- }
- if (client.checkExists().forPath("/output") == null) {
- client.create().creatingParentContainersIfNeeded().forPath("/output");
- }
- serverCache = new TreeCache(client, "/");
- serverCache.start();
- } else {
- while (client.checkExists().forPath("/") == null) {
- LOG.info("Root node is not present yet, going to sleep for " + WAIT_FOR_ROOT_SLEEP_SECONDS + " seconds");
- Thread.sleep(WAIT_FOR_ROOT_SLEEP_SECONDS * 1000);
- }
- logFeederClusterCache = new TreeCache(client, String.format("/%s", clusterName));
- }
-
gson = new GsonBuilder().setDateFormat(DATE_FORMAT).create();
}
@Override
- public boolean inputConfigExistsLogFeeder(String serviceName) throws Exception {
- String nodePath = String.format("/input/%s", serviceName);
- return logFeederClusterCache.getCurrentData(nodePath) != null;
- }
-
- @Override
- public boolean inputConfigExistsServer(String clusterName, String serviceName) throws Exception {
- String nodePath = String.format("/%s/input/%s", clusterName, serviceName);
- return serverCache.getCurrentData(nodePath) != null;
- }
-
- @Override
public void createInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {
String nodePath = String.format("/%s/input/%s", clusterName, serviceName);
try {
@@ -168,159 +112,6 @@ public class LogSearchConfigZK implements LogSearchConfig {
}
@Override
- public void setInputConfig(String clusterName, String serviceName, String inputConfig) throws Exception {
- String nodePath = String.format("/%s/input/%s", clusterName, serviceName);
- client.setData().forPath(nodePath, inputConfig.getBytes());
- LOG.info("Set input config for the service " + serviceName + " for cluster " + clusterName);
- }
-
- @Override
- public void monitorInputConfigChanges(final InputConfigMonitor inputConfigMonitor,
- final LogLevelFilterMonitor logLevelFilterMonitor, final String clusterName) throws Exception {
- final JsonParser parser = new JsonParser();
- final JsonArray globalConfigNode = new JsonArray();
- for (String globalConfigJsonString : inputConfigMonitor.getGlobalConfigJsons()) {
- JsonElement globalConfigJson = parser.parse(globalConfigJsonString);
- globalConfigNode.add(globalConfigJson.getAsJsonObject().get("global"));
- }
-
- createGlobalConfigNode(globalConfigNode, clusterName);
-
- TreeCacheListener listener = new TreeCacheListener() {
- private final Set<Type> nodeEvents = ImmutableSet.of(Type.NODE_ADDED, Type.NODE_UPDATED, Type.NODE_REMOVED);
-
- public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
- if (!nodeEvents.contains(event.getType())) {
- return;
- }
-
- String nodeName = ZKPaths.getNodeFromPath(event.getData().getPath());
- String nodeData = new String(event.getData().getData());
- Type eventType = event.getType();
-
- String configPathStab = String.format("/%s/", clusterName);
-
- if (event.getData().getPath().startsWith(configPathStab + "input/")) {
- handleInputConfigChange(eventType, nodeName, nodeData);
- } else if (event.getData().getPath().startsWith(configPathStab + "loglevelfilter/")) {
- handleLogLevelFilterChange(eventType, nodeName, nodeData);
- }
- }
-
- private void handleInputConfigChange(Type eventType, String nodeName, String nodeData) {
- switch (eventType) {
- case NODE_ADDED:
- LOG.info("Node added under input ZK node: " + nodeName);
- addInputs(nodeName, nodeData);
- break;
- case NODE_UPDATED:
- LOG.info("Node updated under input ZK node: " + nodeName);
- removeInputs(nodeName);
- addInputs(nodeName, nodeData);
- break;
- case NODE_REMOVED:
- LOG.info("Node removed from input ZK node: " + nodeName);
- removeInputs(nodeName);
- break;
- default:
- break;
- }
- }
-
- private void removeInputs(String serviceName) {
- inputConfigMonitor.removeInputs(serviceName);
- }
-
- private void addInputs(String serviceName, String inputConfig) {
- try {
- JsonElement inputConfigJson = parser.parse(inputConfig);
- for (Map.Entry<String, JsonElement> typeEntry : inputConfigJson.getAsJsonObject().entrySet()) {
- for (JsonElement e : typeEntry.getValue().getAsJsonArray()) {
- for (JsonElement globalConfig : globalConfigNode) {
- merge(globalConfig.getAsJsonObject(), e.getAsJsonObject());
- }
- }
- }
-
- inputConfigMonitor.loadInputConfigs(serviceName, InputConfigGson.gson.fromJson(inputConfigJson, InputConfigImpl.class));
- } catch (Exception e) {
- LOG.error("Could not load input configuration for service " + serviceName + ":\n" + inputConfig, e);
- }
- }
-
- private void handleLogLevelFilterChange(Type eventType, String nodeName, String nodeData) {
- switch (eventType) {
- case NODE_ADDED:
- case NODE_UPDATED:
- LOG.info("Node added/updated under loglevelfilter ZK node: " + nodeName);
- LogLevelFilter logLevelFilter = gson.fromJson(nodeData, LogLevelFilter.class);
- logLevelFilterMonitor.setLogLevelFilter(nodeName, logLevelFilter);
- break;
- case NODE_REMOVED:
- LOG.info("Node removed loglevelfilter input ZK node: " + nodeName);
- logLevelFilterMonitor.removeLogLevelFilter(nodeName);
- break;
- default:
- break;
- }
- }
-
- private void merge(JsonObject source, JsonObject target) {
- for (Map.Entry<String, JsonElement> e : source.entrySet()) {
- if (!target.has(e.getKey())) {
- target.add(e.getKey(), e.getValue());
- } else {
- if (e.getValue().isJsonObject()) {
- JsonObject valueJson = (JsonObject)e.getValue();
- merge(valueJson, target.get(e.getKey()).getAsJsonObject());
- }
- }
- }
- }
- };
- logFeederClusterCache.getListenable().addListener(listener);
- logFeederClusterCache.start();
- }
-
- private void createGlobalConfigNode(JsonArray globalConfigNode, String clusterName) {
- String globalConfigNodePath = String.format("/%s/global", clusterName);
- String data = InputConfigGson.gson.toJson(globalConfigNode);
-
- try {
- if (logFeederClusterCache.getCurrentData(globalConfigNodePath) != null) {
- client.setData().forPath(globalConfigNodePath, data.getBytes());
- } else {
- client.create().creatingParentContainersIfNeeded().withACL(getAcls()).forPath(globalConfigNodePath, data.getBytes());
- }
- } catch (Exception e) {
- LOG.warn("Exception during global config node creation/update", e);
- }
- }
-
- @Override
- public List<String> getServices(String clusterName) {
- String parentPath = String.format("/%s/input", clusterName);
- Map<String, ChildData> serviceNodes = serverCache.getCurrentChildren(parentPath);
- return new ArrayList<String>(serviceNodes.keySet());
- }
-
- @Override
- public String getGlobalConfigs(String clusterName) {
- String globalConfigNodePath = String.format("/%s/global", clusterName);
- return new String(serverCache.getCurrentData(globalConfigNodePath).getData());
- }
-
- @Override
- public InputConfig getInputConfig(String clusterName, String serviceName) {
- String globalConfigData = getGlobalConfigs(clusterName);
- JsonArray globalConfigs = (JsonArray) new JsonParser().parse(globalConfigData);
- InputAdapter.setGlobalConfigs(globalConfigs);
-
- ChildData childData = serverCache.getCurrentData(String.format("/%s/input/%s", clusterName, serviceName));
- return childData == null ? null : InputConfigGson.gson.fromJson(new String(childData.getData()), InputConfigImpl.class);
- }
-
- @Override
public void createLogLevelFilter(String clusterName, String logId, LogLevelFilter filter) throws Exception {
String nodePath = String.format("/%s/loglevelfilter/%s", clusterName, logId);
String logLevelFilterJson = gson.toJson(filter);
@@ -332,35 +123,7 @@ public class LogSearchConfigZK implements LogSearchConfig {
}
}
- @Override
- public void setLogLevelFilters(String clusterName, LogLevelFilterMap filters) throws Exception {
- for (Map.Entry<String, LogLevelFilter> e : filters.getFilter().entrySet()) {
- String nodePath = String.format("/%s/loglevelfilter/%s", clusterName, e.getKey());
- String logLevelFilterJson = gson.toJson(e.getValue());
- String currentLogLevelFilterJson = new String(serverCache.getCurrentData(nodePath).getData());
- if (!logLevelFilterJson.equals(currentLogLevelFilterJson)) {
- client.setData().forPath(nodePath, logLevelFilterJson.getBytes());
- LOG.info("Set log level filter for the log " + e.getKey() + " for cluster " + clusterName);
- }
- }
- }
-
- @Override
- public LogLevelFilterMap getLogLevelFilters(String clusterName) {
- String parentPath = String.format("/%s/loglevelfilter", clusterName);
- Map<String, ChildData> logLevelFilterNodes = serverCache.getCurrentChildren(parentPath);
- TreeMap<String, LogLevelFilter> filters = new TreeMap<>();
- for (Map.Entry<String, ChildData> e : logLevelFilterNodes.entrySet()) {
- LogLevelFilter logLevelFilter = gson.fromJson(new String(e.getValue().getData()), LogLevelFilter.class);
- filters.put(e.getKey(), logLevelFilter);
- }
-
- LogLevelFilterMap logLevelFilters = new LogLevelFilterMap();
- logLevelFilters.setFilter(filters);
- return logLevelFilters;
- }
-
- private List<ACL> getAcls() {
+ protected List<ACL> getAcls() {
String aclStr = properties.get(ZK_ACLS_PROPERTY);
if (StringUtils.isBlank(aclStr)) {
return ZooDefs.Ids.OPEN_ACL_UNSAFE;
@@ -404,48 +167,6 @@ public class LogSearchConfigZK implements LogSearchConfig {
}
@Override
- public void saveOutputSolrProperties(String type, OutputSolrProperties outputSolrProperties) throws Exception {
- String nodePath = String.format("/output/solr/%s", type);
- String data = gson.toJson(outputSolrProperties);
- if (outputCache.getCurrentData(nodePath) == null) {
- client.create().creatingParentContainersIfNeeded().withACL(getAcls()).forPath(nodePath, data.getBytes());
- } else {
- client.setData().forPath(nodePath, data.getBytes());
- }
- }
-
- @Override
- public OutputSolrProperties getOutputSolrProperties(String type) throws Exception {
- String nodePath = String.format("/output/solr/%s", type);
- ChildData currentData = outputCache.getCurrentData(nodePath);
- return currentData == null ?
- null :
- gson.fromJson(new String(currentData.getData()), OutputSolrPropertiesImpl.class);
- }
-
- @Override
- public void monitorOutputProperties(final List<? extends OutputConfigMonitor> outputConfigMonitors) throws Exception {
- TreeCacheListener listener = new TreeCacheListener() {
- public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
- if (event.getType() != Type.NODE_UPDATED) {
- return;
- }
-
- LOG.info("Output config updated: " + event.getData().getPath());
- for (OutputConfigMonitor monitor : outputConfigMonitors) {
- String monitorPath = String.format("/output/%s/%s", monitor.getDestination(), monitor.getOutputType());
- if (monitorPath.equals(event.getData().getPath())) {
- String nodeData = new String(event.getData().getData());
- OutputSolrProperties outputSolrProperties = gson.fromJson(nodeData, OutputSolrPropertiesImpl.class);
- monitor.outputConfigChanged(outputSolrProperties);
- }
- }
- }
- };
- outputCache.getListenable().addListener(listener);
- }
-
- @Override
public void close() {
LOG.info("Closing ZooKeeper Connection");
client.close();
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
index 2461819..5114743 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
@@ -27,10 +27,9 @@ import java.util.Map;
import org.apache.ambari.logfeeder.common.ConfigHandler;
import org.apache.ambari.logfeeder.common.LogEntryParseTester;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig.Component;
-import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigZK;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
+import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigLogFeederZK;
import org.apache.commons.io.FileUtils;
import org.apache.ambari.logfeeder.input.InputConfigUploader;
import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
@@ -54,7 +53,7 @@ public class LogFeeder {
private final LogFeederCommandLine cli;
private ConfigHandler configHandler;
- private LogSearchConfig config;
+ private LogSearchConfigLogFeeder config;
private MetricsManager metricsManager = new MetricsManager();
@@ -80,8 +79,8 @@ public class LogFeeder {
SSLUtil.ensureStorePasswords();
- config = LogSearchConfigFactory.createLogSearchConfig(Component.LOGFEEDER,Maps.fromProperties(LogFeederPropertiesUtil.getProperties()),
- LogFeederPropertiesUtil.getClusterName(), LogSearchConfigZK.class);
+ config = LogSearchConfigFactory.createLogSearchConfigLogFeeder(Maps.fromProperties(LogFeederPropertiesUtil.getProperties()),
+ LogFeederPropertiesUtil.getClusterName(), LogSearchConfigLogFeederZK.class);
configHandler = new ConfigHandler(config);
configHandler.init();
LogLevelFilterHandler.init(config);
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d1ac668/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
index 11df9dc..243b344 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
@@ -49,7 +49,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.ambari.logfeeder.util.AliasUtil.AliasType;
import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterGrokDescriptor;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputConfig;
@@ -65,7 +65,7 @@ import com.google.gson.reflect.TypeToken;
public class ConfigHandler implements InputConfigMonitor {
private static final Logger LOG = Logger.getLogger(ConfigHandler.class);
- private final LogSearchConfig logSearchConfig;
+ private final LogSearchConfigLogFeeder logSearchConfig;
private final OutputManager outputManager = new OutputManager();
private final InputManager inputManager = new InputManager();
@@ -79,7 +79,7 @@ public class ConfigHandler implements InputConfigMonitor {
private boolean simulateMode = false;
- public ConfigHandler(LogSearchConfig logSearchConfig) {
+ public ConfigHandler(LogSearchConfigLogFeeder logSearchConfig) {
this.logSearchConfig = logSearchConfig;
}