Updated Branches: refs/heads/trunk fbed96d8e -> acc79e491
AMBARI-2637: Security CSV cleanup. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/acc79e49 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/acc79e49 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/acc79e49 Branch: refs/heads/trunk Commit: acc79e49192f9a4c9bfd75dac68e709a196a7d7a Parents: fbed96d Author: Jaimin Jetly <[email protected]> Authored: Mon Jul 15 15:43:32 2013 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Mon Jul 15 15:44:08 2013 -0700 ---------------------------------------------------------------------- .../main/admin/security/add/step3.js | 26 +++++++++++++++----- ambari-web/app/utils/string_utils.js | 9 +++++++ 2 files changed, 29 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/acc79e49/ambari-web/app/controllers/main/admin/security/add/step3.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/security/add/step3.js b/ambari-web/app/controllers/main/admin/security/add/step3.js index 531a722..0ce41bb 100644 --- a/ambari-web/app/controllers/main/admin/security/add/step3.js +++ b/ambari-web/app/controllers/main/admin/security/add/step3.js @@ -102,6 +102,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.smokeUser'), principal: smokeUser, + keytabFile: stringUtils.getFileFromPath(smokeUserKeytabPath), keytab: smokeUserKeytabPath, owner: smokeUserId, group: hadoopGroupId, @@ -111,6 +112,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.hdfsUser'), principal: hdfsUser, + keytabFile: stringUtils.getFileFromPath(hdfsUserKeytabPath), keytab: hdfsUserKeytabPath, owner: hdfsUserId, group: hadoopGroupId, @@ -121,6 +123,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.hbaseUser'), principal: hbaseUser, + keytabFile: stringUtils.getFileFromPath(hbaseUserKeytabPath), keytab: hbaseUserKeytabPath, owner: hbaseUserId, group: hadoopGroupId, @@ -133,6 +136,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.hdfs.user.httpUser'), principal: hadoopHttpPrincipal.value.replace('_HOST', host.get('hostName')) + hadoopHttpPrincipal.unit, + keytabFile: stringUtils.getFileFromPath(hadoopHttpKeytabPath), keytab: hadoopHttpKeytabPath, owner: 'root', group: hadoopGroupId, @@ -147,6 +151,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.webhcat.user.httpUser'), principal: webHCatHttpPrincipal.value.replace('_HOST', host.get('hostName')) + webHCatHttpPrincipal.unit, + keytabFile: stringUtils.getFileFromPath(webHCatHttpKeytabPath), keytab: webHCatHttpKeytabPath, owner: 'root', group: hadoopGroupId, @@ -161,6 +166,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.oozie.user.httpUser'), principal: oozieHttpPrincipal.value.replace('_HOST', host.get('hostName')) + oozieHttpPrincipal.unit, + keytabFile: stringUtils.getFileFromPath(oozieHttpKeytabPath), keytab: oozieHttpKeytabPath, owner: 'root', group: hadoopGroupId, @@ -186,8 +192,7 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ } } }); - - + var displayName = this.changeDisplayName(hostComponent.get('displayName')); var key = host.get('hostName') + "--" + principal; if (!addedPrincipalsHost[key]) { var owner = componentToOwnerMap[hostComponent.get('componentName')]; @@ -196,8 +201,9 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ } result.push({ host: host.get('hostName'), - component: hostComponent.get('displayName'), + component: displayName, principal: principal, + keytabFile: stringUtils.getFileFromPath(keytab), keytab: keytab, owner: owner, group: hadoopGroupId, @@ -206,8 +212,16 @@ App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({ addedPrincipalsHost[key] = true; } } - }); - }); + },this); + },this); this.set('hostComponents', result); - } + }, + + changeDisplayName: function (name) { + if (name === 'HiveServer2') { + return 'Hive Metastore and HiveServer2'; + } else { + return name; + } + }, }); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/acc79e49/ambari-web/app/utils/string_utils.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/string_utils.js b/ambari-web/app/utils/string_utils.js index 5142601..ef6ae0e 100644 --- a/ambari-web/app/utils/string_utils.js +++ b/ambari-web/app/utils/string_utils.js @@ -123,5 +123,14 @@ module.exports = { content += row.join(',') + '\n'; }); return content; + }, + + /** + * Extracts filename from linux/unix path + * @param String: path + * @return {Sring}: filename + */ + getFileFromPath: function(path) { + return path.replace(/^.*[\/]/, ''); } }
