setComponentConfig: function(hostComponents,host,componentName,serviceName,principal,keytab,displayName,groupId) { if (host.get('hostComponents').someProperty('componentName', componentName)) { var result = {}; var configs = this.get('content.serviceConfigProperties'); var serviceConfigs = configs.filterProperty('serviceName', serviceName); var servicePrincipal = serviceConfigs.findProperty('name', principal); var serviceKeytabPath = serviceConfigs.findProperty('name', keytab).value; result.host = host.get('hostName'); result.component = displayName; result.principal = servicePrincipal.value.replace('_HOST', host.get('hostName').toLowerCase()) + servicePrincipal.unit; result.keytabfile = stringUtils.getFileFromPath(serviceKeytabPath); result.keytab = stringUtils.getPath(serviceKeytabPath); result.owner = 'root'; result.group = groupId; result.acl = '440'; hostComponents.push(result); } },
host.get('hostComponents').forEach(function(hostComponent){ if(componentsToDisplay.contains(hostComponent.get('componentName'))){ var serviceConfigs = configs.filterProperty('serviceName', hostComponent.get('service.serviceName')); var principal, keytab; serviceConfigs.forEach(function (config) { if (config.component && config.component === hostComponent.get('componentName')) { if (config.name.endsWith('_principal_name')) { principal = config.value.replace('_HOST', host.get('hostName').toLowerCase()) + config.unit; } else if (config.name.endsWith('_keytab') || config.name.endsWith('_keytab_path')) { keytab = config.value; } } else if (config.components && config.components.contains(hostComponent.get('componentName'))) { if (config.name.endsWith('_principal_name')) { principal = config.value.replace('_HOST', host.get('hostName').toLowerCase()) + config.unit; } else if (config.name.endsWith('_keytab') || config.name.endsWith('_keytab_path')) { keytab = config.value; } } }); var displayName = this.changeDisplayName(hostComponent.get('displayName')); var key = host.get('hostName') + "--" + principal; if (!addedPrincipalsHost[key]) { var owner = componentToOwnerMap[hostComponent.get('componentName')]; if(!owner){ owner = ''; } result.push({ host: host.get('hostName'), component: displayName, principal: principal, keytabFile: stringUtils.getFileFromPath(keytab), keytab: stringUtils.getPath(keytab), owner: owner, group: hadoopGroupId, acl: '400' }); addedPrincipalsHost[key] = true; } } },this);
hosts.forEach(function (host) { result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.smokeUser'), principal: smokeUser, keytabFile: stringUtils.getFileFromPath(smokeUserKeytabPath), keytab: stringUtils.getPath(smokeUserKeytabPath), owner: smokeUserId, group: hadoopGroupId, acl: '440' }); result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.hdfsUser'), principal: hdfsUser, keytabFile: stringUtils.getFileFromPath(hdfsUserKeytabPath), keytab: stringUtils.getPath(hdfsUserKeytabPath), owner: hdfsUserId, group: hadoopGroupId, acl: '440' }); if (isHbaseInstalled) { result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.user.hbaseUser'), principal: hbaseUser, keytabFile: stringUtils.getFileFromPath(hbaseUserKeytabPath), keytab: stringUtils.getPath(hbaseUserKeytabPath), owner: hbaseUserId, group: hadoopGroupId, acl: '440' }); } if(host.get('hostComponents').someProperty('componentName', 'NAMENODE') || host.get('hostComponents').someProperty('componentName', 'SECONDARY_NAMENODE') || host.get('hostComponents').someProperty('componentName', 'JOURNALNODE')){ result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.hdfs.user.httpUser'), principal: hadoopHttpPrincipal.value.replace('_HOST', host.get('hostName').toLowerCase()) + hadoopHttpPrincipal.unit, keytabFile: stringUtils.getFileFromPath(hadoopHttpKeytabPath), keytab: stringUtils.getPath(hadoopHttpKeytabPath), owner: 'root', group: hadoopGroupId, acl: '440' }); } if (host.get('hostComponents').someProperty('componentName', 'WEBHCAT_SERVER')) { var webHcatConfigs = configs.filterProperty('serviceName', 'WEBHCAT'); var webHCatHttpPrincipal = webHcatConfigs.findProperty('name', 'webHCat_http_principal_name'); var webHCatHttpKeytabPath = webHcatConfigs.findProperty('name', 'webhcat_http_keytab').value; result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.webhcat.user.httpUser'), principal: webHCatHttpPrincipal.value.replace('_HOST', host.get('hostName').toLowerCase()) + webHCatHttpPrincipal.unit, keytabFile: stringUtils.getFileFromPath(webHCatHttpKeytabPath), keytab: stringUtils.getPath(webHCatHttpKeytabPath), owner: 'root', group: hadoopGroupId, acl: '440' }); } if (host.get('hostComponents').someProperty('componentName', 'OOZIE_SERVER')) { var oozieConfigs = configs.filterProperty('serviceName', 'OOZIE'); var oozieHttpPrincipal = oozieConfigs.findProperty('name', 'oozie_http_principal_name'); var oozieHttpKeytabPath = oozieConfigs.findProperty('name', 'oozie_http_keytab').value; result.push({ host: host.get('hostName'), component: Em.I18n.t('admin.addSecurity.oozie.user.httpUser'), principal: oozieHttpPrincipal.value.replace('_HOST', host.get('hostName').toLowerCase()) + oozieHttpPrincipal.unit, keytabFile: stringUtils.getFileFromPath(oozieHttpKeytabPath), keytab: stringUtils.getPath(oozieHttpKeytabPath), owner: 'root', group: hadoopGroupId, acl: '440' }); } this.setComponentConfig(result,host,'HISTORYSERVER','MAPREDUCE2','jobhistory_http_principal_name','jobhistory_http_keytab',Em.I18n.t('admin.addSecurity.historyServer.user.httpUser'),hadoopGroupId); this.setComponentConfig(result,host,'RESOURCEMANAGER','YARN','resourcemanager_http_principal_name','resourcemanager_http_keytab',Em.I18n.t('admin.addSecurity.rm.user.httpUser'),hadoopGroupId); this.setComponentConfig(result,host,'NODEMANAGER','YARN','nodemanager_http_principal_name','nodemanager_http_keytab',Em.I18n.t('admin.addSecurity.nm.user.httpUser'),hadoopGroupId); host.get('hostComponents').forEach(function(hostComponent){ if(componentsToDisplay.contains(hostComponent.get('componentName'))){ var serviceConfigs = configs.filterProperty('serviceName', hostComponent.get('service.serviceName')); var principal, keytab; serviceConfigs.forEach(function (config) { if (config.component && config.component === hostComponent.get('componentName')) { if (config.name.endsWith('_principal_name')) { principal = config.value.replace('_HOST', host.get('hostName').toLowerCase()) + config.unit; } else if (config.name.endsWith('_keytab') || config.name.endsWith('_keytab_path')) { keytab = config.value; } } else if (config.components && config.components.contains(hostComponent.get('componentName'))) { if (config.name.endsWith('_principal_name')) { principal = config.value.replace('_HOST', host.get('hostName').toLowerCase()) + config.unit; } else if (config.name.endsWith('_keytab') || config.name.endsWith('_keytab_path')) { keytab = config.value; } } }); var displayName = this.changeDisplayName(hostComponent.get('displayName')); var key = host.get('hostName') + "--" + principal; if (!addedPrincipalsHost[key]) { var owner = componentToOwnerMap[hostComponent.get('componentName')]; if(!owner){ owner = ''; } result.push({ host: host.get('hostName'), component: displayName, principal: principal, keytabFile: stringUtils.getFileFromPath(keytab), keytab: stringUtils.getPath(keytab), owner: owner, group: hadoopGroupId, acl: '400' }); addedPrincipalsHost[key] = true; } } },this); },this);