You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sa...@apache.org on 2017/04/25 19:58:46 UTC
ambari git commit: AMBARI-20616: Provide an optional attribute for
custom commands to specify title used in operations window title (sangeetar)
Repository: ambari
Updated Branches:
refs/heads/trunk ec51e1663 -> 35d7220af
AMBARI-20616: Provide an optional attribute for custom commands to specify title used in operations window title (sangeetar)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/35d7220a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/35d7220a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/35d7220a
Branch: refs/heads/trunk
Commit: 35d7220afb894565134dd1503d8f2dc08d7be59c
Parents: ec51e16
Author: Sangeeta Ravindran <sa...@apache.org>
Authored: Tue Apr 25 12:19:03 2017 -0700
Committer: Sangeeta Ravindran <sa...@apache.org>
Committed: Tue Apr 25 12:58:22 2017 -0700
----------------------------------------------------------------------
.../server/actionmanager/HostRoleCommand.java | 10 ++++
.../AmbariCustomCommandExecutionHelper.java | 3 ++
.../internal/TaskResourceProvider.java | 3 ++
.../orm/entities/HostRoleCommandEntity.java | 15 ++++++
.../server/state/CustomCommandDefinition.java | 5 ++
.../server/upgrade/UpgradeCatalog300.java | 15 ++++++
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 1 +
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 1 +
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 1 +
.../resources/Ambari-DDL-Postgres-CREATE.sql | 1 +
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 1 +
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 1 +
.../src/main/resources/properties.json | 1 +
.../internal/TaskResourceProviderTest.java | 8 ++++
.../orm/entities/HostRoleCommandEntityTest.java | 49 ++++++++++++++++++++
.../server/upgrade/UpgradeCatalog300Test.java | 8 ++++
.../app/controllers/wizard/step9_controller.js | 2 +-
ambari-web/app/utils/ajax/ajax.js | 8 ++--
ambari-web/app/utils/helper.js | 7 ++-
ambari-web/app/utils/host_progress_popup.js | 2 +-
.../views/wizard/step9/hostLogPopupBody_view.js | 2 +-
ambari-web/test/utils/helper_test.js | 5 ++
22 files changed, 141 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index 87a6edf..bd354d9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
@@ -69,6 +69,7 @@ public class HostRoleCommand {
private String customCommandName;
private ExecutionCommandWrapper executionCommandWrapper;
private boolean isBackgroundCommand = false;
+ private String opsDisplayName;
@Inject
private ExecutionCommandDAO executionCommandDAO;
@@ -179,6 +180,7 @@ public class HostRoleCommand {
roleCommand = hostRoleCommandEntity.getRoleCommand();
event = new ServiceComponentHostEventWrapper(hostRoleCommandEntity.getEvent());
commandDetail = hostRoleCommandEntity.getCommandDetail();
+ opsDisplayName = hostRoleCommandEntity.getOpsDisplayName();
customCommandName = hostRoleCommandEntity.getCustomCommandName();
isBackgroundCommand = hostRoleCommandEntity.isBackgroundCommand();
}
@@ -202,6 +204,7 @@ public class HostRoleCommand {
hostRoleCommandEntity.setAutoSkipOnFailure(autoSkipFailure);
hostRoleCommandEntity.setRoleCommand(roleCommand);
hostRoleCommandEntity.setCommandDetail(commandDetail);
+ hostRoleCommandEntity.setOpsDisplayName(opsDisplayName);
hostRoleCommandEntity.setCustomCommandName(customCommandName);
hostRoleCommandEntity.setBackgroundCommand(isBackgroundCommand);
@@ -294,6 +297,13 @@ public class HostRoleCommand {
this.commandDetail = commandDetail;
}
+ public String getOpsDisplayName() {
+ return opsDisplayName;
+ }
+
+ public void setOpsDisplayName(String opsDisplayName) {
+ this.opsDisplayName = opsDisplayName;
+ }
public String getCustomCommandName() {
return customCommandName;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 17bc718..ab8b659 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
@@ -374,6 +374,9 @@ public class AmbariCustomCommandExecutionHelper {
if (cmd != null) {
cmd.setCommandDetail(commandDetail);
cmd.setCustomCommandName(commandName);
+ if (customCommandDefinition != null){
+ cmd.setOpsDisplayName(customCommandDefinition.getOpsDisplayName());
+ }
}
//set type background
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
index 20b0417..6721f7a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
@@ -75,6 +75,7 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
public static final String TASK_ATTEMPT_CNT_PROPERTY_ID = PropertyHelper.getPropertyId("Tasks", "attempt_cnt");
public static final String TASK_COMMAND_DET_PROPERTY_ID = PropertyHelper.getPropertyId("Tasks", "command_detail");
public static final String TASK_CUST_CMD_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Tasks", "custom_command_name");
+ public static final String TASK_COMMAND_OPS_DISPLAY_NAME = PropertyHelper.getPropertyId("Tasks", "ops_display_name");
private static Set<String> pkPropertyIds =
new HashSet<>(Arrays.asList(new String[]{
@@ -107,6 +108,7 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
PROPERTY_IDS.add(TASK_ATTEMPT_CNT_PROPERTY_ID);
PROPERTY_IDS.add(TASK_COMMAND_DET_PROPERTY_ID);
PROPERTY_IDS.add(TASK_CUST_CMD_NAME_PROPERTY_ID);
+ PROPERTY_IDS.add(TASK_COMMAND_OPS_DISPLAY_NAME);
}
/**
@@ -230,6 +232,7 @@ public class TaskResourceProvider extends AbstractControllerResourceProvider {
setResourceProperty(resource, TASK_COMMAND_DET_PROPERTY_ID, hostRoleCommand.getCommandDetail(), requestedIds);
}
+ setResourceProperty(resource, TASK_COMMAND_OPS_DISPLAY_NAME, hostRoleCommand.getOpsDisplayName(), requestedIds);
results.add(resource);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
index 86feceb..bfc83ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
@@ -181,6 +181,11 @@ public class HostRoleCommandEntity {
@Basic
private String commandDetail;
+ // An optional property that can be used for setting the displayName for operations window
+ @Column(name = "ops_display_name")
+ @Basic
+ private String opsDisplayName;
+
// When command type id CUSTOM_COMMAND and CUSTOM_ACTION this is the name
@Column(name = "custom_command_name")
@Basic
@@ -378,6 +383,16 @@ public class HostRoleCommandEntity {
this.customCommandName = customCommandName;
}
+ public String getOpsDisplayName() {
+ return opsDisplayName;
+ }
+
+ public void setOpsDisplayName(String opsDisplayName) {
+ this.opsDisplayName = opsDisplayName;
+ }
+
+
+
/**
* Determine whether this task should hold for retry when an error occurs.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/main/java/org/apache/ambari/server/state/CustomCommandDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/CustomCommandDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/CustomCommandDefinition.java
index 280a59b..ac16f87 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/CustomCommandDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/CustomCommandDefinition.java
@@ -30,6 +30,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
public class CustomCommandDefinition {
private String name;
+ private String opsDisplayName;
private CommandScriptDefinition commandScript;
private boolean background = false;
@@ -41,6 +42,10 @@ public class CustomCommandDefinition {
return background;
}
+ public String getOpsDisplayName() {
+ return opsDisplayName;
+ }
+
public CommandScriptDefinition getCommandScript() {
return commandScript;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 633d837..dbbbf20 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
@@ -69,6 +69,8 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
protected static final String CLUSTER_CONFIG_SELECTED_COLUMN = "selected";
protected static final String CLUSTER_CONFIG_SELECTED_TIMESTAMP_COLUMN = "selected_timestamp";
protected static final String CLUSTER_CONFIG_MAPPING_TABLE = "clusterconfigmapping";
+ protected static final String HOST_ROLE_COMMAND_TABLE = "host_role_command";
+ protected static final String HRC_OPS_DISPLAY_NAME_COLUMN = "ops_display_name";
@Inject
DaoUtils daoUtils;
@@ -114,6 +116,7 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
protected void executeDDLUpdates() throws AmbariException, SQLException {
updateStageTable();
updateClusterConfigurationTable();
+ addOpsDisplayNameColumnToHostRoleCommand();
}
protected void updateStageTable() throws SQLException {
@@ -278,6 +281,18 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
dbAccessor.dropTable(CLUSTER_CONFIG_MAPPING_TABLE);
}
+
+ /**
+ * Adds the {@value #HRC_OPS_DISPLAY_NAME_COLUMN} column to the
+ * {@value #HOST_ROLE_COMMAND_TABLE} table.
+ *
+ * @throws SQLException
+ */
+ private void addOpsDisplayNameColumnToHostRoleCommand() throws SQLException {
+ dbAccessor.addColumn(HOST_ROLE_COMMAND_TABLE,
+ new DBAccessor.DBColumnInfo(HRC_OPS_DISPLAY_NAME_COLUMN, String.class, 255, null, true));
+ }
+
/**
* Updates Log Search configs.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 fd49b94..0997cd6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
role_command VARCHAR(255),
command_detail VARCHAR(255),
custom_command_name VARCHAR(255),
+ ops_display_name VARCHAR(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 9fc3209..1a76f32 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -403,6 +403,7 @@ CREATE TABLE host_role_command (
error_log VARCHAR(255) NULL,
structured_out LONGBLOB,
command_detail VARCHAR(255),
+ ops_display_name VARCHAR(255),
custom_command_name VARCHAR(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 310208d..4029dda 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -384,6 +384,7 @@ CREATE TABLE host_role_command (
structured_out BLOB NULL,
command_detail VARCHAR2(255) NULL,
custom_command_name VARCHAR2(255) NULL,
+ ops_display_name VARCHAR2(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 c052104..e33875c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -384,6 +384,7 @@ CREATE TABLE host_role_command (
command_detail VARCHAR(255),
custom_command_name VARCHAR(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
+ ops_display_name VARCHAR(255),
CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 5a58ef8..062148d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
command_detail VARCHAR(255),
custom_command_name VARCHAR(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
+ ops_display_name VARCHAR(255),
CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 8c7a31d..5b41a1d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -389,6 +389,7 @@ CREATE TABLE host_role_command (
command_detail VARCHAR(255),
custom_command_name VARCHAR(255),
is_background SMALLINT DEFAULT 0 NOT NULL,
+ ops_display_name VARCHAR(255),
CONSTRAINT PK_host_role_command PRIMARY KEY CLUSTERED (task_id),
CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index c2545fe..6d33cd5 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -167,6 +167,7 @@
"Tasks/attempt_cnt",
"Tasks/custom_command_name",
"Tasks/command_detail",
+ "Tasks/ops_display_name",
"_"
],
"User":[
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java
index 8a52b8a..2fafa5c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java
@@ -125,6 +125,7 @@ public class TaskResourceProviderTest {
hostRoleCommandEntity.setRole(Role.DATANODE);
hostRoleCommandEntity.setCustomCommandName("customCommandName");
hostRoleCommandEntity.setCommandDetail("commandDetail");
+ hostRoleCommandEntity.setOpsDisplayName("opsDisplayName");
entities.add(hostRoleCommandEntity);
// set expectations
@@ -139,6 +140,7 @@ public class TaskResourceProviderTest {
propertyIds.add(TaskResourceProvider.TASK_ID_PROPERTY_ID);
propertyIds.add(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID);
propertyIds.add(TaskResourceProvider.TASK_COMMAND_DET_PROPERTY_ID);
+ propertyIds.add(TaskResourceProvider.TASK_COMMAND_OPS_DISPLAY_NAME);
Predicate predicate = new PredicateBuilder().property(TaskResourceProvider.TASK_ID_PROPERTY_ID).equals("100").
and().property(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID).equals("100").toPredicate();
@@ -153,6 +155,8 @@ public class TaskResourceProviderTest {
.TASK_CUST_CMD_NAME_PROPERTY_ID));
Assert.assertEquals("commandDetail", resource.getPropertyValue(TaskResourceProvider
.TASK_COMMAND_DET_PROPERTY_ID));
+ Assert.assertEquals("opsDisplayName",resource.getPropertyValue(TaskResourceProvider
+ .TASK_COMMAND_OPS_DISPLAY_NAME));
}
// verify
@@ -188,6 +192,7 @@ public class TaskResourceProviderTest {
hostRoleCommandEntity.setRole(Role.DATANODE);
hostRoleCommandEntity.setCustomCommandName("customCommandName");
hostRoleCommandEntity.setCommandDetail("commandDetail");
+ hostRoleCommandEntity.setOpsDisplayName("opsDisplayName");
commands.add(new HostRoleCommand(hostRoleCommandEntity, hostDAO, executionCommandDAO, ecwFactory));
// set expectations
@@ -203,6 +208,7 @@ public class TaskResourceProviderTest {
propertyIds.add(TaskResourceProvider.TASK_ID_PROPERTY_ID);
propertyIds.add(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID);
propertyIds.add(TaskResourceProvider.TASK_COMMAND_DET_PROPERTY_ID);
+ propertyIds.add(TaskResourceProvider.TASK_COMMAND_OPS_DISPLAY_NAME);
Predicate predicate = new PredicateBuilder().property(TaskResourceProvider.TASK_ID_PROPERTY_ID).equals("100").
and().property(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID).equals("100").toPredicate();
@@ -218,6 +224,8 @@ public class TaskResourceProviderTest {
.TASK_CUST_CMD_NAME_PROPERTY_ID));
Assert.assertEquals("commandDetail", resource.getPropertyValue(TaskResourceProvider
.TASK_COMMAND_DET_PROPERTY_ID));
+ Assert.assertEquals("opsDisplayName",resource.getPropertyValue(TaskResourceProvider
+ .TASK_COMMAND_OPS_DISPLAY_NAME));
}
// verify
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntityTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntityTest.java
new file mode 100644
index 0000000..e37b582
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntityTest.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.server.orm.entities;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+/**
+ * HostRoleCommandEntity unit tests.
+ */
+public class HostRoleCommandEntityTest {
+ @Test
+ public void testSetCustomCommandName() {
+ HostRoleCommandEntity entity = new HostRoleCommandEntity();
+ entity.setCustomCommandName("foo");
+ assertEquals("foo", entity.getCustomCommandName());
+ }
+
+ @Test
+ public void testSetCommandDetail() {
+ HostRoleCommandEntity entity = new HostRoleCommandEntity();
+ entity.setCommandDetail("foo");
+ assertEquals("foo", entity.getCommandDetail());
+ }
+
+ @Test
+ public void testSetOpsDisplayName() {
+ HostRoleCommandEntity entity = new HostRoleCommandEntity();
+ entity.setOpsDisplayName("foo");
+ assertEquals("foo", entity.getOpsDisplayName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 fec041c..607a94e 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
@@ -170,8 +170,11 @@ public class UpgradeCatalog300Test {
Capture<DBAccessor.DBColumnInfo> clusterConfigSelectedColumn = newCapture();
Capture<DBAccessor.DBColumnInfo> clusterConfigSelectedTimestampColumn = newCapture();
+ Capture<DBAccessor.DBColumnInfo> hrcOpsDisplayNameColumn = newCapture();
+
dbAccessor.addColumn(eq(UpgradeCatalog300.CLUSTER_CONFIG_TABLE), capture(clusterConfigSelectedColumn));
dbAccessor.addColumn(eq(UpgradeCatalog300.CLUSTER_CONFIG_TABLE), capture(clusterConfigSelectedTimestampColumn));
+ dbAccessor.addColumn(eq(UpgradeCatalog300.HOST_ROLE_COMMAND_TABLE), capture(hrcOpsDisplayNameColumn));
replay(dbAccessor, configuration);
@@ -189,6 +192,11 @@ public class UpgradeCatalog300Test {
Assert.assertEquals(UpgradeCatalog300.CLUSTER_CONFIG_SELECTED_TIMESTAMP_COLUMN, capturedSelectedTimestampColumn.getName());
Assert.assertEquals(Long.class, capturedSelectedTimestampColumn.getType());
+ DBAccessor.DBColumnInfo capturedOpsDisplayNameColumn = hrcOpsDisplayNameColumn.getValue();
+ Assert.assertEquals(UpgradeCatalog300.HRC_OPS_DISPLAY_NAME_COLUMN, capturedOpsDisplayNameColumn.getName());
+ Assert.assertEquals(null, capturedOpsDisplayNameColumn.getDefaultValue());
+ Assert.assertEquals(String.class, capturedOpsDisplayNameColumn.getType());
+
verify(dbAccessor);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index 4697dad..9f27f65 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -424,7 +424,7 @@ App.WizardStep9Controller = Em.Controller.extend(App.ReloadPopupMixin, {
}
break;
case 'CUSTOM_COMMAND':
- role = App.format.commandDetail(task.command_detail, task.request_input);
+ role = App.format.commandDetail(task.command_detail, task.request_input, task.ops_display_name);
case 'EXECUTE' :
case 'SERVICE_CHECK' :
switch (task.status) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 5d7108f..6e93654 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -231,7 +231,7 @@ var urls = {
},
'common.request.polling': {
- 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status,tasks/Tasks/structured_out,Requests/*&tasks/Tasks/stage_id={stageId}',
+ 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/ops_display_name,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status,tasks/Tasks/structured_out,Requests/*&tasks/Tasks/stage_id={stageId}',
'mock': '/data/background_operations/host_upgrade_tasks.json'
},
@@ -544,7 +544,7 @@ var urls = {
'testInProduction': true
},
'background_operations.get_by_request': {
- 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
+ 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/request_id,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/ops_display_name,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
'mock': '/data/background_operations/task_by_request{requestId}.json',
'testInProduction': true
},
@@ -1684,7 +1684,7 @@ var urls = {
'mock': '/data/stack_versions/upgrade_item.json'
},
'admin.upgrade.service_checks': {
- 'real': '/clusters/{clusterName}/upgrades/{upgradeId}/upgrade_groups?upgrade_items/UpgradeItem/status=COMPLETED&upgrade_items/tasks/Tasks/status.in(FAILED,ABORTED,TIMEDOUT)&upgrade_items/tasks/Tasks/command=SERVICE_CHECK&fields=upgrade_items/tasks/Tasks/command_detail,upgrade_items/tasks/Tasks/status&minimal_response=true'
+ 'real': '/clusters/{clusterName}/upgrades/{upgradeId}/upgrade_groups?upgrade_items/UpgradeItem/status=COMPLETED&upgrade_items/tasks/Tasks/status.in(FAILED,ABORTED,TIMEDOUT)&upgrade_items/tasks/Tasks/command=SERVICE_CHECK&fields=upgrade_items/tasks/Tasks/command_detail,tasks/Tasks/ops_display_name,upgrade_items/tasks/Tasks/status&minimal_response=true'
},
'admin.upgrade.update.options': {
'real': '/clusters/{clusterName}/upgrades/{upgradeId}',
@@ -1969,7 +1969,7 @@ var urls = {
'mock': '/data/wizard/deploy/5_hosts/get_host_state.json'
},
'wizard.step9.load_log': {
- 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
+ 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/ops_display_name,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
'mock': '/data/wizard/deploy/5_hosts/poll_{numPolls}.json',
'format': function () {
return {
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 03a2e82..4867c65 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -694,10 +694,14 @@ App.format = {
* @param {string} request_inputs
* @return {string}
*/
- commandDetail: function (command_detail, request_inputs) {
+ commandDetail: function (command_detail, request_inputs, ops_display_name) {
var detailArr = command_detail.split(' ');
var self = this;
var result = '';
+ //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('/')) {
@@ -715,6 +719,7 @@ App.format = {
result = result + ' ' + self.role(item, false);
}
});
+ }
if (result.indexOf('Decommission:') > -1 || result.indexOf('Recommission:') > -1) {
// for Decommission command, make sure the hostname is in lower case
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index c615cae..5bd02cd 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -548,7 +548,7 @@ App.HostPopup = Em.Object.create({
id: _task.Tasks.id,
hostName: _task.Tasks.host_name,
command: _task.Tasks.command.toLowerCase() === 'service_check' ? '' : _task.Tasks.command.toLowerCase(),
- commandDetail: App.format.commandDetail(_task.Tasks.command_detail, _task.Tasks.request_inputs),
+ commandDetail: App.format.commandDetail(_task.Tasks.command_detail, _task.Tasks.request_inputs, _task.Tasks.ops_display_name),
status: App.format.taskStatus(_task.Tasks.status),
role: App.format.role(_task.Tasks.role, false),
stderr: _task.Tasks.stderr,
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js b/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
index d983252..b951f1c 100644
--- a/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
+++ b/ambari-web/app/views/wizard/step9/hostLogPopupBody_view.js
@@ -136,7 +136,7 @@ App.WizardStep9HostLogPopupBodyView = Em.View.extend({
taskInfo.set('id', _task.Tasks.id);
taskInfo.set('requestId', _task.Tasks.request_id);
taskInfo.set('command', _task.Tasks.command.toLowerCase() === 'service_check' ? '' : _task.Tasks.command.toLowerCase());
- taskInfo.set('commandDetail', App.format.commandDetail(_task.Tasks.command_detail, _task.Tasks.request_inputs));
+ taskInfo.set('commandDetail', App.format.commandDetail(_task.Tasks.command_detail, _task.Tasks.request_inputs, _task.Tasks.ops_display_name));
taskInfo.set('status', App.format.taskStatus(_task.Tasks.status));
taskInfo.set('role', App.format.role(_task.Tasks.role, false));
taskInfo.set('stderr', _task.Tasks.stderr);
http://git-wip-us.apache.org/repos/asf/ambari/blob/35d7220a/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 4b9ec36..368e81c 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -256,6 +256,8 @@ describe('utils/helper', function() {
describe('#App.format', function(){
describe('#commandDetail()', function() {
var command = "GANGLIA_MONITOR STOP";
+ var custom_command_detail = "Remove_Logical_Mycomponent Mycomponent";
+ var ops_display_name = "Remove Logical Mycomponent";
var ignored = "DECOMMISSION, NAMENODE";
var removeString = "SERVICE/HDFS STOP";
var nagiosState = "nagios_update_ignore ACTIONEXECUTE";
@@ -263,6 +265,9 @@ describe('utils/helper', function() {
it('should convert command to readable info', function() {
expect(App.format.commandDetail(command)).to.be.equal(' Ganglia Monitor Stop');
});
+ it('should use display name for operations if specified', function() {
+ expect(App.format.commandDetail(custom_command_detail, null, ops_display_name)).to.be.equal(' Remove Logical Mycomponent');
+ });
it('should ignore decommission command', function(){
expect(App.format.commandDetail(ignored)).to.be.equal(' NameNode');
});