You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2016/06/29 12:08:57 UTC

[1/2] ambari git commit: AMBARI-17343. Blueprint attribute provision_action=INSTALL_ONLY loses its value after server restart (magyari_sandor)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6f4a9c288 -> 7474ec4e9


AMBARI-17343. Blueprint attribute provision_action=INSTALL_ONLY loses its value after server restart (magyari_sandor)


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

Branch: refs/heads/trunk
Commit: addc5d04626fdaf976df2a0427cb9cdb3c923c22
Parents: 6f4a9c2
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Wed Jun 29 14:02:40 2016 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Wed Jun 29 14:02:40 2016 +0200

----------------------------------------------------------------------
 .../controller/internal/BaseClusterRequest.java   | 18 ++++++++++++++++++
 .../internal/ProvisionClusterRequest.java         | 17 +----------------
 .../orm/entities/TopologyRequestEntity.java       | 16 ++++++++++++++++
 .../ambari/server/topology/PersistedState.java    |  4 +++-
 .../server/topology/PersistedStateImpl.java       | 13 +++++++++++--
 .../ambari/server/upgrade/UpgradeCatalog240.java  |  9 +++++++++
 .../main/resources/Ambari-DDL-Derby-CREATE.sql    |  1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql    |  1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql   |  1 +
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql |  1 +
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql       |  1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql   |  1 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql     |  1 +
 .../internal/ClusterResourceProviderTest.java     |  2 +-
 .../ambari/server/state/cluster/ClustersTest.java |  5 +++--
 .../server/upgrade/UpgradeCatalog240Test.java     | 13 +++++++++++--
 16 files changed, 80 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index a67317a..54389da 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -42,10 +42,17 @@ import java.util.Set;
  */
 public abstract class BaseClusterRequest implements TopologyRequest {
   /**
+   * Support for controlling whether Install and Start tasks are created on
+   * blueprint deploy by default.
+   */
+  public static final String PROVISION_ACTION_PROPERTY = "provision_action";
+  /**
    * host group info map
    */
   protected final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<String, HostGroupInfo>();
 
+  protected ProvisionAction provisionAction;
+
   /**
    * cluster id
    */
@@ -185,4 +192,15 @@ public abstract class BaseClusterRequest implements TopologyRequest {
     }
     return hostResourceProvider;
   }
+
+  /**
+   * Get requested @ProvisionClusterRequest.ProvisionAction
+   */
+  public ProvisionAction getProvisionAction() {
+    return provisionAction;
+  }
+
+  public void setProvisionAction(ProvisionAction provisionAction) {
+    this.provisionAction = provisionAction;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index 3feac55..a35da86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -101,12 +101,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
   public static final String CONFIG_RECOMMENDATION_STRATEGY = "config_recommendation_strategy";
 
   /**
-   * Support for controlling whether Install and Start tasks are created on
-   * blueprint deploy by default.
-   */
-  public static final String PROVISION_ACTION_PROPERTY = "provision_action";
-
-  /**
    * The repo version to use
    */
   public static final String REPO_VERSION_PROPERTY = "repository_version";
@@ -134,8 +128,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
    */
   private final ConfigRecommendationStrategy configRecommendationStrategy;
 
-  private final ProvisionAction provisionAction;
-
   private String repoVersion;
 
   private final static Logger LOG = LoggerFactory.getLogger(ProvisionClusterRequest.class);
@@ -180,7 +172,7 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
 
     this.configRecommendationStrategy = parseConfigRecommendationStrategy(properties);
 
-    this.provisionAction = parseProvisionAction(properties);
+    setProvisionAction(parseProvisionAction(properties));
   }
 
   private Map<String, Credential> parseCredentials(Map<String, Object> properties) throws
@@ -441,13 +433,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
   }
 
   /**
-   * Get requested @ProvisionClusterRequest.ProvisionAction
-   */
-  public ProvisionAction getProvisionAction() {
-    return provisionAction;
-  }
-
-  /**
    * @return the repository version, if any
    */
   public String getRepositoryVersion() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
index 923ff9c..9aa58dd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
@@ -21,6 +21,8 @@ import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
@@ -34,6 +36,8 @@ import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 import java.util.Collection;
 
+import org.apache.ambari.server.controller.internal.ProvisionAction;
+
 @Entity
 @Table(name = "topology_request")
 @TableGenerator(name = "topology_request_id_generator", table = "ambari_sequences",
@@ -76,6 +80,10 @@ public class TopologyRequestEntity {
   @OneToOne(mappedBy = "topologyRequestEntity", cascade = CascadeType.ALL)
   private TopologyLogicalRequestEntity topologyLogicalRequestEntity;
 
+  @Column(name = "provision_action", length = 255, nullable = true)
+  @Enumerated(EnumType.STRING)
+  private ProvisionAction provisionAction;
+
   public Long getId() {
     return id;
   }
@@ -148,6 +156,14 @@ public class TopologyRequestEntity {
     this.topologyLogicalRequestEntity = topologyLogicalRequestEntity;
   }
 
+  public ProvisionAction getProvisionAction() {
+    return provisionAction;
+  }
+
+  public void setProvisionAction(ProvisionAction provisionAction) {
+    this.provisionAction = provisionAction;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
index 41fa032..8003268 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
@@ -21,6 +21,8 @@ package org.apache.ambari.server.topology;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ambari.server.controller.internal.BaseClusterRequest;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.state.Host;
 
 /**
@@ -35,7 +37,7 @@ public interface PersistedState {
    * @return a persisted topology request which is a wrapper around a TopologyRequest which
    * adds an id that can be used to refer to the persisted entity
    */
-  PersistedTopologyRequest persistTopologyRequest(TopologyRequest topologyRequest);
+  PersistedTopologyRequest persistTopologyRequest(BaseClusterRequest topologyRequest);
 
   /**
    * Persist a logical request.

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index ca81418..bd9a9f7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -23,6 +23,8 @@ import com.google.inject.Inject;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
+import org.apache.ambari.server.controller.internal.BaseClusterRequest;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.TopologyHostGroupDAO;
@@ -97,7 +99,7 @@ public class PersistedStateImpl implements PersistedState {
 
 
   @Override
-  public  PersistedTopologyRequest persistTopologyRequest(TopologyRequest request) {
+  public  PersistedTopologyRequest persistTopologyRequest(BaseClusterRequest request) {
     TopologyRequestEntity requestEntity = toEntity(request);
     topologyRequestDAO.create(requestEntity);
     return new PersistedTopologyRequest(requestEntity.getId(), request);
@@ -178,6 +180,9 @@ public class PersistedStateImpl implements PersistedState {
       if (clusterTopology == null) {
         try {
           clusterTopology = new ClusterTopologyImpl(ambariContext, replayedRequest);
+          if (entity.getProvisionAction() != null) {
+            clusterTopology.setProvisionAction(entity.getProvisionAction());
+          }
           topologyRequests.put(replayedRequest.getClusterId(), clusterTopology);
           allRequests.put(clusterTopology, new ArrayList<LogicalRequest>());
         } catch (InvalidTopologyException e) {
@@ -211,7 +216,7 @@ public class PersistedStateImpl implements PersistedState {
     return allRequests;
   }
 
-  private TopologyRequestEntity toEntity(TopologyRequest request) {
+  private TopologyRequestEntity toEntity(BaseClusterRequest request) {
     TopologyRequestEntity entity = new TopologyRequestEntity();
 
     //todo: this isn't set for a scaling operation because we had intended to allow multiple
@@ -227,6 +232,10 @@ public class PersistedStateImpl implements PersistedState {
     entity.setClusterProperties(propertiesAsString(request.getConfiguration().getProperties()));
     entity.setDescription(request.getDescription());
 
+    if (request.getProvisionAction() != null) {
+      entity.setProvisionAction(request.getProvisionAction());
+    }
+
     // host groups
     Collection<TopologyHostGroupEntity> hostGroupEntities = new ArrayList<TopologyHostGroupEntity>();
     for (HostGroupInfo groupInfo : request.getHostGroupInfo().values())  {

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index e029aea..18dd877 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -166,6 +166,8 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
   public static final String AUTHENTICATED_USER_ID_COLUMN = "authenticated_user_id";
   protected static final String CLUSTER_VERSION_TABLE = "cluster_version";
   protected static final String HOST_VERSION_TABLE = "host_version";
+  protected static final String TOPOLOGY_REQUEST_TABLE = "topology_request";
+  protected static final String PROVISION_ACTION_COL = "provision_action";
   protected static final String PHOENIX_QUERY_SERVER_PRINCIPAL_KEY = "phoenix.queryserver.kerberos.principal";
   protected static final String PHOENIX_QUERY_SERVER_KEYTAB_KEY = "phoenix.queryserver.keytab.file";
   protected static final String DEFAULT_CONFIG_VERSION = "version1";
@@ -308,6 +310,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
     createRemoteClusterTable();
     updateViewInstanceTable();
     updateRequestScheduleEntityTable();
+    updateTopologyRequestTable();
   }
 
   private void createRemoteClusterTable() throws SQLException {
@@ -1343,6 +1346,12 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
         new DBColumnInfo(PRINCIPAL_ID_COL, Long.class, null, null, true));
   }
 
+  protected void updateTopologyRequestTable() throws SQLException {
+    // Add the sort_order column to the adminpermission table
+    dbAccessor.addColumn(TOPOLOGY_REQUEST_TABLE,
+      new DBColumnInfo(PROVISION_ACTION_COL, String.class, null, 255, true));
+  }
+
   /**
    * Updates the {@value #ALERT_DEFINITION_TABLE} in the following ways:
    * <ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 aa8a39e..0a456eb 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -729,6 +729,7 @@ CREATE TABLE topology_request (
   cluster_properties VARCHAR(3000),
   cluster_attributes VARCHAR(3000),
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 3be1299..3e2e144 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -736,6 +736,7 @@ CREATE TABLE topology_request (
   cluster_properties LONGTEXT,
   cluster_attributes LONGTEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 6bbb282..c0f2368 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -726,6 +726,7 @@ CREATE TABLE topology_request (
   cluster_properties CLOB,
   cluster_attributes CLOB,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 b13c121..c4f9dfc 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -729,6 +729,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index fd14e80..d42445d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -851,6 +851,7 @@ CREATE TABLE ambari.topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters(cluster_id)
 );

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 0574c2b..cb6e8b6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -725,6 +725,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/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 02becf2..fda4af6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -746,6 +746,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY CLUSTERED (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
index 7f2ea7c..c7261ea 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
@@ -144,7 +144,7 @@ public class ClusterResourceProviderTest {
   public void testCreateResource_blueprint_With_ProvisionAction() throws Exception {
     Set<Map<String, Object>> requestProperties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME);
     Map<String, Object> properties = requestProperties.iterator().next();
-    properties.put(ProvisionClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY");
+    properties.put(BaseClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY");
     Map<String, String> requestInfoProperties = new HashMap<String, String>();
     requestInfoProperties.put(Request.REQUEST_INFO_BODY_PROPERTY, "{}");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
index 43645b4..bb3db03 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
@@ -42,6 +42,7 @@ import org.apache.ambari.server.DuplicateResourceException;
 import org.apache.ambari.server.HostNotFoundException;
 import org.apache.ambari.server.agent.AgentEnv;
 import org.apache.ambari.server.agent.HostInfo;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.events.HostRegisteredEvent;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
@@ -499,7 +500,7 @@ public class ClustersTest {
 
     Map<String, HostGroupInfo> hostGroups = Maps.newHashMap();
 
-    TopologyRequest topologyRequest = createNiceMock(TopologyRequest.class);
+    ProvisionClusterRequest topologyRequest = createNiceMock(ProvisionClusterRequest.class);
     expect(topologyRequest.getType()).andReturn(TopologyRequest.Type.PROVISION).anyTimes();
     expect(topologyRequest.getBlueprint()).andReturn(bp).anyTimes();
     expect(topologyRequest.getClusterId()).andReturn(cluster.getClusterId()).anyTimes();
@@ -653,7 +654,7 @@ public class ClustersTest {
     hostGroupInfo.addHost(hostName + "3");
     hostGroups.put(groupName, hostGroupInfo);
 
-    TopologyRequest topologyRequest = createNiceMock(TopologyRequest.class);
+    ProvisionClusterRequest topologyRequest = createNiceMock(ProvisionClusterRequest.class);
     expect(topologyRequest.getType()).andReturn(TopologyRequest.Type.PROVISION).anyTimes();
     expect(topologyRequest.getBlueprint()).andReturn(bp).anyTimes();
     expect(topologyRequest.getClusterId()).andReturn(cluster.getClusterId()).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/addc5d04/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
index 0e4b4eb..bf681f2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
@@ -320,13 +320,16 @@ public class UpgradeCatalog240Test {
     expect(dbAccessor.getConnection()).andReturn(connection);
     expect(connection.createStatement()).andReturn(statement);
 
-    dbAccessor.dropColumn(UpgradeCatalog240.VIEWINSTANCE_TABLE,UpgradeCatalog240.CLUSTER_HANDLE_COLUMN);
+    dbAccessor.dropColumn(UpgradeCatalog240.VIEWINSTANCE_TABLE, UpgradeCatalog240.CLUSTER_HANDLE_COLUMN);
 
     Capture<DBAccessor.DBColumnInfo> capturedClusterHandleColumn = EasyMock.newCapture();
-    dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString() , capture(capturedClusterHandleColumn));
+    dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString(), capture(capturedClusterHandleColumn));
     Capture<DBAccessor.DBColumnInfo> requestScheduleUserIdInfo = newCapture();
     dbAccessor.addColumn(eq(UpgradeCatalog240.REQUESTSCHEDULE_TABLE), capture(requestScheduleUserIdInfo));
 
+    Capture<DBAccessor.DBColumnInfo> provisionActionColumnInfo = newCapture();
+    dbAccessor.addColumn(eq(UpgradeCatalog240.TOPOLOGY_REQUEST_TABLE), capture(provisionActionColumnInfo));
+
     replay(dbAccessor, configuration, connection, statement, resultSet);
 
     Module module = new Module() {
@@ -537,6 +540,12 @@ public class UpgradeCatalog240Test {
     Assert.assertEquals(Integer.class, requestScheduleUserIdInfoValue.getType());
     Assert.assertEquals(null, requestScheduleUserIdInfoValue.getDefaultValue());
 
+    DBAccessor.DBColumnInfo provisionActionColumnInfoValue = provisionActionColumnInfo.getValue();
+    Assert.assertNotNull(provisionActionColumnInfoValue);
+    Assert.assertEquals(UpgradeCatalog240.PROVISION_ACTION_COL, provisionActionColumnInfoValue.getName());
+    Assert.assertEquals(String.class, provisionActionColumnInfoValue.getType());
+    Assert.assertEquals(true, provisionActionColumnInfoValue.isNullable());
+
     verify(dbAccessor);
   }
 


[2/2] ambari git commit: AMBARI-17403. Fix hostname in stack advisor for proxy user properties (magyari_sandor)

Posted by ma...@apache.org.
AMBARI-17403. Fix hostname in stack advisor for proxy user properties (magyari_sandor)


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

Branch: refs/heads/trunk
Commit: 7474ec4e9c9bbefeeb09f701380cd7093eff28c6
Parents: addc5d0
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Wed Jun 29 14:04:02 2016 +0200
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Wed Jun 29 14:04:02 2016 +0200

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.0.6/services/stack_advisor.py     | 8 ++++----
 .../test/python/stacks/2.0.6/common/test_stack_advisor.py    | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7474ec4e/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 373403c..9a310b5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -195,7 +195,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if oozieServerrHosts is not None:
           oozieServerHostsNameList = []
           for oozieServerHost in oozieServerrHosts:
-            oozieServerHostsNameList.append(oozieServerHost["Hosts"]["public_host_name"])
+            oozieServerHostsNameList.append(oozieServerHost["Hosts"]["host_name"])
           oozieServerHostsNames = ",".join(oozieServerHostsNameList)
           if not oozie_user in users and oozie_user is not None:
             users[oozie_user] = {"propertyHosts" : oozieServerHostsNames,"propertyGroups" : "*", "config" : "oozie-env", "propertyName" : "oozie_user"}
@@ -213,7 +213,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if hiveServerHosts is not None:
           hiveServerHostsNameList = []
           for hiveServerHost in hiveServerHosts:
-            hiveServerHostsNameList.append(hiveServerHost["Hosts"]["public_host_name"])
+            hiveServerHostsNameList.append(hiveServerHost["Hosts"]["host_name"])
           hiveServerHostsNames = ",".join(hiveServerHostsNameList)
           if not hive_user in users and hive_user is not None:
             users[hive_user] = {"propertyHosts" : hiveServerHostsNames,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "hive_user"}
@@ -221,7 +221,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if webHcatServerHosts is not None:
           webHcatServerHostsNameList = []
           for webHcatServerHost in webHcatServerHosts:
-            webHcatServerHostsNameList.append(webHcatServerHost["Hosts"]["public_host_name"])
+            webHcatServerHostsNameList.append(webHcatServerHost["Hosts"]["host_name"])
           webHcatServerHostsNames = ",".join(webHcatServerHostsNameList)
           if not webhcat_user in users and webhcat_user is not None:
             users[webhcat_user] = {"propertyHosts" : webHcatServerHostsNames,"propertyGroups" : "*", "config" : "hive-env", "propertyName" : "webhcat_user"}
@@ -235,7 +235,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if len(rmHosts) > 1:
           rmHostsNameList = []
           for rmHost in rmHosts:
-            rmHostsNameList.append(rmHost["Hosts"]["public_host_name"])
+            rmHostsNameList.append(rmHost["Hosts"]["host_name"])
           rmHostsNames = ",".join(rmHostsNameList)
           if not yarn_user in users and yarn_user is not None:
             users[yarn_user] = {"propertyHosts" : rmHostsNames, "config" : "yarn-env", "propertyName" : "yarn_user"}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7474ec4e/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 6a8f3e2..7a092fc 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -979,7 +979,7 @@ class TestHDP206StackAdvisor(TestCase):
             "os_arch": "x86_64",
             "os_type": "centos6",
             "ph_cpu_count": 1,
-            "public_host_name": "c6401.ambari.apache.org",
+            "public_host_name": "public.c6401.ambari.apache.org",
             "rack_info": "/default-rack",
             "total_mem": 2097152,
             "disk_info": [{
@@ -996,7 +996,7 @@ class TestHDP206StackAdvisor(TestCase):
             "os_arch": "x86_64",
             "os_type": "centos6",
             "ph_cpu_count": 1,
-            "public_host_name": "c6402.ambari.apache.org",
+            "public_host_name": "public.c6402.ambari.apache.org",
             "rack_info": "/default-rack",
             "total_mem": 1048576,
             "disk_info": [{