Repository: ambari
Updated Branches:
  refs/heads/trunk 15013b719 -> 773ccfe8f


AMBARI-5130. Ambari stack upgrade, cannot delete Mapreduce using 
UpgradeHelper_HDP2.py (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/773ccfe8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/773ccfe8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/773ccfe8

Branch: refs/heads/trunk
Commit: 773ccfe8ffd4777a2adb176fba348726ec335521
Parents: 15013b7
Author: Andrew Onischuk <[email protected]>
Authored: Sun Mar 16 12:48:05 2014 -0700
Committer: Andrew Onischuk <[email protected]>
Committed: Sun Mar 16 12:48:05 2014 -0700

----------------------------------------------------------------------
 .../org/apache/ambari/server/upgrade/UpgradeCatalog150.java   | 7 +++++--
 ambari-server/src/main/python/UpgradeHelper_HDP2.py           | 1 -
 .../HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py    | 2 +-
 ambari-server/src/test/python/TestUpgradeScript_HDP2.py       | 4 +++-
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/773ccfe8/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
index 2d5d5aa..eb253a4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java
@@ -510,8 +510,11 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
 
       
       HostComponentStateEntity jtHostComponentStateEntity = 
serviceComponentDesiredStateEntityJT.getHostComponentStateEntities().iterator().next();
+      HostComponentDesiredStateEntity jtHostComponentDesiredStateEntity = 
serviceComponentDesiredStateEntityJT.getHostComponentDesiredStateEntities().iterator().next();
       String jtHostname = jtHostComponentStateEntity.getHostName();
       State jtCurrState = jtHostComponentStateEntity.getCurrentState();
+      State jtHostComponentDesiredState = 
jtHostComponentDesiredStateEntity.getDesiredState();
+      State jtServiceComponentDesiredState = 
serviceComponentDesiredStateEntityJT.getDesiredState();
           
       ClusterServiceEntityPK pk = new ClusterServiceEntityPK();
       pk.setClusterId(clusterEntity.getClusterId());
@@ -523,7 +526,7 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
       final ServiceComponentDesiredStateEntity 
serviceComponentDesiredStateEntity = new ServiceComponentDesiredStateEntity();
       serviceComponentDesiredStateEntity.setComponentName("HISTORYSERVER");
       
serviceComponentDesiredStateEntity.setDesiredStackVersion(clusterEntity.getDesiredStackVersion());
-      serviceComponentDesiredStateEntity.setDesiredState(State.STARTED);
+      
serviceComponentDesiredStateEntity.setDesiredState(jtServiceComponentDesiredState);
       
serviceComponentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
       
serviceComponentDesiredStateEntity.setHostComponentDesiredStateEntities(new 
ArrayList<HostComponentDesiredStateEntity>());
 
@@ -533,7 +536,7 @@ public class UpgradeCatalog150 extends 
AbstractUpgradeCatalog {
       
stateEntity.setCurrentStackVersion(clusterEntity.getDesiredStackVersion());
       
       final HostComponentDesiredStateEntity desiredStateEntity = new 
HostComponentDesiredStateEntity();
-      desiredStateEntity.setDesiredState(State.STARTED);
+      desiredStateEntity.setDesiredState(jtHostComponentDesiredState);
       
desiredStateEntity.setDesiredStackVersion(clusterEntity.getDesiredStackVersion());
       
       persistComponentEntities(stateEntity, desiredStateEntity, 
serviceComponentDesiredStateEntity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/773ccfe8/ambari-server/src/main/python/UpgradeHelper_HDP2.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/UpgradeHelper_HDP2.py 
b/ambari-server/src/main/python/UpgradeHelper_HDP2.py
index ae12f70..b1df76a 100644
--- a/ambari-server/src/main/python/UpgradeHelper_HDP2.py
+++ b/ambari-server/src/main/python/UpgradeHelper_HDP2.py
@@ -746,7 +746,6 @@ def add_services(options):
     "MAPREDUCE2": ["HISTORYSERVER", "MAPREDUCE2_CLIENT"]}
   new_old_host_map = {
     "NODEMANAGER": "TASKTRACKER",
-    "HISTORYSERVER": "JOBTRACKER",
     "HISTORYSERVER": "HISTORYSERVER",
     "RESOURCEMANAGER": "JOBTRACKER",
     "YARN_CLIENT": "MAPREDUCE_CLIENT",

http://git-wip-us.apache.org/repos/asf/ambari/blob/773ccfe8/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
index 3073400..ac1e5ff 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/MAPREDUCE/package/scripts/params.py
@@ -56,7 +56,7 @@ exclude_file_path = 
config['configurations']['mapred-site']['mapred.hosts.exclud
 mapred_hosts_file_path = 
config['configurations']['mapred-site']['mapred.hosts']
 
 #hdfs directories
-mapreduce_jobhistory_intermediate_done_dir = 
default('/configurations/mapred-site/mapreduce.jobhistory.intermediate-done-dir',
 '/mr-history/tmp')
+mapreduce_jobhistory_intermediate_done_dir = 
config['configurations']['mapred-site']['mapreduce.jobhistory.intermediate-done-dir']
 mapreduce_jobhistory_done_dir = 
config['configurations']['mapred-site']['mapred.job.tracker.history.completed.location']
 #for create_hdfs_directory
 hostname = config["hostname"]

http://git-wip-us.apache.org/repos/asf/ambari/blob/773ccfe8/ambari-server/src/test/python/TestUpgradeScript_HDP2.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestUpgradeScript_HDP2.py 
b/ambari-server/src/test/python/TestUpgradeScript_HDP2.py
index 652ab1c..01113d1 100644
--- a/ambari-server/src/test/python/TestUpgradeScript_HDP2.py
+++ b/ambari-server/src/test/python/TestUpgradeScript_HDP2.py
@@ -211,7 +211,7 @@ class TestUpgradeHDP2Script(TestCase):
     read_mapping_mock.return_value = {
       "TASKTRACKER": ["c6401", "c6402"],
       "JOBTRACKER": ["c6401"],
-      "HISTORYSERVER": ["c6402"],
+      "HISTORYSERVER": ["c6401"],
       "MAPREDUCE_CLIENT": ["c6403"]}
     UpgradeHelper_HDP2.main()
     expected_curl_calls = [
@@ -231,6 +231,8 @@ class TestUpgradeHDP2Script(TestCase):
            
"http://localhost:8080/api/v1/clusters/c1/services/YARN/components/RESOURCEMANAGER";),
       call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", 
"POST",
            
"http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/NODEMANAGER";),
+      call(False, '-u', 'admin:admin', '-H', 'X-Requested-By: ambari', '-X', 
'POST',
+           
'http://localhost:8080/api/v1/clusters/c1/hosts/c6401/host_components/HISTORYSERVER'),
       call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", 
"POST",
            
"http://localhost:8080/api/v1/clusters/c1/hosts/c6402/host_components/NODEMANAGER";),
       call(False, "-u", "admin:admin", '-H', 'X-Requested-By: ambari', "-X", 
"POST",

Reply via email to