[ambari] branch trunk updated: AMBARI-25096 Cluster Installation fails when installing the cluster via Redhat satellite repositories (no internet connectivity Cluster) (asnaik)

2019-02-04 Thread rlevas
This is an automated email from the ASF dual-hosted git repository.

rlevas pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 1a30286  AMBARI-25096 Cluster Installation fails when installing the 
cluster via Redhat satellite repositories (no internet connectivity Cluster)  
(asnaik)
1a30286 is described below

commit 1a30286e82e1c6a59c36c5009001763de6decd14
Author: Akhil Subhash Naik 
AuthorDate: Fri Jan 11 00:54:01 2019 +0530

AMBARI-25096 Cluster Installation fails when installing the cluster via 
Redhat satellite repositories (no internet connectivity Cluster)  (asnaik)
---
 ambari-web/app/controllers/installer.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ambari-web/app/controllers/installer.js 
b/ambari-web/app/controllers/installer.js
index 82aa615..c3d9cb1 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -890,8 +890,10 @@ App.InstallerController = 
App.WizardController.extend(App.Persist, {
   if (!verifyBaseUrl) {
 dfd.resolve();
   }
+  //for redhat satellite/spacewalk the os urls will be empty
+  var useRedhatSatellite = 
wizardStep1Controller.get('selectedStack.useRedhatSatellite');
   selectedStack.get('operatingSystems').forEach(function (os) {
-if (os.get('isSelected') && !os.get('isEmpty')) {
+if (os.get('isSelected') && (useRedhatSatellite || 
!os.get('isEmpty'))) {
   os.get('repositories').forEach(function (repo) {
 if (repo.get('showRepo')) {
   repo.setProperties({



[ambari] branch trunk updated: AMBARI-25138 Cover mappers files with unit tests. (ababiichuk)

2019-02-04 Thread ababiichuk
This is an automated email from the ASF dual-hosted git repository.

ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 100fa13  AMBARI-25138 Cover mappers files with unit tests. (ababiichuk)
100fa13 is described below

commit 100fa13734d223cb0ddd9a3dbae3ec8dc24f7cb1
Author: ababiichuk 
AuthorDate: Fri Feb 1 20:40:26 2019 +0200

AMBARI-25138 Cover mappers files with unit tests. (ababiichuk)
---
 ambari-web/app/assets/test/tests.js|   4 +
 .../app/mappers/alert_notification_mapper.js   |   1 -
 ambari-web/app/mappers/quicklinks_mapper.js|  16 -
 ambari-web/app/models/widget.js|   5 +-
 ambari-web/test/helpers.js |  13 +-
 .../test/mappers/alert_groups_mapper_test.js   |   1 +
 .../test/mappers/alert_notification_mapper_test.js | 429 +
 ambari-web/test/mappers/cluster_mapper_test.js |  97 +
 .../test/mappers/stack_version_mapper_test.js  | 333 
 ambari-web/test/mappers/widget_mapper_test.js  | 162 
 10 files changed, 1038 insertions(+), 23 deletions(-)

diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index d42fbfb..c20a839 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -163,6 +163,8 @@ var files = [
   'test/mappers/alert_instances_mapper_test',
   'test/mappers/alert_definitions_mapper_test',
   'test/mappers/alert_definition_summary_mapper_test',
+  'test/mappers/alert_notification_mapper_test',
+  'test/mappers/cluster_mapper_test',
   'test/mappers/server_data_mapper_test',
   'test/mappers/hosts_mapper_test',
   'test/mappers/service_mapper_test',
@@ -171,8 +173,10 @@ var files = [
   'test/mappers/users_mapper_test',
   'test/mappers/stack_mapper_test',
   'test/mappers/stack_service_mapper_test',
+  'test/mappers/stack_version_mapper_test',
   'test/mappers/repository_version_mapper_test',
   'test/mappers/stack_upgrade_history_mapper_test',
+  'test/mappers/widget_mapper_test',
   'test/mappers/configs/config_groups_mapper_test',
   'test/mappers/configs/service_config_version_mapper_test',
   'test/mappers/configs/themes_mapper_test',
diff --git a/ambari-web/app/mappers/alert_notification_mapper.js 
b/ambari-web/app/mappers/alert_notification_mapper.js
index 8c7f50f..e0ca8d2 100644
--- a/ambari-web/app/mappers/alert_notification_mapper.js
+++ b/ambari-web/app/mappers/alert_notification_mapper.js
@@ -77,7 +77,6 @@ App.alertNotificationMapper = App.QuickDataMapper.create({
* @private
*/
   _setPropertiesToEachModel: function (propertyName, propertiesMap) {
-var modelsMap = this.get('modelsMap');
 for (var recordId in propertiesMap) {
   if (propertiesMap.hasOwnProperty(recordId)) {
 App.AlertNotification.find(recordId).set(propertyName, 
propertiesMap[recordId]);
diff --git a/ambari-web/app/mappers/quicklinks_mapper.js 
b/ambari-web/app/mappers/quicklinks_mapper.js
index 6de9b34..05cd5b9 100644
--- a/ambari-web/app/mappers/quicklinks_mapper.js
+++ b/ambari-web/app/mappers/quicklinks_mapper.js
@@ -29,21 +29,5 @@ App.quicklinksMapper = App.QuickDataMapper.create({
 "name" : "QuickLinkInfo.quicklink_data.QuickLinksConfiguration.name",
 "protocol" : 
"QuickLinkInfo.quicklink_data.QuickLinksConfiguration.configuration.protocol",
 "links" : 
"QuickLinkInfo.quicklink_data.QuickLinksConfiguration.configuration.links"
-  },
-
-  map: function(json){
-console.time('App.quicklinksMapper execution time');
-
-var result = [];
-var linkResult = [];
-
-json.items.forEach(function(item) {
-  var parseResult = this.parseIt(item, this.get('config'));
-  console.log("parseResult", parseResult);
-  result.push(parseResult);
-}, this);
-
-App.store.safeLoadMany(this.get('model'), result);
-console.timeEnd('App.quicklinksMapper execution time');
   }
 });
diff --git a/ambari-web/app/models/widget.js b/ambari-web/app/models/widget.js
index 8c76123..64fd566 100644
--- a/ambari-web/app/models/widget.js
+++ b/ambari-web/app/models/widget.js
@@ -45,10 +45,13 @@ App.Widget = DS.Model.extend({
   tag: DS.attr('string'),
   isVisible: DS.attr('boolean', {defaultValue: true}),
   /**
+   * This field is not derived from API but needs to be filled in the mapper 
on the client side
* @type {number}
* @default 0
*/
-  defaultOrder: 0, // This field is not derived from API but needs to be 
filled in the mapper on the client side
+  defaultOrder: DS.attr('number', {
+defaultValue: 0
+  }),
 
   /**
* @type Em.View
diff --git a/ambari-web/test/helpers.js b/ambari-web/test/helpers.js
index b843189..5327ba2 100644
--- a/ambari-web/test/helpers.js
+++ b/ambari-web/test/helpers.js
@@ -37,11 +37,14 @@ module.exports = {
   nestedExpect: function (expected, actual) {
 

[ambari] branch branch-2.7 updated: AMBARI-25141. Encrypting LDAP manager password in case password security is ON (#2810)

2019-02-04 Thread smolnar
This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new a05bb20  AMBARI-25141. Encrypting LDAP manager password in case 
password security is ON (#2810)
a05bb20 is described below

commit a05bb201067f0ae10d40f180bb6216d098f9447f
Author: Sandor Molnar 
AuthorDate: Mon Feb 4 17:37:33 2019 +0100

AMBARI-25141. Encrypting LDAP manager password in case password security is 
ON (#2810)
---
 .../org/apache/ambari/server/utils/PasswordUtils.java  |  3 ++-
 .../src/main/python/ambari_server/setupSecurity.py | 14 +-
 .../apache/ambari/server/utils/PasswordUtilsTest.java  | 18 --
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java 
b/ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java
index dafc47c..04df5d9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/utils/PasswordUtils.java
@@ -82,7 +82,8 @@ public class PasswordUtils {
   if (CredentialProvider.isAliasString(passwordProperty)) {
 return readPasswordFromStore(passwordProperty);
   } else {
-return readPasswordFromFile(passwordProperty, defaultPassword);
+final String pw = readPasswordFromFile(passwordProperty, 
defaultPassword);
+return CredentialProvider.isAliasString(pw) ? 
readPasswordFromStore(pw) : pw;
   }
 }
 return defaultPassword;
diff --git a/ambari-server/src/main/python/ambari_server/setupSecurity.py 
b/ambari-server/src/main/python/ambari_server/setupSecurity.py
index f6d0a3e..1958f8f 100644
--- a/ambari-server/src/main/python/ambari_server/setupSecurity.py
+++ b/ambari-server/src/main/python/ambari_server/setupSecurity.py
@@ -918,19 +918,15 @@ def setup_ldap(options):
 if isSecure:
   if mgr_password:
 encrypted_passwd = encrypt_password(LDAP_MGR_PASSWORD_ALIAS, 
mgr_password, options)
-if mgr_password != encrypted_passwd:
-  ldap_property_value_map[LDAP_MGR_PASSWORD_PROPERTY] = 
encrypted_passwd
-  pass
+ldap_property_value_map[LDAP_MGR_PASSWORD_PROPERTY] = 
store_password_file(encrypted_passwd, LDAP_MGR_PASSWORD_FILENAME)
+
   if ts_password:
 encrypted_passwd = encrypt_password(SSL_TRUSTSTORE_PASSWORD_ALIAS, 
ts_password, options)
 if ts_password != encrypted_passwd:
   
ldap_property_values_in_ambari_properties[SSL_TRUSTSTORE_PASSWORD_PROPERTY] = 
encrypted_passwd
-  pass
-pass
-
-# Persisting values
-if mgr_password:
-  ldap_property_value_map[LDAP_MGR_PASSWORD_PROPERTY] = 
store_password_file(mgr_password, LDAP_MGR_PASSWORD_FILENAME)
+else: #not secure
+  if mgr_password:
+ldap_property_value_map[LDAP_MGR_PASSWORD_PROPERTY] = 
store_password_file(mgr_password, LDAP_MGR_PASSWORD_FILENAME)
 
 print 'Saving LDAP properties...'
 
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/utils/PasswordUtilsTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/utils/PasswordUtilsTest.java
index b18ebd3..a47cb64 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/utils/PasswordUtilsTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/utils/PasswordUtilsTest.java
@@ -66,10 +66,10 @@ public class PasswordUtilsTest extends EasyMockSupport {
 final CredentialProvider credentialProvider = 
PowerMock.createNiceMock(CredentialProvider.class);
 setupBasicCredentialProviderExpectations(credentialProvider);
 credentialProvider.getPasswordForAlias(CS_ALIAS);
-PowerMock.expectLastCall().andReturn("testPassword".toCharArray()).once();
+
PowerMock.expectLastCall().andReturn("testPassword".toCharArray()).anyTimes();
 PowerMock.replay(credentialProvider, CredentialProvider.class);
 replayAll();
-assertEquals("testPassword", passwordUtils.readPassword(CS_ALIAS, 
"testPassword"));
+assertEquals("testPassword", passwordUtils.readPassword(CS_ALIAS, 
"testPasswordDefault"));
 verifyAll();
   }
   
@@ -95,6 +95,20 @@ public class PasswordUtilsTest extends EasyMockSupport {
 assertEquals("testPasswordDefault", 
passwordUtils.readPassword(passwordFile.getAbsolutePath(), 
"testPasswordDefault"));
   }
 
+  @Test
+  public void shouldResolveEncryptedPaswordIfWeStoreTheAliasInPasswordFile() 
throws Exception {
+final String testPassword = "testPassword";
+final File passwordFile = writeTestPasswordFile(CS_ALIAS);
+final CredentialProvider credentialProvider = 
PowerMock.createNiceMock(CredentialProvider.class);
+setupBasicCredentialProviderExpectations(credentialProvider);
+credentialProvider.getPasswordForAlias(CS_ALIAS);
+

[ambari] branch branch-2.7 updated: AMBARI-25055 JS error after starting stack downgrade

2019-02-04 Thread atkach
This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 100ad2f0 AMBARI-25055 JS error after starting stack downgrade
100ad2f0 is described below

commit 100ad2f08f3cfdce9386c249e3d7bf9ca5f38507
Author: Andrii Tkach 
AuthorDate: Wed Dec 19 15:43:29 2018 +0200

AMBARI-25055 JS error after starting stack downgrade
---
 .../controllers/main/admin/stack_and_upgrade_controller.js| 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

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 ac04c88..8695bdb 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
@@ -2283,15 +2283,8 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
 this.initDBProperties();
 App.set('upgradeState', lastUpgradeData.Upgrade.request_status);
 this.loadRepoVersionsToModel().done(function () {
-  var upgradeVersion;
-  if (isDowngrade) {
-var services = Object.keys(lastUpgradeData.versions);
-upgradeVersion = services[0].from_repository_version;
-  } else {
-var toVersion = 
App.RepositoryVersion.find().findProperty('repositoryVersion', 
lastUpgradeData.Upgrade.associated_version);
-upgradeVersion = toVersion && toVersion.get('displayName');
-  }
-  lastUpgradeData.versions
+  var version = 
App.RepositoryVersion.find().findProperty('repositoryVersion', 
lastUpgradeData.Upgrade.associated_version);
+  var upgradeVersion = version && version.get('displayName');
   self.setDBProperty('upgradeVersion', upgradeVersion);
   self.set('upgradeVersion', upgradeVersion);
 });



[ambari] branch trunk updated: AMBARI-25020. Allow unattended mpack install with purge (#2794)

2019-02-04 Thread adoroszlai
This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new b2a0297  AMBARI-25020. Allow unattended mpack install with purge 
(#2794)
b2a0297 is described below

commit b2a0297051a9603ab695b640ba37bc13e90877a1
Author: Doroszlai, Attila <6454655+adorosz...@users.noreply.github.com>
AuthorDate: Mon Feb 4 15:22:13 2019 +0100

AMBARI-25020. Allow unattended mpack install with purge (#2794)
---
 ambari-server/src/main/python/ambari_server/setupMpacks.py | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/setupMpacks.py 
b/ambari-server/src/main/python/ambari_server/setupMpacks.py
index b8c0974..640cc2f 100755
--- a/ambari-server/src/main/python/ambari_server/setupMpacks.py
+++ b/ambari-server/src/main/python/ambari_server/setupMpacks.py
@@ -347,11 +347,12 @@ def validate_purge(options, purge_list, mpack_dir, 
mpack_metadata, replay_mode=F
 
   if not replay_mode:
 purge_resources = set((v) for k, v in RESOURCE_FRIENDLY_NAMES.iteritems() 
if k in purge_list)
+answer = 'yes' if options.silent else 'no'
 warn_msg = "CAUTION: You have specified the --purge option with 
--purge-list={0}. " \
"This will replace all existing {1} currently installed.\n" \
-   "Are you absolutely sure you want to perform the purge 
[yes/no]? (no)".format(
-purge_list, ", ".join(purge_resources))
-okToPurge = get_YN_input(warn_msg, False)
+   "Are you absolutely sure you want to perform the purge 
[yes/no]? ({2})".format(
+purge_list, ", ".join(purge_resources), answer)
+okToPurge = get_YN_input(warn_msg, options.silent, answer)
 if not okToPurge:
   err = "Management pack installation cancelled by user"
   raise FatalException(1, err)



[ambari] branch trunk updated: AMBARI-25140 Cover widget mixin with unit tests

2019-02-04 Thread atkach
This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 98457d1  AMBARI-25140 Cover widget mixin with unit tests
98457d1 is described below

commit 98457d182d11948820cde1d5c1b47b4ee3bb60d7
Author: Andrii Tkach 
AuthorDate: Mon Feb 4 10:09:56 2019 +0200

AMBARI-25140 Cover widget mixin with unit tests
---
 .../app/mixins/common/widgets/widget_mixin.js  |  60 +--
 ambari-web/test/mixins/common/widget_mixin_test.js | 481 -
 2 files changed, 498 insertions(+), 43 deletions(-)

diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js 
b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index 6486856..11ae6bc 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -263,7 +263,7 @@ App.WidgetMixin = Ember.Mixin.create({
 };
 
 if (request.tag) {
-  data.selectedHostsParam = '/host_name.in(' + 
App.HDFSService.find().objectAt(0).get('masterComponentGroups').findProperty('name',
 request.tag).hosts.join(',') + ')';
+  data.selectedHostsParam = '/host_name.in(' + 
App.HDFSService.find('HDFS').get('masterComponentGroups').findProperty('name', 
request.tag).hosts.join(',') + ')';
 }
 
 if (metricPaths.length) {
@@ -293,30 +293,15 @@ App.WidgetMixin = Ember.Mixin.create({
* @param data
*/
   getMetricsSuccessCallback: function (data) {
-var metrics = [];
 var atLeastOneMetricPresent = false;
 
 if (this.get('content.metrics')) {
   this.get('content.metrics').forEach(function (_metric) {
-var metric_path = _metric.metric_path;
-var isAggregatorFunc = false;
-var metric_data = Em.get(data, metric_path.replace(/\//g, '.'));
+var metricPath = _metric.metric_path;
+
+var metric_data = Em.get(data, metricPath.replace(/\//g, '.'));
 if (Em.isNone(metric_data)) {
-  this.aggregatorFunc.forEach(function (_item) {
-if (metric_path.endsWith(_item) && !isAggregatorFunc) {
-  isAggregatorFunc = true;
-  var metricBeanProperty = metric_path.split("/").pop();
-  var metricBean;
-  metric_path = metric_path.substring(0, 
metric_path.indexOf(metricBeanProperty));
-  if (metric_path.endsWith("/")) {
-metric_path = metric_path.slice(0, -1);
-  }
-  metricBean = Em.get(data, metric_path.replace(/\//g, '.'));
-  if (!Em.isNone(metricBean)) {
-metric_data = metricBean[metricBeanProperty];
-  }
-}
-  }, this);
+  metric_data = this.parseMetricsWithAggregatorFunc(data, metricPath);
 }
 if (!Em.isNone(metric_data)) {
   atLeastOneMetricPresent = true;
@@ -330,6 +315,28 @@ App.WidgetMixin = Ember.Mixin.create({
   }
 }
   },
+  
+  parseMetricsWithAggregatorFunc: function(data, metric_path) {
+let isAggregatorFunc = false;
+let metric = null;
+this.aggregatorFunc.forEach(function (_item) {
+  if (metric_path.endsWith(_item) && !isAggregatorFunc) {
+isAggregatorFunc = true;
+var metricBeanProperty = metric_path.split("/").pop();
+var metricBean;
+metric_path = metric_path.substring(0, 
metric_path.indexOf(metricBeanProperty));
+
+if (metric_path.endsWith("/")) {
+  metric_path = metric_path.slice(0, -1);
+}
+metricBean = Em.get(data, metric_path.replace(/\//g, '.'));
+if (!Em.isNone(metricBean)) {
+  metric = metricBean[metricBeanProperty];
+}
+  }
+}, this);
+return metric;
+  },
 
   /**
* if no metrics were received from server then disable graph
@@ -377,8 +384,8 @@ App.WidgetMixin = Ember.Mixin.create({
* @return {$.ajax}
*/
   getHostComponentsMetrics: function (request) {
-request.metric_paths.forEach(function (_metric, index) {
-  request.metric_paths[index] = "host_components/" + _metric.metric_path;
+request.metric_paths  = request.metric_paths.map((_metric) => {
+  return "host_components/" + _metric.metric_path;
 });
 return App.ajax.send({
   name: 'widgets.serviceComponent.metrics.get',
@@ -422,7 +429,7 @@ App.WidgetMixin = Ember.Mixin.create({
   getHostsMetricsSuccessCallback: function (data) {
 var metrics = this.get('content.metrics');
 data.items.forEach(function (item) {
-  metrics.forEach(function (_metric, index) {
+  metrics.forEach(function (_metric) {
 const metric = $.extend({}, _metric, true);
 metric.hostName = item.Hosts.host_name;
 if (!Em.isNone(Em.get(item, _metric.metric_path.replace(/\//g, '.' 
{
@@ -574,7 +581,7 @@ App.WidgetMixin = Ember.Mixin.create({
   /*
* make call when clicking