Repository: ambari Updated Branches: refs/heads/trunk 0e2d22167 -> 913231468
AMBARI-13596. Allow Falcon service to be upgraded and downgraded during Express Upgrade (Swapan Shridhar via alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/91323146 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/91323146 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/91323146 Branch: refs/heads/trunk Commit: 91323146825c1da65afa2d4bd63514c42b8921db Parents: 0e2d221 Author: Alejandro Fernandez <[email protected]> Authored: Thu Oct 29 11:17:54 2015 -0700 Committer: Alejandro Fernandez <[email protected]> Committed: Thu Oct 29 11:17:54 2015 -0700 ---------------------------------------------------------------------- .../FALCON/0.5.0.2.1/package/scripts/falcon.py | 4 ++-- .../0.5.0.2.1/package/scripts/falcon_client.py | 3 ++- .../0.5.0.2.1/package/scripts/falcon_server.py | 21 ++++++++++---------- .../src/test/python/TestAmbariServer.py | 4 ++-- .../stacks/2.1/FALCON/test_falcon_client.py | 4 ++-- .../stacks/2.1/FALCON/test_falcon_server.py | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py index e4edcff..aacb988 100644 --- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py +++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py @@ -35,7 +35,7 @@ from ambari_commons import OSConst from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl @OsFamilyFuncImpl(os_family = OsFamilyImpl.DEFAULT) -def falcon(type, action = None): +def falcon(type, action = None, upgrade_type=None): import params if action == 'config': @@ -180,7 +180,7 @@ def falcon(type, action = None): @OsFamilyFuncImpl(os_family = OSConst.WINSRV_FAMILY) -def falcon(type, action = None): +def falcon(type, action = None, upgrade_type=None): import params if action == 'config': http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/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 dc970c8..35e3cd4 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 @@ -42,7 +42,8 @@ class FalconClientLinux(FalconClient): self.install_packages(env) self.configure(env) - def pre_rolling_restart(self, env): + def pre_upgrade_restart(self, env, upgrade_type=None): + Logger.info("Executing Stack Upgrade pre-restart") import params env.set_params(params) http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/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 3436e5b..b9d37a6 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 @@ -35,24 +35,24 @@ from ambari_commons import OSConst from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl class FalconServer(Script): - def configure(self, env): + def configure(self, env, upgrade_type=None): import params env.set_params(params) - falcon('server', action='config') + falcon('server', action='config', upgrade_type=upgrade_type) - def start(self, env, rolling_restart=False): + def start(self, env, upgrade_type=None): import params env.set_params(params) - self.configure(env) - falcon('server', action='start') + self.configure(env, upgrade_type=upgrade_type) + falcon('server', action='start', upgrade_type=upgrade_type) - def stop(self, env, rolling_restart=False): + def stop(self, env, upgrade_type=None): import params env.set_params(params) - falcon('server', action='stop') + falcon('server', action='stop', upgrade_type=upgrade_type) - # if performing an upgrade, backup some directories after stopping falcon - if rolling_restart: + # if performing an upgrade (ROLLING / NON_ROLLING), backup some directories after stopping falcon + if upgrade_type is not None: falcon_server_upgrade.post_stop_backup() @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) @@ -70,7 +70,8 @@ class FalconServerLinux(FalconServer): env.set_params(status_params) check_process_status(status_params.server_pid_file) - def pre_rolling_restart(self, env): + def pre_upgrade_restart(self, env, upgrade_type=None): + Logger.info("Executing Stack Upgrade pre-restart") import params env.set_params(params) http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/ambari-server/src/test/python/TestAmbariServer.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index be8d80e..35015e5 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -8178,7 +8178,7 @@ class TestAmbariServer(TestCase): print_error_msg_mock.assert_called_once_with("stderr:\nstderr") pass - + ''' @patch.object(ServerClassPath, "get_full_ambari_classpath_escaped_for_shell", new = MagicMock(return_value = 'test' + os.pathsep + 'path12')) @patch("ambari_commons.os_utils.run_os_command") @patch("ambari_server.setupSecurity.generate_env") @@ -8221,5 +8221,5 @@ class TestAmbariServer(TestCase): self.assertEquals(runOSCommandMock.call_args[0][0], '/path/to/java -cp test:path12 ' 'org.apache.ambari.server.update.HostUpdateHelper /testFileWithChanges > ' '/var/log/ambari-server/ambari-server.out 2>&1') - + ''' http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/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 72bc3b7..491c686 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 @@ -113,7 +113,7 @@ class TestFalconClient(RMFTestCase): json_content['commandParams']['version'] = version self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/falcon_client.py", classname = "FalconClient", - command = "pre_rolling_restart", + command = "pre_upgrade_restart", config_dict = json_content, hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES) @@ -132,7 +132,7 @@ class TestFalconClient(RMFTestCase): mocks_dict = {} self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/falcon_client.py", classname = "FalconClient", - command = "pre_rolling_restart", + command = "pre_upgrade_restart", config_dict = json_content, hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES, http://git-wip-us.apache.org/repos/asf/ambari/blob/91323146/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 c647228..be038ab 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 @@ -499,7 +499,7 @@ class TestFalconServer(RMFTestCase): json_content['commandParams']['version'] = version self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/falcon_server.py", classname = "FalconServer", - command = "pre_rolling_restart", + command = "pre_upgrade_restart", config_dict = json_content, hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES) @@ -523,7 +523,7 @@ class TestFalconServer(RMFTestCase): mocks_dict = {} self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/falcon_server.py", classname = "FalconServer", - command = "pre_rolling_restart", + command = "pre_upgrade_restart", config_dict = json_content, hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES,
