You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/11/04 13:26:46 UTC

[01/11] ambari git commit: AMBARI-18786. HDP Upgrade fails when the cluster size is large (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-18634 f9814d2bf -> 1f4221cf7


AMBARI-18786. HDP Upgrade fails when the cluster size is large (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba5cbf42
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba5cbf42
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba5cbf42

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: ba5cbf428194733b93ff122dbe4b66706f75e676
Parents: 43a181a
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Nov 3 17:32:17 2016 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Nov 3 17:32:52 2016 +0200

----------------------------------------------------------------------
 .../HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py                | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ba5cbf42/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
index db52ee1..b7735f4 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_namenode.py
@@ -510,7 +510,7 @@ def is_namenode_bootstrapped(params):
   return marked
 
 
-@retry(times=5, sleep_time=5, backoff_factor=2, err_class=Fail)
+@retry(times=125, sleep_time=5, backoff_factor=2, err_class=Fail)
 def is_this_namenode_active():
   """
   Gets whether the current NameNode is Active. This function will wait until the NameNode is


[03/11] ambari git commit: AMBARI-18788 Checkboxes for installed services aren't disabled in Add Service Wizard. (ababiichuk)

Posted by nc...@apache.org.
AMBARI-18788 Checkboxes for installed services aren't disabled in Add Service Wizard. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/35cb3968
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/35cb3968
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/35cb3968

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 35cb39682551f05d100fdf4975a61eaf5cc58340
Parents: 2ebc6ed
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Nov 3 17:52:34 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Nov 3 18:50:03 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/mappers/stack_service_mapper.js | 6 +++---
 ambari-web/app/models/stack_service.js         | 4 +++-
 ambari-web/test/models/stack_service_test.js   | 2 ++
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/35cb3968/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index fa8f3f3..888dcdf 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -33,7 +33,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     stack_name: 'stack_name',
     stack_version: 'stack_version',
     selection: 'selection',
-    is_disabled: 'is_disabled',
+    is_mandatory: 'is_mandatory',
     is_selected: 'is_selected',
     is_installed: 'is_installed',
     is_installable: 'is_installable',
@@ -120,8 +120,8 @@ App.stackServiceMapper = App.QuickDataMapper.create({
       if (stackService.selection === "TECH_PREVIEW") {
         stackService.is_selected = false;
       }
-      if(stackService.selection === "MANDATORY" || stackService.is_installed) {
-        stackService.is_disabled = true;
+      if(stackService.selection === "MANDATORY") {
+        stackService.is_mandatory = true;
       }
       result.push(this.parseIt(stackService, this.get('config')));
     }, this);

http://git-wip-us.apache.org/repos/asf/ambari/blob/35cb3968/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 756c177..0136ec3 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -36,7 +36,7 @@ App.StackService = DS.Model.extend({
   stackName: DS.attr('string'),
   stackVersion: DS.attr('string'),
   selection: DS.attr('string'),
-  isDisabled: DS.attr('boolean', {defaultValue: false}),
+  isMandatory: DS.attr('boolean', {defaultValue: false}),
   isSelected: DS.attr('boolean', {defaultValue: true}),
   isInstalled: DS.attr('boolean', {defaultValue: false}),
   isInstallable: DS.attr('boolean', {defaultValue: true}),
@@ -46,6 +46,8 @@ App.StackService = DS.Model.extend({
   configs: DS.attr('array'),
   requiredServices: DS.attr('array', {defaultValue: []}),
 
+  isDisabled: Em.computed.or('isMandatory', 'isInstalled'),
+
   /**
    * @type {String[]}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/35cb3968/ambari-web/test/models/stack_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_service_test.js b/ambari-web/test/models/stack_service_test.js
index 0d3fdf6..9f12e88 100644
--- a/ambari-web/test/models/stack_service_test.js
+++ b/ambari-web/test/models/stack_service_test.js
@@ -283,5 +283,7 @@ describe('App.StackService', function () {
     });
   });
 
+  App.TestAliases.testAsComputedOr(ss, 'isDisabled', ['isMandatory', 'isInstalled']);
+
 
 });


[08/11] ambari git commit: AMBARI-18790. Implement lazy loading for Service configs Advanced tab (akovalenko)

Posted by nc...@apache.org.
AMBARI-18790. Implement lazy loading for Service configs Advanced tab (akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0c165e33
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0c165e33
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0c165e33

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 0c165e3368a9be1a4b023b129632bf4ba2b2b90e
Parents: 9881409
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Nov 3 19:31:20 2016 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Nov 4 01:13:09 2016 +0200

----------------------------------------------------------------------
 .../templates/common/configs/service_config.hbs | 16 +----
 ambari-web/app/views.js                         |  1 +
 .../configs/config_category_container_view.js   | 64 ++++++++++++++++++++
 .../configs/service_configs_by_category_view.js | 42 ++++++-------
 .../notification_configs_view_test.js           |  6 +-
 5 files changed, 92 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c165e33/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index ed70f8c..d25515a 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -134,13 +134,7 @@
         <div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}>
           {{#if tab.isAdvanced}}
             {{#if tab.isRendered}}
-              {{#each category in selectedService.configCategories}}
-                {{#if category.isCustomView}}
-                  {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
-                {{else}}
-                  {{view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
-                {{/if}}
-              {{/each}}
+              {{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
             {{else}}
               {{view App.SpinnerView}}
             {{/if}}
@@ -152,13 +146,7 @@
       {{/each}}
     </div>
   {{else}}
-    {{#each category in selectedService.configCategories}}
-      {{#if category.isCustomView}}
-        {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
-      {{else}}
-        {{view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
-      {{/if}}
-    {{/each}}
+    {{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
   {{/if}}
   {{#if view.isAllConfigsHidden}}
     <div class="alert alert-info col-sm-12">

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c165e33/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d713db1..a04dcc4 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -65,6 +65,7 @@ require('views/common/configs/service_config_container_view');
 require('views/common/configs/service_configs_by_category_view');
 require('views/common/configs/service_config_view');
 require('views/common/configs/service_config_tab_view');
+require('views/common/configs/config_category_container_view');
 require('views/common/configs/overriddenPropertyRow_view');
 require('views/common/configs/overriddenProperty_view');
 require('views/common/configs/compare_property_view');

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c165e33/ambari-web/app/views/common/configs/config_category_container_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_category_container_view.js b/ambari-web/app/views/common/configs/config_category_container_view.js
new file mode 100644
index 0000000..08cdb2c
--- /dev/null
+++ b/ambari-web/app/views/common/configs/config_category_container_view.js
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+var lazyLoading = require('utils/lazy_loading');
+
+App.ConfigCategoryContainerView = Em.ContainerView.extend({
+
+  lazyLoading: null,
+
+  categories: [],
+
+  didInsertElement: function () {
+    this.pushViews();
+    this._super();
+  },
+
+  willDestroyElement: function () {
+    if (this.get('lazyLoading')) {
+      lazyLoading.terminate(this.get('lazyLoading'))
+    }
+    this._super();
+  },
+
+  pushViews: function () {
+    var self = this;
+    var categoriesViews = [];
+    this.get('categories').forEach(function (category) {
+      var viewClass = category.isCustomView ? category.customView : App.ServiceConfigsByCategoryView;
+      categoriesViews.push(viewClass.create({
+        category: category,
+        canEdit: self.get("canEdit"),
+        service: self.get("service"),
+        serviceConfigs: self.get("serviceConfigs"),
+        supportsHostOverrides: self.get("supportsHostOverrides")
+      }));
+    });
+    this.set('lazyLoading', lazyLoading.run({
+      destination: self.get('childViews'),
+      source: categoriesViews,
+      initSize: 3,
+      chunkSize: 3,
+      delay: 200,
+      context: this
+    }));
+  }
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c165e33/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 3a898e2..baf7852 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -68,24 +68,24 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
     var self = this;
     // If `this.categoryConfigsAll` is a computed property then don't set it.
     // some extended class like `App.NotificationsConfigsView` overrides `categoryConfigsAll` as computed property
-    if ($.isArray(this.categoryConfigsAll)) {
-      this.setCategoryConfigsAll();
-    }
-    this.setVisibleCategoryConfigs();
-    var isCollapsed = this.calcIsCollapsed();
-    this.set('category.isCollapsed', isCollapsed);
-    if (isCollapsed) {
-      this.$('.accordion-body').hide();
-    }
-    else {
-      this.$('.accordion-body').show();
-    }
-    $('#serviceConfig').tooltip({
-      selector: '[data-toggle=tooltip]',
-      placement: 'top'
-    });
-    this.filteredCategoryConfigs();
     Em.run.next(function () {
+      if ($.isArray(self.categoryConfigsAll)) {
+        self.setCategoryConfigsAll();
+      }
+      self.setVisibleCategoryConfigs();
+      var isCollapsed = self.calcIsCollapsed();
+      self.set('category.isCollapsed', isCollapsed);
+      if (isCollapsed) {
+        self.$('.accordion-body').hide();
+      }
+      else {
+        self.$('.accordion-body').show();
+      }
+      $('#serviceConfig').tooltip({
+        selector: '[data-toggle=tooltip]',
+        placement: 'top'
+      });
+      self.filteredCategoryConfigs();
       self.updateReadOnlyFlags();
     });
   },
@@ -171,9 +171,9 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
     var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
         return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget'));
       }, this).length > 0;
-    return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.columns').someProperty('selected')) ||
+    return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('parentView.parentView.columns').someProperty('selected')) ||
       hasFilteredAdvancedConfigs;
-  }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.columns.@each.selected'),
+  }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'parentView.parentView.columns.@each.selected'),
 
   /**
    * Re-order the configs to list content displayType properties at last in the category
@@ -317,7 +317,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
   collapseCategory: function () {
     if (this.get('state') === 'destroyed') return;
     $('.popover').remove();
-    var filter = this.get('parentView.filter').toLowerCase();
+    var filter = this.get('parentView.parentView.filter').toLowerCase();
     var filteredResult = this.get('categoryConfigs');
     var isInitialRendering = !arguments.length || arguments[1] != 'categoryConfigs';
 
@@ -640,7 +640,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
           var controller = (App.router.get('currentState.name') == 'configs')
               ? App.router.get('mainServiceInfoConfigsController')
               : App.router.get('wizardStep7Controller');
-          this.get('parentView').onClose();
+          this.get('parentView.parentView').onClose();
           controller.set('filter', event.view.get('serviceConfigObj.name'));
         }
       })

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c165e33/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
index b970c89..681d346 100644
--- a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
+++ b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -32,8 +32,10 @@ function getView() {
     categoryConfigs: [],
     categoryConfigsAll: [],
     parentView: Em.View.create({
-      filter: '',
-      columns: []
+      parentView: Em.View.create({
+        filter: '',
+        columns: []
+      })
     })
   });
 }


[06/11] ambari git commit: AMBARI-18774: Install Package for non-HDP stack fails with non-VDF repo version (jluniya)

Posted by nc...@apache.org.
AMBARI-18774: Install Package for non-HDP stack fails with non-VDF repo version (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2da6fa78
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2da6fa78
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2da6fa78

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 2da6fa789f6ac64c4e699469bde1185bb2ab126d
Parents: 574fd64
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Nov 3 13:17:44 2016 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Thu Nov 3 13:17:44 2016 -0700

----------------------------------------------------------------------
 .../orm/entities/RepositoryVersionEntity.java   | 39 +++++++-------------
 .../org/apache/ambari/server/state/StackId.java |  4 --
 ...leRepositoryVersionResourceProviderTest.java |  4 ++
 .../RepositoryVersionResourceProviderTest.java  | 14 +++++++
 .../orm/dao/RepositoryVersionDAOTest.java       | 35 ++++++++++++++++++
 5 files changed, 67 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2da6fa78/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
index 25aa62b..4e6451e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
@@ -80,8 +80,6 @@ import static java.util.Arrays.asList;
 })
 @StaticallyInject
 public class RepositoryVersionEntity {
-
-  private static final List<String> STACK_PREFIXES = asList(StackId.HDP_STACK, StackId.HDPWIN_STACK);
   private static Logger LOG = LoggerFactory.getLogger(RepositoryVersionEntity.class);
 
   @Inject
@@ -158,10 +156,9 @@ public class RepositoryVersionEntity {
   @PreUpdate
   @PrePersist
   public void removePrefixFromVersion() {
-    for (String stackPrefix : STACK_PREFIXES) {
-      if (version.startsWith(stackPrefix + "-")) {
-        version = version.substring(stackPrefix.length() + 1);
-      }
+    String stackName = stack.getStackName();
+    if (version.startsWith(stackName)) {
+      version = version.substring(stackName.length() + 1);
     }
   }
   /**
@@ -394,38 +391,30 @@ public class RepositoryVersionEntity {
 
   /**
    * Determine if the version belongs to the stack.
-   * Right now, this is only applicable for the HDP stack.
    * @param stackId Stack, such as HDP-2.3
    * @param version Version number, such as 2.3.0.0, or 2.3.0.0-1234
    * @return Return true if the version starts with the digits of the stack.
    */
   public static boolean isVersionInStack(StackId stackId, String version) {
     if (null != version && !StringUtils.isBlank(version)) {
-      for (String stackPrefix : STACK_PREFIXES) {
-        if (version.startsWith(stackPrefix + "-")) {
-          version = version.substring(stackPrefix.length() + 1);
-        }
+      String stackName = stackId.getStackName();
+      if (version.startsWith(stackName + "-")) {
+        version = version.substring(stackName.length() + 1);
       }
-      // HDP Stack
-      if (stackId.getStackName().equalsIgnoreCase(StackId.HDP_STACK) ||
-          stackId.getStackName().equalsIgnoreCase(StackId.HDPWIN_STACK)) {
-
-        String leading = stackId.getStackVersion();  // E.g, 2.3
-        // In some cases during unit tests, the leading can contain 3 digits, so only the major number (first two parts) are needed.
-        String[] leadingParts = leading.split("\\.");
-        if (null != leadingParts && leadingParts.length > 2) {
-          leading = leadingParts[0] + "." + leadingParts[1];
-        }
-        return version.startsWith(leading);
+
+      String leading = stackId.getStackVersion();  // E.g, 2.3
+      // In some cases during unit tests, the leading can contain 3 digits, so only the major number (first two parts) are needed.
+      String[] leadingParts = leading.split("\\.");
+      if (null != leadingParts && leadingParts.length > 2) {
+        leading = leadingParts[0] + "." + leadingParts[1];
       }
-      // For other stacks, don't make the check.
-      return true;
+      return version.startsWith(leading);
     }
     return false;
   }
 
   /**
-   * @param parent
+   * @param entity parent entity
    */
   public void setParent(RepositoryVersionEntity entity) {
     parent = entity;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2da6fa78/ambari-server/src/main/java/org/apache/ambari/server/state/StackId.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackId.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackId.java
index 367775a..f5a440d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackId.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackId.java
@@ -25,10 +25,6 @@ public class StackId implements Comparable<StackId> {
 
   private static final String NAME_SEPARATOR = "-";
 
-  public static final String HDP_STACK = "HDP";
-  public static final String HDPWIN_STACK = "HDPWIN";
-  public static final String BIGTOP_STACK = "BIGTOP";
-
   private String stackName;
   private String stackVersion;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2da6fa78/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java
index 78f0a48..dffc4f7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProviderTest.java
@@ -250,9 +250,13 @@ public class CompatibleRepositoryVersionResourceProviderTest {
   public void testVersionInStack() {
     assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDP", "2.3"), "2.3.0.0"));
     assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDPWIN", "2.3"), "2.3.0.0"));
+    assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDP", "2.3.GlusterFS"), "2.3.0.0"));
+    assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDF", "2.1"), "2.1.0.0"));
 
     assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDP", "2.3"), "HDP-2.3.0.0"));
     assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDPWIN", "2.3"), "HDPWIN-2.3.0.0"));
+    assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDP", "2.3.GlusterFS"), "HDP-2.3.0.0"));
+    assertTrue(RepositoryVersionEntity.isVersionInStack(new StackId("HDF", "2.1"), "HDF-2.1.0.0"));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/2da6fa78/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
index a43a1dc..b8d450b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProviderTest.java
@@ -609,17 +609,31 @@ public class RepositoryVersionResourceProviderTest {
   public void testVersionInStack(){
     StackId sid = new StackId("HDP-2.3");
     StackId sid2 = new StackId("HDP-2.3.NEW");
+    StackId sid3 = new StackId("HDF-2.3");
+
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid, "2.3"));
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid2, "2.3"));
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid3, "2.3"));
 
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid, "2.3.1"));
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid2, "2.3.1"));
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid3, "2.3.1"));
 
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid, "2.3.2.0-2300"));
     Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid2, "2.3.2.1-3562"));
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid3, "2.3.2.1-3562"));
+
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid, "HDP-2.3.2.0-2300"));
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid2, "HDP-2.3.2.1-3562"));
+    Assert.assertEquals(true, RepositoryVersionEntity.isVersionInStack(sid3, "HDF-2.3.2.1-3562"));
 
     Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid, "2.4.2.0-2300"));
     Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid2, "2.1"));
+    Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid3, "2.1"));
+
+    Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid, "HDP-2.4.2.0-2300"));
+    Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid2, "HDP-2.1"));
+    Assert.assertEquals(false, RepositoryVersionEntity.isVersionInStack(sid3, "HDF-2.1"));
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2da6fa78/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RepositoryVersionDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RepositoryVersionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RepositoryVersionDAOTest.java
index 1267f96..6f6f05b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RepositoryVersionDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RepositoryVersionDAOTest.java
@@ -48,6 +48,7 @@ public class RepositoryVersionDAOTest {
   private static Injector injector;
 
   private static final StackId HDP_206 = new StackId("HDP", "2.0.6");
+  private static final StackId OTHER_10 = new StackId("OTHER", "1.0");
   private static final StackId BAD_STACK = new StackId("BADSTACK", "1.0");
 
   private RepositoryVersionDAO repositoryVersionDAO;
@@ -198,6 +199,40 @@ public class RepositoryVersionDAOTest {
 
   }
 
+  @Test
+  public void testRemovePrefixFromVersion() {
+
+    StackEntity hdp206StackEntity = stackDAO.find(HDP_206.getStackName(),
+        HDP_206.getStackVersion());
+    Assert.assertNotNull(hdp206StackEntity);
+
+    final RepositoryVersionEntity hdp206RepoEntity = new RepositoryVersionEntity();
+    hdp206RepoEntity.setDisplayName("HDP-2.0.6.0-1234");
+    hdp206RepoEntity.setOperatingSystems("repositories");
+    hdp206RepoEntity.setStack(hdp206StackEntity);
+    hdp206RepoEntity.setVersion("HDP-2.0.6.0-1234");
+    repositoryVersionDAO.create(hdp206RepoEntity);
+    Assert.assertEquals("Failed to remove HDP stack prefix from version", "2.0.6.0-1234", hdp206RepoEntity.getVersion());
+    Assert.assertNotNull(repositoryVersionDAO.findByDisplayName("HDP-2.0.6.0-1234"));
+    Assert.assertNotNull(repositoryVersionDAO.findByStackAndVersion(HDP_206,
+        "2.0.6.0-1234"));
+
+    StackEntity other10StackEntity = stackDAO.find(OTHER_10.getStackName(),
+        OTHER_10.getStackVersion());
+    Assert.assertNotNull(other10StackEntity);
+
+    final RepositoryVersionEntity other10RepoEntity = new RepositoryVersionEntity();
+    other10RepoEntity.setDisplayName("OTHER-1.0.1.0-1234");
+    other10RepoEntity.setOperatingSystems("repositories");
+    other10RepoEntity.setStack(other10StackEntity);
+    other10RepoEntity.setVersion("OTHER-1.0.1.0-1234");
+    repositoryVersionDAO.create(other10RepoEntity);
+    Assert.assertEquals("Failed to remove OTHER stack prefix from version", "1.0.1.0-1234", other10RepoEntity.getVersion());
+    Assert.assertNotNull(repositoryVersionDAO.findByDisplayName("OTHER-1.0.1.0-1234"));
+    Assert.assertNotNull(repositoryVersionDAO.findByStackAndVersion(OTHER_10,
+        "1.0.1.0-1234"));
+  }
+
   @After
   public void after() {
     injector.getInstance(PersistService.class).stop();


[02/11] ambari git commit: AMBARI-18765 - Services with invalid themes hang the UI when you attempt to add them

Posted by nc...@apache.org.
AMBARI-18765 - Services with invalid themes hang the UI when you attempt to add them


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2ebc6ed9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ebc6ed9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ebc6ed9

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 2ebc6ed957c468ef5b2e966094ad41b09ceb1fc5
Parents: ba5cbf4
Author: Tim Thorpe <tt...@apache.org>
Authored: Thu Nov 3 09:40:42 2016 -0700
Committer: Tim Thorpe <tt...@apache.org>
Committed: Thu Nov 3 09:40:42 2016 -0700

----------------------------------------------------------------------
 .../apache/ambari/server/stack/ServiceModule.java    | 15 ++++++++++++---
 .../server/stack/StackManagerExtensionTest.java      |  9 +++++++++
 .../extensions/EXT/0.1/services/OOZIE2/metainfo.xml  |  8 ++++++++
 .../0.1/services/OOZIE2/themes/working_theme.json    |  5 +++++
 .../extensions/EXT/0.2/services/OOZIE2/metainfo.xml  |  8 ++++++++
 .../EXT/0.2/services/OOZIE2/themes/broken_theme.json |  3 +++
 6 files changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index 826abbc..b6a0da5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory;
 import javax.annotation.Nullable;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -421,14 +422,22 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
     String themesDir = serviceDirectory.getAbsolutePath() + File.separator + serviceInfo.getThemesDir();
 
     if (serviceInfo.getThemes() != null) {
+      List<ThemeInfo> themes = new ArrayList<ThemeInfo>(serviceInfo.getThemes().size());
       for (ThemeInfo themeInfo : serviceInfo.getThemes()) {
         File themeFile = new File(themesDir + File.separator + themeInfo.getFileName());
         ThemeModule module = new ThemeModule(themeFile, themeInfo);
-        themeModules.put(module.getId(), module);
+        if (module.isValid()) {
+          themeModules.put(module.getId(), module);
+          themes.add(themeInfo);
+        }
+        else {
+          //lets not fail if theme contain errors
+          LOG.error("Invalid theme {} for service {}", themeInfo.getFileName(), serviceInfo.getName());
+        }
       }
+      //filter out the invalid themes
+      serviceInfo.setThemes(themes);
     }
-
-    //lets not fail if theme contain errors
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
index 044f2c4..0676568 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
@@ -45,6 +45,7 @@ import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.ExtensionInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.StackInfo;
+import org.apache.ambari.server.state.ThemeInfo;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.EasyMock;
 import org.junit.Test;
@@ -109,6 +110,11 @@ public class StackManagerExtensionTest  {
     File checks = oozie.getChecksFolder();
     assertNotNull(checks);
     assertTrue("Checks dir is " + checks.getPath(), checks.getPath().contains("extensions/EXT/0.1/services/OOZIE2/checks"));
+    List<ThemeInfo> themes = oozie.getThemes();
+    assertNotNull(themes);
+    assertTrue("Number of themes is " + themes.size(), themes.size() == 1);
+    ThemeInfo theme = themes.get(0);
+    assertTrue("Theme: " + theme.getFileName(), theme.getFileName().contains("working_theme.json"));
 
     extension = stackManager.getExtension("EXT", "0.2");
     assertNotNull("EXT 0.2's parent: " + extension.getParentExtensionVersion(), extension.getParentExtensionVersion());
@@ -121,6 +127,9 @@ public class StackManagerExtensionTest  {
     checks = oozie.getChecksFolder();
     assertNotNull(checks);
     assertTrue("Checks dir is " + checks.getPath(), checks.getPath().contains("extensions/EXT/0.1/services/OOZIE2/checks"));
+    themes = oozie.getThemes();
+    assertNotNull(themes);
+    assertTrue("Number of themes is " + themes.size(), themes.size() == 0);
 
     StackInfo stack = stackManager.getStack("HDP", "0.2");
     assertNotNull(stack.getService("OOZIE2"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/metainfo.xml b/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/metainfo.xml
index ab67178..5e94b60 100644
--- a/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/metainfo.xml
+++ b/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/metainfo.xml
@@ -105,6 +105,14 @@
         <config-type>global</config-type>
         <config-type>oozie2-site</config-type>
       </configuration-dependencies>
+
+      <themes>
+        <theme>
+          <fileName>working_theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/themes/working_theme.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/themes/working_theme.json b/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/themes/working_theme.json
new file mode 100644
index 0000000..fe267ee
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.1/services/OOZIE2/themes/working_theme.json
@@ -0,0 +1,5 @@
+{
+  "name": "default",
+  "description": "Default theme for OOZIE2 service",
+  "configuration": {}
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/metainfo.xml b/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/metainfo.xml
index 9ae4f4b..9176551 100644
--- a/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/metainfo.xml
+++ b/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/metainfo.xml
@@ -105,6 +105,14 @@
         <config-type>global</config-type>
         <config-type>oozie2-site</config-type>
       </configuration-dependencies>
+
+      <themes>
+        <theme>
+          <fileName>broken_theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ebc6ed9/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/themes/broken_theme.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/themes/broken_theme.json b/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/themes/broken_theme.json
new file mode 100644
index 0000000..6e8b5bf
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.2/services/OOZIE2/themes/broken_theme.json
@@ -0,0 +1,3 @@
+{
+  "configuration": {
+}


[04/11] ambari git commit: AMBARI-18789 - Change the Wording of the HiveServer2 Non-Rolling Warning (jonathanhurley)

Posted by nc...@apache.org.
AMBARI-18789 - Change the Wording of the HiveServer2 Non-Rolling Warning (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7394cef4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7394cef4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7394cef4

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 7394cef4bf0b949758d06470cefbf581a914967c
Parents: 35cb396
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Nov 3 13:14:30 2016 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 3 13:14:30 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/checks/CheckDescription.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7394cef4/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index b5cb6ce..a56b08d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -292,10 +292,10 @@ public class CheckDescription {
 
   public static CheckDescription SERVICES_HIVE_ROLLING_WARNING = new CheckDescription("SERVICES_HIVE_ROLLING_WARNING",
     PrereqCheckType.SERVICE,
-    "Hive Server Downtime",
+    "HiveServer2 Downtime",
     new ImmutableMap.Builder<String, String>()
       .put(AbstractCheckDescriptor.DEFAULT,
-          "Hive does not currently support rolling upgrades. Hive will be upgraded, however existing queries which have been submitted will fail and need to be resubmitted after Hive has been upgraded.").build());
+          "HiveServer2 does not currently support rolling upgrades. HiveServer2 will be upgraded, however existing queries which have not completed will fail and need to be resubmitted after HiveServer2 has been upgraded.").build());
   
   public static CheckDescription SERVICES_STORM_ROLLING_WARNING = new CheckDescription("SERVICES_STORM_ROLLING_WARNING",
     PrereqCheckType.SERVICE,


[07/11] ambari git commit: AMBARI-18778: Ambari-server: Blueprint enhancements to support enabling or disabling credential store

Posted by nc...@apache.org.
AMBARI-18778: Ambari-server: Blueprint enhancements to support enabling or disabling credential store


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/98814097
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/98814097
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/98814097

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 988140979d64b9a1d38fc266ca58e509b4cbcfa1
Parents: 2da6fa7
Author: Nahappan Somasundaram <ns...@hortonworks.com>
Authored: Wed Nov 2 16:35:42 2016 -0700
Committer: Nahappan Somasundaram <ns...@hortonworks.com>
Committed: Thu Nov 3 15:37:36 2016 -0700

----------------------------------------------------------------------
 .../ambari/server/topology/AmbariContext.java   |  3 +-
 .../ambari/server/topology/Blueprint.java       |  9 ++++
 .../ambari/server/topology/BlueprintImpl.java   | 49 ++++++++++++++++++++
 .../apache/ambari/server/topology/Setting.java  | 21 +++++++++
 .../server/topology/AmbariContextTest.java      |  1 +
 5 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/98814097/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
index b11d9d3..83f8470 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
@@ -199,7 +199,8 @@ public class AmbariContext {
     Set<ServiceRequest> serviceRequests = new HashSet<ServiceRequest>();
     Set<ServiceComponentRequest> componentRequests = new HashSet<ServiceComponentRequest>();
     for (String service : services) {
-      serviceRequests.add(new ServiceRequest(clusterName, service, null));
+      String credentialStoreEnabled = topology.getBlueprint().getCredentialStoreEnabled(service);
+      serviceRequests.add(new ServiceRequest(clusterName, service, null, credentialStoreEnabled));
       for (String component : topology.getBlueprint().getComponents(service)) {
         String recoveryEnabled = topology.getBlueprint().getRecoveryEnabled(service, component);
         componentRequests.add(new ServiceComponentRequest(clusterName, service, component, null, recoveryEnabled));

http://git-wip-us.apache.org/repos/asf/ambari/blob/98814097/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
index 8061f37..a82f02a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
@@ -97,6 +97,15 @@ public interface Blueprint {
   public String getRecoveryEnabled(String serviceName, String componentName);
 
   /**
+   * Get whether a service is enabled for credential store use.
+   *
+   * @param serviceName - Service name.
+   *
+   * @return null if value is not specified; true or false if specified.
+   */
+  public String getCredentialStoreEnabled(String serviceName);
+
+  /**
    * Check if auto skip failure is enabled.
    * @return true if enabled, otherwise false.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/98814097/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
index df0187e..3ea90b4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
@@ -208,6 +208,55 @@ public class BlueprintImpl implements Blueprint {
     return null;
   }
 
+  /**
+   * Get whether the specified service is enabled for credential store use.
+   *
+   * <pre>
+   *     {@code
+   *       {
+   *         "service_settings" : [
+   *         { "name" : "RANGER",
+   *           "recovery_enabled" : "true",
+   *           "credential_store_enabled" : "true"
+   *         },
+   *         { "name" : "HIVE",
+   *           "recovery_enabled" : "true",
+   *           "credential_store_enabled" : "false"
+   *         },
+   *         { "name" : "TEZ",
+   *           "recovery_enabled" : "false"
+   *         }
+   *       ]
+   *     }
+   *   }
+   * </pre>
+   *
+   * @param serviceName - Service name.
+   *
+   * @return null if value is not specified; true or false if specified.
+   */
+  @Override
+  public String getCredentialStoreEnabled(String serviceName) {
+    if (setting == null)
+      return null;
+
+    /**
+     * Look up the service and return the credential_store_enabled value.
+     */
+    Set<HashMap<String, String>> settingValue = setting.getSettingValue(Setting.SETTING_NAME_SERVICE_SETTINGS);
+    for (Map<String, String> setting : settingValue) {
+      String name = setting.get(Setting.SETTING_NAME_NAME);
+      if (StringUtils.equals(name, serviceName)) {
+        if (!StringUtils.isEmpty(setting.get(Setting.SETTING_NAME_CREDENTIAL_STORE_ENABLED))) {
+          return setting.get(Setting.SETTING_NAME_CREDENTIAL_STORE_ENABLED);
+        }
+        break;
+      }
+    }
+
+    return null;
+  }
+
   @Override
   public boolean shouldSkipFailure() {
     if (setting == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/98814097/ambari-server/src/main/java/org/apache/ambari/server/topology/Setting.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Setting.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Setting.java
index 601cbfd..6a14331 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Setting.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Setting.java
@@ -45,6 +45,27 @@ public class Setting {
   public static final String SETTING_NAME_NAME = "name";
 
   /**
+   * When specified under the "service_settings" section, it indicates whether credential store
+   * use is enabled for that service. Value is "true" or "false". Specify a value of "true"
+   * only if the stack definition for the service has a credential_store_supported value of "true".
+   * If credential_store_enabled is not specified, value will be taken as null and default value
+   * will be picked up from the stack definition, if available.
+   *   <pre>
+   *     {@code
+   *       {
+   *         "service_settings" : [
+   *           { "name" : "RANGER",
+   *             "recovery_enabled" : "true",
+   *             "credential_store_enabled" : "true"
+   *           },
+   *           :
+   *       }
+   *     }
+   *   </pre>
+   */
+  public static final String SETTING_NAME_CREDENTIAL_STORE_ENABLED = "credential_store_enabled";
+
+  /**
    * Settings.
    *
    * @param properties  setting name-->Set(property name-->property value)

http://git-wip-us.apache.org/repos/asf/ambari/blob/98814097/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
index 6ef240d..ee64ac9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
@@ -185,6 +185,7 @@ public class AmbariContextTest {
     expect(blueprint.getComponents("service1")).andReturn(Arrays.asList("s1Component1", "s1Component2")).anyTimes();
     expect(blueprint.getComponents("service2")).andReturn(Collections.singleton("s2Component1")).anyTimes();
     expect(blueprint.getConfiguration()).andReturn(bpConfiguration).anyTimes();
+    expect(blueprint.getCredentialStoreEnabled("service1")).andReturn("true").anyTimes();
 
     expect(stack.getName()).andReturn(STACK_NAME).anyTimes();
     expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes();


[10/11] ambari git commit: AMBARI-18769. Proxy user fixes for Hive view 2.0. (Ashwin Rajeev via dipayanb)

Posted by nc...@apache.org.
AMBARI-18769. Proxy user fixes for Hive view 2.0. (Ashwin Rajeev via dipayanb)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0bdaff80
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0bdaff80
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0bdaff80

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 0bdaff8022f368a9f993142db84ee932767ae23f
Parents: d348b65
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Nov 4 17:25:11 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Nov 4 17:25:47 2016 +0530

----------------------------------------------------------------------
 .../apache/ambari/view/hive2/AuthParams.java    | 102 +++++++++++++++++++
 .../ambari/view/hive2/actor/JdbcConnector.java  |  30 +++++-
 .../view/hive2/actor/message/Connect.java       |   5 +-
 .../hive2/internal/HiveConnectionWrapper.java   |  43 ++++++--
 .../resources/browser/ConnectionService.java    |   4 +-
 .../view/hive2/ConnectionFailuresTest.java      |   9 +-
 .../ambari/view/hive2/JobExecutionTest.java     |   6 +-
 7 files changed, 179 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/AuthParams.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/AuthParams.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/AuthParams.java
new file mode 100644
index 0000000..53077e3
--- /dev/null
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/AuthParams.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.view.hive2;
+
+import org.apache.ambari.view.ViewContext;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.hadoop.security.UserGroupInformation;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Holds session parameters pulled from the
+ * view context
+ */
+public class AuthParams {
+  private static final String HIVE_SESSION_PARAMS = "hive.session.params";
+  private Map<String, String> sessionParams = new HashMap<>();
+  private final ViewContext context;
+
+  public AuthParams(ViewContext context) {
+    sessionParams = parseSessionParams(context.getProperties().get(HIVE_SESSION_PARAMS));
+    this.context = context;
+  }
+
+  /**
+   * Returns a map created by parsing the parameters in view context
+   * @param params session parameters as string
+   * @return parsed session parameters
+   */
+  private Map<String, String> parseSessionParams(String params) {
+    Map<String, String> sessions = new HashMap<>();
+    if (StringUtils.isEmpty(params))
+      return sessions;
+    String[] splits = params.split(";");
+    for (String split : splits) {
+      String[] paramSplit = split.trim().split("=");
+      if ("auth".equals(paramSplit[0]) || "proxyuser".equals(paramSplit[0])) {
+        sessions.put(paramSplit[0], paramSplit[1]);
+      }
+    }
+    return Collections.unmodifiableMap(sessions);
+  }
+
+  /**
+   * Gets the proxy user
+   * @return User and group information
+   * @throws IOException
+   */
+  public UserGroupInformation getProxyUser() throws IOException {
+    UserGroupInformation ugi;
+    String proxyuser = null;
+    if(context.getCluster() != null) {
+      proxyuser = context.getCluster().getConfigurationValue("cluster-env","ambari_principal_name");
+    }
+
+    if(StringUtils.isEmpty(proxyuser)) {
+      if (sessionParams.containsKey("proxyuser")) {
+        ugi = UserGroupInformation.createRemoteUser(sessionParams.get("proxyuser"));
+      } else {
+        ugi = UserGroupInformation.getCurrentUser();
+      }
+    } else {
+      ugi = UserGroupInformation.createRemoteUser(proxyuser);
+    }
+    ugi.setAuthenticationMethod(getAuthenticationMethod());
+    return ugi;
+  }
+
+  /**
+   * Get the Authentication method
+   * @return
+   */
+  private UserGroupInformation.AuthenticationMethod getAuthenticationMethod() {
+    UserGroupInformation.AuthenticationMethod authMethod;
+    if (sessionParams.containsKey("auth") && !StringUtils.isEmpty(sessionParams.get("auth"))) {
+      String authName = sessionParams.get("auth");
+      authMethod = UserGroupInformation.AuthenticationMethod.valueOf(authName.toUpperCase());
+    } else {
+      authMethod = UserGroupInformation.AuthenticationMethod.SIMPLE;
+    }
+    return authMethod;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
index fcbef81..d6d5d51 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/JdbcConnector.java
@@ -24,6 +24,7 @@ import akka.actor.PoisonPill;
 import akka.actor.Props;
 import com.google.common.base.Optional;
 import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.hive2.AuthParams;
 import org.apache.ambari.view.hive2.ConnectionDelegate;
 import org.apache.ambari.view.hive2.actor.message.Connect;
 import org.apache.ambari.view.hive2.actor.message.FetchError;
@@ -78,6 +79,8 @@ public class JdbcConnector extends HiveActor {
 
   private final Logger LOG = LoggerFactory.getLogger(getClass());
 
+  public static final String SUFFIX = "validating the login";
+
   /**
    * Interval for maximum inactivity allowed
    */
@@ -116,6 +119,7 @@ public class JdbcConnector extends HiveActor {
   private final ActorRef parent;
   private ActorRef statementExecutor = null;
   private final HdfsApi hdfsApi;
+  private final AuthParams authParams;
 
   /**
    * true if the actor is currently executing any job.
@@ -153,6 +157,8 @@ public class JdbcConnector extends HiveActor {
     this.storage = storage;
     this.lastActivityTimestamp = System.currentTimeMillis();
     resultSetIterator = null;
+
+    authParams = new AuthParams(viewContext);
     actorConfiguration = new HiveActorConfiguration(viewContext);
   }
 
@@ -383,10 +389,30 @@ public class JdbcConnector extends HiveActor {
     this.failure = new Failure("Cannot connect to hive", ex);
     if (isAsync()) {
       updateJobStatus(jobId.get(), Job.JOB_STATE_ERROR);
+
+      if(ex instanceof ConnectionException){
+        ConnectionException connectionException = (ConnectionException) ex;
+        Throwable cause = connectionException.getCause();
+        if(cause instanceof SQLException){
+          SQLException sqlException = (SQLException) cause;
+          if(isLoginError(sqlException))
+            return;
+        }
+      }
+
     } else {
       sender().tell(new ExecutionFailed("Cannot connect to hive"), ActorRef.noSender());
     }
-    cleanUpWithTermination();
+    // Do not clean up in case of failed authorizations
+    // The failure is bubbled to the user for requesting credentials
+
+    if (!(ex instanceof SQLException) || !((SQLException) ex).getSQLState().equals("AUTHFAIL")) {
+      cleanUpWithTermination();
+    }
+  }
+
+  private boolean isLoginError(SQLException ce) {
+    return ce.getCause().getMessage().toLowerCase().endsWith(SUFFIX);
   }
 
   private void keepAlive() {
@@ -410,7 +436,7 @@ public class JdbcConnector extends HiveActor {
     executionType = message.getType();
     // check the connectable
     if (connectable == null) {
-      connectable = message.getConnectable();
+      connectable = message.getConnectable(authParams);
     }
     // make the connectable to Hive
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/message/Connect.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/message/Connect.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/message/Connect.java
index 49ef3df..360125b 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/message/Connect.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/actor/message/Connect.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.view.hive2.actor.message;
 
 import com.google.common.base.Optional;
+import org.apache.ambari.view.hive2.AuthParams;
 import org.apache.ambari.view.hive2.internal.Connectable;
 import org.apache.ambari.view.hive2.internal.HiveConnectionWrapper;
 
@@ -50,8 +51,8 @@ public class Connect {
     this(HiveJob.Type.SYNC, null, username, password, jdbcUrl);
   }
 
-  public Connectable getConnectable(){
-    return new HiveConnectionWrapper(getJdbcUrl(),username,password);
+  public Connectable getConnectable(AuthParams authParams){
+    return new HiveConnectionWrapper(getJdbcUrl(),username,password, authParams);
   }
 
   public String getUsername() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/internal/HiveConnectionWrapper.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/internal/HiveConnectionWrapper.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/internal/HiveConnectionWrapper.java
index 3701016..92a8a2c 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/internal/HiveConnectionWrapper.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/internal/HiveConnectionWrapper.java
@@ -20,8 +20,13 @@ package org.apache.ambari.view.hive2.internal;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Supplier;
+import org.apache.ambari.view.hive2.AuthParams;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hive.jdbc.HiveConnection;
 
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
@@ -31,24 +36,27 @@ import java.sql.SQLException;
  * This class only provides a connection over which
  * callers should run their own JDBC statements
  */
-public class HiveConnectionWrapper implements Connectable,Supplier<HiveConnection> {
+public class HiveConnectionWrapper implements Connectable, Supplier<HiveConnection> {
 
   private static String DRIVER_NAME = "org.apache.hive.jdbc.HiveDriver";
   public static final String SUFFIX = "validating the login";
   private final String jdbcUrl;
   private final String username;
   private final String password;
+  private final AuthParams authParams;
+
+  private UserGroupInformation ugi;
 
   private HiveConnection connection = null;
   private boolean authFailed;
 
-  public HiveConnectionWrapper(String jdbcUrl, String username, String password) {
+  public HiveConnectionWrapper(String jdbcUrl, String username, String password, AuthParams authParams) {
     this.jdbcUrl = jdbcUrl;
     this.username = username;
     this.password = password;
+    this.authParams = authParams;
   }
 
-
   @Override
   public void connect() throws ConnectionException {
     try {
@@ -58,16 +66,33 @@ public class HiveConnectionWrapper implements Connectable,Supplier<HiveConnectio
     }
 
     try {
-      Connection conn = DriverManager.getConnection(jdbcUrl, username, password);
-      connection = (HiveConnection)conn;
+      ugi = UserGroupInformation.createProxyUser(username, authParams.getProxyUser());
+    } catch (IOException e) {
+      throw new ConnectionException(e, "Cannot set kerberos authentication for getting connection.");
+    }
 
-    } catch (SQLException e) {
-      if(isLoginError(e))
-        this.authFailed = true;
+    try {
+      Connection conn = ugi.doAs(new PrivilegedExceptionAction<Connection>() {
+        @Override
+        public Connection run() throws Exception {
+          return DriverManager.getConnection(jdbcUrl, username, password);
+        }
+      });
+      connection = (HiveConnection) conn;
+    } catch (UndeclaredThrowableException exception) {
+      // Check if the reason was an auth error
+      Throwable undeclaredThrowable = exception.getUndeclaredThrowable();
+      if (undeclaredThrowable instanceof SQLException) {
+        SQLException sqlException = (SQLException) undeclaredThrowable;
+        if (isLoginError(sqlException))
+          authFailed = true;
+        throw new ConnectionException(sqlException, "Cannot open a hive connection with connect string " + jdbcUrl);
+      }
+
+    } catch (IOException | InterruptedException e) {
       throw new ConnectionException(e, "Cannot open a hive connection with connect string " + jdbcUrl);
     }
 
-
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/browser/ConnectionService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/browser/ConnectionService.java b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/browser/ConnectionService.java
index eb1609d..cd4d30e 100644
--- a/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/browser/ConnectionService.java
+++ b/contrib/views/hive-next/src/main/java/org/apache/ambari/view/hive2/resources/browser/ConnectionService.java
@@ -19,8 +19,8 @@
 package org.apache.ambari.view.hive2.resources.browser;
 
 import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
 import org.apache.ambari.view.ViewContext;
+import org.apache.ambari.view.hive2.AuthParams;
 import org.apache.ambari.view.hive2.ConnectionFactory;
 import org.apache.ambari.view.hive2.ConnectionSystem;
 import org.apache.ambari.view.hive2.client.ConnectionConfig;
@@ -97,7 +97,7 @@ public class ConnectionService {
 
     private Response attemptHiveConnection(String pass) {
         ConnectionConfig connectionConfig = ConnectionFactory.create(context);
-        HiveConnectionWrapper hiveConnectionWrapper = new HiveConnectionWrapper(connectionConfig.getJdbcUrl(), connectionConfig.getUsername(), pass);
+        HiveConnectionWrapper hiveConnectionWrapper = new HiveConnectionWrapper(connectionConfig.getJdbcUrl(), connectionConfig.getUsername(), pass,new AuthParams(context));
         try {
           hiveConnectionWrapper.connect();
         } catch (ConnectionException e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/ConnectionFailuresTest.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/ConnectionFailuresTest.java b/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/ConnectionFailuresTest.java
index e36c1d4..7cb2dd7 100644
--- a/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/ConnectionFailuresTest.java
+++ b/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/ConnectionFailuresTest.java
@@ -47,6 +47,7 @@ import org.junit.Test;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.HashMap;
 
 import static org.easymock.EasyMock.*;
 
@@ -86,7 +87,8 @@ public class ConnectionFailuresTest {
             Props.create(OperationController.class, actorSystem, deathwatch, viewContext, connectionSupplier, dataStorageSupplier, hdfsApiSupplier), "operationController-test");
     expect(hdfsApiSupplier.get(viewContext)).andReturn(Optional.of(hdfsApi));
     expect(viewContext.getInstanceName()).andReturn("test").anyTimes();
-    expect(connect.getConnectable()).andReturn(connectionWrapper);
+    expect(viewContext.getProperties()).andReturn(new HashMap<String, String>()).anyTimes();
+    expect(connect.getConnectable(anyObject(AuthParams.class))).andReturn(connectionWrapper);
     expect(connectionWrapper.isOpen()).andReturn(false).anyTimes();
     expect(connectionWrapper.getConnection()).andReturn(Optional.<HiveConnection>absent()).anyTimes();
     expect(dataStorageSupplier.get(viewContext)).andReturn(storage);
@@ -127,7 +129,8 @@ public class ConnectionFailuresTest {
     ActorRef operationControl = actorSystem.actorOf(
             Props.create(OperationController.class, actorSystem, deathwatch, viewContext, connectionSupplier, dataStorageSupplier, hdfsApiSupplier), "operationController-test");
     expect(hdfsApiSupplier.get(viewContext)).andReturn(Optional.of(hdfsApi));
-    expect(connect.getConnectable()).andReturn(connectionWrapper);
+    expect(viewContext.getProperties()).andReturn(new HashMap<String, String>()).anyTimes();
+    expect(connect.getConnectable(anyObject(AuthParams.class))).andReturn(connectionWrapper);
     expect(connectionWrapper.isOpen()).andReturn(false);
     expect(connectionWrapper.getConnection()).andReturn(Optional.of(hiveConnection)).anyTimes();
     expect(dataStorageSupplier.get(viewContext)).andReturn(storage);
@@ -141,7 +144,7 @@ public class ConnectionFailuresTest {
     connectionWrapper.connect();
     jobImpl.setStatus(Job.JOB_STATE_ERROR);
     storage.store(JobImpl.class, jobImpl);
-    replay(connect, hdfsApiSupplier, dataStorageSupplier, connectionWrapper,
+    replay(viewContext, connect, hdfsApiSupplier, dataStorageSupplier, connectionWrapper,
             storage, jobImpl, connectionSupplier, delegate, statement, resultSet);
 
     operationControl.tell(executeJob, ActorRef.noSender());

http://git-wip-us.apache.org/repos/asf/ambari/blob/0bdaff80/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/JobExecutionTest.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/JobExecutionTest.java b/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/JobExecutionTest.java
index fc042ce..f8e88a4 100644
--- a/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/JobExecutionTest.java
+++ b/contrib/views/hive-next/src/test/java/org/apache/ambari/view/hive2/JobExecutionTest.java
@@ -47,6 +47,7 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.sql.ResultSet;
+import java.util.HashMap;
 
 import static org.easymock.EasyMock.*;
 
@@ -85,7 +86,8 @@ public class JobExecutionTest {
     ActorRef operationControl = actorSystem.actorOf(
             Props.create(OperationController.class, actorSystem, deathwatch, viewContext, connectionSupplier, dataStorageSupplier, hdfsApiSupplier), "operationController-test");
     expect(hdfsApiSupplier.get(viewContext)).andReturn(Optional.of(hdfsApi));
-    expect(connect.getConnectable()).andReturn(connectionWrapper);
+    expect(viewContext.getProperties()).andReturn(new HashMap<String, String>()).anyTimes();
+    expect(connect.getConnectable(anyObject(AuthParams.class))).andReturn(connectionWrapper);
     expect(connectionWrapper.isOpen()).andReturn(false);
     expect(connectionWrapper.getConnection()).andReturn(Optional.of(hiveConnection)).anyTimes();
     expect(dataStorageSupplier.get(viewContext)).andReturn(storage);
@@ -100,7 +102,7 @@ public class JobExecutionTest {
     connectionWrapper.connect();
     jobImpl.setStatus(Job.JOB_STATE_FINISHED);
     storage.store(JobImpl.class, jobImpl);
-    replay(connect, hdfsApiSupplier, dataStorageSupplier, connectionWrapper,
+    replay(viewContext, connect, hdfsApiSupplier, dataStorageSupplier, connectionWrapper,
             storage, jobImpl, connectionSupplier, delegate, statement, resultSet);
 
     operationControl.tell(executeJob, ActorRef.noSender());


[09/11] ambari git commit: AMBARI-18798. Long rack_id value causes sql-error (onechiporenko)

Posted by nc...@apache.org.
AMBARI-18798. Long rack_id value causes sql-error (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d348b65e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d348b65e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d348b65e

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: d348b65e023d17589767c7a2c45700bf4ad674ed
Parents: 0c165e3
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Nov 4 12:01:28 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Nov 4 12:01:28 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/messages.js                      |  2 +-
 ambari-web/app/styles/application.less          | 12 ++++------
 ambari-web/app/templates/main/host/summary.hbs  |  2 +-
 ambari-web/app/utils/validator.js               |  3 ++-
 .../common/helpers/format_word_break_view.js    |  8 +++----
 ambari-web/test/utils/validator_test.js         | 22 ++++++++++++++++++
 .../helpers/format_word_break_view_test.js      | 24 +++++++++++---------
 7 files changed, 48 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index b0ebddd..fa5e1bb 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -408,7 +408,7 @@ Em.I18n.translations = {
   'hostPopup.reccomendation.beforeDecommission': '{0} Maintenance Mode is pre required for decommissioning.',
   'hostPopup.setRackId.success': 'Updating rack id to \"{0}\". It may take a few moments for it to get refreshed.',
   'hostPopup.setRackId.error': 'Updating the rack id failed.',
-  'hostPopup.setRackId.invalid': 'Should start with a forward slash it may include alphanumeric chars, dots, dashes and forward slashes.',
+  'hostPopup.setRackId.invalid': 'Should start with a forward slash it may include alphanumeric chars, dots, dashes and forward slashes. Should be less than 255 symbols.',
   'hostPopup.RackId': 'Rack',
   'hostPopup.recommendation.beforeDecommission': '{0} Maintenance Mode is pre required for decommissioning.',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 64b5797..821c087 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -4663,6 +4663,11 @@ ul.list-inline li {
   width: 100%
 }
 
+.rack-id {
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
 
 .big-arrow-right {
   background-repeat: no-repeat;
@@ -4672,13 +4677,6 @@ ul.list-inline li {
 .advanced-header-table {
   table-layout: fixed;
 
-  td {
-    &.rack-id {
-      white-space: nowrap;
-      overflow: hidden;
-      text-overflow: ellipsis;
-    }
-  }
   .sorting_asc {
     background: url(data:image/png;base64,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) no-repeat right 50%;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/app/templates/main/host/summary.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs
index 1ec0ac6..ea4be05 100644
--- a/ambari-web/app/templates/main/host/summary.hbs
+++ b/ambari-web/app/templates/main/host/summary.hbs
@@ -154,7 +154,7 @@
             <dd class="summary-ipaddress-value">&nbsp;{{view.content.ip}}</dd>
 
             <dt class="summary-rack-label">{{t common.rack}}:</dt>
-            <dd class="summary-rack-value">&nbsp;{{view.content.rack}}
+            <dd class="summary-rack-value">&nbsp;{{formatWordBreak view.content.rack}}
                 {{#isAuthorized "HOST.TOGGLE_MAINTENANCE"}}
                   <a class="set-rack-id" {{action setRackId view.content target="controller"}}><i
                     class="glyphicon glyphicon-pencil"></i></a>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/app/utils/validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/validator.js b/ambari-web/app/utils/validator.js
index 48ba4dd..c7248bb 100644
--- a/ambari-web/app/utils/validator.js
+++ b/ambari-web/app/utils/validator.js
@@ -269,8 +269,9 @@ module.exports = {
   },
 
   isValidRackId: function(path) {
+    var _path = '' + path;
     // See app/message.js:hostPopup.setRackId.invalid
-    return /^\/[/.\w-]+$/.test(path);
+    return /^\/[/.\w-]+$/.test(_path) && _path.length < 255;
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/app/views/common/helpers/format_word_break_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/helpers/format_word_break_view.js b/ambari-web/app/views/common/helpers/format_word_break_view.js
index d33692c..8601cdc 100644
--- a/ambari-web/app/views/common/helpers/format_word_break_view.js
+++ b/ambari-web/app/views/common/helpers/format_word_break_view.js
@@ -31,7 +31,7 @@ App.FormatWordBreakView = Em.View.extend({
     if (str.length <= maxBlockLength || str.contains('-') || str.contains(' ')) {
       return str;
     }
-    return str.split(/(?=[A-Z])/).join('<wbr />');
+    return str.split(/(?=[A-Z])/).join('<wbr>');
   },
 
   /**
@@ -40,13 +40,13 @@ App.FormatWordBreakView = Em.View.extend({
   result: function() {
     var content = this.get('content') || '';
     var self = this;
-    ['.', '_'].forEach(function (delimiter) {
+    ['.', '_', '/'].forEach(function (delimiter) {
       if (content.contains(delimiter)) {
         content = content.split(delimiter).map(function (substr) {
           return self._splitLongSubStrings(substr);
-        }).join(delimiter + '<wbr />');
+        }).join(delimiter + '<wbr>');
       }
     });
-    return content.replace(/(<wbr \/>){2,}/, '<wbr />'); // no need for double <wbr />
+    return content.replace(/(<wbr>){2,}/g, '<wbr>'); // no need for double <wbr>
   }.property('content')
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/test/utils/validator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/validator_test.js b/ambari-web/test/utils/validator_test.js
index 2a30993..4f069e0 100644
--- a/ambari-web/test/utils/validator_test.js
+++ b/ambari-web/test/utils/validator_test.js
@@ -498,4 +498,26 @@ describe('validator', function () {
       })
     });
   });
+
+  describe('#isValidRackId()', function () {
+
+    [
+      {v: '', e: false},
+      {v: 'a', e: false},
+      {v: '1', e: false},
+      {v: '/', e: false},
+      {v: '/a', e: true},
+      {v: '/1', e: true},
+      {v: '/-', e: true},
+      {v: '/' + (new Array(255)).join('a'), m: 'Value bigger than 255 symbols', e: false}
+    ].forEach(function (test) {
+
+      it(test.m || test.v, function () {
+        expect(validator.isValidRackId(test.v)).to.be.equal(test.e);
+      })
+
+    });
+
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/d348b65e/ambari-web/test/views/common/helpers/format_word_break_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/helpers/format_word_break_view_test.js b/ambari-web/test/views/common/helpers/format_word_break_view_test.js
index 40154af..f656fbe 100644
--- a/ambari-web/test/views/common/helpers/format_word_break_view_test.js
+++ b/ambari-web/test/views/common/helpers/format_word_break_view_test.js
@@ -30,17 +30,19 @@ describe('App.FormatWordBreakView', function () {
 
     Em.A([
       {content: 'abc', expected: 'abc'},
-      {content: 'a.bc', expected: 'a.<wbr />bc'},
-      {content: 'a.b.c', expected: 'a.<wbr />b.<wbr />c'},
-      {content: 'a.123456789A123456789B12345.c', expected: 'a.<wbr />123456789<wbr />A123456789<wbr />B12345.<wbr />c'},
-      {content: 'a_bc', expected: 'a_<wbr />bc'},
-      {content: 'a_b_c', expected: 'a_<wbr />b_<wbr />c'},
-      {content: 'a_123456789A123456789B12345_c', expected: 'a_<wbr />123456789<wbr />A123456789<wbr />B12345_<wbr />c'},
-      {content: 'a.123456789A123456789B12345_c', expected: 'a.<wbr />123456789<wbr />A123456789<wbr />B12345_<wbr />c'},
-      {content: 'a.123456789a123456789b12345_c', expected: 'a.<wbr />123456789a123456789b12345_<wbr />c'},
-      {content: 'a.123456789a-23456789b12345_c', expected: 'a.<wbr />123456789a-23456789b12345_<wbr />c'},
-      {content: 'a.123456789a 23456789b12345_c', expected: 'a.<wbr />123456789a 23456789b12345_<wbr />c'},
-      {content: 'a.123456789a123456789_c', expected: 'a.<wbr />123456789a123456789_<wbr />c'},
+      {content: 'a.bc', expected: 'a.<wbr>bc'},
+      {content: 'a.b.c', expected: 'a.<wbr>b.<wbr>c'},
+      {content: 'a/bc', expected: 'a/<wbr>bc'},
+      {content: 'a/b/c', expected: 'a/<wbr>b/<wbr>c'},
+      {content: 'a.123456789A123456789B12345.c', expected: 'a.<wbr>123456789<wbr>A123456789<wbr>B12345.<wbr>c'},
+      {content: 'a_bc', expected: 'a_<wbr>bc'},
+      {content: 'a_b_c', expected: 'a_<wbr>b_<wbr>c'},
+      {content: 'a_123456789A123456789B12345_c', expected: 'a_<wbr>123456789<wbr>A123456789<wbr>B12345_<wbr>c'},
+      {content: 'a.123456789A123456789B12345_c', expected: 'a.<wbr>123456789<wbr>A123456789<wbr>B12345_<wbr>c'},
+      {content: 'a.123456789a123456789b12345_c', expected: 'a.<wbr>123456789a123456789b12345_<wbr>c'},
+      {content: 'a.123456789a-23456789b12345_c', expected: 'a.<wbr>123456789a-23456789b12345_<wbr>c'},
+      {content: 'a.123456789a 23456789b12345_c', expected: 'a.<wbr>123456789a 23456789b12345_<wbr>c'},
+      {content: 'a.123456789a123456789_c', expected: 'a.<wbr>123456789a123456789_<wbr>c'},
     ]).forEach(function (test) {
       var message = 'content: {0}, expected: {1}'.format(JSON.stringify(test.content), JSON.stringify(test.expected));
       it(message, function () {


[05/11] ambari git commit: AMBARI-18746: Sqoop parameter hadoop_home is pointed to incorrect path in params_linux.py (dili)

Posted by nc...@apache.org.
AMBARI-18746: Sqoop parameter hadoop_home is pointed to incorrect path in params_linux.py (dili)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/574fd643
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/574fd643
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/574fd643

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 574fd6435f1df87f632ea86287f26e8f1f7f1121
Parents: 7394cef
Author: Di Li <di...@apache.org>
Authored: Thu Nov 3 15:57:56 2016 -0400
Committer: Di Li <di...@apache.org>
Committed: Thu Nov 3 15:57:56 2016 -0400

----------------------------------------------------------------------
 .../SQOOP/1.4.4.2.0/package/scripts/params_linux.py                | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/574fd643/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
index df418f0..283f54d 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
@@ -70,7 +70,7 @@ zoo_conf_dir = "/etc/zookeeper"
 if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
   sqoop_conf_dir = format("{stack_root}/current/sqoop-client/conf")
   sqoop_lib = format("{stack_root}/current/sqoop-client/lib")
-  hadoop_home = format("{stack_root}/current/hbase-client")
+  hadoop_home = format("{stack_root}/current/hadoop-client")
   hbase_home = format("{stack_root}/current/hbase-client")
   hive_home = format("{stack_root}/current/hive-client")
   sqoop_bin_dir = format("{stack_root}/current/sqoop-client/bin/")


[11/11] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-18634

Posted by nc...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-18634


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f4221cf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f4221cf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f4221cf

Branch: refs/heads/branch-feature-AMBARI-18634
Commit: 1f4221cf71e2a2c216ad1017fd5d6a28d99dbc6a
Parents: f9814d2 0bdaff8
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Nov 4 09:26:37 2016 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Nov 4 09:26:37 2016 -0400

----------------------------------------------------------------------
 .../ambari/server/checks/CheckDescription.java  |   4 +-
 .../orm/entities/RepositoryVersionEntity.java   |  39 +++----
 .../ambari/server/stack/ServiceModule.java      |  15 ++-
 .../org/apache/ambari/server/state/StackId.java |   4 -
 .../ambari/server/topology/AmbariContext.java   |   3 +-
 .../ambari/server/topology/Blueprint.java       |   9 ++
 .../ambari/server/topology/BlueprintImpl.java   |  49 +++++++++
 .../apache/ambari/server/topology/Setting.java  |  21 ++++
 .../2.1.0.2.0/package/scripts/hdfs_namenode.py  |   2 +-
 .../1.4.4.2.0/package/scripts/params_linux.py   |   2 +-
 ...leRepositoryVersionResourceProviderTest.java |   4 +
 .../RepositoryVersionResourceProviderTest.java  |  14 +++
 .../orm/dao/RepositoryVersionDAOTest.java       |  35 +++++++
 .../server/stack/StackManagerExtensionTest.java |   9 ++
 .../server/topology/AmbariContextTest.java      |   1 +
 .../EXT/0.1/services/OOZIE2/metainfo.xml        |   8 ++
 .../services/OOZIE2/themes/working_theme.json   |   5 +
 .../EXT/0.2/services/OOZIE2/metainfo.xml        |   8 ++
 .../services/OOZIE2/themes/broken_theme.json    |   3 +
 ambari-web/app/mappers/stack_service_mapper.js  |   6 +-
 ambari-web/app/messages.js                      |   2 +-
 ambari-web/app/models/stack_service.js          |   4 +-
 ambari-web/app/styles/application.less          |  12 +--
 .../templates/common/configs/service_config.hbs |  16 +--
 ambari-web/app/templates/main/host/summary.hbs  |   2 +-
 ambari-web/app/utils/validator.js               |   3 +-
 ambari-web/app/views.js                         |   1 +
 .../configs/config_category_container_view.js   |  64 ++++++++++++
 .../configs/service_configs_by_category_view.js |  42 ++++----
 .../common/helpers/format_word_break_view.js    |   8 +-
 ambari-web/test/models/stack_service_test.js    |   2 +
 ambari-web/test/utils/validator_test.js         |  22 ++++
 .../notification_configs_view_test.js           |   6 +-
 .../helpers/format_word_break_view_test.js      |  24 +++--
 .../apache/ambari/view/hive2/AuthParams.java    | 102 +++++++++++++++++++
 .../ambari/view/hive2/actor/JdbcConnector.java  |  30 +++++-
 .../view/hive2/actor/message/Connect.java       |   5 +-
 .../hive2/internal/HiveConnectionWrapper.java   |  43 ++++++--
 .../resources/browser/ConnectionService.java    |   4 +-
 .../view/hive2/ConnectionFailuresTest.java      |   9 +-
 .../ambari/view/hive2/JobExecutionTest.java     |   6 +-
 41 files changed, 525 insertions(+), 123 deletions(-)
----------------------------------------------------------------------