AMBARI-8753 Turn on pre-upgrade checks when API is ready. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c62b378c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c62b378c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c62b378c Branch: refs/heads/trunk Commit: c62b378c51170c971bc861c26c9853b51a26258d Parents: 3702ad8 Author: aBabiichuk <ababiic...@cybervisiontech.com> Authored: Wed Dec 17 15:39:51 2014 +0200 Committer: aBabiichuk <ababiic...@cybervisiontech.com> Committed: Wed Dec 17 17:06:49 2014 +0200 ---------------------------------------------------------------------- .../data/stack_versions/pre_upgrade_check.json | 102 +++++-------------- ambari-web/app/config.js | 2 +- .../main/admin/stack_and_upgrade_controller.js | 8 +- .../stack_upgrade/pre_upgrade_check_dialog.hbs | 4 +- ambari-web/app/utils/ajax/ajax.js | 2 +- .../admin/stack_and_upgrade_controller_test.js | 28 ++--- 6 files changed, 48 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json b/ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json index 81df649..47566f4 100644 --- a/ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json +++ b/ambari-web/app/assets/data/stack_versions/pre_upgrade_check.json @@ -1,81 +1,29 @@ { - "UpgradeChecks": [ - { - "check": "NameNode HA is enabled", - "status": "PASS", - "reason": "", - "failed_on": [], - "check_type": "SERVICE" - }, - { - "check": "Work-preserving RM/NM restart is enabled in YARN configs", - "status": "FAIL", - "reason": "X should be set to Y in yarn-site", - "failed_on": [ "YARN" ], - "check_type": "SERVICE" - }, - { - "check": "MapReduce jobs are referencing Hadoop libraries from the distributed cache instead of the cluster", - "status": "PASS", - "reason": "", - "failed_on": [], - "check_type": "SERVICE" - }, - { - "check": "Tez jobs are referencing Hadoop libraries from the distributed cache instead of the cluster", - "status": "PASS", - "reason": "", - "failed_on": [], - "check_type": "SERVICE" - }, - { - "check": "Oozie jobs are referencing Hadoop libraries from the distributed cache instead of the cluster", - "status": "PASS", - "reason": "", - "failed_on": [], - "check_type": "SERVICE" - }, - { - "check": "All services are up", - "status": "FAIL", - "reason": "Some services are down", - "failed_on": [ "STORM" ], - "check_type": "SERVICE" - }, - { - "check": "All services must not in Maintenance Mode", - "status": "FAIL", - "reason": "Some services are in Maintenance Mode", - "failed_on": [ "FALCON", "OOZIE" ], - "check_type": "SERVICE" - }, - { - "check": "There must not be any DataNodes in decommissioning state", - "status": "FAIL", - "reason": "Some DataNodes are in decommissioning state", - "failed_on": [ "host004", "host005" ], - "check_type": "HOST" - }, - { - "check": "All hosts must be heartbeating with the server unless they are in Maintenance Mode", - "status": "FAIL", - "reason": "Some hosts are not heartbeating with the server", - "failed_on": [ "host009", "host010" ], - "check_type": "HOST" - }, - { - "check": "All hosts must not have any components in Maintenance Mode", - "status": "FAIL", - "reason": "Some hosts have host components in Maintenance Mode", - "failed_on": [ "host001", "host002" ], - "check_type": "HOST" - }, - { - "check": "All hosts must have the new version installed", - "status": "FAIL", - "reason": "Some hosts do not have HDP-2.2.1 installed", - "failed_on": [ "host001", "host002" ], - "check_type": "HOST" + "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrades_check/", + "items" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrade_check/HOST_HEARTBEAT", + "UpgradeChecks" : { + "cluster_name" : "clus", + "id" : "HOST_HEARTBEAT", + "check" : "All hosts must be heartbeating with the server unless they are in Maintenance Mode", + "check_type" : "HOST", + "failed_on" : ["c6401.ambari.apache.org"], + "reason" : "Some hosts are not heartbeating with the server", + "status" : "FAIL" + } + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/clusters/clus/rolling_upgrade_check/SERVICES_MAINTENANCE_MODE", + "UpgradeChecks" : { + "cluster_name" : "clus", + "id" : "SERVICES_MAINTENANCE_MODE", + "check" : "All services must not in Maintenance Mode", + "check_type" : "SERVICE", + "failed_on" : [], + "reason" : "", + "status" : "PASS" + } } ] } http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/ambari-web/app/config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js index 3971ffd..a7cdc29 100644 --- a/ambari-web/app/config.js +++ b/ambari-web/app/config.js @@ -57,7 +57,7 @@ App.isManagedMySQLForHiveEnabled = false; App.enableExperimental = false; App.supports = { - preUpgradeCheck: false, + preUpgradeCheck: true, stackUpgrade: true, autoRollbackHA: false, alwaysEnableManagedMySQLForHive: false, http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js index 5bde0c6..2a27e53 100644 --- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js +++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js @@ -283,7 +283,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, * @param version */ runPreUpgradeCheck: function(version) { - if (App.supports.preUpgradeCheck) { + if (App.get('supports.preUpgradeCheck')) { App.ajax.send({ name: "admin.rolling_upgrade.pre_upgrade_check", sender: this, @@ -304,16 +304,14 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage, * @returns {App.ModalPopup|void} */ runPreUpgradeCheckSuccess: function(data, opt, params) { - if (data.UpgradeChecks.someProperty('status',"FAIL")) { + if (data.items.someProperty('UpgradeChecks.status',"FAIL")) { return App.ModalPopup.show({ header: Em.I18n.t('admin.stackUpgrade.preupgradeCheck.header').format(params.label), primary: Em.I18n.t('common.dismiss'), secondary: false, bodyClass: Em.View.extend({ templateName: require('templates/main/admin/stack_upgrade/pre_upgrade_check_dialog'), - checks: function() { - return data.UpgradeChecks.filterProperty('status',"FAIL"); - }.property() + checks: data.items.filterProperty('UpgradeChecks.status',"FAIL") }) }) } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs index 4a6af6a..f6613ee 100644 --- a/ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs +++ b/ambari-web/app/templates/main/admin/stack_upgrade/pre_upgrade_check_dialog.hbs @@ -22,8 +22,8 @@ </div> <div class="limited-height-2"> {{#each item in view.checks}} - <i class="icon-remove"></i> <span>{{item.check}}</span> - <pre>{{t admin.stackUpgrade.preupgradeCheck.reason}}{{item.reason}}<br/>{{t admin.stackUpgrade.preupgradeCheck.failedOn}}{{item.failed_on}}</pre> + <i class="icon-remove"></i> <span>{{item.UpgradeChecks.check}}</span> + <pre>{{t admin.stackUpgrade.preupgradeCheck.reason}}{{item.UpgradeChecks.reason}}<br/>{{t admin.stackUpgrade.preupgradeCheck.failedOn}}{{item.UpgradeChecks.failed_on}}</pre> {{/each}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/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 6c2e38e..00b4985 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -1394,7 +1394,7 @@ var urls = { 'mock': '' }, 'admin.rolling_upgrade.pre_upgrade_check': { - 'real': '/clusters/{clusterName}/rolling_upgrades_check', + 'real': '/clusters/{clusterName}/rolling_upgrades_check?fields=*', 'mock': '/data/stack_versions/pre_upgrade_check.json' }, http://git-wip-us.apache.org/repos/asf/ambari/blob/c62b378c/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js index f20d9a4..0341265 100644 --- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js +++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js @@ -248,24 +248,28 @@ describe('App.MainAdminStackAndUpgradeController', function() { controller.upgrade.restore(); }); it("shows popup", function () { - var check = {UpgradeChecks: [{ - "check": "Work-preserving RM/NM restart is enabled in YARN configs", - "status": "FAIL", - "reason": "FAIL", - "failed_on": [], - "check_type": "SERVICE" + var check = { items: [{ + UpgradeChecks: { + "check": "Work-preserving RM/NM restart is enabled in YARN configs", + "status": "FAIL", + "reason": "FAIL", + "failed_on": [], + "check_type": "SERVICE" + } }]}; controller.runPreUpgradeCheckSuccess(check,null,{label: "name"}); expect(controller.upgrade.calledOnce).to.be.false; expect(App.ModalPopup.show.calledOnce).to.be.true; }); it("runs upgrade popup", function () { - var check = {UpgradeChecks: [{ - "check": "Work-preserving RM/NM restart is enabled in YARN configs", - "status": "PASS", - "reason": "OK", - "failed_on": [], - "check_type": "SERVICE" + var check = { items: [{ + UpgradeChecks: { + "check": "Work-preserving RM/NM restart is enabled in YARN configs", + "status": "PASS", + "reason": "OK", + "failed_on": [], + "check_type": "SERVICE" + } }]}; controller.runPreUpgradeCheckSuccess(check,null,{label: "name"}); expect(controller.upgrade.calledOnce).to.be.true;