Repository: ambari Updated Branches: refs/heads/trunk 9a4cef789 -> 7a5c891e6
AMBARI-5539. Stop/Start flume agent request fails. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7a5c891e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7a5c891e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7a5c891e Branch: refs/heads/trunk Commit: 7a5c891e6efea4309764988ddbd1f3c640ed155f Parents: 9a4cef7 Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Wed Apr 23 15:05:07 2014 +0300 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Wed Apr 23 15:05:07 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/main/service/info/summary.js | 14 +++++++------- ambari-web/app/utils/ajax/ajax.js | 15 ++++++--------- 2 files changed, 13 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7a5c891e/ambari-web/app/controllers/main/service/info/summary.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js index 6365c00..5e90b11 100644 --- a/ambari-web/app/controllers/main/service/info/summary.js +++ b/ambari-web/app/controllers/main/service/info/summary.js @@ -31,9 +31,9 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({ if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'INSTALLED') { var self = this; App.showConfirmationPopup(function () { - var command = 'START'; + var state = 'STARTED'; var context = Em.I18n.t('services.service.summary.flume.start.context').format(selectedFlumeAgent.get('name')); - self.sendFlumeAgentCommandToServer(command, context, selectedFlumeAgent); + self.sendFlumeAgentCommandToServer(state, context, selectedFlumeAgent); }); } }, @@ -47,26 +47,26 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({ if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'RUNNING') { var self = this; App.showConfirmationPopup(function () { - var command = 'STOP'; + var state = 'INSTALLED'; var context = Em.I18n.t('services.service.summary.flume.stop.context').format(selectedFlumeAgent.get('name')); - self.sendFlumeAgentCommandToServer(command, context, selectedFlumeAgent); + self.sendFlumeAgentCommandToServer(state, context, selectedFlumeAgent); }); } }, /** * Send command for Flume Agent to server - * @param {string} command + * @param {string} state * @param {string} context * @param {Object} agent * @method sendFlumeAgentCommandToServer */ - sendFlumeAgentCommandToServer: function (command, context, agent) { + sendFlumeAgentCommandToServer: function (state, context, agent) { App.ajax.send({ name: 'service.flume.agent.command', sender: this, data: { - command: command, + state: state, context: context, agentName: agent.get('name'), host: agent.get('host.hostName') http://git-wip-us.apache.org/repos/asf/ambari/blob/7a5c891e/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 0316071..6eef791 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -142,24 +142,21 @@ var urls = { 'mock': '/data/configurations/config_group.json' }, 'service.flume.agent.command': { - 'real': '/clusters/{clusterName}/requests', + 'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER', 'mock': '', 'format': function (data) { return { - type: 'POST', + type: 'PUT', data: JSON.stringify({ "RequestInfo": { - "command": data.command, "context": data.context, "flume_handler": data.agentName }, - "Requests/resource_filters": [ - { - "service_name": "FLUME", - "component_name": "FLUME_HANDLER", - "hosts": data.host + "Body": { + "HostRoles": { + "state": data.state } - ] + } }) } }