You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ha...@apache.org on 2017/11/28 17:26:26 UTC
[1/2] ambari git commit: AMBARI-22465 Post-Upgrade Tasks Use the
Wrong Repository and Hooks Folders (dgrinenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.6 473abc324 -> 66efd3d5c
refs/heads/trunk 020e15281 -> 82af6fb6d
AMBARI-22465 Post-Upgrade Tasks Use the Wrong Repository and Hooks Folders (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/82af6fb6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/82af6fb6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/82af6fb6
Branch: refs/heads/trunk
Commit: 82af6fb6d3f11476df203d9871cc978091891cfe
Parents: 020e152
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Nov 28 19:23:28 2017 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Nov 28 19:25:28 2017 +0200
----------------------------------------------------------------------
.../server/controller/internal/UpgradeResourceProvider.java | 8 --------
.../resources/custom_actions/scripts/ru_execute_tasks.py | 5 +++--
.../src/test/python/custom_actions/test_ru_execute_tasks.py | 6 +++---
3 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/82af6fb6/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 c5303cc..bab5369 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
@@ -1053,10 +1053,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
// Apply additional parameters to the command that come from the stage.
applyAdditionalParameters(wrapper, params);
- // the ru_execute_tasks invokes scripts - it needs information about where
- // the scripts live and for that it should always use the target repository
- // stack
- applyRepositoryAssociatedParameters(wrapper, effectiveRepositoryVersion.getStackId(), params);
// add each host to this stage
RequestResourceFilter filter = new RequestResourceFilter(serviceName, componentName,
@@ -1204,10 +1200,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
// Apply additional parameters to the command that come from the stage.
applyAdditionalParameters(wrapper, commandParams);
- // add things like hooks and service folders based on effective repo
- applyRepositoryAssociatedParameters(wrapper, effectiveRepositoryVersion.getStackId(),
- commandParams);
-
ActionExecutionContext actionContext = new ActionExecutionContext(cluster.getClusterName(),
"SERVICE_CHECK", filters, commandParams);
http://git-wip-us.apache.org/repos/asf/ambari/blob/82af6fb6/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py b/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
index c0f0d41..dff4ee1 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
@@ -102,8 +102,8 @@ class ExecuteUpgradeTasks(Script):
version = default('/roleParams/version', None)
# These 2 variables are optional
- service_package_folder = default('/roleParams/service_package_folder', None)
- hooks_folder = default('/roleParams/hooks_folder', None)
+ service_package_folder = default('/commandParams/service_package_folder', None)
+ hooks_folder = default('/commandParams/hooks_folder', None)
tasks = json.loads(config['roleParams']['tasks'])
if tasks:
@@ -154,5 +154,6 @@ class ExecuteUpgradeTasks(Script):
task.command = replace_variables(task.command, host_name, version)
shell.checked_call(task.command, logoutput=True, quiet=True)
+
if __name__ == "__main__":
ExecuteUpgradeTasks().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/82af6fb6/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py b/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
index 0d12a91..17d5e77 100644
--- a/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
+++ b/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
@@ -146,8 +146,8 @@ class TestRUExecuteTasks(RMFTestCase):
with open(json_file_path, "r") as json_file:
json_payload = json.load(json_file)
- del json_payload['roleParams']['service_package_folder']
- del json_payload['roleParams']['hooks_folder']
+ del json_payload['commandParams']['service_package_folder']
+ del json_payload['commandParams']['hooks_folder']
config_dict = ConfigDictionary(json_payload)
@@ -166,7 +166,7 @@ class TestRUExecuteTasks(RMFTestCase):
# Ensure that the json file was actually read.
stack_name = default("/hostLevelParams/stack_name", None)
stack_version = default("/hostLevelParams/stack_version", None)
- service_package_folder = default('/roleParams/service_package_folder', None)
+ service_package_folder = default('/commandParams/service_package_folder', None)
self.assertEqual(stack_name, "HDP")
self.assertEqual(stack_version, '2.2')
[2/2] ambari git commit: AMBARI-22465 Post-Upgrade Tasks Use the
Wrong Repository and Hooks Folders (dgrinenko)
Posted by ha...@apache.org.
AMBARI-22465 Post-Upgrade Tasks Use the Wrong Repository and Hooks Folders (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/66efd3d5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/66efd3d5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/66efd3d5
Branch: refs/heads/branch-2.6
Commit: 66efd3d5cba7986535099f9d117f1333a6d87ca7
Parents: 473abc3
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Nov 28 16:52:40 2017 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Nov 28 19:26:14 2017 +0200
----------------------------------------------------------------------
.../actionmanager/ExecutionCommandWrapper.java | 1 -
.../internal/UpgradeResourceProvider.java | 38 --------------------
.../custom_actions/scripts/ru_execute_tasks.py | 5 +--
.../custom_actions/test_ru_execute_tasks.py | 6 ++--
4 files changed, 6 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/66efd3d5/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index 4107370..212363b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -46,7 +46,6 @@ import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
-import org.apache.ambari.server.state.ServiceComponentImpl;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
http://git-wip-us.apache.org/repos/asf/ambari/blob/66efd3d5/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 ff326aa..5cfe4f3 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
@@ -945,36 +945,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
}
}
- /**
- * Adds the hooks and service folders based on the effective stack ID and the
- * name of the service from the wrapper.
- *
- * @param wrapper
- * the stage wrapper to use when detemrining the service name.
- * @param effectiveStackId
- * the stack ID to use when getting the hooks and service folders.
- * @param commandParams
- * the params to update with the new values
- * @throws AmbariException
- */
- private void applyRepositoryAssociatedParameters(StageWrapper wrapper, StackId effectiveStackId,
- Map<String, String> commandParams) throws AmbariException {
- if (CollectionUtils.isNotEmpty(wrapper.getTasks())
- && wrapper.getTasks().get(0).getService() != null) {
-
- AmbariMetaInfo ambariMetaInfo = s_metaProvider.get();
-
- StackInfo stackInfo = ambariMetaInfo.getStack(effectiveStackId.getStackName(),
- effectiveStackId.getStackVersion());
-
- String serviceName = wrapper.getTasks().get(0).getService();
- ServiceInfo serviceInfo = ambariMetaInfo.getService(effectiveStackId.getStackName(),
- effectiveStackId.getStackVersion(), serviceName);
-
- commandParams.put(SERVICE_PACKAGE_FOLDER, serviceInfo.getServicePackageFolder());
- commandParams.put(HOOKS_FOLDER, stackInfo.getStackHooksFolder());
- }
- }
/**
* Creates an action stage using the {@link #EXECUTE_TASK_ROLE} custom action
@@ -1049,10 +1019,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
// Apply additional parameters to the command that come from the stage.
applyAdditionalParameters(wrapper, params);
- // the ru_execute_tasks invokes scripts - it needs information about where
- // the scripts live and for that it should always use the target repository
- // stack
- applyRepositoryAssociatedParameters(wrapper, effectiveRepositoryVersion.getStackId(), params);
// add each host to this stage
RequestResourceFilter filter = new RequestResourceFilter(serviceName, componentName,
@@ -1200,10 +1166,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
// Apply additional parameters to the command that come from the stage.
applyAdditionalParameters(wrapper, commandParams);
- // add things like hooks and service folders based on effective repo
- applyRepositoryAssociatedParameters(wrapper, effectiveRepositoryVersion.getStackId(),
- commandParams);
-
ActionExecutionContext actionContext = new ActionExecutionContext(cluster.getClusterName(),
"SERVICE_CHECK", filters, commandParams);
http://git-wip-us.apache.org/repos/asf/ambari/blob/66efd3d5/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py b/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
index 4dec16f..efed150 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/ru_execute_tasks.py
@@ -100,8 +100,8 @@ class ExecuteUpgradeTasks(Script):
version = default('/roleParams/version', None)
# These 2 variables are optional
- service_package_folder = default('/roleParams/service_package_folder', None)
- hooks_folder = default('/roleParams/hooks_folder', None)
+ service_package_folder = default('/commandParams/service_package_folder', None)
+ hooks_folder = default('/commandParams/hooks_folder', None)
tasks = json.loads(config['roleParams']['tasks'])
if tasks:
@@ -152,5 +152,6 @@ class ExecuteUpgradeTasks(Script):
task.command = replace_variables(task.command, host_name, version)
shell.checked_call(task.command, logoutput=True, quiet=True)
+
if __name__ == "__main__":
ExecuteUpgradeTasks().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/66efd3d5/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py b/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
index 0d12a91..17d5e77 100644
--- a/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
+++ b/ambari-server/src/test/python/custom_actions/test_ru_execute_tasks.py
@@ -146,8 +146,8 @@ class TestRUExecuteTasks(RMFTestCase):
with open(json_file_path, "r") as json_file:
json_payload = json.load(json_file)
- del json_payload['roleParams']['service_package_folder']
- del json_payload['roleParams']['hooks_folder']
+ del json_payload['commandParams']['service_package_folder']
+ del json_payload['commandParams']['hooks_folder']
config_dict = ConfigDictionary(json_payload)
@@ -166,7 +166,7 @@ class TestRUExecuteTasks(RMFTestCase):
# Ensure that the json file was actually read.
stack_name = default("/hostLevelParams/stack_name", None)
stack_version = default("/hostLevelParams/stack_version", None)
- service_package_folder = default('/roleParams/service_package_folder', None)
+ service_package_folder = default('/commandParams/service_package_folder', None)
self.assertEqual(stack_name, "HDP")
self.assertEqual(stack_version, '2.2')