ambari git commit: AMBARI-10512. Action buttons should be on the right side of the widgets (onechiporenko)

2015-04-16 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 2a7ec815f - 37aa58ff6


AMBARI-10512. Action buttons should be on the right side of the widgets 
(onechiporenko)


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

Branch: refs/heads/trunk
Commit: 37aa58ff68e4d613984ff34a48feaa57c948c520
Parents: 2a7ec81
Author: Oleg Nechiporenko onechipore...@apache.org
Authored: Thu Apr 16 11:50:30 2015 +0300
Committer: Oleg Nechiporenko onechipore...@apache.org
Committed: Thu Apr 16 11:50:30 2015 +0300

--
 .../app/controllers/wizard/step7_controller.js  |  2 +-
 ambari-web/app/styles/widgets.less  |  9 ++---
 .../templates/common/configs/restore_config.hbs | 23 ---
 .../configs/widgets/checkbox_config_widget.hbs  |  2 +-
 .../configs/widgets/combo_config_widget.hbs |  4 +-
 .../common/configs/widgets/controls.hbs | 35 +++--
 .../configs/widgets/list_config_widget.hbs  | 12 ++
 .../overrides/config_widget_override.hbs| 41 +---
 .../configs/widgets/slider_config_widget.hbs|  4 +-
 .../configs/widgets/time_interval_spinner.hbs   |  4 +-
 .../configs/widgets/toggle_config_widget.hbs|  4 +-
 ambari-web/app/views.js |  1 -
 .../views/common/configs/restore_config_view.js | 30 --
 .../configs/widgets/config_widget_view.js   | 15 ++-
 .../widgets/radio_button_config_widget_view.js  |  2 +-
 .../widgets/slider_config_widget_view.js|  5 ++-
 .../configs/widgets/config_widget_view_test.js  | 17 
 17 files changed, 83 insertions(+), 127 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/37aa58ff/ambari-web/app/controllers/wizard/step7_controller.js
--
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js 
b/ambari-web/app/controllers/wizard/step7_controller.js
index b5d84dc..4eaa119 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -1081,7 +1081,7 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, App.E
 var newSCP = App.ServiceConfigProperty.create(serviceConfigProperty);
 var group = this.get('selectedService.configGroups').findProperty('name', 
this.get('selectedConfigGroup.name'));
 newSCP.set('group', group);
-newSCP.set('value', '');
+newSCP.set('value', serviceConfigProperty.get('widget') ? 
serviceConfigProperty.get('value') : '');
 newSCP.set('isOriginalSCP', false); // indicated this is overridden value,
 newSCP.set('parentSCP', serviceConfigProperty);
 newSCP.set('isEditable', true);

http://git-wip-us.apache.org/repos/asf/ambari/blob/37aa58ff/ambari-web/app/styles/widgets.less
--
diff --git a/ambari-web/app/styles/widgets.less 
b/ambari-web/app/styles/widgets.less
index 08d6e9f..4af4e31 100644
--- a/ambari-web/app/styles/widgets.less
+++ b/ambari-web/app/styles/widgets.less
@@ -51,13 +51,10 @@
   }
   .widget-config-controls {
 display: inline-block;
-margin-left: 20px;
+margin-left: 10px;
 .widget-action {
   text-decoration: none;
   display: block;
-  .not-show {
-  display: none;
-  }
 }
 .widget-action-final {
   color: @widget-config-override-action-color;
@@ -193,7 +190,9 @@
   line-height: 35px;
 }
   }
-
+  .overrideField {
+margin-top: 30px;
+  }
 }
 .slider-disabled {
   .slider-track-high {

http://git-wip-us.apache.org/repos/asf/ambari/blob/37aa58ff/ambari-web/app/templates/common/configs/restore_config.hbs
--
diff --git a/ambari-web/app/templates/common/configs/restore_config.hbs 
b/ambari-web/app/templates/common/configs/restore_config.hbs
deleted file mode 100644
index 0633c50..000
--- a/ambari-web/app/templates/common/configs/restore_config.hbs
+++ /dev/null
@@ -1,23 +0,0 @@
-{{!
-* 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 

ambari git commit: AMBARI-10516 Create widget wizard: Restore data for preview widget. (atkach)

2015-04-16 Thread atkach
Repository: ambari
Updated Branches:
  refs/heads/trunk 37aa58ff6 - cf5703a7c


AMBARI-10516 Create widget wizard: Restore data for preview widget. (atkach)


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

Branch: refs/heads/trunk
Commit: cf5703a7cde3834f22c0ac0abefc843e481e13d8
Parents: 37aa58f
Author: Andrii Tkach atk...@hortonworks.com
Authored: Thu Apr 16 13:10:31 2015 +0300
Committer: Andrii Tkach atk...@hortonworks.com
Committed: Thu Apr 16 13:10:31 2015 +0300

--
 .../service/widgets/create/step2_controller.js  | 162 ---
 .../service/widgets/create/step3_controller.js  |   2 +
 .../service/widgets/create/wizard_controller.js | 155 +++---
 ambari-web/app/routes/add_widget.js |  16 +-
 ambari-web/app/routes/main.js   |   2 +-
 .../main/service/widgets/create/expression.hbs  |   2 +-
 .../main/service/widgets/create/step2.hbs   |   4 +-
 .../main/service/widgets/create/step2_graph.hbs |   6 +-
 .../service/widgets/create/step2_number.hbs |   2 +-
 .../service/widgets/create/step2_template.hbs   |   8 +-
 .../service/widgets/create/expression_view.js   |   4 +-
 .../main/service/widgets/create/step2_view.js   | 110 +
 .../widgets/create/expression_view_test.js  |   4 +-
 13 files changed, 233 insertions(+), 244 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cf5703a7/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
--
diff --git 
a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js 
b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
index cdf8dc8..09c65c2 100644
--- a/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
+++ b/ambari-web/app/controllers/main/service/widgets/create/step2_controller.js
@@ -21,11 +21,7 @@ var App = require('app');
 App.WidgetWizardStep2Controller = Em.Controller.extend({
   name: widgetWizardStep2Controller,
 
-  /**
-   * views of properties
-   * @type {Array}
-   */
-  widgetPropertiesViews: [],
+  EXPRESSION_PREFIX: 'Expression',
 
   /**
* actual values of properties in API format
@@ -43,6 +39,29 @@ App.WidgetWizardStep2Controller = Em.Controller.extend({
*/
   widgetMetrics: [],
 
+  /**
+   * @type {Array}
+   */
+  expressions: [],
+
+  /**
+   * used only for GRAPH widget
+   * @type {Array}
+   */
+  dataSets: [],
+
+  /**
+   * content of template of Template widget
+   * @type {string}
+   */
+  templateValue: '',
+
+  /**
+   * views of properties
+   * @type {Array}
+   */
+  widgetPropertiesViews: [],
+
   propertiesMap: {
 warning_threshold: {
   name: 'threshold',
@@ -82,20 +101,123 @@ App.WidgetWizardStep2Controller = Em.Controller.extend({
   }.property('content.allMetrics'),
 
   /**
+   * @type {boolean}
+   */
+  isSubmitDisabled: function() {
+if (this.get('widgetPropertiesViews').someProperty('isValid', false)) {
+  return true;
+}
+switch (this.get('content.widgetType')) {
+  case NUMBER:
+  case GAUGE:
+return this.get('expressions')[0] 
+  (this.get('expressions')[0].get('editMode') ||
+  this.get('expressions')[0].get('data.length') === 0);
+  case GRAPH:
+return this.get('dataSets.length')  0 
+  (this.get('dataSets').someProperty('expression.editMode') ||
+  this.get('dataSets').someProperty('expression.data.length', 0));
+  case TEMPLATE:
+return !this.get('templateValue') ||
+  this.get('expressions.length')  0 
+  (this.get('expressions').someProperty('editMode') ||
+  this.get('expressions').someProperty('data.length', 0));
+}
+return false;
+  }.property('widgetPropertiesViews.@each.isValid',
+'expressions.@each.editMode',
+'dataSets.@each.expression'),
+
+  /**
+   * Add data set
+   * @param {object|null} event
+   * @param {boolean} isDefault
+   */
+  addDataSet: function(event, isDefault) {
+var id = (isDefault) ? 1 :(Math.max.apply(this, 
this.get('dataSets').mapProperty('id')) + 1);
+
+this.get('dataSets').pushObject(Em.Object.create({
+  id: id,
+  label: '',
+  isRemovable: !isDefault,
+  expression: {
+data: [],
+editMode: false
+  }
+}));
+  },
+
+  /**
+   * Remove data set
+   * @param {object} event
+   */
+  removeDataSet: function(event) {
+this.get('dataSets').removeObject(event.context);
+  },
+
+  /**
+   * Add expression
+   * @param {object|null} event
+   * @param {boolean} isDefault
+   */
+  addExpression: 

ambari git commit: AMBARI-10480 BE: Extend stack-advisor to recommend property_value_attributes for Hive/Tez (additional patch) (dsen)

2015-04-16 Thread dsen
Repository: ambari
Updated Branches:
  refs/heads/trunk 28e68643d - 7d62dbb7b


AMBARI-10480 BE: Extend stack-advisor to recommend property_value_attributes 
for Hive/Tez (additional patch) (dsen)


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

Branch: refs/heads/trunk
Commit: 7d62dbb7ba1ca98d583513d92291a45cbe13be98
Parents: 28e6864
Author: Dmytro Sen d...@apache.org
Authored: Thu Apr 16 15:23:05 2015 +0300
Committer: Dmytro Sen d...@apache.org
Committed: Thu Apr 16 15:25:02 2015 +0300

--
 .../src/main/resources/stacks/HDP/2.2/services/stack_advisor.py| 2 +-
 .../src/test/python/stacks/2.2/common/test_stack_advisor.py| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d62dbb7/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index c3bf9ff..41fd157 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -144,7 +144,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
 putHiveSiteProperty(hive.exec.reducers.bytes.per.reducer, 67108864)
 
 # Transactions
-putHiveEnvProperty(hive_txn_acid, false)
+putHiveEnvProperty(hive_txn_acid, Off)
 if str(configurations[hive-env][properties][hive_txn_acid]).lower() 
== on:
   putHiveSiteProperty(hive.txn.manager, 
org.apache.hadoop.hive.ql.lockmgr.DbTxnManager)
   putHiveSiteProperty(hive.support.concurrency, true)

http://git-wip-us.apache.org/repos/asf/ambari/blob/7d62dbb7/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
--
diff --git 
a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index 8a721d1..dda807f 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -865,7 +865,7 @@ class TestHDP22StackAdvisor(TestCase):
   'hive_exec_orc_storage_strategy': 'SPEED',
   'hive_security_authorization': 'None',
   'hive_timeline_logging_enabled': 'true',
-  'hive_txn_acid': 'false'
+  'hive_txn_acid': 'Off'
 }
   },
   'hive-site': {



[5/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index adf5828..a69e235 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -31,20 +31,107 @@ GO
 --create the database--
 
 --create tables and grant privileges to db user-
-CREATE TABLE clusters (cluster_id BIGINT NOT NULL, resource_id BIGINT NOT 
NULL, cluster_info VARCHAR(255) NOT NULL, cluster_name VARCHAR(100) NOT NULL 
UNIQUE, provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT', security_type 
VARCHAR(32) NOT NULL DEFAULT 'NONE', desired_cluster_state VARCHAR(255) NOT 
NULL, desired_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY CLUSTERED 
(cluster_id));
-CREATE TABLE clusterconfig (config_id BIGINT NOT NULL, version_tag 
VARCHAR(255) NOT NULL, version BIGINT NOT NULL, type_name VARCHAR(255) NOT 
NULL, cluster_id BIGINT NOT NULL, config_data VARCHAR(MAX) NOT NULL, 
config_attributes VARCHAR(MAX), create_timestamp BIGINT NOT NULL, PRIMARY KEY 
CLUSTERED (config_id));
-CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id 
BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, 
create_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT 
'_db', group_id BIGINT, note VARCHAR(MAX), PRIMARY KEY CLUSTERED 
(service_config_id));
-CREATE TABLE serviceconfighosts (service_config_id BIGINT NOT NULL, hostname 
VARCHAR(255) NOT NULL, PRIMARY KEY CLUSTERED (service_config_id, hostname));
-CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, 
config_id BIGINT NOT NULL, PRIMARY KEY CLUSTERED (service_config_id, 
config_id));
-CREATE TABLE clusterconfigmapping (cluster_id BIGINT NOT NULL, type_name 
VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp 
BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) 
NOT NULL DEFAULT '_db', PRIMARY KEY CLUSTERED (cluster_id, type_name, 
create_timestamp));
-CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id 
BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY CLUSTERED 
(service_name, cluster_id));
-CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state 
VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY 
CLUSTERED (cluster_id));
-CREATE TABLE cluster_version (id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, 
repo_version_id BIGINT NOT NULL, state VARCHAR(255) NOT NULL, start_time BIGINT 
NOT NULL, end_time BIGINT, user_name VARCHAR(255), PRIMARY KEY (id));
+CREATE TABLE stack(
+  stack_id BIGINT NOT NULL,
+  stack_name VARCHAR(255) NOT NULL,
+  stack_version VARCHAR(255) NOT NULL,
+  PRIMARY KEY (stack_id),
+  CONSTRAINT unq_stack UNIQUE(stack_name,stack_version)
+);
+
+CREATE TABLE clusters (
+  cluster_id BIGINT NOT NULL,
+  resource_id BIGINT NOT NULL,
+  cluster_info VARCHAR(255) NOT NULL,
+  cluster_name VARCHAR(100) NOT NULL UNIQUE,
+  provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT',
+  security_type VARCHAR(32) NOT NULL DEFAULT 'NONE',
+  desired_cluster_state VARCHAR(255) NOT NULL,
+  desired_stack_id BIGINT NOT NULL,
+  PRIMARY KEY CLUSTERED (cluster_id),
+  FOREIGN KEY (desired_stack_id) REFERENCES stack(stack_id)
+  );
+
+CREATE TABLE clusterconfig (
+  config_id BIGINT NOT NULL,
+  version_tag VARCHAR(255) NOT NULL,
+  version BIGINT NOT NULL,
+  type_name VARCHAR(255) NOT NULL,
+  cluster_id BIGINT NOT NULL,
+  stack_id BIGINT NOT NULL,
+  config_data VARCHAR(MAX) NOT NULL,
+  config_attributes VARCHAR(MAX),
+  create_timestamp BIGINT NOT NULL,
+  PRIMARY KEY CLUSTERED (config_id),
+  FOREIGN KEY (stack_id) REFERENCES stack(stack_id)
+  );
+
+CREATE TABLE serviceconfig (
+  service_config_id BIGINT NOT NULL,
+  cluster_id BIGINT NOT NULL,
+  service_name VARCHAR(255) NOT NULL,
+  version BIGINT NOT NULL,
+  create_timestamp BIGINT NOT NULL,
+  stack_id BIGINT NOT NULL,
+  user_name VARCHAR(255) NOT NULL DEFAULT '_db',
+  group_id BIGINT,
+  note VARCHAR(MAX),
+  PRIMARY KEY CLUSTERED (service_config_id),
+  FOREIGN KEY (stack_id) REFERENCES stack(stack_id)
+  );
+
+CREATE TABLE serviceconfighosts (
+  service_config_id BIGINT NOT NULL,
+  hostname VARCHAR(255) NOT NULL,
+  PRIMARY KEY CLUSTERED (service_config_id, hostname)
+  );
+
+CREATE TABLE serviceconfigmapping (
+  service_config_id BIGINT NOT NULL,
+  config_id BIGINT NOT NULL,
+  PRIMARY KEY CLUSTERED (service_config_id, config_id)
+  );
+
+CREATE TABLE clusterconfigmapping (
+  cluster_id BIGINT NOT NULL,
+  type_name VARCHAR(255) NOT NULL,
+  version_tag VARCHAR(255) NOT NULL,
+  create_timestamp BIGINT NOT NULL,
+  selected INT NOT 

[4/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
index 11a2b22..1fa4a4d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
@@ -71,18 +71,21 @@ import 
org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.BlueprintDAO;
+import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
 import org.apache.ambari.server.orm.entities.BlueprintConfiguration;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
 import org.apache.ambari.server.orm.entities.HostGroupComponentEntity;
 import org.apache.ambari.server.orm.entities.HostGroupConfigEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
+import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.AutoDeployInfo;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.utils.StageUtils;
 import org.easymock.Capture;
+import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -104,12 +107,23 @@ public class BlueprintResourceProviderTest {
 
   private final static BlueprintResourceProvider provider = createProvider();
   private final static BlueprintDAO dao = createStrictMock(BlueprintDAO.class);
+  private final static StackDAO stackDAO = createNiceMock(StackDAO.class);
   private final static Gson gson = new Gson();
   private final static AmbariMetaInfo metaInfo = 
createMock(AmbariMetaInfo.class);
 
   @BeforeClass
   public static void initClass() {
-BlueprintResourceProvider.init(dao, gson, metaInfo);
+BlueprintResourceProvider.init(dao, stackDAO, gson, metaInfo);
+
+StackEntity stackEntity = new StackEntity();
+stackEntity.setStackName(test-stack-name);
+stackEntity.setStackVersion(test-stack-version);
+
+expect(
+stackDAO.find(EasyMock.anyObject(String.class),
+
EasyMock.anyObject(String.class))).andReturn(stackEntity).anyTimes();
+
+replay(stackDAO);
   }
 
   @Before
@@ -1167,8 +1181,10 @@ public class BlueprintResourceProviderTest {
 
   private void validateEntity(BlueprintEntity entity, boolean containsConfig) {
 assertEquals(BLUEPRINT_NAME, entity.getBlueprintName());
-assertEquals(test-stack-name, entity.getStackName());
-assertEquals(test-stack-version, entity.getStackVersion());
+
+StackEntity stackEntity = entity.getStack();
+assertEquals(test-stack-name, stackEntity.getStackName());
+assertEquals(test-stack-version, stackEntity.getStackVersion());
 
 CollectionHostGroupEntity hostGroupEntities = entity.getHostGroups();
 
@@ -1289,15 +1305,20 @@ public class BlueprintResourceProviderTest {
   private static BlueprintResourceProvider createProvider() {
 return new BlueprintResourceProvider(
 PropertyHelper.getPropertyIds(Resource.Type.Blueprint),
-PropertyHelper.getKeyPropertyIds(Resource.Type.Blueprint),
-null);
+PropertyHelper.getKeyPropertyIds(Resource.Type.Blueprint), null);
   }
 
   private BlueprintEntity createEntity(MapString, Object properties) {
 BlueprintEntity entity = new BlueprintEntity();
 entity.setBlueprintName((String) 
properties.get(BlueprintResourceProvider.BLUEPRINT_NAME_PROPERTY_ID));
-entity.setStackName((String) 
properties.get(BlueprintResourceProvider.STACK_NAME_PROPERTY_ID));
-entity.setStackVersion((String) 
properties.get(BlueprintResourceProvider.STACK_VERSION_PROPERTY_ID));
+
+String stackName = (String) 
properties.get(BlueprintResourceProvider.STACK_NAME_PROPERTY_ID);
+String stackVersion = (String) 
properties.get(BlueprintResourceProvider.STACK_VERSION_PROPERTY_ID);
+StackEntity stackEntity = new StackEntity();
+stackEntity.setStackName(stackName);
+stackEntity.setStackVersion(stackVersion);
+
+entity.setStack(stackEntity);
 
 SetMapString, Object hostGroupProperties = (SetMapString, Object) 
properties.get(
 BlueprintResourceProvider.HOST_GROUP_PROPERTY_ID);


[2/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 66a4ade..bb1cb46 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -70,6 +70,7 @@ import org.apache.ambari.server.orm.entities.HostStateEntity;
 import org.apache.ambari.server.orm.entities.HostVersionEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
+import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.AgentVersion;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
@@ -100,7 +101,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
-import com.google.gson.Gson;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
@@ -187,7 +187,8 @@ public class ClusterTest {
   }
 
   private void createDefaultCluster() throws Exception {
-clusters.addCluster(c1);
+StackId stackId = new StackId(HDP-0.1);
+clusters.addCluster(c1, stackId);
 c1 = clusters.getCluster(c1);
 Assert.assertEquals(c1, c1.getClusterName());
 Assert.assertEquals(1, c1.getClusterId());
@@ -211,21 +212,26 @@ public class ClusterTest {
 host1.persist();
 host2.persist();
 
-StackId stackId = new StackId(HDP-0.1);
-c1.setDesiredStackVersion(stackId);
-helper.getOrCreateRepositoryVersion(stackId.getStackName(), 
stackId.getStackVersion());
-c1.createClusterVersion(stackId.getStackName(), stackId.getStackVersion(), 
admin, RepositoryVersionState.UPGRADING);
-c1.transitionClusterVersion(stackId.getStackName(), 
stackId.getStackVersion(), RepositoryVersionState.CURRENT);
+helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion());
+c1.createClusterVersion(stackId, stackId.getStackVersion(), admin,
+RepositoryVersionState.UPGRADING);
+c1.transitionClusterVersion(stackId, stackId.getStackVersion(),
+RepositoryVersionState.CURRENT);
 clusters.mapHostToCluster(h1, c1);
 clusters.mapHostToCluster(h2, c1);
 ClusterVersionDAOMock.failOnCurrentVersionState = false;
   }
 
   public ClusterEntity createDummyData() {
+StackEntity stackEntity = new StackEntity();
+stackEntity.setStackName(HDP);
+stackEntity.setStackVersion(0.1);
+
 ClusterEntity clusterEntity = new ClusterEntity();
 clusterEntity.setClusterId(1L);
 clusterEntity.setClusterName(test_cluster1);
 clusterEntity.setClusterInfo(test_cluster_info1);
+clusterEntity.setDesiredStack(stackEntity);
 
 HostEntity host1 = new HostEntity();
 HostEntity host2 = new HostEntity();
@@ -262,10 +268,11 @@ public class ClusterTest {
 clusterServiceEntity.setClusterEntity(clusterEntity);
 clusterServiceEntity.setServiceComponentDesiredStateEntities(
 Collections.EMPTY_LIST);
+
 ServiceDesiredStateEntity stateEntity = 
mock(ServiceDesiredStateEntity.class);
-Gson gson = new Gson();
-when(stateEntity.getDesiredStackVersion()).thenReturn(gson.toJson(new 
StackId(HDP-0.1),
-StackId.class));
+
+when(stateEntity.getDesiredStack()).thenReturn(stackEntity);
+
 clusterServiceEntity.setServiceDesiredStateEntity(stateEntity);
 ListClusterServiceEntity clusterServiceEntities = new 
ArrayListClusterServiceEntity();
 clusterServiceEntities.add(clusterServiceEntity);
@@ -273,23 +280,25 @@ public class ClusterTest {
 return clusterEntity;
   }
 
-  private void checkStackVersionState(String stack, String version, 
RepositoryVersionState state) {
+  private void checkStackVersionState(StackId stackId, String version, 
RepositoryVersionState state) {
 CollectionClusterVersionEntity allClusterVersions = 
c1.getAllClusterVersions();
 for (ClusterVersionEntity entity : allClusterVersions) {
-  if (entity.getRepositoryVersion().getStack().equals(stack)
-   entity.getRepositoryVersion().getVersion().equals(version)) {
+  StackId repoVersionStackId = new 
StackId(entity.getRepositoryVersion().getStack());
+  if (repoVersionStackId.equals(stackId)
+   repoVersionStackId.getStackVersion().equals(version)) {
 assertEquals(state, entity.getState());
   }
 }
   }
 
-  private void assertStateException(String stack, String version, 
RepositoryVersionState transitionState,
+  private void assertStateException(StackId stackId, String version,
+  RepositoryVersionState 

[6/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index 9ec0370..ffa085a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -17,12 +17,14 @@
  */
 package org.apache.ambari.server.state.configgroup;
 
-import com.google.gson.Gson;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.assistedinject.Assisted;
-import com.google.inject.assistedinject.AssistedInject;
-import com.google.inject.persist.Transactional;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.DuplicateResourceException;
 import org.apache.ambari.server.controller.ConfigGroupResponse;
@@ -46,13 +48,13 @@ import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.Host;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import com.google.gson.Gson;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.assistedinject.AssistedInject;
+import com.google.inject.persist.Transactional;
 
 public class ConfigGroupImpl implements ConfigGroup {
   private static final Logger LOG = 
LoggerFactory.getLogger(ConfigGroupImpl.class);
@@ -105,9 +107,9 @@ public class ConfigGroupImpl implements ConfigGroup {
 }
 
 if (configs != null) {
-  this.configurations = configs;
+  configurations = configs;
 } else {
-  this.configurations = new HashMapString, Config();
+  configurations = new HashMapString, Config();
 }
   }
 
@@ -119,8 +121,8 @@ public class ConfigGroupImpl implements ConfigGroup {
 this.cluster = cluster;
 
 this.configGroupEntity = configGroupEntity;
-this.configurations = new HashMapString, Config();
-this.hosts = new HashMapString, Host();
+configurations = new HashMapString, Config();
+hosts = new HashMapString, Host();
 
 // Populate configs
 for (ConfigGroupConfigMappingEntity configMappingEntity : configGroupEntity
@@ -130,7 +132,7 @@ public class ConfigGroupImpl implements ConfigGroup {
 configMappingEntity.getVersionTag());
 
   if (config != null) {
-this.configurations.put(config.getType(), config);
+configurations.put(config.getType(), config);
   } else {
 LOG.warn(Unable to find config mapping for config group
   + , clusterName =  + cluster.getClusterName()
@@ -146,7 +148,7 @@ public class ConfigGroupImpl implements ConfigGroup {
   try {
 Host host = clusters.getHost(hostMappingEntity.getHostname());
 if (host != null) {
-  this.hosts.put(host.getHostName(), host);
+  hosts.put(host.getHostName(), host);
 }
   } catch (AmbariException e) {
 String msg = Host seems to be deleted but Config group mapping still 
 +
@@ -178,7 +180,7 @@ public class ConfigGroupImpl implements ConfigGroup {
   public void setName(String name) {
 readWriteLock.writeLock().lock();
 try {
-  this.configGroupEntity.setGroupName(name);
+  configGroupEntity.setGroupName(name);
 } finally {
   readWriteLock.writeLock().unlock();
 }
@@ -204,7 +206,7 @@ public class ConfigGroupImpl implements ConfigGroup {
   public void setTag(String tag) {
 readWriteLock.writeLock().lock();
 try {
-  this.configGroupEntity.setTag(tag);
+  configGroupEntity.setTag(tag);
 } finally {
   readWriteLock.writeLock().unlock();
 }
@@ -225,7 +227,7 @@ public class ConfigGroupImpl implements ConfigGroup {
   public void setDescription(String description) {
 readWriteLock.writeLock().lock();
 try {
-  this.configGroupEntity.setDescription(description);
+  configGroupEntity.setDescription(description);
 } finally {
   readWriteLock.writeLock().unlock();
 }
@@ -276,7 +278,7 @@ public class ConfigGroupImpl implements ConfigGroup {
   public void setConfigurations(MapString, Config configs) {
 readWriteLock.writeLock().lock();
 try 

[7/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterVersionEntity.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterVersionEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterVersionEntity.java
index 01b9c03..5181a0d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterVersionEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterVersionEntity.java
@@ -48,15 +48,14 @@ import 
org.apache.ambari.server.state.RepositoryVersionState;
 @NamedQueries({
 @NamedQuery(name = clusterVersionByClusterAndStackAndVersion, query =
 SELECT clusterVersion FROM ClusterVersionEntity clusterVersion JOIN 
clusterVersion.clusterEntity cluster  +
-WHERE cluster.clusterName=:clusterName AND 
clusterVersion.repositoryVersion.stack=:stack AND 
clusterVersion.repositoryVersion.version=:version),
+WHERE cluster.clusterName=:clusterName AND 
clusterVersion.repositoryVersion.stack.stackName=:stackName AND 
clusterVersion.repositoryVersion.stack.stackVersion=:stackVersion AND 
clusterVersion.repositoryVersion.version=:version),
 @NamedQuery(name = clusterVersionByClusterAndState, query =
 SELECT clusterVersion FROM ClusterVersionEntity clusterVersion JOIN 
clusterVersion.clusterEntity cluster  +
 WHERE cluster.clusterName=:clusterName AND 
clusterVersion.state=:state),
 @NamedQuery(name = clusterVersionByCluster, query =
 SELECT clusterVersion FROM ClusterVersionEntity clusterVersion JOIN 
clusterVersion.clusterEntity cluster  +
 WHERE cluster.clusterName=:clusterName),
-@NamedQuery(name = clusterVersionByStackVersion,
-query = SELECT clusterVersion FROM ClusterVersionEntity 
clusterVersion WHERE clusterVersion.repositoryVersion.stack=:stack AND 
clusterVersion.repositoryVersion.version=:version),
+@NamedQuery(name = clusterVersionByStackVersion, query = SELECT 
clusterVersion FROM ClusterVersionEntity clusterVersion WHERE 
clusterVersion.repositoryVersion.stack.stackName=:stackName AND 
clusterVersion.repositoryVersion.stack.stackVersion=:stackVersion AND 
clusterVersion.repositoryVersion.version=:version),
 })
 public class ClusterVersionEntity {
 
@@ -107,9 +106,9 @@ public class ClusterVersionEntity {
* @param userName User who performed the action
*/
   public ClusterVersionEntity(ClusterEntity cluster, RepositoryVersionEntity 
repositoryVersion, RepositoryVersionState state, long startTime, String 
userName) {
-this.clusterId = cluster.getClusterId();
+clusterId = cluster.getClusterId();
 this.repositoryVersion = repositoryVersion;
-this.clusterEntity = cluster;
+clusterEntity = cluster;
 this.state = state;
 this.startTime = startTime;
 this.userName = userName;
@@ -192,13 +191,13 @@ public class ClusterVersionEntity {
 
 ClusterVersionEntity that = (ClusterVersionEntity) o;
 
-if (this.id != that.id
-|| this.clusterId != that.clusterId
-|| !this.repositoryVersion.equals(that.repositoryVersion)
-|| !this.state.equals(that.state)
-|| !this.startTime.equals(that.startTime)
-|| !this.endTime.equals(that.endTime)
-|| !this.userName.equals(that.userName)) {
+if (id != that.id
+|| clusterId != that.clusterId
+|| !repositoryVersion.equals(that.repositoryVersion)
+|| !state.equals(that.state)
+|| !startTime.equals(that.startTime)
+|| !endTime.equals(that.endTime)
+|| !userName.equals(that.userName)) {
   return false;
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
index 7f0b19d..570c84b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
@@ -29,10 +29,11 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinColumns;
 import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
 
-import org.apache.ambari.server.state.SecurityState;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.SecurityState;
 import org.apache.ambari.server.state.State;
 
 

[3/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ClusterVersionDAOTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ClusterVersionDAOTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ClusterVersionDAOTest.java
index 4837764..6a1c80d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ClusterVersionDAOTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ClusterVersionDAOTest.java
@@ -18,21 +18,21 @@
 
 package org.apache.ambari.server.orm.dao;
 
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.persist.PersistService;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.OrmTestHelper;
-
 import org.apache.ambari.server.orm.entities.ClusterEntity;
+import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.StackId;
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
-import org.junit.Assert;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.persist.PersistService;
 
 /**
  * ClusterVersionDAO unit tests.
@@ -57,6 +57,9 @@ public class ClusterVersionDAOTest {
   ClusterVersionEntity cvC;
   long cvCId = 0L;
 
+  private final static StackId HDP_22_STACK = new StackId(HDP, 2.2.0);
+  private final static StackId BAD_STACK = new StackId(BADSTACK, 1.0);
+
   @Before
   public void before() {
 injector = Guice.createInjector(new InMemoryDefaultTestModule());
@@ -76,7 +79,7 @@ public class ClusterVersionDAOTest {
   clusterId = helper.createCluster();
   cluster = clusterDAO.findById(clusterId);
 
-  cvA = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP-2.2, 2.2.0.0-995), 
RepositoryVersionState.CURRENT, System.currentTimeMillis(), 
System.currentTimeMillis(), admin);
+  cvA = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP_22_STACK, 2.2.0.0-995), 
RepositoryVersionState.CURRENT, System.currentTimeMillis(), 
System.currentTimeMillis(), admin);
   clusterVersionDAO.create(cvA);
   cvAId = cvA.getId();
 } else {
@@ -87,7 +90,7 @@ public class ClusterVersionDAOTest {
 // Install B
 if (currStep = 2) {
   if (lastStep = 1) {
-cvB = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP-2.2, 2.2.0.1-998), 
RepositoryVersionState.INSTALLED, System.currentTimeMillis(), 
System.currentTimeMillis(), admin);
+cvB = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP_22_STACK, 2.2.0.1-998), 
RepositoryVersionState.INSTALLED, System.currentTimeMillis(), 
System.currentTimeMillis(), admin);
 clusterVersionDAO.create(cvB);
 cvBId = cvB.getId();
   } else {
@@ -106,7 +109,7 @@ public class ClusterVersionDAOTest {
 // Start upgrading C
 if (currStep = 4) {
   if (lastStep = 3) {
-cvC = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP-2.2, 2.2.1.0-100), 
RepositoryVersionState.UPGRADING, System.currentTimeMillis(), admin);
+cvC = new ClusterVersionEntity(cluster, 
helper.getOrCreateRepositoryVersion(HDP_22_STACK, 2.2.1.0-100), 
RepositoryVersionState.UPGRADING, System.currentTimeMillis(), admin);
 clusterVersionDAO.create(cvC);
 cvCId = cvC.getId();
   } else {
@@ -140,14 +143,21 @@ public class ClusterVersionDAOTest {
 clusterVersionDAO.merge(cvB);
 }
 
-this.lastStep = currStep;
+lastStep = currStep;
   }
 
   @Test
   public void testFindByStackAndVersion() {
 createRecordsUntilStep(1);
-Assert.assertEquals(0, clusterVersionDAO.findByStackAndVersion(non 
existing, non existing).size());
-Assert.assertEquals(1, clusterVersionDAO.findByStackAndVersion(HDP-2.2, 
2.2.0.0-995).size());
+Assert.assertEquals(
+0,
+clusterVersionDAO.findByStackAndVersion(non existing, non existing,
+non existing).size());
+
+Assert.assertEquals(
+1,
+clusterVersionDAO.findByStackAndVersion(HDP_22_STACK.getStackName(),
+HDP_22_STACK.getStackVersion(), 2.2.0.0-995).size());
   }
 
   @Test
@@ -160,8 +170,11 @@ public class ClusterVersionDAOTest {
   @Test
   public void testFindByClusterAndStackAndVersion() {
 createRecordsUntilStep(1);
-
Assert.assertNull(clusterVersionDAO.findByClusterAndStackAndVersion(cluster.getClusterName(),
 non existing, non existing));
-

ambari git commit: AMBARI-10522. Cannot install Ranger Admin on non-root + umask 027 (aonishuk)

2015-04-16 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/trunk d445eed53 - e6a02eed7


AMBARI-10522. Cannot install Ranger Admin on non-root + umask 027 (aonishuk)


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

Branch: refs/heads/trunk
Commit: e6a02eed7b99546fa7032ab06f8a23a9a60d8465
Parents: d445eed
Author: Andrew Onishuk aonis...@hortonworks.com
Authored: Thu Apr 16 16:36:31 2015 +0300
Committer: Andrew Onishuk aonis...@hortonworks.com
Committed: Thu Apr 16 16:36:31 2015 +0300

--
 ambari-common/src/main/python/resource_management/core/sudo.py   | 4 ++--
 .../libraries/providers/modify_properties_file.py| 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e6a02eed/ambari-common/src/main/python/resource_management/core/sudo.py
--
diff --git a/ambari-common/src/main/python/resource_management/core/sudo.py 
b/ambari-common/src/main/python/resource_management/core/sudo.py
index d481ecc..38af963 100644
--- a/ambari-common/src/main/python/resource_management/core/sudo.py
+++ b/ambari-common/src/main/python/resource_management/core/sudo.py
@@ -65,7 +65,7 @@ def rmtree(path):
   shell.checked_call([rm,-rf, path], sudo=True)
   
 # fp.write replacement
-def create_file(filename, content, encoding='utf-8'):
+def create_file(filename, content, encoding=None):
   
   if content is None, create empty file
   
@@ -83,7 +83,7 @@ def create_file(filename, content, encoding='utf-8'):
   chmod(filename, 0644)
 
 # fp.read replacement
-def read_file(filename, encoding='utf-8'):
+def read_file(filename, encoding=None):
   tmpf = tempfile.NamedTemporaryFile()
   shell.checked_call([cp, -f, filename, tmpf.name], sudo=True)
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/e6a02eed/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py
 
b/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py
index 03d9028..a44ecd1 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py
@@ -38,7 +38,7 @@ class ModifyPropertiesFileProvider(Provider):
 new_content_lines = []
 
 if sudo.path_isfile(filename):
-  file_content = sudo.read_file(filename)
+  file_content = sudo.read_file(filename, encoding=self.resource.encoding)
   new_content_lines += file_content.split('\n')
 
   Logger.info(format(Modifying existing properties file: {filename}))



ambari git commit: AMBARI-10525 Clicking on default marker of slider widget sets a completely different value. (ababiichuk)

2015-04-16 Thread ababiichuk
Repository: ambari
Updated Branches:
  refs/heads/trunk d6659bcfd - 564df7166


AMBARI-10525 Clicking on default marker of slider widget sets a completely 
different value. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 564df71661715105d021ef00e50b87135bc82336
Parents: d6659bc
Author: aBabiichuk ababiic...@cybervisiontech.com
Authored: Thu Apr 16 17:31:08 2015 +0300
Committer: aBabiichuk ababiic...@cybervisiontech.com
Committed: Thu Apr 16 18:09:50 2015 +0300

--
 .../common/configs/widgets/slider_config_widget_view.js | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/564df716/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js 
b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
index 99824be..3e144bc 100644
--- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js
@@ -86,6 +86,16 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
 return step ? parseFunction(step) : this.get('unitType') === 'int' ? 1 : 
0.1;
   }.property('config.stackConfigProperty.valueAttributes.increment_step'),
 
+
+  /**
+   * Default value of config property transformed according widget format
+   * @returns {Number}
+   */
+  widgetDefaultValue: function() {
+var parseFunction = this.get('mirrorValueParseFunction');
+return 
parseFunction(this.widgetValueByConfigAttributes(this.get('config.defaultValue')));
+  }.property('config.defaultValue'),
+
   /**
* unit type of widget
* @type {String}
@@ -327,7 +337,7 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({
*/
   restoreValue: function () {
 this._super();
-this.get('slider').setValue();
+this.get('slider').setValue(this.get('widgetDefaultValue'));
   },
 
   /**



ambari git commit: AMBARI-10480 BE: Extend stack-advisor to recommend property_value_attributes for Hive/Tez (additional patch2) (dsen)

2015-04-16 Thread dsen
Repository: ambari
Updated Branches:
  refs/heads/trunk 746df034c - d6659bcfd


AMBARI-10480 BE: Extend stack-advisor to recommend property_value_attributes 
for Hive/Tez (additional patch2) (dsen)


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

Branch: refs/heads/trunk
Commit: d6659bcfdd0af160176499fc2f47be4f31002f3c
Parents: 746df03
Author: Dmytro Sen d...@apache.org
Authored: Thu Apr 16 18:05:40 2015 +0300
Committer: Dmytro Sen d...@apache.org
Committed: Thu Apr 16 18:05:40 2015 +0300

--
 .../src/main/resources/stacks/HDP/2.2/services/stack_advisor.py| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6659bcf/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index 41fd157..0c10f32 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -151,7 +151,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
   putHiveSiteProperty(hive.compactor.initiator.on, true)
   putHiveSiteProperty(hive.compactor.worker.threads, 1)
   putHiveSiteProperty(hive.enforce.bucketing, true)
-  putHiveSiteProperty(hive.exec.dynamic.partition.mode, nostrict)
+  putHiveSiteProperty(hive.exec.dynamic.partition.mode, nonstrict)
 else:
   putHiveSiteProperty(hive.txn.manager, 
org.apache.hadoop.hive.ql.lockmgr.DummyTxnManager)
   putHiveSiteProperty(hive.support.concurrency, false)



ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (part2) (jonathanhurley)

2015-04-16 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/trunk 40e4b807d - d3e647a90


AMBARI-10511 - Use Stack Table For Entity Relationships (part2) (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: d3e647a9020c09c90d9e211e706cd190d0eaff06
Parents: 40e4b80
Author: Jonathan Hurley jhur...@hortonworks.com
Authored: Thu Apr 16 12:00:32 2015 -0400
Committer: Jonathan Hurley jhur...@hortonworks.com
Committed: Thu Apr 16 12:12:23 2015 -0400

--
 .../java/org/apache/ambari/server/controller/AmbariServer.java  | 5 +
 .../server/controller/internal/BlueprintResourceProvider.java   | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e647a9/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 2451438..8b767d7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -47,6 +47,7 @@ import 
org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.Configuration;
 import 
org.apache.ambari.server.controller.internal.AbstractControllerResourceProvider;
 import 
org.apache.ambari.server.controller.internal.AmbariPrivilegeResourceProvider;
+import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
 import 
org.apache.ambari.server.controller.internal.ClusterPrivilegeResourceProvider;
 import org.apache.ambari.server.controller.internal.ClusterResourceProvider;
 import org.apache.ambari.server.controller.internal.PermissionResourceProvider;
@@ -67,6 +68,7 @@ import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.PrincipalDAO;
 import org.apache.ambari.server.orm.dao.PrivilegeDAO;
 import org.apache.ambari.server.orm.dao.ResourceDAO;
+import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
 import org.apache.ambari.server.orm.entities.MetainfoEntity;
@@ -601,6 +603,9 @@ public class AmbariServer {
 SecurityFilter.init(injector.getInstance(Configuration.class));
 StackDefinedPropertyProvider.init(injector);
 
AbstractControllerResourceProvider.init(injector.getInstance(ResourceProviderFactory.class));
+BlueprintResourceProvider.init(injector.getInstance(BlueprintDAO.class),
+injector.getInstance(StackDAO.class),
+injector.getInstance(Gson.class), ambariMetaInfo);
 StackDependencyResourceProvider.init(ambariMetaInfo);
 ClusterResourceProvider.init(injector.getInstance(BlueprintDAO.class), 
ambariMetaInfo, injector.getInstance(ConfigHelper.class));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d3e647a9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
index 29a95c4..03acd40 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
@@ -30,7 +30,6 @@ import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.DuplicateResourceException;
-import org.apache.ambari.server.StaticallyInject;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
@@ -61,7 +60,6 @@ import com.google.gson.Gson;
 /**
  * Resource Provider for Blueprint resources.
  */
-@StaticallyInject
 public class BlueprintResourceProvider extends BaseBlueprintProcessor {
 
   // - Property ID constants -



ambari git commit: AMBARI-10530. Syntax error in Ambari-DDL-Postgres-CREATE.sql (mpapirkovskyy)

2015-04-16 Thread mpapirkovskyy
Repository: ambari
Updated Branches:
  refs/heads/trunk 564df7166 - eb481241a


AMBARI-10530. Syntax error in Ambari-DDL-Postgres-CREATE.sql (mpapirkovskyy)


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

Branch: refs/heads/trunk
Commit: eb481241af9da6873b32436178fb2d64f3cd01b5
Parents: 564df71
Author: Myroslav Papirkovskyy mpapyrkovs...@hortonworks.com
Authored: Wed Apr 15 00:36:29 2015 +0300
Committer: Myroslav Papirkovskyy mpapyrkovs...@hortonworks.com
Committed: Wed Apr 15 00:36:29 2015 +0300

--
 ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/eb481241/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 2cec20a..252feea 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -582,7 +582,7 @@ CREATE TABLE widget_layout_user_widget (
 );
 
 CREATE TABLE artifact (
-  artifact_name VARCHAR(255) NOT NULL,bug33634
+  artifact_name VARCHAR(255) NOT NULL,
   artifact_data TEXT NOT NULL,
   foreign_keys VARCHAR(255) NOT NULL,
   PRIMARY KEY (artifact_name, foreign_keys));



ambari git commit: AMBARI-10531. Add Postgres support for Ranger.(vbrodetskyi)

2015-04-16 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/trunk eb481241a - 40e4b807d


AMBARI-10531. Add Postgres support for Ranger.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 40e4b807da25e9840108ad8b3552603573e2294e
Parents: eb48124
Author: Vitaly Brodetskyi vbrodets...@hortonworks.com
Authored: Thu Apr 16 19:03:54 2015 +0300
Committer: Vitaly Brodetskyi vbrodets...@hortonworks.com
Committed: Thu Apr 16 19:03:54 2015 +0300

--
 .../HBASE/0.96.0.2.0/package/scripts/params_linux.py | 6 ++
 .../HBASE/1.1.0.2.3/package/scripts/params_linux.py  | 6 ++
 .../HDFS/2.1.0.2.0/package/scripts/params_linux.py   | 6 ++
 .../HIVE/0.12.0.2.0/package/scripts/params_linux.py  | 6 ++
 .../common-services/KNOX/0.5.0.2.2/package/scripts/params.py | 6 ++
 .../common-services/RANGER/0.4.0/package/scripts/params.py   | 6 ++
 .../RANGER/0.4.0/package/scripts/setup_ranger.py | 4 
 .../STORM/0.9.1.2.1/package/scripts/params_linux.py  | 8 +++-
 8 files changed, 47 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/40e4b807/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
index f971f74..cabe713 100644
--- 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py
@@ -239,6 +239,12 @@ if xa_audit_db_flavor and xa_audit_db_flavor.lower() == 
'mysql':
 elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'oracle':
   jdbc_jar_name = ojdbc6.jar
   jdbc_symlink_name = oracle-jdbc-driver.jar
+elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'postgres':
+  jdbc_jar_name = postgresql.jar
+  jdbc_symlink_name = postgres-jdbc-driver.jar
+elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'sqlserver':
+  jdbc_jar_name = sqljdbc4.jar
+  jdbc_symlink_name = mssql-jdbc-driver.jar
 
 downloaded_custom_connector = format({exec_tmp_dir}/{jdbc_jar_name})
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/40e4b807/ambari-server/src/main/resources/common-services/HBASE/1.1.0.2.3/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HBASE/1.1.0.2.3/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HBASE/1.1.0.2.3/package/scripts/params_linux.py
index abde3f2..efca51a 100644
--- 
a/ambari-server/src/main/resources/common-services/HBASE/1.1.0.2.3/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HBASE/1.1.0.2.3/package/scripts/params_linux.py
@@ -242,6 +242,12 @@ if xa_audit_db_flavor and xa_audit_db_flavor.lower() == 
'mysql':
 elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'oracle':
   jdbc_jar_name = ojdbc6.jar
   jdbc_symlink_name = oracle-jdbc-driver.jar
+elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'postgres':
+  jdbc_jar_name = postgresql.jar
+  jdbc_symlink_name = postgres-jdbc-driver.jar
+elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'sqlserver':
+  jdbc_jar_name = sqljdbc4.jar
+  jdbc_symlink_name = mssql-jdbc-driver.jar
 
 downloaded_custom_connector = format({exec_tmp_dir}/{jdbc_jar_name})
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/40e4b807/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
index 2a13337..b0e100f 100644
--- 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py
@@ -392,6 +392,12 @@ if xa_audit_db_flavor and xa_audit_db_flavor.lower() == 
'mysql':
 elif xa_audit_db_flavor and xa_audit_db_flavor.lower() == 'oracle':
   jdbc_jar_name = ojdbc6.jar
   jdbc_symlink_name = oracle-jdbc-driver.jar
+elif xa_audit_db_flavor and 

ambari git commit: AMBARI-10532 Time interval spinner widget allowing setting of value larger than max. (ababiichuk)

2015-04-16 Thread ababiichuk
Repository: ambari
Updated Branches:
  refs/heads/trunk 39306bf58 - f618d5f53


AMBARI-10532 Time interval spinner widget allowing setting of value larger than 
max. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: f618d5f5363e6762e6d6ac52c934f17802175ba3
Parents: 39306bf
Author: aBabiichuk ababiic...@cybervisiontech.com
Authored: Thu Apr 16 19:01:56 2015 +0300
Committer: aBabiichuk ababiic...@cybervisiontech.com
Committed: Thu Apr 16 19:50:05 2015 +0300

--
 ambari-web/app/messages.js  |  2 +-
 .../app/templates/common/configs/widgets/controls.hbs   |  4 
 ambari-web/app/utils/number_utils.js|  2 +-
 .../configs/widgets/time_interval_spinner_view.js   | 12 ++--
 ambari-web/test/utils/number_utils_test.js  |  4 ++--
 5 files changed, 14 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f618d5f5/ambari-web/app/messages.js
--
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 45124e4..86a1b4b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2552,7 +2552,7 @@ Em.I18n.translations = {
 
   'number.validate.empty': 'cannot be empty',
   'number.validate.notValidNumber': 'not a valid number',
-  'number.validate.lessThanMinumum': 'value less than {0}',
+  'number.validate.lessThanMinimum': 'value less than {0}',
   'number.validate.moreThanMaximum': 'value greater than {0}',
 
   'common.combobox.placeholder': 'Filter...',

http://git-wip-us.apache.org/repos/asf/ambari/blob/f618d5f5/ambari-web/app/templates/common/configs/widgets/controls.hbs
--
diff --git a/ambari-web/app/templates/common/configs/widgets/controls.hbs 
b/ambari-web/app/templates/common/configs/widgets/controls.hbs
index 8bd1529..955d414 100644
--- a/ambari-web/app/templates/common/configs/widgets/controls.hbs
+++ b/ambari-web/app/templates/common/configs/widgets/controls.hbs
@@ -66,6 +66,10 @@
   {{/if}}
 {{/if}}
 
+{{#if view.config.errorMessage}}
+  p class=text-error{{view.config.errorMessage}}/p
+{{/if}}
+
 {{#if view.isComparison}}
   div class=widget-config-controls
   {{#if controller.selectedConfigGroup.isDefault}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f618d5f5/ambari-web/app/utils/number_utils.js
--
diff --git a/ambari-web/app/utils/number_utils.js 
b/ambari-web/app/utils/number_utils.js
index 85c38f6..b39496e 100644
--- a/ambari-web/app/utils/number_utils.js
+++ b/ambari-web/app/utils/number_utils.js
@@ -77,7 +77,7 @@ module.exports = {
   return Em.I18n.t('number.validate.notValidNumber');
 }
 if (!isNaN(min)  number  min) {
-  return Em.I18n.t('number.validate.lessThanMinumum').format(min);
+  return Em.I18n.t('number.validate.lessThanMinimum').format(min);
 }
 if (!isNaN(max)  number  max) {
   return Em.I18n.t('number.validate.moreThanMaximum').format(max);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f618d5f5/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js 
b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
index d3da7b6..d3e8f7e 100644
--- a/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
+++ b/ambari-web/app/views/common/configs/widgets/time_interval_spinner_view.js
@@ -155,8 +155,9 @@ App.TimeIntervalSpinnerView = App.ConfigWidgetView.extend({
 
   valueObserverCallback: function() {
 this.checkModified();
-this.checkErrors();
 this.setConfigValue();
+this.checkErrors();
+this.sendRequestRorDependentConfigs(this.get('config'));
   },
 
   /**
@@ -173,9 +174,9 @@ App.TimeIntervalSpinnerView = App.ConfigWidgetView.extend({
*/
   checkErrors: function() {
 var convertedValue = this.configValueByWidget(this.get('content'));
-var errorMessage = false;
+var errorMessage = '';
 if (convertedValue  
parseInt(this.get('config.stackConfigProperty.valueAttributes.minimum'))) {
-  errorMessage = 
Em.I18n.t('number.validate.lessThanMinumum').format(this.dateToText(this.get('minValue')));
+  errorMessage = 
Em.I18n.t('number.validate.lessThanMinimum').format(this.dateToText(this.get('minValue')));
 }
 else if 

ambari git commit: AMBARI-10539. Ambari adds PATH to own classpath. (mpapirkovskyy)

2015-04-16 Thread mpapirkovskyy
Repository: ambari
Updated Branches:
  refs/heads/trunk f618d5f53 - abb2fa1d5


AMBARI-10539. Ambari adds PATH to own classpath. (mpapirkovskyy)


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

Branch: refs/heads/trunk
Commit: abb2fa1d5f4cdd274f1c7934b1cc252601eadf98
Parents: f618d5f
Author: Myroslav Papirkovskyy mpapyrkovs...@hortonworks.com
Authored: Thu Apr 16 19:44:10 2015 +0300
Committer: Myroslav Papirkovskyy mpapyrkovs...@hortonworks.com
Committed: Thu Apr 16 19:53:16 2015 +0300

--
 ambari-server/sbin/ambari-server | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/abb2fa1d/ambari-server/sbin/ambari-server
--
diff --git a/ambari-server/sbin/ambari-server b/ambari-server/sbin/ambari-server
index 24c327a..7319ed5 100755
--- a/ambari-server/sbin/ambari-server
+++ b/ambari-server/sbin/ambari-server
@@ -36,7 +36,7 @@ case $1 in
 esac
 
 export PATH=/usr/lib/ambari-server/*:$PATH:/sbin/:/usr/sbin
-export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
+export AMBARI_CONF_DIR=/etc/ambari-server/conf
 
 # Because Ambari rpm unpacks modules here on all systems
 export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH



ambari git commit: AMBARI-10331. BE issue: install repo version is stuck in INSTALLING after sudden server restart (dlysnichenko)

2015-04-16 Thread dmitriusan
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.maint bb58fe921 - 7ba47fd23


AMBARI-10331. BE issue: install repo version is stuck in INSTALLING after 
sudden server restart (dlysnichenko)


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

Branch: refs/heads/branch-2.0.maint
Commit: 7ba47fd2379452ef70739b939b31bded4b41a78e
Parents: bb58fe9
Author: Lisnichenko Dmitro dlysniche...@hortonworks.com
Authored: Thu Apr 2 22:04:30 2015 +0300
Committer: Lisnichenko Dmitro dlysniche...@hortonworks.com
Committed: Thu Apr 16 20:09:56 2015 +0300

--
 .../server/actionmanager/ActionScheduler.java   | 53 ++--
 1 file changed, 39 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7ba47fd2/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 1a49289..9c16b10 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -579,6 +579,9 @@ class ActionScheduler implements Runnable {
   // Abort the command itself
   // We don't need to send CANCEL_COMMANDs in this case
   db.abortHostRole(host, s.getRequestId(), s.getStageId(), 
c.getRole(), message);
+  if (c.getRoleCommand().equals(RoleCommand.ACTIONEXECUTE)) {
+processActionDeath(cluster.getClusterName(), c.getHostname(), 
roleStr);
+  }
   status = HostRoleStatus.ABORTED;
 } else if (timeOutActionNeeded(status, s, hostObj, roleStr, now, 
commandTimeout)) {
   // Process command timeouts
@@ -591,6 +594,9 @@ class ActionScheduler implements Runnable {
 
 if (null != cluster) {
   transitionToFailedState(cluster.getClusterName(), 
c.getServiceName(), roleStr, host, now, false);
+  if (c.getRoleCommand().equals(RoleCommand.ACTIONEXECUTE)) {
+processActionDeath(cluster.getClusterName(), c.getHostname(), 
roleStr);
+  }
 }
 
 // Dequeue command
@@ -628,7 +634,13 @@ class ActionScheduler implements Runnable {
   for(ExecutionCommandWrapper wrapper : commandWrappers) {
 ExecutionCommand c = wrapper.getExecutionCommand();
 transitionToFailedState(stage.getClusterName(), c.getServiceName(),
-  c.getRole(), hostName, now, true);
+c.getRole(), hostName, now, true);
+if (c.getRoleCommand().equals(RoleCommand.ACTIONEXECUTE)) {
+  String clusterName = c.getClusterName();
+  processActionDeath(clusterName,
+  c.getHostname(),
+  c.getRole());
+}
   }
 }
 db.abortOperation(stage.getRequestId());
@@ -889,23 +901,36 @@ class ActionScheduler implements Runnable {
   // If host role is an Action, we have to send an event
   if (hostRoleCommand.getRoleCommand().equals(RoleCommand.ACTIONEXECUTE)) {
 String clusterName = 
hostRoleCommand.getExecutionCommandWrapper().getExecutionCommand().getClusterName();
-try {
-  // Usually clusterId is defined (except the awkward case when
-  // Distribute repositories/install packages action has been issued
-  // against a concrete host without binding to a cluster)
-  Long clusterId = clusterName != null ?
-  fsmObject.getCluster(clusterName).getClusterId() : null;
-  ActionFinalReportReceivedEvent event = new 
ActionFinalReportReceivedEvent(
-  clusterId, hostRoleCommand.getHostName(), null,
-  hostRoleCommand.getRole().name());
-  ambariEventPublisher.publish(event);
-} catch (AmbariException e) {
-  LOG.error(String.format(Can not get cluster %s, clusterName), e);
-}
+processActionDeath(clusterName,
+hostRoleCommand.getHostName(),
+hostRoleCommand.getRole().name());
   }
 }
   }
 
+
+  /**
+   * Attempts to process kill/timeout/abort of action and send
+   * appropriate event to all listeners
+   */
+  private void processActionDeath(String clusterName,
+  String hostname,
+  String role) {
+try {
+  // Usually clusterId is defined (except the awkward case when
+  // 

ambari git commit: AMBARI-10541. Toggle config entries chopped off and need color changes (onechiporenko)

2015-04-16 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk abb2fa1d5 - cb9fd8e3c


AMBARI-10541. Toggle config entries chopped off and need color changes 
(onechiporenko)


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

Branch: refs/heads/trunk
Commit: cb9fd8e3c44b05d808b15c9cf206a6e2ccc06f60
Parents: abb2fa1
Author: Oleg Nechiporenko onechipore...@apache.org
Authored: Thu Apr 16 20:15:09 2015 +0300
Committer: Oleg Nechiporenko onechipore...@apache.org
Committed: Thu Apr 16 20:15:09 2015 +0300

--
 ambari-web/app/mappers/configs/themes_mapper.js |  1 +
 ambari-web/app/styles/widgets.less  | 47 
 .../common/configs/widgets/controls.hbs |  2 +-
 .../widgets/toggle_config_widget_view.js| 25 ++-
 4 files changed, 72 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb9fd8e3/ambari-web/app/mappers/configs/themes_mapper.js
--
diff --git a/ambari-web/app/mappers/configs/themes_mapper.js 
b/ambari-web/app/mappers/configs/themes_mapper.js
index 7fde958..978d7e3 100644
--- a/ambari-web/app/mappers/configs/themes_mapper.js
+++ b/ambari-web/app/mappers/configs/themes_mapper.js
@@ -67,6 +67,7 @@ App.themesMapper = App.QuickDataMapper.create({
 }, this);
 
 App.store.loadMany(this.get(tabModel), tabs);
+App.store.commit();
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb9fd8e3/ambari-web/app/styles/widgets.less
--
diff --git a/ambari-web/app/styles/widgets.less 
b/ambari-web/app/styles/widgets.less
index 4af4e31..c052bd2 100644
--- a/ambari-web/app/styles/widgets.less
+++ b/ambari-web/app/styles/widgets.less
@@ -35,6 +35,11 @@
 @slider-widget-disabled-selection-background-color: 
lighten(@slider-widget-selection-background-color, 20%);
 @widget-config-override-action-color: #cbcbcb;
 @widget-config-override-action-active-color: #acacac;
+@toggle-widget-handle-background-color: #f3f3f3;
+@toggle-widget-text-color: #fff;
+@toggle-widget-text-size: 12px;
+@toggle-widget-on-background-color: #aaa;
+@toggle-widget-off-background-color: @green;
 
 .widget-config {
   .widget-config {
@@ -250,6 +255,48 @@
   .undo-button {
 margin-left: @undo-btn-margin;
   }
+
+  .bootstrap-switch {
+,
+.bootstrap-switch-focused {
+  border-color: transparent;
+  box-shadow: none;
+}
+
+.bootstrap-switch-label {
+  background-color: @toggle-widget-handle-background-color;
+  background-image: none;
+  text-shadow: none;
+  border-width: 0;
+  padding: 2px 8px;
+  border-left: 1px solid transparent;
+  border-right: 1px solid transparent;
+  border-bottom: 1px solid @toggle-widget-handle-background-color;
+}
+
+.bootstrap-switch-handle-on,
+.bootstrap-switch-handle-off {
+  color: @toggle-widget-text-color;
+  font-size: @toggle-widget-text-size;
+  background-image: none;
+  text-shadow: none;
+  border: none;
+  padding: 2px 0;
+
+  :hover {
+text-shadow: none;
+color: @toggle-widget-text-color;
+  }
+
+  .bootstrap-switch-default {
+background-color: @toggle-widget-on-background-color;
+  }
+
+  .bootstrap-switch-success {
+background-color: @toggle-widget-off-background-color;
+  }
+}
+  }
 }
 
 .combo-widget {

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb9fd8e3/ambari-web/app/templates/common/configs/widgets/controls.hbs
--
diff --git a/ambari-web/app/templates/common/configs/widgets/controls.hbs 
b/ambari-web/app/templates/common/configs/widgets/controls.hbs
index 955d414..3889ecc 100644
--- a/ambari-web/app/templates/common/configs/widgets/controls.hbs
+++ b/ambari-web/app/templates/common/configs/widgets/controls.hbs
@@ -48,7 +48,7 @@
 {{/unless}}
 {{#if view.config.isNotDefaultValue}}
   {{#if view.undoAllowed}}
-a class=btn btn-small href=# {{action restoreValue 
target=view}}
+a class=widget-action widget-action-undo href=# {{action 
restoreValue target=view}}
   i class=icon-undo/i
 /a
   {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb9fd8e3/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js 
b/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js

ambari git commit: AMBARI-10521. Toggling 'ACID Transactions' config does not update depended_by configs (onechiporenko)

2015-04-16 Thread onechiporenko
Repository: ambari
Updated Branches:
  refs/heads/trunk d3e647a90 - 39306bf58


AMBARI-10521. Toggling 'ACID Transactions' config does not update depended_by 
configs (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 39306bf5817070377e7206e0d6e6fd4b074a9813
Parents: d3e647a
Author: Oleg Nechiporenko onechipore...@apache.org
Authored: Thu Apr 16 19:41:15 2015 +0300
Committer: Oleg Nechiporenko onechipore...@apache.org
Committed: Thu Apr 16 19:41:15 2015 +0300

--
 .../widgets/toggle_config_widget_view.js| 25 
 .../widgets/toggle_config_widget_view_test.js   | 19 ---
 2 files changed, 31 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/39306bf5/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
--
diff --git 
a/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js 
b/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
index 8e002e3..059257b 100644
--- a/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/toggle_config_widget_view.js
@@ -44,23 +44,23 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
 
   /**
* Update config value using codeswitcherValue/code.
-   * switcherValue is boolean, but config value should be a string 
'true'|'false'.
+   * switcherValue is boolean, but config value should be a string.
*
* @method updateConfigValue
*/
   updateConfigValue: function () {
-this.set('config.value', '' + this.get('switcherValue'));
+this.set('config.value', 
this.get('config.stackConfigProperty.valueAttributes.entries')[this.get('switcherValue')
 ? 0 : 1].value);
   },
 
   /**
* Get value for codeswitcherValue/code (boolean) using 
codeconfig.value/code (string).
*
* @param configValue
-   * @returns {boolean} true for 'true', false for 'false'
+   * @returns {boolean}
* @method getNewSwitcherValue
*/
   getNewSwitcherValue: function (configValue) {
-return 'true' === configValue;
+return 
this.get('config.stackConfigProperty.valueAttributes.entries')[0].value === '' 
+ configValue;
   },
 
   didInsertElement: function () {
@@ -71,11 +71,25 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
   this.toggleWidgetState();
   this.initPopover();
 }.bind(this), 10);
-this.addObserver('switcherValue', this.updateConfigValue);
+this.addObserver('switcherValue', this, this.updateConfigValue);
 this._super();
   },
 
   /**
+   * Value may be changed after recommendations are received
+   * So, switcher should be updated too
+   *
+   * @method setValue
+   */
+  setValue: function (configValue) {
+var value = this.getNewSwitcherValue(configValue);
+if (this.get('switcherValue') !== value) {
+  this.get('switcher').bootstrapSwitch('toggleState', value);
+  this.set('switcherValue', value);
+}
+  },
+
+  /**
* Init switcher plugin.
*
* @method initSwitcher
@@ -83,6 +97,7 @@ App.ToggleConfigWidgetView = App.ConfigWidgetView.extend({
   initSwitcher: function () {
 var labels = 
this.get('config.stackConfigProperty.valueAttributes.entries'),
   self = this;
+Em.assert('toggle for `' + this.get('config.name') + '` should contain two 
entries', labels.length === 2);
 if (this.$()) {
   var switcher = this.$(input).bootstrapSwitch({
 onText: labels[0].label,

http://git-wip-us.apache.org/repos/asf/ambari/blob/39306bf5/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
--
diff --git 
a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
 
b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
index d048472..98e974b 100644
--- 
a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
+++ 
b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
@@ -27,13 +27,16 @@ describe('App.ToggleConfigWidgetView', function () {
   initPopover: Em.K,
   config: Em.Object.create({
 name: 'a.b.c',
-value: 'true',
-defaultValue: 'true',
+value: 'active',
+defaultValue: 'active',
 stackConfigProperty: Em.Object.create({
   valueAttributes: {
 type: value-list,
-entries: [true, false],
-entry_labels: [Active, Inactive],
+   

[1/8] ambari git commit: AMBARI-10511 - Use Stack Table For Entity Relationships (jonathanhurley)

2015-04-16 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/trunk e6a02eed7 - 746df034c


http://git-wip-us.apache.org/repos/asf/ambari/blob/746df034/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java
index aa9d26b..19c0c7f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java
@@ -34,6 +34,7 @@ import org.apache.ambari.server.orm.entities.ResourceEntity;
 import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
 import 
org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity;
 import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
+import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.State;
 
@@ -51,11 +52,11 @@ public class UpgradeCatalogHelper {
*
* @param injector
* @param clusterName
-   * @param desiredStackVersion
+   * @param desiredStackEntity
* @return
*/
   protected ClusterEntity createCluster(Injector injector, String clusterName,
-  String desiredStackVersion) {
+  StackEntity desiredStackEntity) {
 ResourceTypeDAO resourceTypeDAO = 
injector.getInstance(ResourceTypeDAO.class);
 
 // create an admin resource to represent this cluster
@@ -74,9 +75,10 @@ public class UpgradeCatalogHelper {
 ClusterEntity clusterEntity = new ClusterEntity();
 clusterEntity.setClusterId(1L);
 clusterEntity.setClusterName(clusterName);
-clusterEntity.setDesiredStackVersion(desiredStackVersion);
+clusterEntity.setDesiredStack(desiredStackEntity);
 clusterEntity.setProvisioningState(State.INIT);
 clusterEntity.setResource(resourceEntity);
+
 clusterDAO.create(clusterEntity);
 return clusterEntity;
   }
@@ -107,19 +109,19 @@ public class UpgradeCatalogHelper {
* @param injector
* @param clusterEntity
* @param serviceName
-   * @param desiredStackVersion
+   * @param desiredStackEntity
* @return
*/
   protected ClusterServiceEntity addService(Injector injector,
   ClusterEntity clusterEntity, String serviceName,
-  String desiredStackVersion) {
+  StackEntity desiredStackEntity) {
 ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class);
 
 ClusterServiceEntity clusterServiceEntity = createService(injector,
 clusterEntity, serviceName);
 
 ServiceDesiredStateEntity serviceDesiredStateEntity = new 
ServiceDesiredStateEntity();
-serviceDesiredStateEntity.setDesiredStackVersion(desiredStackVersion);
+serviceDesiredStateEntity.setDesiredStack(desiredStackEntity);
 serviceDesiredStateEntity.setClusterId(1L);
 serviceDesiredStateEntity.setServiceName(serviceName);
 serviceDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
@@ -161,17 +163,17 @@ public class UpgradeCatalogHelper {
* @param clusterServiceEntity
* @param hostEntity
* @param componentName
-   * @param desiredStackVersion
+   * @param desiredStackEntity
*/
   @Transactional
   protected void addComponent(Injector injector, ClusterEntity clusterEntity,
   ClusterServiceEntity clusterServiceEntity, HostEntity hostEntity,
-  String componentName, String desiredStackVersion) {
+  String componentName, StackEntity desiredStackEntity) {
 ServiceComponentDesiredStateEntity componentDesiredStateEntity = new 
ServiceComponentDesiredStateEntity();
 componentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
 componentDesiredStateEntity.setComponentName(componentName);
 
componentDesiredStateEntity.setServiceName(clusterServiceEntity.getServiceName());
-componentDesiredStateEntity.setDesiredStackVersion(desiredStackVersion);
+componentDesiredStateEntity.setDesiredStack(desiredStackEntity);
 componentDesiredStateEntity.setClusterServiceEntity(clusterServiceEntity);
 
componentDesiredStateEntity.setClusterId(clusterServiceEntity.getClusterId());
 
@@ -183,6 +185,7 @@ public class UpgradeCatalogHelper {
 
hostComponentDesiredStateEntity.setAdminState(HostComponentAdminState.INSERVICE);
 
hostComponentDesiredStateEntity.setServiceComponentDesiredStateEntity(componentDesiredStateEntity);
 hostComponentDesiredStateEntity.setHostEntity(hostEntity);
+hostComponentDesiredStateEntity.setDesiredStack(desiredStackEntity);
 hostComponentDesiredStateDAO.create(hostComponentDesiredStateEntity);
 
 HostComponentStateEntity hostComponentStateEntity = new 
HostComponentStateEntity();
@@ -190,8 +193,9 @@ public class UpgradeCatalogHelper {
 

[2/2] ambari git commit: AMBARI-10526. Provide Visual Que for Permission Denied operations (alexantonenko)

2015-04-16 Thread alexantonenko
AMBARI-10526. Provide Visual Que for Permission Denied operations 
(alexantonenko)


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

Branch: refs/heads/trunk
Commit: 035af842c48548f1107a1bbee27e87d6f95f1cfd
Parents: cb9fd8e
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 17:50:24 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 20:39:25 2015 +0300

--
 .../files/src/main/resources/ui/app/adapter.js  |  6 +--
 .../ui/app/components/toggleContext.js  | 27 ++-
 .../resources/ui/app/components/uploader.js | 50 
 .../main/resources/ui/app/controllers/files.js  |  8 ++--
 .../ui/app/templates/components/mkdirInput.hbs  |  2 +-
 .../main/resources/ui/app/templates/files.hbs   |  6 +--
 .../resources/ui/app/templates/util/fileRow.hbs |  4 +-
 7 files changed, 67 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/adapter.js
--
diff --git a/contrib/views/files/src/main/resources/ui/app/adapter.js 
b/contrib/views/files/src/main/resources/ui/app/adapter.js
index b181854..1c13b3d 100644
--- a/contrib/views/files/src/main/resources/ui/app/adapter.js
+++ b/contrib/views/files/src/main/resources/ui/app/adapter.js
@@ -56,7 +56,7 @@ function _listdir(adapter, store, type, query, recordArray) {
   label = ;
 
   return Ember.RSVP.Promise.cast(promise, label).then(function(adapterPayload) 
{
-var payload = serializer.extractArray(store, type, adapterPayload);
+var payload = serializer.extract(store, type, adapterPayload, null, 
'findAll');
 
 Ember.assert(The response from a findQuery must be an Array, not  + 
Ember.inspect(payload), Ember.typeOf(payload) === 'array');
 
@@ -284,10 +284,6 @@ App.ApplicationStore = DS.Store.extend({
 
 App.FileSerializer = DS.RESTSerializer.extend({
   primaryKey:'path',
-  extractArray: function(store, type, payload, id, requestType) {
-payload = {'files': payload};
-return this._super(store, type, payload, id, requestType);
-  },
   extractSingle: function(store, type, payload, id, requestType) {
 payload = {'files': payload};
 return this._super(store, type, payload, id, requestType);

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
--
diff --git 
a/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js 
b/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
index 65735ba..31f1e27 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
+++ b/contrib/views/files/src/main/resources/ui/app/components/toggleContext.js
@@ -18,6 +18,15 @@
 
 var App = require('app');
 
+function _shake (element) {
+  var l = 5;
+  for ( var i = 0; i  4; i++ ) {
+element.animate( (l0) ? 
{'margin-left':(l=-l)+'px','padding-left':0}:{'padding-left':+(l=-l)+'px','margin-left':0},
 50, function (el) {
+  element.css({'padding-left':0,'margin-left':0});
+});
+  }
+}
+
 App.ToggleContextComponent = Em.Component.extend({
   didInsertElement:function () {
 var fileRow = this.$().parents('tr'),
@@ -46,7 +55,11 @@ App.ToggleContextComponent = Em.Component.extend({
   },
   openOnClick:function (e) {
 if($(e.target).is('td') || $(e.target).hasClass('allow-open')){
-  this.get('targetObject').send('open');
+  if (this.get('targetObject.content.readAccess')) {
+this.get('targetObject').send('open');
+  } else {
+_shake(this.$().parents('.file-row').find('.file-name span').first());
+  }
 }
   },
   willClearRender:function () {
@@ -55,3 +68,15 @@ App.ToggleContextComponent = Em.Component.extend({
 fileRow.data('context').destroy();
   }
 });
+
+App.FileShakerComponent = Em.Component.extend({
+  action:'',
+  isValid:false,
+  click:function () {
+if (this.get('isValid')) {
+  this.sendAction('action');
+} else {
+  _shake(this.$());
+}
+  }
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/035af842/contrib/views/files/src/main/resources/ui/app/components/uploader.js
--
diff --git 
a/contrib/views/files/src/main/resources/ui/app/components/uploader.js 
b/contrib/views/files/src/main/resources/ui/app/components/uploader.js
index 919e4dd..9e413e0 100644
--- a/contrib/views/files/src/main/resources/ui/app/components/uploader.js
+++ 

[1/2] ambari git commit: AMBARI-10527. Pig View: Can`t delete script from table (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk cb9fd8e3c - d835f4485


AMBARI-10527. Pig View: Can`t delete script from table (alexantonenko)


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

Branch: refs/heads/trunk
Commit: d835f4485006c1684e247f3a1baca8f2c10ab035
Parents: 035af84
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 18:17:10 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 20:39:25 2015 +0300

--
 .../ui/pig-web/app/components/scriptListRow.js  | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d835f448/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
--
diff --git 
a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
 
b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
index 3dc67ca..445fc91 100644
--- 
a/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
+++ 
b/contrib/views/pig/src/main/resources/ui/pig-web/app/components/scriptListRow.js
@@ -38,5 +38,15 @@ App.ScriptListRowComponent = Em.Component.extend({
   return job.get('id') == jobId;
 });
 return scriptJob.get('firstObject');
-  }.property('currentJobId','scriptJobs')
+  }.property('currentJobId','scriptJobs'),
+  copyAction:'copyScript',
+  deleteAction:'deletescript',
+  actions:{
+copyScript: function(script){
+  this.sendAction('copyAction',script);
+},
+deletescript: function(script){
+  this.sendAction('deleteAction',script);
+}
+  }
 });



ambari git commit: AMBARI-10537. Service Actions menu: after page refresh, slaves rolling restart and download configs items appear with delay (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk d835f4485 - 34e60b07f


AMBARI-10537. Service Actions menu: after page refresh, slaves rolling restart 
and download configs items appear with delay (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 34e60b07ff340f786b4e73a36959e6974d5bed8b
Parents: d835f44
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 20:50:19 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 20:50:19 2015 +0300

--
 .../app/controllers/global/update_controller.js |  1 +
 ambari-web/app/controllers/main/service/item.js |  2 +
 ambari-web/app/routes/main.js   |  1 +
 .../app/views/main/service/info/summary.js  |  4 --
 ambari-web/app/views/main/service/item.js   |  4 +-
 ambari-web/test/views/main/service/item_test.js | 50 
 6 files changed, 57 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/controllers/global/update_controller.js
--
diff --git a/ambari-web/app/controllers/global/update_controller.js 
b/ambari-web/app/controllers/global/update_controller.js
index 6b58ebd..f81a079 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -407,6 +407,7 @@ App.UpdateController = Em.Controller.extend({
 };
 App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, {
   complete: function () {
+App.set('router.mainServiceItemController.isServicesInfoLoaded', 
App.get('router.clusterController.isLoaded'));
 callback();
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/controllers/main/service/item.js
--
diff --git a/ambari-web/app/controllers/main/service/item.js 
b/ambari-web/app/controllers/main/service/item.js
index 4518efb..3497be2 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -45,6 +45,8 @@ App.MainServiceItemController = Em.Controller.extend({
 }
   },
 
+  isServicesInfoLoaded: false,
+
   initHosts: function() {
 if (App.get('components.masters').length !== 0) {
   var self = this;

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/routes/main.js
--
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 4913733..3734653 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -614,6 +614,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
 route: '/summary',
 connectOutlets: function (router, context) {
   var item = router.get('mainServiceItemController.content');
+  router.get('updateController').updateServiceMetric(Em.K);
   //if service is not existed then route to default service
   if (item.get('isLoaded')) {
 
router.get('mainServiceItemController').connectOutlet('mainServiceInfoSummary', 
item);

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/views/main/service/info/summary.js
--
diff --git a/ambari-web/app/views/main/service/info/summary.js 
b/ambari-web/app/views/main/service/info/summary.js
index 84638f5..af3e359 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -526,10 +526,6 @@ App.MainServiceInfoSummaryView = 
Em.View.extend(App.UserPref, {
 return gangliaUrl;
   }.property('App.router.clusterController.gangliaUrl', 'service.serviceName'),
 
-  willInsertElement: function () {
-App.router.get('updateController').updateServiceMetric(Em.K);
-  },
-
   didInsertElement: function () {
 var svcName = this.get('service.serviceName');
 var isMetricsSupported = svcName != 'STORM' || 
App.get('isStormMetricsSupported');

http://git-wip-us.apache.org/repos/asf/ambari/blob/34e60b07/ambari-web/app/views/main/service/item.js
--
diff --git a/ambari-web/app/views/main/service/item.js 
b/ambari-web/app/views/main/service/item.js
index 485695d..1abac49 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -96,7 +96,7 @@ App.MainServiceItemView = Em.View.extend({
   

ambari git commit: AMBARI-10533. Admin View About says 2.0.0 (and links to Admin View are hardcoded to 2.0.0) (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 34e60b07f - ecaf2d15f


AMBARI-10533. Admin View About says 2.0.0 (and links to Admin View are 
hardcoded to 2.0.0) (alexantonenko)


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

Branch: refs/heads/trunk
Commit: ecaf2d15f3657ca53625434bbfcce2c36fbaf4b4
Parents: 34e60b0
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 21:06:52 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 21:06:52 2015 +0300

--
 .../assets/data/cluster/ambariServerInfo.json   |  7 +++
 .../main/resources/ui/admin-web/app/index.html  |  1 +
 .../app/scripts/controllers/mainCtrl.js | 23 
 .../admin-web/app/scripts/services/Component.js | 30 +++
 .../admin-web/app/views/modals/AboutModal.html  |  4 +-
 .../test/unit/services/Component_test.js| 56 
 ambari-web/app/router.js| 28 +++---
 .../main/admin/stack_upgrade/versions_view.js   |  7 ++-
 ambari-web/test/router_test.js  | 38 +
 .../admin/stack_upgrade/version_view_test.js| 14 -
 10 files changed, 188 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ecaf2d15/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
--
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
 
b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
new file mode 100644
index 000..bddc249
--- /dev/null
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/assets/data/cluster/ambariServerInfo.json
@@ -0,0 +1,7 @@
+{
+  RootServiceComponents : {
+component_name : AMBARI_SERVER,
+component_version : 2.0.0,
+service_name : AMBARI
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecaf2d15/ambari-admin/src/main/resources/ui/admin-web/app/index.html
--
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html 
b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index 17a1dc9..ca2ae8b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -146,6 +146,7 @@
 script src=scripts/services/User.js/script
 script src=scripts/services/Group.js/script
 script src=scripts/services/View.js/script
+script src=scripts/services/Component.js/script
 script src=scripts/services/Cluster.js/script
 script src=scripts/services/Alert.js/script
 script src=scripts/services/PermissionLoader.js/script

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecaf2d15/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
--
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
index baec0cf..1bdfe05 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
@@ -18,7 +18,7 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 
'Cluster', 'View', function($scope, $window, Auth, Alert, $modal, Cluster, 
View) {
+.controller('MainCtrl',['$scope', '$window','Auth', 'Alert', '$modal', 
'Cluster', 'Component', 'View', function($scope, $window, Auth, Alert, $modal, 
Cluster, Component, View) {
   $scope.signOut = function() {
 var data = JSON.parse(localStorage.ambari);
 delete data.app.authenticated;
@@ -31,14 +31,19 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.about = function() {
-   var modalInstance = $modal.open({
-   templateUrl:'views/modals/AboutModal.html',
-   controller: ['$scope', function($scope) {
-   $scope.ok = function() {
-   modalInstance.close();
-   };
-   }]
-   });
+Component.getAmbariServer().then(function(component) {
+  var modalInstance = $modal.open({
+templateUrl:'views/modals/AboutModal.html',
+controller: ['$scope', function($scope) {
+  $scope.component = component;
+  $scope.ok = function() {
+ 

ambari git commit: AMBARI-10545. A couple environment varibles are missing for NFS Gateway. (jaimin)

2015-04-16 Thread jaimin
Repository: ambari
Updated Branches:
  refs/heads/trunk 6dae33e54 - 3c2fa88f5


AMBARI-10545. A couple environment varibles are missing for NFS Gateway. 
(jaimin)


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

Branch: refs/heads/trunk
Commit: 3c2fa88f54ab794e069d729c61c3dbb39407a1a9
Parents: 6dae33e
Author: Jaimin Jetly jai...@hortonworks.com
Authored: Thu Apr 16 14:06:04 2015 -0700
Committer: Jaimin Jetly jai...@hortonworks.com
Committed: Thu Apr 16 14:06:04 2015 -0700

--
 .../HDFS/2.1.0.2.0/package/scripts/utils.py | 24 
 .../python/stacks/2.0.6/HDFS/test_nfsgateway.py | 20 +---
 2 files changed, 27 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c2fa88f/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
index 156a0ed..217f2f0 100644
--- 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
+++ 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py
@@ -150,19 +150,19 @@ def service(action=None, name=None, user=None, 
options=, create_pid_dir=False,
   hadoop_env_exports = {
 'HADOOP_LIBEXEC_DIR': params.hadoop_libexec_dir
   }
+  log_dir = format({hdfs_log_dir_prefix}/{user})
+
   # NFS GATEWAY is always started by root using jsvc due to rpcbind bugs
   # on Linux such as CentOS6.2. 
https://bugzilla.redhat.com/show_bug.cgi?id=731542
   if name == nfs3 :
-pid_file = format(
-  {hadoop_pid_dir_prefix}/root/hadoop_privileged_nfs3.pid)
-
-print pid_file
+pid_file = format({pid_dir}/hadoop_privileged_nfs3.pid)
 custom_export = {
-  'HADOOP_PRIVILEGED_NFS_USER': params.hdfs_user
+  'HADOOP_PRIVILEGED_NFS_USER': params.hdfs_user,
+  'HADOOP_PRIVILEGED_NFS_PID_DIR': pid_dir,
+  'HADOOP_PRIVILEGED_NFS_LOG_DIR': log_dir
 }
 hadoop_env_exports.update(custom_export)
 
-  log_dir = format({hdfs_log_dir_prefix}/{user})
   check_process = format(
 ls {pid_file} /dev/null 21 
  ps -p `cat {pid_file}` /dev/null 21)
@@ -172,9 +172,15 @@ def service(action=None, name=None, user=None, options=, 
create_pid_dir=False,
   owner=user,
   recursive=True)
   if create_log_dir:
-Directory(log_dir,
-  owner=user,
-  recursive=True)
+if name == nfs3:
+  Directory(log_dir,
+mode=0775,
+owner=params.root_user,
+group=params.user_group)
+else:
+  Directory(log_dir,
+owner=user,
+recursive=True)
 
   if params.security_enabled and name == datanode:
 ## The directory where pid files are stored in the secure data environment.

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c2fa88f/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
--
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py 
b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
index e58f7be..d683198 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_nfsgateway.py
@@ -61,14 +61,15 @@ class TestNFSGateway(RMFTestCase):
   )
 self.assertResourceCalled('Directory', '/var/log/hadoop/root',
   owner = 'root',
-  recursive = True,
+  group = 'hadoop',
+  mode = 0775
   )
 self.assertResourceCalled('File', 
'/var/run/hadoop/root/hadoop_privileged_nfs3.pid',
   action = ['delete'],
   not_if='ls 
/var/run/hadoop/root/hadoop_privileged_nfs3.pid /dev/null 21  ps -p `cat 
/var/run/hadoop/root/hadoop_privileged_nfs3.pid` /dev/null 21',
   )
 self.assertResourceCalled('Execute', ambari-sudo.sh [RMF_ENV_PLACEHOLDER] 
-H -E /usr/lib/hadoop/sbin/hadoop-daemon.sh --config /etc/hadoop/conf start 
nfs3,
-environment = {'HADOOP_LIBEXEC_DIR': '/usr/lib/hadoop/libexec', 
'HADOOP_PRIVILEGED_NFS_USER': 'hdfs'},
+environment = {'HADOOP_LIBEXEC_DIR': '/usr/lib/hadoop/libexec', 
'HADOOP_PRIVILEGED_NFS_USER': 

[2/2] ambari git commit: AMBARI-10547. Integrate displaying defined Number widget type from the API on service summary page. (jaimin)

2015-04-16 Thread jaimin
AMBARI-10547. Integrate displaying defined Number widget type from the API on 
service summary page. (jaimin)


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

Branch: refs/heads/trunk
Commit: 6dae33e54caeb42cf3bda5f8b8c88e1917f5b73d
Parents: c7e310d
Author: Jaimin Jetly jai...@hortonworks.com
Authored: Thu Apr 16 13:14:56 2015 -0700
Committer: Jaimin Jetly jai...@hortonworks.com
Committed: Thu Apr 16 13:14:56 2015 -0700

--
 .../HBASE/0.96.0.2.0/metrics.json   |  14 +-
 .../HBASE/0.96.0.2.0/widgets.json   |  12 +-
 .../HBASE/1.1.0.2.3/metrics.json|  27 +-
 .../HBASE/1.1.0.2.3/widgets.json| 598 +--
 .../stacks/HDP/2.3/services/HBASE/widgets.json  | 434 ++
 .../widget_layouts/HBASE/default_dashboard.json | 278 +
 ambari-web/app/config.js|   1 +
 .../controllers/main/service/info/summary.js| 116 ++--
 ambari-web/app/mappers/stack_service_mapper.js  |   2 +-
 ambari-web/app/mappers/widget_layout_mapper.js  |  54 +-
 ambari-web/app/mappers/widget_mapper.js |   4 +-
 ambari-web/app/mixins/common/widget_mixin.js| 238 
 ambari-web/app/models/widget.js |  10 +-
 ambari-web/app/models/widget_layout.js  |   3 +-
 .../app/templates/main/service/info/summary.hbs |   4 +-
 ambari-web/app/utils/ajax/ajax.js   |   9 +-
 .../views/common/widget/graph_widget_view.js|  35 +-
 .../app/views/main/service/info/summary.js  |  54 +-
 .../main/service/info/summary_test.js   |  72 +--
 .../test/mappers/stack_service_mapper_test.js   |   2 +-
 .../test/mixins/common/widget_mixin_test.js |  36 +-
 21 files changed, 1378 insertions(+), 625 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
--
diff --git 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
index 627667b..84efc2f 100644
--- 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
+++ 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
@@ -797,32 +797,32 @@
 },
 metrics/hbase/regionserver/Server/Get_95th_percentile: {
   metric: regionserver.Server.Get_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/ScanNext_95th_percentile: {
   metric: regionserver.Server.ScanNext_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/Mutate_95th_percentile: {
   metric: regionserver.Server.Mutate_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/Increment_95th_percentile: {
   metric: regionserver.Server.Increment_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/Append_95th_percentile: {
   metric: regionserver.Server.Append_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/Delete_95th_percentile: {
   metric: regionserver.Server.Delete_95th_percentile,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/Server/percentFilesLocal: {
@@ -1837,7 +1837,7 @@
 },
 metrics/hbase/regionserver/percentFilesLocal: {
   metric: regionserver.Server.percentFilesLocal,
-  pointInTime: false,
+  pointInTime: true,
   temporal: true
 },
 metrics/hbase/regionserver/fsWriteLatency_avg_time: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
--
diff --git 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
 

[1/2] ambari git commit: AMBARI-10547. Integrate displaying defined Number widget type from the API on service summary page. (jaimin)

2015-04-16 Thread jaimin
Repository: ambari
Updated Branches:
  refs/heads/trunk c7e310d62 - 6dae33e54


http://git-wip-us.apache.org/repos/asf/ambari/blob/6dae33e5/ambari-web/app/mixins/common/widget_mixin.js
--
diff --git a/ambari-web/app/mixins/common/widget_mixin.js 
b/ambari-web/app/mixins/common/widget_mixin.js
index 48fbf8f..7667bf4 100644
--- a/ambari-web/app/mixins/common/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widget_mixin.js
@@ -24,13 +24,13 @@ App.WidgetMixin = Ember.Mixin.create({
* @type {RegExp}
* @const
*/
-  EXPRESSION_REGEX: /\$\{([\w\.\+\-\*\/\(\)\:\=\[\]]*)\}/g,
+  EXPRESSION_REGEX: /\$\{([\w\s\.\,\+\-\*\/\(\)\:\=\[\]]*)\}/g,
 
   /**
* @type {RegExp}
* @const
*/
-  MATH_EXPRESSION_REGEX: /^[\d\+\-\*\/\(\)\.]+$/,
+  MATH_EXPRESSION_REGEX: /^[\d\s\+\-\*\/\(\)\.]+$/,
 
   /**
* @type {RegExp}
@@ -59,36 +59,15 @@ App.WidgetMixin = Ember.Mixin.create({
 this.loadMetrics();
   },
 
-  /**
-   * draw widget
-   */
-  drawWidget: function () {
-if (this.get('isLoaded')) {
-  this.calculateValues();
-  this.set('value', this.get('content.values')[0]  
this.get('content.values')[0].computedValue);
-}
-  },
-
-  /**
-   * callback on metrics loaded
-   */
-  onMetricsLoaded: function () {
-var self = this;
-this.set('isLoaded', true);
-this.drawWidget();
-setTimeout(function() {
-  self.loadMetrics();
-}, App.contentUpdateInterval);
-  },
 
   /**
* load metrics
*/
   loadMetrics: function () {
 var requestData = this.getRequestData(this.get('content.metrics')),
-request,
-requestCounter = 0,
-self = this;
+  request,
+  requestCounter = 0,
+  self = this;
 
 for (var i in requestData) {
   request = requestData[i];
@@ -108,23 +87,106 @@ App.WidgetMixin = Ember.Mixin.create({
   },
 
   /**
-   * extract expressions
-   * Example:
-   *  input: ${a/b} equal ${b+a}
-   *  expressions: ['a/b', 'b+a']
-   *
-   * @param {object} input
-   * @returns {Array}
+   * get data formatted for request
+   * @param {Array} metrics
*/
-  extractExpressions: function (input) {
-var pattern = this.get('EXPRESSION_REGEX'),
-  expressions = [],
-  match;
+  getRequestData: function (metrics) {
+var requestsData = {};
 
-while (match = pattern.exec(input.value)) {
-  expressions.push(match[1]);
+metrics.forEach(function (metric, index) {
+  var key;
+  if (metric.host_component_criteria) {
+key = metric.service_name + '_' + metric.component_name + '_' + 
metric.host_component_criteria;
+  } else {
+key = metric.service_name + '_' + metric.component_name;
+  }
+  var requestMetric = $.extend({}, metric);
+
+  if (requestsData[key]) {
+requestsData[key][metric_paths].push(requestMetric[metric_path]);
+  } else {
+requestMetric[metric_paths] = [requestMetric[metric_path]];
+delete requestMetric[metric_path];
+requestsData[key] = requestMetric;
+  }
+}, this);
+return requestsData;
+  },
+
+  /**
+   * make GET call to server in order to fetch service-component metrics
+   * @param {object} request
+   * @returns {$.ajax}
+   */
+  getServiceComponentMetrics: function (request) {
+return App.ajax.send({
+  name: 'widgets.serviceComponent.metrics.get',
+  sender: this,
+  data: {
+serviceName: request.service_name,
+componentName: request.component_name,
+metricPaths: request.metric_paths.join(',')
+  },
+  success: 'getMetricsSuccessCallback'
+});
+  },
+
+  /**
+   * make GET call to server in order to fetch host-component metrics
+   * @param {object} request
+   * @returns {$.ajax}
+   */
+  getHostComponentMetrics: function (request) {
+return App.ajax.send({
+  name: 'widgets.hostComponent.metrics.get',
+  sender: this,
+  data: {
+serviceName: request.service_name,
+componentName: request.component_name,
+metricPaths: request.metric_paths.join(','),
+hostComponentCriteria: 'host_components/HostRoles/' + 
request.host_component_criteria
+  },
+  success: 'getMetricsSuccessCallback'
+});
+  },
+
+  /**
+   * callback on getting aggregated metrics and host component metrics
+   * @param data
+   */
+  getMetricsSuccessCallback: function (data) {
+var metrics = [];
+
+this.get('content.metrics').forEach(function (_metric) {
+  if (!Em.isNone(Em.get(data, _metric.metric_path.replace(/\//g, '.' {
+_metric.data = Em.get(data, _metric.metric_path.replace(/\//g, '.'));
+this.get('metrics').pushObject(_metric);
+  }
+}, this);
+  },
+
+
+  /**
+   * callback on metrics loaded
+   */
+  onMetricsLoaded: function () {
+var self = this;
+this.set('isLoaded', true);
+this.drawWidget();
+setTimeout(function() {
+  self.loadMetrics();
+}, 

ambari git commit: AMBARI-10548. Unit tests failing in b.a.o

2015-04-16 Thread smohanty
Repository: ambari
Updated Branches:
  refs/heads/trunk 3c2fa88f5 - 2ca95b32b


AMBARI-10548. Unit tests failing in b.a.o


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

Branch: refs/heads/trunk
Commit: 2ca95b32bd0a39fc16270857266c01428d4ed49f
Parents: 3c2fa88
Author: Sumit Mohanty smoha...@hortonworks.com
Authored: Thu Apr 16 13:35:43 2015 -0700
Committer: Sumit Mohanty smoha...@hortonworks.com
Committed: Thu Apr 16 14:57:15 2015 -0700

--
 .../src/test/python/ambari_agent/TestHeartbeat.py   | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ca95b32/ambari-agent/src/test/python/ambari_agent/TestHeartbeat.py
--
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHeartbeat.py 
b/ambari-agent/src/test/python/ambari_agent/TestHeartbeat.py
index fc52c95..11a4182 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHeartbeat.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHeartbeat.py
@@ -26,6 +26,7 @@ import time
 from mock.mock import patch, MagicMock, call
 import StringIO
 import sys
+from ambari_agent.RecoveryManager import RecoveryManager
 
 
 with patch(platform.linux_distribution, return_value = 
('Suse','11','Final')):
@@ -37,9 +38,9 @@ with patch(platform.linux_distribution, return_value = 
('Suse','11','Final')):
   from ambari_agent.StackVersionsFileHandler import StackVersionsFileHandler
   from ambari_agent.HostInfo import HostInfoLinux
 
-from only_for_platform import only_for_platform, PLATFORM_LINUX
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
 
-@only_for_platform(PLATFORM_LINUX)
+@not_for_platform(PLATFORM_WINDOWS)
 class TestHeartbeat(TestCase):
 
   def setUp(self):
@@ -114,6 +115,7 @@ class TestHeartbeat(TestCase):
 config.set('agent', 'cache_dir', /var/lib/ambari-agent/cache)
 config.set('agent', 'tolerate_download_failures', true)
 dummy_controller = MagicMock()
+dummy_controller.recovery_manager = RecoveryManager()
 actionQueue = ActionQueue(config, dummy_controller)
 result_mock.return_value = {
   'reports': [{'status': 'IN_PROGRESS',
@@ -174,6 +176,7 @@ class TestHeartbeat(TestCase):
 expected = {'nodeStatus':
   {'status': 'HEALTHY',
'cause': 'NONE'},
+'recoveryReport': {'summary': 'DISABLED'},
 'timestamp': 'timestamp', 'hostname': 'hostname',
 'responseId': 10, 'reports': [
   {'status': 'IN_PROGRESS', 'roleCommand': u'INSTALL',
@@ -195,6 +198,7 @@ class TestHeartbeat(TestCase):
'stderr': 'stderr'}], 'componentStatus': [
   {'status': 'HEALTHY', 'componentName': 'DATANODE'},
   {'status': 'UNHEALTHY', 'componentName': 'NAMENODE'}]}
+self.assertEqual.__self__.maxDiff = None
 self.assertEquals(hb, expected)
 
 
@@ -214,13 +218,13 @@ class TestHeartbeat(TestCase):
   componentName : DATANODE,
   'configurations':{'global' : {}}
 }
-actionQueue.put([statusCommand])
+actionQueue.put_status([statusCommand])
 
 heartbeat = Heartbeat(actionQueue)
 heartbeat.build(12, 6)
 self.assertTrue(register_mock.called)
 args, kwargs = register_mock.call_args_list[0]
-self.assertTrue(args[2])
+self.assertFalse(args[2])
 self.assertFalse(args[1])
 
 



ambari git commit: AMBARI-10548. Unit tests failing in b.a.o (enabling few more tests on mac for dev testing)

2015-04-16 Thread smohanty
Repository: ambari
Updated Branches:
  refs/heads/trunk 2ca95b32b - c7157e00f


AMBARI-10548. Unit tests failing in b.a.o (enabling few more tests on mac for 
dev testing)


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

Branch: refs/heads/trunk
Commit: c7157e00feff0eb0cc5ccb308cfce54e2950c82f
Parents: 2ca95b3
Author: Sumit Mohanty smoha...@hortonworks.com
Authored: Thu Apr 16 15:23:02 2015 -0700
Committer: Sumit Mohanty smoha...@hortonworks.com
Committed: Thu Apr 16 15:23:02 2015 -0700

--
 ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py   | 4 ++--
 ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py | 5 +++--
 ambari-agent/src/test/python/ambari_agent/TestShell.py | 4 ++--
 3 files changed, 7 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7157e00/ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py
--
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py 
b/ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py
index 734db5d..78cf4c2 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostCleanup.py
@@ -67,9 +67,9 @@ pkg_list = 
sqoop.noarch,hadoop-libhdfs.x86_64,rrdtool.x86_64,ganglia-gmond.x86_6
 [metadata]
 created = 2013-07-02 20:39:22.162757
 
-from only_for_platform import only_for_platform, PLATFORM_LINUX
+from only_for_platform import only_for_platform, not_for_platform, 
PLATFORM_WINDOWS, PLATFORM_LINUX
 
-@only_for_platform(PLATFORM_LINUX)
+@not_for_platform(PLATFORM_WINDOWS)
 class TestHostCleanup(TestCase):
 
   def setUp(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7157e00/ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py
--
diff --git a/ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py 
b/ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py
index b0b828d..f30d45d 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestProcessHelper.py
@@ -25,8 +25,9 @@ import unittest
 from mock.mock import patch, MagicMock
 from ambari_agent import ProcessHelper
 
-from only_for_platform import only_for_platform, PLATFORM_LINUX
-@only_for_platform(PLATFORM_LINUX)
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
+
+@not_for_platform(PLATFORM_WINDOWS)
 class TestProcessHelper(unittest.TestCase):
 
   @patch.object(ProcessHelper, getTempFiles)

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7157e00/ambari-agent/src/test/python/ambari_agent/TestShell.py
--
diff --git a/ambari-agent/src/test/python/ambari_agent/TestShell.py 
b/ambari-agent/src/test/python/ambari_agent/TestShell.py
index 797e1b7..d185755 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestShell.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestShell.py
@@ -27,10 +27,10 @@ from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_commons import shell
 from ambari_commons.shell import shellRunner
 from sys import platform as _platform
-from only_for_platform import only_for_platform, PLATFORM_LINUX
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
 import subprocess, time
 
-@only_for_platform(PLATFORM_LINUX)
+@not_for_platform(PLATFORM_WINDOWS)
 class TestShell(unittest.TestCase):
 
 



ambari git commit: AMBARI-10491 [WinTP2] Ambari server: Ensure the service can be configured to run under a domain account

2015-04-16 Thread fbarca
Repository: ambari
Updated Branches:
  refs/heads/trunk 68c68a6f0 - 962a8a006


AMBARI-10491 [WinTP2] Ambari server: Ensure the service can be configured to 
run under a domain account

+Fixed service username handling at registration.
+Fixed service registration workflow.
+Updated unit tests.


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

Branch: refs/heads/trunk
Commit: 962a8a006e35860d391d10781d0b911d7f602d9d
Parents: 68c68a6
Author: Florian Barca fba...@hortonworks.com
Authored: Thu Apr 16 20:45:03 2015 -0700
Committer: Florian Barca fba...@hortonworks.com
Committed: Thu Apr 16 20:45:03 2015 -0700

--
 .../main/python/ambari_commons/os_windows.py|  12 +-
 ambari-server/src/main/python/ambari-server.py  |  17 ++-
 .../python/ambari_server/serverConfiguration.py |   3 -
 .../main/python/ambari_server/serverSetup.py| 150 ---
 .../src/main/python/ambari_windows_service.py   |  17 +--
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   1 +
 .../src/test/python/TestAmbariServer.py | 142 +-
 7 files changed, 200 insertions(+), 142 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/962a8a00/ambari-common/src/main/python/ambari_commons/os_windows.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/os_windows.py 
b/ambari-common/src/main/python/ambari_commons/os_windows.py
index edbcc7b..38db310 100644
--- a/ambari-common/src/main/python/ambari_commons/os_windows.py
+++ b/ambari-common/src/main/python/ambari_commons/os_windows.py
@@ -629,7 +629,7 @@ class WinService(win32serviceutil.ServiceFramework):
   installArgs.append(--perfmondll= + perfMonDll)
 installArgs.append(install)
 
-win32serviceutil.HandleCommandLine(cls, classPath, installArgs)
+return win32serviceutil.HandleCommandLine(cls, classPath, installArgs)
 
   @classmethod
   def Start(cls, waitSecs = 30):
@@ -740,6 +740,16 @@ class UserHelper(object):
 return UserHelper.ACTION_FAILED, e.strerror
 return UserHelper.ACTION_OK, User created.
 
+  def find_user(self):
+try:
+  user_info = win32net.NetUserGetInfo(self.dcName, self.userName, 0)
+except pywintypes.error as e:
+  if e.winerror == 2221:
+return False
+  else:
+raise
+return True
+
   def add_user_privilege(self, privilege):
 try:
   acc_sid = win32security.LookupAccountName(self.dcName, self.userName)[0]

http://git-wip-us.apache.org/repos/asf/ambari/blob/962a8a00/ambari-server/src/main/python/ambari-server.py
--
diff --git a/ambari-server/src/main/python/ambari-server.py 
b/ambari-server/src/main/python/ambari-server.py
index f1f005d..749a965 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -69,12 +69,6 @@ class UserActionRestart(UserAction):
 self.need_restart = self.fn(*self.args, **self.kwargs)
 
 
-def winsetup(options):
-  from ambari_windows_service import svcsetup
-
-  setup(options)
-  svcsetup()
-
 #
 # Starts the Ambari Server as a standalone process.
 # Ensures only one instance of the process is running.
@@ -269,6 +263,13 @@ def restore(args):
 
 @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
 def init_parser_options(parser):
+  parser.add_option('-k', '--service-user-name', dest=svc_user,
+default=None,
+help=User account under which the Ambari Server service 
will run)
+  parser.add_option('-x', '--service-user-password', dest=svc_password,
+default=None,
+help=Password for the Ambari Server service user account)
+
   parser.add_option('-f', '--init-script-file', dest=init_db_script_file,
 default=resources + os.sep + 
Ambari-DDL-SQLServer-CREATE.sql,
 help=File with database setup script)
@@ -302,7 +303,7 @@ def init_parser_options(parser):
 help=Database user password)
   parser.add_option('--jdbc-driver', default=None, dest=jdbc_driver,
 help=Specifies the path to the JDBC driver JAR file)
-  # -b, -i, -k and -x the remaining available short options
+  # -b and -i the remaining available short options
   # -h reserved for help
 
 @OsFamilyFuncImpl(OsFamilyImpl.DEFAULT)
@@ -475,7 +476,7 @@ def fix_database_options(options, parser):
 @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
 def create_user_action_map(args, options):
   action_map = {
-SETUP_ACTION: UserAction(winsetup, options),
+SETUP_ACTION: UserAction(setup, 

ambari git commit: AMBARI-10544. Views: FE work for adding the ability for a view instance to be associated to a cluster for configuration (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 23f7428a0 - 68c68a6f0


AMBARI-10544. Views: FE work for adding the ability for a view instance to be 
associated to a cluster for configuration (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 68c68a6f0eb09f0bbdd530c9c9e1baa8dbfa9828
Parents: 23f7428
Author: Alex Antonenko hiv...@gmail.com
Authored: Fri Apr 17 06:17:28 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Fri Apr 17 06:17:28 2015 +0300

--
 .../ambariViews/CreateViewInstanceCtrl.js   |  37 -
 .../controllers/ambariViews/ViewsEditCtrl.js| 149 +--
 .../ui/admin-web/app/scripts/services/View.js   |  37 +++--
 .../resources/ui/admin-web/app/styles/main.css  |  28 +++-
 .../admin-web/app/views/ambariViews/create.html |  68 ++---
 .../admin-web/app/views/ambariViews/edit.html   |  63 ++--
 6 files changed, 284 insertions(+), 98 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/68c68a6f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
--
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 2492c91..e6c047b 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -18,22 +18,28 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', 
'$routeParams', '$location', 'UnsavedDialog', function($scope, View, Alert, 
$routeParams, $location, UnsavedDialog) {
+.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', 'Cluster', 
'$routeParams', '$location', 'UnsavedDialog', function($scope, View, Alert, 
Cluster, $routeParams, $location, UnsavedDialog) {
   $scope.form = {};
   var targetUrl = '';
 
   function loadMeta(){
 View.getMeta($routeParams.viewId, $scope.version).then(function(data) {
-  var viewVersion = data.data;
-  $scope.view = viewVersion;
+  var viewVersion = data.data,
+parameters;
 
-  var parameters = viewVersion.ViewVersionInfo.parameters;
+  $scope.view = viewVersion;
+  parameters = viewVersion.ViewVersionInfo.parameters;
 
   angular.forEach(parameters, function (item) {
 item.value = item['defaultValue'];
+item.clusterConfig = !!item.clusterConfig;
 item.displayName = item.name.replace(/\./g, '\.\u200B');
+$scope.numberOfClusterConfigs = item.clusterConfig ? 
$scope.numberOfClusterConfigs+1 : $scope.numberOfClusterConfigs;
   });
 
+  $scope.clusterConfigurable = 
viewVersion.ViewVersionInfo.cluster_configurable;
+  $scope.clusterConfigurableErrorMsg = $scope.clusterConfigurable ?  : 
This view cannot use this option;
+
   $scope.instance = {
 view_name: viewVersion.ViewVersionInfo.view_name,
 version: viewVersion.ViewVersionInfo.version,
@@ -43,7 +49,8 @@ angular.module('ambariAdminConsole')
 icon_path: '',
 icon64_path: '',
 properties: parameters,
-description: ''
+description: '',
+isLocalCluster: false
   };
 });
   }
@@ -61,6 +68,25 @@ angular.module('ambariAdminConsole')
   $scope.isAdvancedClosed = true;
   $scope.instanceExists = false;
 
+  $scope.clusterConfigurable = false;
+  $scope.clusterConfigurableErrorMsg = ;
+  $scope.clusters = [];
+  $scope.noClusterAvailible = true;
+  $scope.cluster = null;
+  $scope.numberOfClusterConfigs = 0;
+
+  Cluster.getAllClusters().then(function (clusters) {
+if(clusters.length 0){
+  clusters.forEach(function(cluster) {
+$scope.clusters.push(cluster.Clusters.cluster_name)
+  });
+  $scope.noClusterAvailible = false;
+}else{
+  $scope.clusters.push(No Clusters);
+}
+$scope.cluster = $scope.clusters[0];
+  });
+
   $scope.versions = [];
   $scope.version = null;
 
@@ -77,6 +103,7 @@ angular.module('ambariAdminConsole')
 $scope.form.instanceCreateForm.submitted = true;
 if($scope.form.instanceCreateForm.$valid){
   $scope.form.instanceCreateForm.isSaving = true;
+  $scope.instance.clusterName = $scope.cluster;
   View.createInstance($scope.instance)
 .then(function(data) {
   

ambari git commit: AMBARI-10534. Alert notification with invalid parameters can be created after switching method value (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk ecaf2d15f - 9dfbf91df


AMBARI-10534. Alert notification with invalid parameters can be created after 
switching method value (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 9dfbf91df05320ab382a714d1186685645c4c35e
Parents: ecaf2d1
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 21:10:51 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 21:10:51 2015 +0300

--
 .../manage_alert_notifications_controller.js| 51 
 ...anage_alert_notifications_controller_test.js | 44 +
 2 files changed, 76 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9dfbf91d/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
--
diff --git 
a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
 
b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
index 101df64..19d2f9e 100644
--- 
a/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
+++ 
b/ambari-web/app/controllers/main/alerts/manage_alert_notifications_controller.js
@@ -233,6 +233,37 @@ App.ManageAlertNotificationsController = 
Em.Controller.extend({
 'mail.smtp.starttls.enable'
   ],
 
+  validationMap: {
+EMAIL: [
+  {
+errorKey: 'emailToError',
+validator: 'emailToValidation'
+  },
+  {
+errorKey: 'emailFromError',
+validator: 'emailFromValidation'
+  },
+  {
+errorKey: 'smtpPortError',
+validator: 'smtpPortValidation'
+  },
+  {
+errorKey: 'passwordError',
+validator: 'retypePasswordValidation'
+  }
+],
+SNMP: [
+  {
+errorKey: 'portError',
+validator: 'portValidation'
+  },
+  {
+errorKey: 'hostError',
+validator: 'hostsValidation'
+  }
+]
+  },
+
   /**
* Load all Alert Notifications from server
* @method loadAlertNotifications
@@ -372,15 +403,17 @@ App.ManageAlertNotificationsController = 
Em.Controller.extend({
   return this.get('controller.inputFields.method.value') === 'EMAIL';
 }.property('controller.inputFields.method.value'),
 
-clearValidationErrors: function () {
-  var linkedErrorsMap = {
-  EMAIL: ['emailToError', 'emailFromError', 'smtpPortError', 
'passwordError'],
-  SNMP: ['portError', 'hostError']
-},
-method = this.get('controller.inputFields.method.value');
-  Em.keys(linkedErrorsMap).forEach(function (name) {
-if (name != method) {
-  linkedErrorsMap[name].forEach(function (key) {
+methodObserver: function () {
+  var currentMethod = this.get('controller.inputFields.method.value'),
+validationMap = self.get('validationMap');
+  self.get('methods').forEach(function (method) {
+var validations = validationMap[method];
+if (method == currentMethod) {
+  validations.mapProperty('validator').forEach(function (key) {
+this.get(key).call(this);
+  }, this);
+} else {
+  validations.mapProperty('errorKey').forEach(function (key) {
 this.set(key, false);
   }, this);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9dfbf91d/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
--
diff --git 
a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
 
b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
index 7f68fce..a74839b 100644
--- 
a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
+++ 
b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js
@@ -645,18 +645,39 @@ describe('App.ManageAlertNotificationsController', 
function () {
 
   });
 
-  describe('#clearValidationErrors', function () {
+  describe('#methodObserver', function () {
 
 var cases = [
-  {
-method: 'EMAIL',
-errors: ['portError', 'hostError']
-  },
-  {
-method: 'SNMP',
-errors: ['emailToError', 'emailFromError', 'smtpPortError', 
'passwordError']
-  }
-];
+{
+   

ambari git commit: AMBARI-10543. String matches does not work on metrics property of Widget response.

2015-04-16 Thread swagle
Repository: ambari
Updated Branches:
  refs/heads/trunk 9dfbf91df - 5bb1faefb


AMBARI-10543. String matches does not work on metrics property of Widget 
response.


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

Branch: refs/heads/trunk
Commit: 5bb1faefb10bce6f2eee5d65d98f4ad9e05d4e8d
Parents: 9dfbf91
Author: Siddharth Wagle swa...@hortonworks.com
Authored: Thu Apr 16 11:17:49 2015 -0700
Committer: Siddharth Wagle swa...@hortonworks.com
Committed: Thu Apr 16 11:17:49 2015 -0700

--
 .../internal/WidgetResourceProvider.java|  6 ++--
 .../internal/WidgetResourceProviderTest.java| 32 +---
 2 files changed, 24 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5bb1faef/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
index 1bd1058..59f0e88 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
@@ -230,14 +230,14 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
   resource.setProperty(WIDGET_ID_PROPERTY_ID, entity.getId());
   resource.setProperty(WIDGET_WIDGET_NAME_PROPERTY_ID, 
entity.getWidgetName());
   resource.setProperty(WIDGET_WIDGET_TYPE_PROPERTY_ID, 
entity.getWidgetType());
-  setResourceProperty(resource, WIDGET_METRICS_PROPERTY_ID, 
gson.fromJson(entity.getMetrics(), ArrayList.class), requestedIds);
+  setResourceProperty(resource, WIDGET_METRICS_PROPERTY_ID, 
entity.getMetrics(), requestedIds);
   setResourceProperty(resource, WIDGET_TIME_CREATED_PROPERTY_ID, 
entity.getTimeCreated(), requestedIds);
   resource.setProperty(WIDGET_AUTHOR_PROPERTY_ID, entity.getAuthor());
   setResourceProperty(resource, WIDGET_DESCRIPTION_PROPERTY_ID, 
entity.getDescription(), requestedIds);
   resource.setProperty(WIDGET_DISPLAY_NAME_PROPERTY_ID, 
entity.getDisplayName());
   resource.setProperty(WIDGET_SCOPE_PROPERTY_ID, entity.getScope());
-  setResourceProperty(resource, WIDGET_VALUES_PROPERTY_ID, 
gson.fromJson(entity.getWidgetValues(), ArrayList.class), requestedIds);
-  setResourceProperty(resource, WIDGET_PROPERTIES_PROPERTY_ID, 
gson.fromJson(entity.getProperties(), Map.class), requestedIds);
+  setResourceProperty(resource, WIDGET_VALUES_PROPERTY_ID, 
entity.getWidgetValues(), requestedIds);
+  setResourceProperty(resource, WIDGET_PROPERTIES_PROPERTY_ID, 
entity.getProperties(), requestedIds);
 
   String clusterName = null;
   try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5bb1faef/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
index 568a89c..917f1c2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
@@ -145,11 +145,20 @@ public class WidgetResourceProviderTest {
 Assert.assertEquals(displ_name, 
r.getPropertyValue(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID));
 Assert.assertEquals(widget name, 
r.getPropertyValue(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID));
 Object metrics = 
r.getPropertyValue(WidgetResourceProvider.WIDGET_METRICS_PROPERTY_ID);
-Assert.assertTrue(metrics instanceof List);
-Assert.assertEquals(2, ((List) metrics).size());
-Object values = 
r.getPropertyValue(WidgetResourceProvider.WIDGET_VALUES_PROPERTY_ID);
-Assert.assertTrue(values instanceof List);
-Assert.assertEquals(1, ((List) values).size());
+Assert.assertEquals([{\widget_id\:\metrics/jvm/HeapMemoryUsed\, +
+
\host_component_criteria\:\host_components/metrics/dfs/FSNamesystem/HAState\\u003dactive\,
 +
+\service_name\:\HDFS\,\component_name\:\NAMENODE\, +
+

ambari git commit: AMBARI-10540. Stack Versions: Incorrect order of hosts in boxes for versions in popup (alexantonenko)

2015-04-16 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk c7022dc36 - d87c8bc20


AMBARI-10540. Stack Versions: Incorrect order of hosts in boxes for versions in 
popup (alexantonenko)


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

Branch: refs/heads/trunk
Commit: d87c8bc20d04fe70a799cfa6988646b839cc6401
Parents: c7022dc
Author: Alex Antonenko hiv...@gmail.com
Authored: Thu Apr 16 21:20:11 2015 +0300
Committer: Alex Antonenko hiv...@gmail.com
Committed: Thu Apr 16 21:20:11 2015 +0300

--
 .../app/views/main/admin/stack_upgrade/upgrade_version_box_view.js  | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d87c8bc2/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
--
diff --git 
a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js 
b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
index 3a77b82..7e78535 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_box_view.js
@@ -267,6 +267,7 @@ App.UpgradeVersionBoxView = Em.View.extend({
 var displayName = this.get('content.displayName');
 var hosts = this.get('content').get(status['property']);
 var self = this;
+hosts.sort();
 if (hosts.length) {
   return App.ModalPopup.show({
 bodyClass: Ember.View.extend({



ambari git commit: AMBARI-10531. Add Postgres support for Ranger.Part2.(vbrodetskyi)

2015-04-16 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/trunk db058a451 - c7e310d62


AMBARI-10531. Add Postgres support for Ranger.Part2.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: c7e310d62dd99db348faa00baca3af4ddc8ee1c1
Parents: db058a4
Author: Vitaly Brodetskyi vbrodets...@hortonworks.com
Authored: Thu Apr 16 20:13:47 2015 +0300
Committer: Vitaly Brodetskyi vbrodets...@hortonworks.com
Committed: Thu Apr 16 20:13:47 2015 +0300

--
 .../common-services/RANGER/0.4.0/package/scripts/setup_ranger.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7e310d6/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
index 4f372c7..391df2a 100644
--- 
a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
@@ -89,9 +89,9 @@ def check_db_connnection():
   elif params.db_flavor.lower() == 'oracle':
 cmd = format('{sql_command_invoker} 
{db_root_user}/{db_root_password}@{db_host} AS SYSDBA')
   elif params.db_flavor.lower() == 'postgres':
-cmd_str = 'true'
+cmd = 'true'
   elif params.db_flavor.lower() == 'sqlserver':
-cmd_str = 'true'
+cmd = 'true'
 
   try:
 Execute(cmd)