[1/4] ambari git commit: AMBARI-21114 - Fix Unit Test Failures From Prior Patch/Service Upgrade Commits (jonathanhurley)

2017-05-24 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-12556 2cfc8d22d -> 770c519a9


http://git-wip-us.apache.org/repos/asf/ambari/blob/770c519a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index b228988..cfb7726 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -182,7 +182,7 @@ public class UpgradeHelper {
* {@link StageWrapperBuilder} has finished building out all of the stages.
*/
   @Inject
-  private Provider m_configHelperProvider;
+  Provider m_configHelperProvider;
 
   @Inject
   private Provider m_ambariMetaInfoProvider;
@@ -203,7 +203,7 @@ public class UpgradeHelper {
* Used to get configurations by service name.
*/
   @Inject
-  private ServiceConfigDAO m_serviceConfigDAO;
+  ServiceConfigDAO m_serviceConfigDAO;
 
   /**
* Get right Upgrade Pack, depends on stack, direction and upgrade type

http://git-wip-us.apache.org/repos/asf/ambari/blob/770c519a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
index f79b1c2..a631448 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java
@@ -17,8 +17,13 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import java.util.ArrayList;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.junit.Assert.assertEquals;
+
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.persistence.EntityManager;
@@ -28,7 +33,6 @@ import 
org.apache.ambari.server.actionmanager.HostRoleCommandFactory;
 import org.apache.ambari.server.actionmanager.HostRoleCommandFactoryImpl;
 import org.apache.ambari.server.actionmanager.RequestFactory;
 import org.apache.ambari.server.actionmanager.StageFactory;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AbstractRootServiceResponseFactory;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.KerberosHelper;
@@ -38,8 +42,10 @@ import org.apache.ambari.server.hooks.HookService;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.orm.dao.ServiceConfigDAO;
+import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
-import org.apache.ambari.server.orm.entities.StackEntity;
+import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
 import org.apache.ambari.server.scheduler.ExecutionScheduler;
 import org.apache.ambari.server.security.authorization.Users;
 import org.apache.ambari.server.stack.StackManagerFactory;
@@ -50,10 +56,12 @@ import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigFactory;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentHostFactory;
 import org.apache.ambari.server.state.ServiceFactory;
-import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.UpgradeContext;
 import org.apache.ambari.server.state.UpgradeContextFactory;
@@ -63,7 +71,7 @@ import 
org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.stack.UpgradePack;
 import org.apache.ambari.server.state.stack.upgrade.Direction;
-import org.apache.ambari.server.state.stack.upgrade.Grouping;
+import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 

[3/4] ambari git commit: AMBARI-21114 - Fix Unit Test Failures From Prior Patch/Service Upgrade Commits (jonathanhurley)

2017-05-24 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/770c519a/ambari-server/docs/api/generated/index.html
--
diff --git a/ambari-server/docs/api/generated/index.html 
b/ambari-server/docs/api/generated/index.html
index 1771346..7ea4297 100644
--- a/ambari-server/docs/api/generated/index.html
+++ b/ambari-server/docs/api/generated/index.html
@@ -710,6 +710,80 @@ margin-bottom: 20px;
   
 // Script section to load models into a JS Var
 var defs = {}
+defs.ActionRequest = {
+  "type" : "object",
+  "properties" : {
+"action_name" : {
+  "type" : "string"
+},
+"action_type" : {
+  "type" : "string"
+},
+"inputs" : {
+  "type" : "string"
+},
+"target_service" : {
+  "type" : "string"
+},
+"target_component" : {
+  "type" : "string"
+},
+"description" : {
+  "type" : "string"
+},
+"target_type" : {
+  "type" : "string"
+},
+"default_timeout" : {
+  "type" : "string"
+}
+  }
+};
+defs.ActionRequestSwagger = {
+  "type" : "object",
+  "properties" : {
+"Actions" : {
+  "$ref" : "#/definitions/ActionRequest"
+}
+  }
+};
+defs.ActionResponse = {
+  "type" : "object",
+  "properties" : {
+"action_name" : {
+  "type" : "string"
+},
+"action_type" : {
+  "type" : "string"
+},
+"inputs" : {
+  "type" : "string"
+},
+"target_service" : {
+  "type" : "string"
+},
+"target_component" : {
+  "type" : "string"
+},
+"description" : {
+  "type" : "string"
+},
+"target_type" : {
+  "type" : "string"
+},
+"default_timeout" : {
+  "type" : "string"
+}
+  }
+};
+defs.ActionResponseSwagger = {
+  "type" : "object",
+  "properties" : {
+"Actions" : {
+  "$ref" : "#/definitions/ActionResponse"
+}
+  }
+};
 defs.ActiveWidgetLayoutRequest = {
   "type" : "object",
   "properties" : {
@@ -753,489 +827,728 @@ margin-bottom: 20px;
 }
   }
 };
-defs.GroupPrivilegeResponse = {
+defs.AgentEnv = {
   "type" : "object",
-  "required" : [ "PrivilegeInfo/group_name" ],
   "properties" : {
-"PrivilegeInfo/permission_label" : {
-  "type" : "string"
+"stackFoldersAndFiles" : {
+  "type" : "array",
+  "items" : {
+"$ref" : "#/definitions/Directory"
+  }
 },
-"PrivilegeInfo/privilege_id" : {
+"alternatives" : {
+  "type" : "array",
+  "items" : {
+"$ref" : "#/definitions/Alternative"
+  }
+},
+"existingUsers" : {
+  "type" : "array",
+  "items" : {
+"$ref" : "#/definitions/ExistingUser"
+  }
+},
+"existingRepos" : {
+  "type" : "array",
+  "items" : {
+"type" : "string"
+  }
+},
+"installedPackages" : {
+  "type" : "array",
+  "items" : {
+"$ref" : "#/definitions/PackageDetail"
+  }
+},
+"hostHealth" : {
+  "$ref" : "#/definitions/HostHealth"
+},
+"umask" : {
   "type" : "integer",
   "format" : "int32"
 },
-"PrivilegeInfo/permission_name" : {
+"transparentHugePage" : {
   "type" : "string"
 },
-"PrivilegeInfo/principal_type" : {
-  "type" : "string",
-  "enum" : [ "USER", "GROUP", "ROLE" ]
+"firewallRunning" : {
+  "type" : "boolean",
+  "default" : false
 },
-"PrivilegeInfo/principal_name" : {
+"firewallName" : {
   "type" : "string"
 },
-"PrivilegeInfo/type" : {
-  "type" : "string",
-  "enum" : [ "AMBARI", "CLUSTER", "VIEW" ]
+"hasUnlimitedJcePolicy" : {
+  "type" : "boolean",
+  "default" : false
 },
-"PrivilegeInfo/cluster_name" : {
+"reverseLookup" : {
+  "type" : "boolean",
+  "default" : false
+}
+  }
+};
+defs.Alternative = {
+  "type" : "object",
+  "properties" : {
+"name" : {
   "type" : "string"
 },
-"PrivilegeInfo/view_name" : {
+"target" : {
+  "type" : "string"
+}
+  }
+};
+defs.Artifacts = {
+  "type" : "object",
+  "properties" : {
+"stack_name" : {
   "type" : "string"
 },
-"PrivilegeInfo/version" : {
+"stack_version" : {
   "type" : "string"
 },
-"PrivilegeInfo/instance_name" : {
+"artifact_name" : {
   "type" : "string"
 },
-"PrivilegeInfo/group_name" : {
+"service_name" : {
   "type" : "string"
 }
   }
 };
-defs.GroupRequest = {
+defs.BlueprintInfo = {
   "type" : "object",
-  "required" : [ "Groups/group_name" ],
   "properties" : {
-"Groups/group_name" : {
+"security" : {
+  "$ref" : "#/definitions/SecurityInfo"
+},
+"stack_name" : {
+  "type" : "string"
+},
+"stack_version" : {
+  "type" : "string"
+},
+"blueprint_name" : {
   "type" : "string"
 }
   }
 };
-defs.GroupResponse = {
+defs.BlueprintSwagger = {
   "type" : "object",
   "properties" : {
-

[2/4] ambari git commit: AMBARI-21114 - Fix Unit Test Failures From Prior Patch/Service Upgrade Commits (jonathanhurley)

2017-05-24 Thread jonathanhurley
http://git-wip-us.apache.org/repos/asf/ambari/blob/770c519a/ambari-server/docs/api/generated/swagger.json
--
diff --git a/ambari-server/docs/api/generated/swagger.json 
b/ambari-server/docs/api/generated/swagger.json
index f7dbb6b..d7d54a5 100644
--- a/ambari-server/docs/api/generated/swagger.json
+++ b/ambari-server/docs/api/generated/swagger.json
@@ -11,37 +11,65 @@
   },
   "basePath" : "/api/v1",
   "tags" : [ {
+"name" : "Actions",
+"description" : "Endpoint for action definition specific operations"
+  }, {
+"name" : "Blueprints",
+"description" : "Endpoint for blueprint specific operations"
+  }, {
 "name" : "Groups",
 "description" : "Endpoint for group specific operations"
   }, {
+"name" : "Requests",
+"description" : "Endpoint for request specific operations"
+  }, {
+"name" : "Services",
+"description" : "Endpoint for service specific operations"
+  }, {
+"name" : "Stacks",
+"description" : "Endpoint for stack specific operations"
+  }, {
 "name" : "Users",
 "description" : "Endpoint for user specific operations"
   }, {
-"name" : "Views"
+"name" : "Views",
+"description" : "Endpoint for view specific operations"
+  }, {
+"name" : "clusters",
+"description" : "Endpoint for cluster-specific operations"
+  }, {
+"name" : "hosts",
+"description" : "Endpoint for host-specific operations"
+  }, {
+"name" : "services",
+"description" : "Endpoint for querying root-level services, ie. Ambari 
Server and Ambari Agents"
+  }, {
+"name" : "settings",
+"description" : "Endpoint for settings-specific operations"
   } ],
   "schemes" : [ "http", "https" ],
   "paths" : {
-"/groups" : {
+"/actions" : {
   "get" : {
-"tags" : [ "Groups" ],
-"summary" : "Get all groups",
-"description" : "Returns details of all groups.",
-"operationId" : "GroupService#getGroups",
+"tags" : [ "Actions" ],
+"summary" : "Get all action definitions",
+"description" : "",
+"operationId" : "ActionService#getActionDefinitions",
 "produces" : [ "text/plain" ],
 "parameters" : [ {
   "name" : "fields",
   "in" : "query",
-  "description" : "Filter group details",
+  "description" : "Filter fields in the response (identifier fields 
are mandatory)",
   "required" : false,
   "type" : "string",
-  "default" : "Groups/*"
+  "default" : "Actions/action_name"
 }, {
   "name" : "sortBy",
   "in" : "query",
-  "description" : "Sort groups (asc | desc)",
+  "description" : "Sort resources in result by (asc | desc)",
   "required" : false,
   "type" : "string",
-  "default" : "Groups/group_name.asc"
+  "default" : "Actions/action_name.asc"
 }, {
   "name" : "page_size",
   "in" : "query",
@@ -52,134 +80,191 @@
 }, {
   "name" : "from",
   "in" : "query",
-  "description" : "The starting page resource (inclusive). Valid 
values are :offset | \"start\"",
+  "description" : "The starting page resource (inclusive).  \"start\" 
is also accepted.",
   "required" : false,
   "type" : "string",
   "default" : "0"
 }, {
   "name" : "to",
   "in" : "query",
-  "description" : "The ending page resource (inclusive). Valid values 
are :offset | \"end\"",
+  "description" : "The ending page resource (inclusive).  \"end\" is 
also accepted.",
   "required" : false,
   "type" : "string"
 } ],
 "responses" : {
   "200" : {
-"description" : "Successful retrieval of all group entries",
+"description" : "Successful operation",
 "schema" : {
   "type" : "array",
   "items" : {
-"$ref" : "#/definitions/GroupResponse"
+"$ref" : "#/definitions/ActionResponseSwagger"
   }
 }
+  },
+  "401" : {
+"description" : "Not authenticated"
+  },
+  "500" : {
+"description" : "Internal server error"
+  }
+}
+  }
+},
+"/actions/{actionName}" : {
+  "get" : {
+"tags" : [ "Actions" ],
+"summary" : "Get the details of an action definition",
+"description" : "",
+"operationId" : "ActionService#getActionDefinition",
+"produces" : [ "text/plain" ],
+"parameters" : [ {
+  "name" : "actionName",
+  "in" : "path",
+  "required" : true,
+  "type" : "string"
+}, {
+  "name" : "fields",
+  "in" : "query",
+  "description" : "Filter fields in the response (identifier fields 
are mandatory)",
+  "required" : false,
+

ambari git commit: AMBARI-21090 Add Log Feeder input config to HDP 3.0 hooks too (mgergely)

2017-05-24 Thread mgergely
Repository: ambari
Updated Branches:
  refs/heads/trunk 42be8ce79 -> 2f7331535


AMBARI-21090 Add Log Feeder input config to HDP 3.0 hooks too (mgergely)

Change-Id: I83da4d1987e224cf54bd352aa1731d4cf5b26174


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

Branch: refs/heads/trunk
Commit: 2f73315356551224b69bf7e9d1c9c914107ac6df
Parents: 42be8ce
Author: Miklos Gergely 
Authored: Thu May 25 02:52:29 2017 +0200
Committer: Miklos Gergely 
Committed: Thu May 25 02:52:29 2017 +0200

--
 .../HDP/3.0/hooks/after-INSTALL/scripts/params.py  | 14 ++
 .../after-INSTALL/scripts/shared_initialization.py | 17 +
 2 files changed, 31 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f733153/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
index 5dcd39b..4a422ec 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/params.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import 
conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format_jvm_option
 from resource_management.libraries.functions.version import 
format_stack_version
+from string import lower
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -46,6 +47,19 @@ stack_version_formatted = 
format_stack_version(stack_version_unformatted)
 # current host stack version
 current_version = default("/hostLevelParams/current_version", None)
 
+# service name
+service_name = config['serviceName']
+
+# logsearch configuration
+logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+
+agent_cache_dir = config['hostLevelParams']['agentCacheDir']
+service_package_folder = config['commandParams']['service_package_folder']
+logsearch_service_name = service_name.lower().replace("_", "-")
+logsearch_config_file_name = 'input.config-' + logsearch_service_name + ".json"
+logsearch_config_file_path = agent_cache_dir + "/" + service_package_folder + 
"/templates/" + logsearch_config_file_name + ".j2"
+logsearch_config_file_exists = os.path.isfile(logsearch_config_file_path)
+
 # default hadoop params
 mapreduce_libs_path = format("{stack_root}/current/hadoop-mapreduce-client/*")
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f733153/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
 
b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
index e9f2283..36a202f 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/3.0/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -19,9 +19,13 @@ limitations under the License.
 import os
 
 import ambari_simplejson as json
+from ambari_jinja2 import Environment as JinjaEnvironment
 from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Directory, File
+from resource_management.core.source import InlineTemplate, Template
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.version import compare_versions
 from resource_management.libraries.functions.fcntl_based_process_lock import 
FcntlBasedProcessLock
@@ -72,6 +76,19 @@ def setup_config():
   group=params.user_group,
   only_if=format("ls {hadoop_conf_dir}"))
 
+  Directory(params.logsearch_logfeeder_conf,
+mode=0755,
+cd_access='a',
+create_parents=True
+)
+
+  if params.logsearch_config_file_exists:
+File(format("{logsearch_logfeeder_conf}/" + 

ambari git commit: AMBARI-21095 - Enable opening views in a new tab (Anita Jebaraj via sangeetar)

2017-05-24 Thread sangeetar
Repository: ambari
Updated Branches:
  refs/heads/trunk 56f019081 -> 42be8ce79


AMBARI-21095 - Enable opening views in a new tab (Anita Jebaraj via sangeetar)


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

Branch: refs/heads/trunk
Commit: 42be8ce798172757b8b0967b309baf73fe0a5212
Parents: 56f0190
Author: Sangeeta Ravindran 
Authored: Wed May 24 15:51:55 2017 -0700
Committer: Sangeeta Ravindran 
Committed: Wed May 24 15:51:55 2017 -0700

--
 .../src/main/resources/ui/admin-web/app/index.html|  2 +-
 .../ui/admin-web/app/views/ambariViews/edit.html  |  2 +-
 ambari-web/app/controllers/main/views_controller.js   |  4 ++--
 ambari-web/app/models/view_instance.js|  6 +++---
 .../test/controllers/main/views_controller_test.js| 14 ++
 ambari-web/test/models/view_instance_test.js  |  6 +++---
 6 files changed, 20 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/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 32f9ba7..52e41f6 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
@@ -55,7 +55,7 @@
 
   
   
-{{instance.label}}
+{{instance.label}}
 {{'common.noViews' | translate}}
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
--
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index b6ec61d..f91862d 100644
--- 
a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ 
b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -20,7 +20,7 @@
 {{'common.views' | translate}}
 {{instance.ViewInstanceInfo.label}}
   
+ href="{{fromSiteRoot('/#/main/views/' + viewUrl)}}" target="_blank">
 {{'views.goToInstance' | translate}}
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/app/controllers/main/views_controller.js
--
diff --git a/ambari-web/app/controllers/main/views_controller.js 
b/ambari-web/app/controllers/main/views_controller.js
index 398cdd8..b746cf1 100644
--- a/ambari-web/app/controllers/main/views_controller.js
+++ b/ambari-web/app/controllers/main/views_controller.js
@@ -109,7 +109,7 @@ App.MainViewsController = Em.Controller.extend({
 
   setView: function (event) {
 if (event.context) {
-  App.router.route(event.context.get('internalAmbariUrl'));
+  window.open(event.context.get('internalAmbariUrl'));
 }
   }
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/app/models/view_instance.js
--
diff --git a/ambari-web/app/models/view_instance.js 
b/ambari-web/app/models/view_instance.js
index d438640..2ee3005 100644
--- a/ambari-web/app/models/view_instance.js
+++ b/ambari-web/app/models/view_instance.js
@@ -74,8 +74,8 @@ App.ViewInstance = Em.Object.extend({
 var version = this.get('version');
 var instanceName = this.get('instanceName');
 if(shortUrl) {
-  return 'main/view/' + viewName + '/' + shortUrl;
+  return '#/main/view/' + viewName + '/' + shortUrl;
 }
-return 'main/views/' + viewName + '/' + version + '/' + instanceName;
+return '#/main/views/' + viewName + '/' + version + '/' + instanceName;
   }.property('shortUrl', 'viewName', 'version', 'instanceName')
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/42be8ce7/ambari-web/test/controllers/main/views_controller_test.js
--
diff --git a/ambari-web/test/controllers/main/views_controller_test.js 
b/ambari-web/test/controllers/main/views_controller_test.js
index 0ab7654..af5c61b 100644
--- a/ambari-web/test/controllers/main/views_controller_test.js
+++ b/ambari-web/test/controllers/main/views_controller_test.js
@@ -143,17 

[1/3] ambari git commit: AMBARI-21079. Add ability to sink Raw metrics to external system via Http. (swagle)

2017-05-24 Thread swagle
Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-ams cd769e2e7 -> c32eebf89


http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eebf8/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricsCacheSizeOfEngine.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricsCacheSizeOfEngine.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricsCacheSizeOfEngine.java
index 19e0e60..fccf190 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricsCacheSizeOfEngine.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/cache/TimelineMetricsCacheSizeOfEngine.java
@@ -17,57 +17,27 @@
  */
 package org.apache.ambari.server.controller.metrics.timeline.cache;
 
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
-import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
+import 
org.apache.hadoop.metrics2.sink.timeline.cache.TimelineMetricsEhCacheSizeOfEngine;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import net.sf.ehcache.pool.Size;
 import net.sf.ehcache.pool.SizeOfEngine;
-import net.sf.ehcache.pool.impl.DefaultSizeOfEngine;
-import net.sf.ehcache.pool.sizeof.ReflectionSizeOf;
-import net.sf.ehcache.pool.sizeof.SizeOf;
 
 /**
  * Cache sizing engine that reduces reflective calls over the Object graph to
  * find total Heap usage.
  */
-public class TimelineMetricsCacheSizeOfEngine implements SizeOfEngine {
+public class TimelineMetricsCacheSizeOfEngine extends 
TimelineMetricsEhCacheSizeOfEngine {
 
   private final static Logger LOG = 
LoggerFactory.getLogger(TimelineMetricsCacheSizeOfEngine.class);
-  public static int DEFAULT_MAX_DEPTH = 1000;
-  public static boolean DEFAULT_ABORT_WHEN_MAX_DEPTH_EXCEEDED = false;
-
-  private SizeOfEngine underlying = null;
-  SizeOf reflectionSizeOf = new ReflectionSizeOf();
-
-  // Optimizations
-  private volatile long timelineMetricPrimitivesApproximation = 0;
-
-  private long sizeOfMapEntry;
-  private long sizeOfMapEntryOverhead;
 
   private TimelineMetricsCacheSizeOfEngine(SizeOfEngine underlying) {
-this.underlying = underlying;
+super(underlying);
   }
 
   public TimelineMetricsCacheSizeOfEngine() {
-this(new DefaultSizeOfEngine(DEFAULT_MAX_DEPTH, 
DEFAULT_ABORT_WHEN_MAX_DEPTH_EXCEEDED));
-
-this.sizeOfMapEntry = reflectionSizeOf.sizeOf(new Long(1)) +
-  reflectionSizeOf.sizeOf(new Double(2.0));
-
-//SizeOfMapEntryOverhead = SizeOfMapWithOneEntry - (SizeOfEmptyMap + 
SizeOfOneEntry)
-TreeMap map = new TreeMap<>();
-long emptyMapSize = reflectionSizeOf.sizeOf(map);
-map.put(new Long(1), new Double(2.0));
-long sizeOfMapOneEntry = reflectionSizeOf.deepSizeOf(DEFAULT_MAX_DEPTH, 
DEFAULT_ABORT_WHEN_MAX_DEPTH_EXCEEDED, map).getCalculated();
-this.sizeOfMapEntryOverhead =  sizeOfMapOneEntry - (emptyMapSize + 
this.sizeOfMapEntry);
-
-LOG.info("Creating custom sizeof engine for TimelineMetrics.");
+// Invoke default constructor in base class
   }
 
   @Override
@@ -108,36 +78,10 @@ public class TimelineMetricsCacheSizeOfEngine implements 
SizeOfEngine {
 
   private long getTimelineMetricCacheValueSize(TimelineMetricsCacheValue 
value) {
 long size = 16; // startTime + endTime
-TimelineMetrics metrics = value.getTimelineMetrics();
+
 size += 8; // Object reference
 
-if (metrics != null) {
-  for (TimelineMetric metric : metrics.getMetrics()) {
-
-if (timelineMetricPrimitivesApproximation == 0) {
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getMetricName());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getAppId());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getHostName());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getInstanceId());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getTimestamp());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getStartTime());
-  timelineMetricPrimitivesApproximation += 
reflectionSizeOf.sizeOf(metric.getType());
-  timelineMetricPrimitivesApproximation += 8; // Object overhead
-
-  LOG.debug("timelineMetricPrimitivesApproximation bytes = " + 
timelineMetricPrimitivesApproximation);
-}
-size += timelineMetricPrimitivesApproximation;
-
-Map metricValues = metric.getMetricValues();
-if (metricValues != null && !metricValues.isEmpty()) {
-  // Numeric wrapper: 12 bytes + 8 bytes Data type + 4 bytes alignment 
= 48 

[3/3] ambari git commit: AMBARI-21079. Add ability to sink Raw metrics to external system via Http. (swagle)

2017-05-24 Thread swagle
AMBARI-21079. Add ability to sink Raw metrics to external system via Http. 
(swagle)


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

Branch: refs/heads/branch-3.0-ams
Commit: c32eebf8935acab9d1a510bf05e8f8aeb8873a6f
Parents: cd769e2
Author: Siddharth Wagle 
Authored: Tue May 23 14:01:14 2017 -0700
Committer: Siddharth Wagle 
Committed: Tue May 23 14:01:14 2017 -0700

--
 ambari-metrics/ambari-metrics-common/pom.xml|  29 ++-
 .../TimelineMetricsEhCacheSizeOfEngine.java | 115 +
 .../ApplicationHistoryServer.java   |  13 +-
 .../timeline/HBaseTimelineMetricStore.java  |  30 ++-
 .../metrics/timeline/PhoenixHBaseAccessor.java  | 230 ++
 .../timeline/TimelineMetricConfiguration.java   | 176 +-
 .../TimelineMetricClusterAggregator.java|   2 +-
 .../TimelineMetricMetadataManager.java  |  15 +-
 .../timeline/sink/DefaultFSSinkProvider.java| 153 
 .../timeline/sink/ExternalMetricsSink.java  |  48 
 .../timeline/sink/ExternalSinkProvider.java |  35 +++
 .../metrics/timeline/sink/HttpSinkProvider.java | 231 +++
 .../DefaultInternalMetricsSourceProvider.java   |  42 
 .../timeline/source/InternalMetricsSource.java  |  30 +++
 .../timeline/source/InternalSourceProvider.java |  39 
 .../timeline/source/RawMetricsSource.java   |  93 
 .../source/cache/InternalMetricCacheKey.java| 109 +
 .../source/cache/InternalMetricCacheValue.java  |  37 +++
 .../source/cache/InternalMetricsCache.java  | 231 +++
 .../cache/InternalMetricsCacheProvider.java |  48 
 .../cache/InternalMetricsCacheSizeOfEngine.java |  66 ++
 .../TestApplicationHistoryServer.java   |   4 +-
 .../timeline/AbstractMiniHBaseClusterTest.java  |  49 ++--
 .../timeline/HBaseTimelineMetricStoreTest.java  |   8 +-
 .../timeline/ITPhoenixHBaseAccessor.java| 110 -
 .../timeline/PhoenixHBaseAccessorTest.java  | 167 ++
 .../TimelineMetricStoreWatcherTest.java |   4 +-
 .../aggregators/ITClusterAggregator.java|  72 +++---
 .../timeline/discovery/TestMetadataManager.java |   2 +-
 .../timeline/discovery/TestMetadataSync.java|   6 +-
 .../timeline/source/RawMetricsSourceTest.java   | 142 
 .../cache/TimelineMetricsCacheSizeOfEngine.java |  71 +-
 pom.xml |   1 +
 33 files changed, 1933 insertions(+), 475 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eebf8/ambari-metrics/ambari-metrics-common/pom.xml
--
diff --git a/ambari-metrics/ambari-metrics-common/pom.xml 
b/ambari-metrics/ambari-metrics-common/pom.xml
index 62ae75f..dc2ab5e 100644
--- a/ambari-metrics/ambari-metrics-common/pom.xml
+++ b/ambari-metrics/ambari-metrics-common/pom.xml
@@ -70,43 +70,47 @@
   
 
   com.google
-  
org.apache.hadoop.metrics2.sink.relocated.google
+  
org.apache.ambari.metrics.sink.relocated.google
 
 
   org.apache.commons.io
-  
org.apache.hadoop.metrics2.sink.relocated.commons.ioStormTimelineMetricsReporter
+  
org.apache.ambari.metrics.sink.relocated.commons.ioStormTimelineMetricsReporter
 
 
   org.apache.commons.lang
-  
org.apache.hadoop.metrics2.sink.relocated.commons.lang
+  
org.apache.ambari.metrics.relocated.commons.lang
 
 
   org.apache.curator
-  
org.apache.hadoop.metrics2.sink.relocated.curator
+  
org.apache.ambari.metrics.sink.relocated.curator
 
 
   org.apache.jute
-  
org.apache.hadoop.metrics2.sink.relocated.jute
+  
org.apache.ambari.metrics.sink.relocated.jute
 
 
   org.apache.zookeeper
-  
org.apache.hadoop.metrics2.sink.relocated.zookeeper
+  
org.apache.ambari.metrics.sink.relocated.zookeeper
 
 
   org.slf4j
-  
org.apache.hadoop.metrics2.sink.relocated.slf4j
+  
org.apache.ambari.metrics.sink.relocated.slf4j
 
 
   org.apache.log4j
-  

[2/3] ambari git commit: AMBARI-21079. Add ability to sink Raw metrics to external system via Http. (swagle)

2017-05-24 Thread swagle
http://git-wip-us.apache.org/repos/asf/ambari/blob/c32eebf8/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSource.java
--
diff --git 
a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSource.java
 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSource.java
new file mode 100644
index 000..967d819
--- /dev/null
+++ 
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/source/RawMetricsSource.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source;
+
+import java.util.Collection;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
+import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.sink.ExternalMetricsSink;
+import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source.cache.InternalMetricsCache;
+import 
org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.source.cache.InternalMetricsCacheProvider;
+
+public class RawMetricsSource implements InternalMetricsSource {
+  private static final Log LOG = LogFactory.getLog(RawMetricsSource.class);
+  private final int internalCacheInterval;
+  private final ExternalMetricsSink rawMetricsSink;
+  private final ScheduledExecutorService executorService = 
Executors.newSingleThreadScheduledExecutor();
+  private final InternalMetricsCache cache;
+  static final String RAW_METRICS_CACHE = "RAW_METRICS_CACHE_INSTANCE";
+
+  public RawMetricsSource(int internalCacheInterval, ExternalMetricsSink 
rawMetricsSink) {
+this.internalCacheInterval = internalCacheInterval;
+this.rawMetricsSink = rawMetricsSink;
+this.cache = 
InternalMetricsCacheProvider.getInstance().getCacheInstance(RAW_METRICS_CACHE);
+if (rawMetricsSink.getFlushSeconds() > internalCacheInterval) {
+  initializeFixedRateScheduler();
+}
+  }
+
+  @Override
+  public void publishTimelineMetrics(Collection metrics) {
+// TODO: Adjust default flush to reasonable defaults > 3 seconds
+if (rawMetricsSink.getFlushSeconds() > internalCacheInterval) {
+  // Need to cache only if external sink cannot keep up and thereby has
+  // different flush interval as compared to HBase flush
+  cache.putAll(metrics); // Scheduler initialized already for flush
+} else {
+  submitDataWithTimeout(metrics);
+}
+  }
+
+  private void initializeFixedRateScheduler() {
+executorService.scheduleAtFixedRate(new Runnable() {
+  @Override
+  public void run() {
+rawMetricsSink.sinkMetricData(cache.evictAll());
+  }
+}, rawMetricsSink.getFlushSeconds(), rawMetricsSink.getFlushSeconds(), 
TimeUnit.SECONDS);
+  }
+
+  private void submitDataWithTimeout(final Collection 
metrics) {
+Future f = executorService.submit(new Callable() {
+  @Override
+  public Object call() throws Exception {
+rawMetricsSink.sinkMetricData(metrics);
+return null;
+  }
+});
+try {
+  f.get(rawMetricsSink.getSinkTimeOutSeconds(), TimeUnit.SECONDS);
+} catch (InterruptedException e) {
+  LOG.warn("Raw metrics sink interrupted.");
+} catch (ExecutionException e) {
+  LOG.warn("Exception on sinking metrics", e);
+} catch (TimeoutException e) {
+  LOG.warn("Timeout exception on sinking metrics", e);
+}
+  }
+
+}


ambari git commit: AMBARI-21116. Setting yarn.node-labels.fs-store.root-dir to a "path" changes the permission of the "root path" (aonishuk)

2017-05-24 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/trunk b9ecb1fa5 -> 4405d4982


AMBARI-21116. Setting yarn.node-labels.fs-store.root-dir to a "path" changes 
the permission of the "root path" (aonishuk)


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

Branch: refs/heads/trunk
Commit: 4405d4982842a729ebfbd4c000c5ffb023a5
Parents: b9ecb1f
Author: Andrew Onishuk 
Authored: Wed May 24 22:00:21 2017 +0300
Committer: Andrew Onishuk 
Committed: Wed May 24 22:00:21 2017 +0300

--
 .../common-services/YARN/2.1.0.2.0/package/scripts/yarn.py  | 1 -
 .../common-services/YARN/3.0.0.3.0/package/scripts/yarn.py  | 1 -
 2 files changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4405d498/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
index 2e1b208..5ef08ad 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
@@ -310,7 +310,6 @@ def setup_historyserver():
action="create_on_execute",
owner=params.mapred_user,
group=params.user_group,
-   change_permissions_for_parents=True,
mode=0777
   )
   params.HdfsResource(None, action="execute")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4405d498/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
index c6b4c18..768411c 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
@@ -387,7 +387,6 @@ def setup_resourcemanager():
 params.HdfsResource(params.node_labels_dir,
  type="directory",
  action="create_on_execute",
- change_permissions_for_parents=True,
  owner=params.yarn_user,
  group=params.user_group,
  mode=0700



ambari git commit: AMBARI-21110. ambari-server setup fails with default postgres (aonishuk)

2017-05-24 Thread aonishuk
Repository: ambari
Updated Branches:
  refs/heads/trunk ff0c5253e -> b9ecb1fa5


AMBARI-21110. ambari-server setup fails with default postgres (aonishuk)


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

Branch: refs/heads/trunk
Commit: b9ecb1fa5c5e602d2ea1ae70be2dbbca8368a59f
Parents: ff0c525
Author: Andrew Onishuk 
Authored: Wed May 24 21:52:17 2017 +0300
Committer: Andrew Onishuk 
Committed: Wed May 24 21:52:17 2017 +0300

--
 .../main/python/ambari_commons/inet_utils.py| 12 +
 .../ambari_server/dbConfiguration_linux.py  | 27 ++--
 2 files changed, 25 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b9ecb1fa/ambari-common/src/main/python/ambari_commons/inet_utils.py
--
diff --git a/ambari-common/src/main/python/ambari_commons/inet_utils.py 
b/ambari-common/src/main/python/ambari_commons/inet_utils.py
index 66f6544..22eaaf5 100644
--- a/ambari-common/src/main/python/ambari_commons/inet_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/inet_utils.py
@@ -19,6 +19,7 @@ limitations under the License.
 '''
 
 import os
+import time
 import sys
 import urllib2
 import socket
@@ -70,6 +71,17 @@ def download_progress(file_name, downloaded_size, blockSize, 
totalSize):
   sys.stdout.write(status)
   sys.stdout.flush()
 
+def wait_for_port_opened(hostname, port, tries_count, try_sleep):
+  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+  sock.settimeout(2)
+
+  for i in range(tries_count):
+if sock.connect_ex((hostname, port)) == 0:
+  return True
+time.sleep(try_sleep)
+
+  return False
+
 
 def find_range_components(meta):
   file_size = 0

http://git-wip-us.apache.org/repos/asf/ambari/blob/b9ecb1fa/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
--
diff --git 
a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py 
b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index 797466d..dac3141 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -46,7 +46,7 @@ from ambari_server.serverConfiguration import 
encrypt_password, store_password_f
 PERSISTENCE_TYPE_PROPERTY, JDBC_CONNECTION_POOL_TYPE, 
JDBC_CONNECTION_POOL_ACQUISITION_SIZE, \
 JDBC_CONNECTION_POOL_IDLE_TEST_INTERVAL, JDBC_CONNECTION_POOL_MAX_AGE, 
JDBC_CONNECTION_POOL_MAX_IDLE_TIME, \
 JDBC_CONNECTION_POOL_MAX_IDLE_TIME_EXCESS, JDBC_SQLA_SERVER_NAME, 
LOCAL_DATABASE_ADMIN_PROPERTY
-
+from ambari_commons.inet_utils import wait_for_port_opened
 from ambari_commons.constants import AMBARI_SUDO_BINARY
 
 from ambari_server.userInput import get_YN_input, get_validated_string_input, 
read_password
@@ -59,6 +59,10 @@ ORACLE_SNAME_PATTERN = "jdbc:oracle:thin:@.+:.+:.+"
 
 JDBC_PROPERTIES_PREFIX = "server.jdbc.properties."
 
+PG_PORT_CHECK_TRIES_COUNT = 30
+PG_PORT_CHECK_INTERVAL = 1
+PG_PORT = 5432
+
 class LinuxDBMSConfig(DBMSConfig):
   def __init__(self, options, properties, storage_type):
 super(LinuxDBMSConfig, self).__init__(options, properties, storage_type)
@@ -622,19 +626,14 @@ class PGConfig(LinuxDBMSConfig):
stdin=subprocess.PIPE,
stderr=subprocess.PIPE
 )
-if OSCheck.is_suse_family():
-  time.sleep(20)
-  result = process.poll()
-  print_info_msg("Result of postgres start cmd: " + str(result))
-  if result is None:
-process.kill()
-pg_status, retcode, out, err = PGConfig._get_postgre_status()
-  else:
-retcode = result
-else:
-  out, err = process.communicate()
-  retcode = process.returncode
-  pg_status, retcode, out, err = PGConfig._get_postgre_status()
+out, err = process.communicate()
+retcode = process.returncode
+
+print_info_msg("Waiting for postgres to start at port 
{0}...".format(PG_PORT))
+wait_for_port_opened('127.0.0.1', PG_PORT, PG_PORT_CHECK_TRIES_COUNT, 
PG_PORT_CHECK_INTERVAL)
+
+pg_status, retcode, out, err = PGConfig._get_postgre_status()
+
 if pg_status == PGConfig.PG_STATUS_RUNNING:
   print_info_msg("Postgres process is running. Returning...")
   return pg_status, 0, out, err



ambari git commit: AMBARI-21101. HDP 3.0 install fails due to 'Script' has no attribute 'get_force_https_protocol' because function was renamed (echekanskiy)

2017-05-24 Thread echekanskiy
Repository: ambari
Updated Branches:
  refs/heads/trunk 90abffd70 -> 7bb2aba5c


AMBARI-21101. HDP 3.0 install fails due to 'Script' has no attribute 
'get_force_https_protocol' because function was renamed (echekanskiy)


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

Branch: refs/heads/trunk
Commit: 7bb2aba5cc67e65e586352efdf307cf67dbfd416
Parents: 90abffd
Author: Eugene Chekanskiy 
Authored: Wed May 24 18:25:32 2017 +0300
Committer: Eugene Chekanskiy 
Committed: Wed May 24 18:25:32 2017 +0300

--
 .../common-services/HDFS/3.0.0.3.0/package/scripts/utils.py| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7bb2aba5/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
 
b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
index ab4308c..53774c6 100644
--- 
a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
+++ 
b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/utils.py
@@ -38,7 +38,7 @@ from resource_management.libraries.script.script import Script
 from ambari_commons.inet_utils import ensure_ssl_using_protocol
 from zkfc_slave import ZkfcSlaveDefault
 
-ensure_ssl_using_protocol(Script.get_force_https_protocol())
+ensure_ssl_using_protocol(Script.get_force_https_protocol_name())
 
 def safe_zkfc_op(action, env):
   """



[3/4] ambari git commit: AMBARI-21050. Address config-groups while exporting blueprint from UI (alexantonenko)

2017-05-24 Thread jonathanhurley
AMBARI-21050. Address config-groups while exporting blueprint from UI 
(alexantonenko)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 90abffd706448786cc02257abd76a22b4f96fcd3
Parents: 5b44fa4
Author: Alex Antonenko 
Authored: Wed May 24 12:02:52 2017 +0300
Committer: Alex Antonenko 
Committed: Wed May 24 12:02:52 2017 +0300

--
 .../app/controllers/wizard/step8_controller.js  | 158 ++-
 .../test/controllers/wizard/step8_test.js   |  78 ++---
 2 files changed, 178 insertions(+), 58 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/90abffd7/ambari-web/app/controllers/wizard/step8_controller.js
--
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js 
b/ambari-web/app/controllers/wizard/step8_controller.js
index 7e318e0..f2b4ca7 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1811,9 +1811,9 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
 return configurationsDetails;
   },
 
-  hostInExistingHostGroup: function (newHost, cluster_template_host_groups) {
+  hostInExistingHostGroup: function (newHost, host_groups) {
 var hostGroupMatched = false;
-  cluster_template_host_groups.some(function (existingHostGroup) {
+  host_groups.some(function (existingHostGroup) {
 if(!hostGroupMatched) {
 var fqdnInHostGroup =  existingHostGroup.hosts[0].fqdn;
 var componentsInExistingHostGroup = 
this.getRegisteredHosts().filterProperty('hostName', 
fqdnInHostGroup)[0].hostComponents;
@@ -1830,8 +1830,8 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   });
   if(!componentMismatch) {
 hostGroupMatched = true;
-existingHostGroup["cardinality"]["cardinality"] = 
parseInt(existingHostGroup["cardinality"]["cardinality"]) + 1;
-existingHostGroup.hosts.push({"fqdn" : newHost.hostName})
+existingHostGroup["cardinality"] = 
parseInt(existingHostGroup["cardinality"]) + 1;
+existingHostGroup.hosts.push({"fqdn" : newHost.hostName});
 return true;
   }
 }
@@ -1840,6 +1840,17 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
 return hostGroupMatched;
   },
 
+   hostInChildHostGroup: function (presentHostGroup, configGroupName, 
hostInConfigGroup) {
+return  presentHostGroup['childHostGroups'].some(function (childHostGroup) 
{
+  //Check if childHostGroup name is same as this configgroupname, if yes, 
update childHostGroup else, compare with other childhostgroups
+  if(childHostGroup.configGroupName === configGroupName) {
+childHostGroup.hosts.push( { "fqdn" : hostInConfigGroup } );
+childHostGroup['cardinality'] = childHostGroup['cardinality'] + 1;
+return true;
+  }
+  });
+  },
+
   generateBlueprint: function () {
 console.log("Prepare blueprint for download...");
 var blueprint = {};
@@ -1863,59 +1874,130 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   }, this);
 }, this);
 
-//TODO address configGroups
 var host_groups = [];
 var cluster_template_host_groups = [];
 var counter = 0;
 
 this.getRegisteredHosts().filterProperty('isInstalled', 
false).map(function (host) {
-  var clusterTemplateHostGroupDetail = {};
-  if(self.hostInExistingHostGroup(host, cluster_template_host_groups)) {
+  if(self.hostInExistingHostGroup(host, host_groups)) {
 return;
   }
-
+  //Create new host_group if host is not mapped to existing host_groups
   var hostGroupId = "host_group_" + counter;
-  var cardinality = {"cardinality": 1};
+  var hostListForGroup = [];
+  hostListForGroup.push({ "fqdn": host.hostName });
   var hostGroupDetail = {
 "name": hostGroupId,
 "components": self.getComponentsForHost(host),
-cardinality
+"hosts": hostListForGroup,
+"cardinality" : 1
   };
   hostGroupDetail.toJSON = function () {
-  var hostGroupDetailResult = {};
-  for (var x in this) {
-if (x === "cardinality") {
-  hostGroupDetailResult[x] = (this[x]["cardinality"]).toString();
-  } else {
-hostGroupDetailResult[x] = this[x];
-}
-  }
-  return hostGroupDetailResult;
-  }
+var 

[4/4] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-12556

2017-05-24 Thread jonathanhurley
Merge branch 'trunk' into branch-feature-AMBARI-12556


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 2cfc8d22dc1ccc180c376b40ea6a96967d9bf6a4
Parents: 560b0d1 90abffd
Author: Jonathan Hurley 
Authored: Wed May 24 09:57:57 2017 -0400
Committer: Jonathan Hurley 
Committed: Wed May 24 09:57:57 2017 -0400

--
 .../server/state/ValueAttributesInfo.java   |  26 +--
 .../app/controllers/wizard/step8_controller.js  | 158 ++-
 .../test/controllers/wizard/step8_test.js   |  77 ++---
 pom.xml |   1 +
 4 files changed, 192 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2cfc8d22/ambari-web/app/controllers/wizard/step8_controller.js
--

http://git-wip-us.apache.org/repos/asf/ambari/blob/2cfc8d22/ambari-web/test/controllers/wizard/step8_test.js
--



[1/4] ambari git commit: AMBARI-20970. Integrate StackService with Swagger - addendum: fix XML property names

2017-05-24 Thread jonathanhurley
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-12556 560b0d194 -> 2cfc8d22d


AMBARI-20970. Integrate StackService with Swagger - addendum: fix XML property 
names


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ca54b9607c0b8c43d8880fbc1531d3098c9fcb95
Parents: 1c19200
Author: Attila Doroszlai 
Authored: Wed May 24 06:09:52 2017 +0200
Committer: Attila Doroszlai 
Committed: Wed May 24 09:33:37 2017 +0200

--
 .../server/state/ValueAttributesInfo.java   | 26 ++--
 1 file changed, 13 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ca54b960/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
index 4137115..739c204 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ValueAttributesInfo.java
@@ -35,12 +35,12 @@ import io.swagger.annotations.ApiModelProperty;
 @XmlAccessorType(XmlAccessType.FIELD)
 @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
 public class ValueAttributesInfo implements ApiModel {
-  public static final String EMPTY_VALUE_VALID = "empty-value-valid";
-  public static final String UI_ONLY_PROPERTY = "ui-only-property";
-  public static final String READ_ONLY = "read-only";
-  public static final String EDITABLE_ONLY_AT_INSTALL = 
"editable-only-at-install";
-  public static final String SHOW_PROPERTY_NAME = "show-property-name";
-  public static final String INCREMENT_STEP = "increment-step";
+  public static final String EMPTY_VALUE_VALID = "empty_value_valid";
+  public static final String UI_ONLY_PROPERTY = "ui_only_property";
+  public static final String READ_ONLY = "read_only";
+  public static final String EDITABLE_ONLY_AT_INSTALL = 
"editable_only_at_install";
+  public static final String SHOW_PROPERTY_NAME = "show_property_name";
+  public static final String INCREMENT_STEP = "increment_step";
   public static final String SELECTION_CARDINALITY = "selection_cardinality";
   public static final String PROPERTY_FILE_NAME = "property-file-name";
   public static final String PROPERTY_FILE_TYPE = "property-file-type";
@@ -58,27 +58,27 @@ public class ValueAttributesInfo implements ApiModel {
   private Boolean overridable;
   private String copy;
 
-  @XmlElement(name = EMPTY_VALUE_VALID)
+  @XmlElement(name = "empty-value-valid")
   @JsonProperty(EMPTY_VALUE_VALID)
   private Boolean emptyValueValid;
 
-  @XmlElement(name = UI_ONLY_PROPERTY)
+  @XmlElement(name = "ui-only-property")
   @JsonProperty(UI_ONLY_PROPERTY)
   private Boolean uiOnlyProperty;
 
-  @XmlElement(name = READ_ONLY)
+  @XmlElement(name = "read-only")
   @JsonProperty(READ_ONLY)
   private Boolean readOnly;
 
-  @XmlElement(name = EDITABLE_ONLY_AT_INSTALL)
+  @XmlElement(name = "editable-only-at-install")
   @JsonProperty(EDITABLE_ONLY_AT_INSTALL)
   private Boolean editableOnlyAtInstall;
 
-  @XmlElement(name = SHOW_PROPERTY_NAME)
+  @XmlElement(name = "show-property-name")
   @JsonProperty(SHOW_PROPERTY_NAME)
   private Boolean showPropertyName;
 
-  @XmlElement(name = INCREMENT_STEP)
+  @XmlElement(name = "increment-step")
   @JsonProperty(INCREMENT_STEP)
   private String incrementStep;
 
@@ -92,7 +92,7 @@ public class ValueAttributesInfo implements ApiModel {
   @XmlElement(name = ENTRIES_EDITABLE)
   private Boolean entriesEditable;
 
-  @XmlElement(name = SELECTION_CARDINALITY)
+  @XmlElement(name = "selection-cardinality")
   @JsonProperty(SELECTION_CARDINALITY)
   private String selectionCardinality;
 



ambari git commit: AMBARI-21050. Address config-groups while exporting blueprint from UI (alexantonenko)

2017-05-24 Thread alexantonenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 5b44fa44e -> 90abffd70


AMBARI-21050. Address config-groups while exporting blueprint from UI 
(alexantonenko)


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

Branch: refs/heads/trunk
Commit: 90abffd706448786cc02257abd76a22b4f96fcd3
Parents: 5b44fa4
Author: Alex Antonenko 
Authored: Wed May 24 12:02:52 2017 +0300
Committer: Alex Antonenko 
Committed: Wed May 24 12:02:52 2017 +0300

--
 .../app/controllers/wizard/step8_controller.js  | 158 ++-
 .../test/controllers/wizard/step8_test.js   |  78 ++---
 2 files changed, 178 insertions(+), 58 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/90abffd7/ambari-web/app/controllers/wizard/step8_controller.js
--
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js 
b/ambari-web/app/controllers/wizard/step8_controller.js
index 7e318e0..f2b4ca7 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1811,9 +1811,9 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
 return configurationsDetails;
   },
 
-  hostInExistingHostGroup: function (newHost, cluster_template_host_groups) {
+  hostInExistingHostGroup: function (newHost, host_groups) {
 var hostGroupMatched = false;
-  cluster_template_host_groups.some(function (existingHostGroup) {
+  host_groups.some(function (existingHostGroup) {
 if(!hostGroupMatched) {
 var fqdnInHostGroup =  existingHostGroup.hosts[0].fqdn;
 var componentsInExistingHostGroup = 
this.getRegisteredHosts().filterProperty('hostName', 
fqdnInHostGroup)[0].hostComponents;
@@ -1830,8 +1830,8 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   });
   if(!componentMismatch) {
 hostGroupMatched = true;
-existingHostGroup["cardinality"]["cardinality"] = 
parseInt(existingHostGroup["cardinality"]["cardinality"]) + 1;
-existingHostGroup.hosts.push({"fqdn" : newHost.hostName})
+existingHostGroup["cardinality"] = 
parseInt(existingHostGroup["cardinality"]) + 1;
+existingHostGroup.hosts.push({"fqdn" : newHost.hostName});
 return true;
   }
 }
@@ -1840,6 +1840,17 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
 return hostGroupMatched;
   },
 
+   hostInChildHostGroup: function (presentHostGroup, configGroupName, 
hostInConfigGroup) {
+return  presentHostGroup['childHostGroups'].some(function (childHostGroup) 
{
+  //Check if childHostGroup name is same as this configgroupname, if yes, 
update childHostGroup else, compare with other childhostgroups
+  if(childHostGroup.configGroupName === configGroupName) {
+childHostGroup.hosts.push( { "fqdn" : hostInConfigGroup } );
+childHostGroup['cardinality'] = childHostGroup['cardinality'] + 1;
+return true;
+  }
+  });
+  },
+
   generateBlueprint: function () {
 console.log("Prepare blueprint for download...");
 var blueprint = {};
@@ -1863,59 +1874,130 @@ App.WizardStep8Controller = 
Em.Controller.extend(App.AddSecurityConfigs, App.wiz
   }, this);
 }, this);
 
-//TODO address configGroups
 var host_groups = [];
 var cluster_template_host_groups = [];
 var counter = 0;
 
 this.getRegisteredHosts().filterProperty('isInstalled', 
false).map(function (host) {
-  var clusterTemplateHostGroupDetail = {};
-  if(self.hostInExistingHostGroup(host, cluster_template_host_groups)) {
+  if(self.hostInExistingHostGroup(host, host_groups)) {
 return;
   }
-
+  //Create new host_group if host is not mapped to existing host_groups
   var hostGroupId = "host_group_" + counter;
-  var cardinality = {"cardinality": 1};
+  var hostListForGroup = [];
+  hostListForGroup.push({ "fqdn": host.hostName });
   var hostGroupDetail = {
 "name": hostGroupId,
 "components": self.getComponentsForHost(host),
-cardinality
+"hosts": hostListForGroup,
+"cardinality" : 1
   };
   hostGroupDetail.toJSON = function () {
-  var hostGroupDetailResult = {};
-  for (var x in this) {
-if (x === "cardinality") {
-  hostGroupDetailResult[x] = (this[x]["cardinality"]).toString();
-  } else {
-hostGroupDetailResult[x] = this[x];
-}
-  }
-  

ambari git commit: AMBARI-21107. RAT check fails due to Checkstyle output in utility

2017-05-24 Thread adoroszlai
Repository: ambari
Updated Branches:
  refs/heads/trunk ca54b9607 -> 5b44fa44e


AMBARI-21107. RAT check fails due to Checkstyle output in utility


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

Branch: refs/heads/trunk
Commit: 5b44fa44e0e08f8fed5482a8ae54827ac0f49eeb
Parents: ca54b96
Author: Attila Doroszlai 
Authored: Wed May 24 07:26:53 2017 +0200
Committer: Attila Doroszlai 
Committed: Wed May 24 10:37:41 2017 +0200

--
 pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5b44fa44/pom.xml
--
diff --git a/pom.xml b/pom.xml
index e0d0373..8faec29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -400,6 +400,7 @@
 
 **/createDDL.jdbc
 **/yarn.lock
+utility/target/**