git commit: AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist. Doc updates (srimanth)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 a5b37ab6d -> 25d0b121e AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist. Doc updates (srimanth) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/25d0b121 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/25d0b121 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/25d0b121 Branch: refs/heads/branch-1.7.0 Commit: 25d0b121e9552ef86f4036e3272f02a375f6ff77 Parents: a5b37ab Author: Srimanth Gunturi Authored: Thu Oct 16 23:36:09 2014 -0700 Committer: Srimanth Gunturi Committed: Thu Oct 16 23:36:52 2014 -0700 -- contrib/views/slider/docs/index.md | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/25d0b121/contrib/views/slider/docs/index.md -- diff --git a/contrib/views/slider/docs/index.md b/contrib/views/slider/docs/index.md index 0c9132c..bd23d14 100644 --- a/contrib/views/slider/docs/index.md +++ b/contrib/views/slider/docs/index.md @@ -80,4 +80,35 @@ From *Ambari-Admin* create a *Slider Apps View* with the below parameters popula * slider.security.enabled = true * view.kerberos.principal = `view-principal` -* view.kerberos.principal.keytab = `/etc/security/keytabs/view-principal.headless.keytab` \ No newline at end of file +* view.kerberos.principal.keytab = `/etc/security/keytabs/view-principal.headless.keytab` + + Step-5 Create *Kerberos* principal for *slider.user* +We need to provide a *Kerberos* identity for the user identified in *slider.user* view parameter. + +The *slider.user* view parameter has the following interpretations: + +* If the parameter is left blank, it means the user *yarn*. +* If it is `${username}`, it is the user logged into Ambari. +* Else, it is exact name of the user. + +We shall assume the user as `slider-user`. In a secured cluster this user has to actually exist on all the hosts. The user should also have an *uid* greater than 1000. + +On the machine where *KDC Server* is hosted, create user principal by running below command + +``` +kadmin.local -q "addprinc -randkey slider-u...@example.com" +``` +Next, extract keytab file + +``` +kadmin.local -q "xst -k /path/to/keytab/slider-user.headless.keytab view-princi...@example.com" +``` +The keytab file should then be copied over to the keytabs location on the host where the view is hosted. + +``` +cp /path/to/keytab/slider-user.headless.keytab /etc/security/keytabs/ +``` + +Change file permissions so that only necessary users can access it. + +**Make sure that `slider-user` keytab is at /etc/security/keytabs/`slider-user`.headless.keytab**
git commit: AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist. Doc updates (srimanth)
Repository: ambari Updated Branches: refs/heads/trunk 336e2b1ff -> 8c59e4a3d AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist. Doc updates (srimanth) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8c59e4a3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c59e4a3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c59e4a3 Branch: refs/heads/trunk Commit: 8c59e4a3d049435e66a3332958e1a30ed8d4b347 Parents: 336e2b1 Author: Srimanth Gunturi Authored: Thu Oct 16 23:36:09 2014 -0700 Committer: Srimanth Gunturi Committed: Thu Oct 16 23:36:09 2014 -0700 -- contrib/views/slider/docs/index.md | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8c59e4a3/contrib/views/slider/docs/index.md -- diff --git a/contrib/views/slider/docs/index.md b/contrib/views/slider/docs/index.md index 0c9132c..bd23d14 100644 --- a/contrib/views/slider/docs/index.md +++ b/contrib/views/slider/docs/index.md @@ -80,4 +80,35 @@ From *Ambari-Admin* create a *Slider Apps View* with the below parameters popula * slider.security.enabled = true * view.kerberos.principal = `view-principal` -* view.kerberos.principal.keytab = `/etc/security/keytabs/view-principal.headless.keytab` \ No newline at end of file +* view.kerberos.principal.keytab = `/etc/security/keytabs/view-principal.headless.keytab` + + Step-5 Create *Kerberos* principal for *slider.user* +We need to provide a *Kerberos* identity for the user identified in *slider.user* view parameter. + +The *slider.user* view parameter has the following interpretations: + +* If the parameter is left blank, it means the user *yarn*. +* If it is `${username}`, it is the user logged into Ambari. +* Else, it is exact name of the user. + +We shall assume the user as `slider-user`. In a secured cluster this user has to actually exist on all the hosts. The user should also have an *uid* greater than 1000. + +On the machine where *KDC Server* is hosted, create user principal by running below command + +``` +kadmin.local -q "addprinc -randkey slider-u...@example.com" +``` +Next, extract keytab file + +``` +kadmin.local -q "xst -k /path/to/keytab/slider-user.headless.keytab view-princi...@example.com" +``` +The keytab file should then be copied over to the keytabs location on the host where the view is hosted. + +``` +cp /path/to/keytab/slider-user.headless.keytab /etc/security/keytabs/ +``` + +Change file permissions so that only necessary users can access it. + +**Make sure that `slider-user` keytab is at /etc/security/keytabs/`slider-user`.headless.keytab**
git commit: AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist (srimanth)
Repository: ambari Updated Branches: refs/heads/trunk 43ab9e61f -> 336e2b1ff AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist (srimanth) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/336e2b1f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/336e2b1f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/336e2b1f Branch: refs/heads/trunk Commit: 336e2b1ff3984f892c4d1d8c1b3fa93a86026de9 Parents: 43ab9e6 Author: Srimanth Gunturi Authored: Thu Oct 16 18:52:57 2014 -0700 Committer: Srimanth Gunturi Committed: Thu Oct 16 23:07:42 2014 -0700 -- .../0.51.0/slider-agent-0.51.0.tar.gz | Bin 472393 -> 471859 bytes .../slider-core/0.51.0/slider-core-0.51.0.jar | Bin 1155217 -> 1167680 bytes contrib/views/slider/pom.xml| 5 ++ .../slider/SliderAppsViewControllerImpl.java| 49 +-- 4 files changed, 50 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/336e2b1f/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz -- diff --git a/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz b/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz index f724da9..9d22825 100644 Binary files a/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz and b/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz differ http://git-wip-us.apache.org/repos/asf/ambari/blob/336e2b1f/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar -- diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar index 7c2e42f..cbcca5c 100644 Binary files a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar and b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar differ http://git-wip-us.apache.org/repos/asf/ambari/blob/336e2b1f/contrib/views/slider/pom.xml -- diff --git a/contrib/views/slider/pom.xml b/contrib/views/slider/pom.xml index 3f311c8..cb07dd4 100644 --- a/contrib/views/slider/pom.xml +++ b/contrib/views/slider/pom.xml @@ -252,6 +252,11 @@ org.apache.hadoop + hadoop-yarn-registry + ${hadoop.version} + + + org.apache.hadoop hadoop-yarn-common ${hadoop.version} http://git-wip-us.apache.org/repos/asf/ambari/blob/336e2b1f/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java -- diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java index 92f95c9..bdd3c0f 100644 --- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java +++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java @@ -66,6 +66,7 @@ import org.apache.slider.client.SliderClient; import org.apache.slider.common.params.ActionCreateArgs; import org.apache.slider.common.params.ActionFlexArgs; import org.apache.slider.common.params.ActionFreezeArgs; +import org.apache.slider.common.params.ActionInstallKeytabArgs; import org.apache.slider.common.params.ActionInstallPackageArgs; import org.apache.slider.common.params.ActionThawArgs; import org.apache.slider.core.exceptions.SliderException; @@ -84,6 +85,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -134,7 +136,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { ambariUsername, ambariPassword); try { AmbariClusterInfo clusterInfo = ambariClient.getClusterInfo(); - if (clusterName.equals(clusterInfo.getName())) { + if (clusterInfo!=null && clusterName.equals(clusterInfo.getName())) { Amba
git commit: AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist (srimanth)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 7d86ffc97 -> a5b37ab6d AMBARI-7824. Slider View: Unable to create app when cluster is secured - keytab doesnt exist (srimanth) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a5b37ab6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a5b37ab6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a5b37ab6 Branch: refs/heads/branch-1.7.0 Commit: a5b37ab6d0d18b6d09a42fd7c564278ae3f61103 Parents: 7d86ffc Author: Srimanth Gunturi Authored: Thu Oct 16 18:52:57 2014 -0700 Committer: Srimanth Gunturi Committed: Thu Oct 16 18:53:11 2014 -0700 -- .../0.51.0/slider-agent-0.51.0.tar.gz | Bin 472393 -> 471859 bytes .../slider-core/0.51.0/slider-core-0.51.0.jar | Bin 1155217 -> 1167680 bytes contrib/views/slider/pom.xml| 5 ++ .../slider/SliderAppsViewControllerImpl.java| 49 +-- 4 files changed, 50 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b37ab6/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz -- diff --git a/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz b/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz index f724da9..9d22825 100644 Binary files a/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz and b/contrib/views/slider/lib/org/apache/slider/slider-agent/0.51.0/slider-agent-0.51.0.tar.gz differ http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b37ab6/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar -- diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar index 7c2e42f..cbcca5c 100644 Binary files a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar and b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar differ http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b37ab6/contrib/views/slider/pom.xml -- diff --git a/contrib/views/slider/pom.xml b/contrib/views/slider/pom.xml index 3f311c8..cb07dd4 100644 --- a/contrib/views/slider/pom.xml +++ b/contrib/views/slider/pom.xml @@ -252,6 +252,11 @@ org.apache.hadoop + hadoop-yarn-registry + ${hadoop.version} + + + org.apache.hadoop hadoop-yarn-common ${hadoop.version} http://git-wip-us.apache.org/repos/asf/ambari/blob/a5b37ab6/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java -- diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java index 92f95c9..bdd3c0f 100644 --- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java +++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java @@ -66,6 +66,7 @@ import org.apache.slider.client.SliderClient; import org.apache.slider.common.params.ActionCreateArgs; import org.apache.slider.common.params.ActionFlexArgs; import org.apache.slider.common.params.ActionFreezeArgs; +import org.apache.slider.common.params.ActionInstallKeytabArgs; import org.apache.slider.common.params.ActionInstallPackageArgs; import org.apache.slider.common.params.ActionThawArgs; import org.apache.slider.core.exceptions.SliderException; @@ -84,6 +85,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.google.gson.JsonPrimitive; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -134,7 +136,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { ambariUsername, ambariPassword); try { AmbariClusterInfo clusterInfo = ambariClient.getClusterInfo(); - if (clusterName.equals(clusterInfo.getName())) { + if (clusterInfo!=null && clusterName.equals(clusterInfo.getName())) {
[1/2] git commit: AMBARI-7822. Events with Service Checks results in Exceptions in log.
Repository: ambari Updated Branches: refs/heads/trunk 1cf2b9852 -> 43ab9e61f AMBARI-7822. Events with Service Checks results in Exceptions in log. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/383d3e71 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/383d3e71 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/383d3e71 Branch: refs/heads/trunk Commit: 383d3e7116565fba181ec823c455867a99ff09e3 Parents: 1cf2b98 Author: Siddharth Wagle Authored: Thu Oct 16 17:47:54 2014 -0700 Committer: Siddharth Wagle Committed: Thu Oct 16 17:47:54 2014 -0700 -- .../AmbariManagementControllerImpl.java | 44 +-- .../AmbariManagementControllerImplTest.java | 343 +-- 2 files changed, 254 insertions(+), 133 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/383d3e71/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index d12b6fd..9b17352 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1979,7 +1979,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle for (String serviceName : smokeTestServices) { // Creates smoke test commands Service s = cluster.getService(serviceName); // find service component host -String clientHost = getClientHostForRunningAction(cluster, s); +ServiceComponent component = getClientComponentForRunningAction(cluster, s); +String componentName = component.getName(); +String clientHost = getClientHostForRunningAction(cluster, s, component); String smokeTestRole = actionMetadata.getServiceCheckAction(serviceName); @@ -1995,7 +1997,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle customCommandExecutionHelper.addServiceCheckAction(stage, clientHost, smokeTestRole, nowTimestamp, serviceName, - null, null); + componentName, null); } RoleCommandOrder rco = getRoleCommandOrder(cluster); @@ -2880,7 +2882,17 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } } - private String getClientHostForRunningAction(Cluster cluster, + protected String getClientHostForRunningAction(Cluster cluster, Service service, ServiceComponent serviceComponent) + throws AmbariException { +if (serviceComponent != null && !serviceComponent.getServiceComponentHosts().isEmpty()) { + Set candidateHosts = serviceComponent.getServiceComponentHosts().keySet(); + filterHostsForAction(candidateHosts, service, cluster, Resource.Type.Cluster); + return getHealthyHost(candidateHosts); +} +return null; + } + + protected ServiceComponent getClientComponentForRunningAction(Cluster cluster, Service service) throws AmbariException { /* * We assume Cluster level here. That means that we never run service @@ -2888,7 +2900,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle * That also means that we can not run service check if the only host * that has client component is in maintenance state */ -Resource.Type opLvl = Resource.Type.Cluster; StackId stackId = service.getDesiredStackVersion(); ComponentInfo compInfo = @@ -2896,13 +2907,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle stackId.getStackVersion(), service.getName()).getClientComponent(); if (compInfo != null) { try { -ServiceComponent serviceComponent = -service.getServiceComponent(compInfo.getName()); -if (!serviceComponent.getServiceComponentHosts().isEmpty()) { - Set candidateHosts = serviceComponent.getServiceComponentHosts().keySet(); - filterHostsForAction(candidateHosts, service, cluster, opLvl); - return getHealthyHost(candidateHosts); -} +return service.getServiceComponent(compInfo.getName()); } catch (ServiceComponentNotFoundException e) { LOG.warn("Could not find required component to run action" + ", clusterName=" + cluster.getClusterName() @@ -2913,17 +2918,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // any component w
[2/2] git commit: AMBARI-7822. Events with Service Checks results in Exceptions in log. Null check.
AMBARI-7822. Events with Service Checks results in Exceptions in log. Null check. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/43ab9e61 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/43ab9e61 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/43ab9e61 Branch: refs/heads/trunk Commit: 43ab9e61f076affb0a6fc92e39053cf0e8b6d163 Parents: 383d3e7 Author: Siddharth Wagle Authored: Thu Oct 16 18:45:45 2014 -0700 Committer: Siddharth Wagle Committed: Thu Oct 16 18:45:45 2014 -0700 -- .../server/controller/AmbariManagementControllerImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/43ab9e61/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 9b17352..6779205 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1980,10 +1980,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Service s = cluster.getService(serviceName); // find service component host ServiceComponent component = getClientComponentForRunningAction(cluster, s); -String componentName = component.getName(); +String componentName = component != null ? component.getName() : null; String clientHost = getClientHostForRunningAction(cluster, s, component); -String smokeTestRole = -actionMetadata.getServiceCheckAction(serviceName); +String smokeTestRole = actionMetadata.getServiceCheckAction(serviceName); if (clientHost == null || smokeTestRole == null) { LOG.info("Nothing to do for service check as could not find role or"
[2/2] git commit: AMBARI-7822. Events with Service Checks results in Exceptions in log. Null check.
AMBARI-7822. Events with Service Checks results in Exceptions in log. Null check. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7d86ffc9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7d86ffc9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7d86ffc9 Branch: refs/heads/branch-1.7.0 Commit: 7d86ffc97a5b2e8ca0fe031b2cab662b2558971c Parents: f93722d Author: Siddharth Wagle Authored: Thu Oct 16 18:40:40 2014 -0700 Committer: Siddharth Wagle Committed: Thu Oct 16 18:40:40 2014 -0700 -- .../server/controller/AmbariManagementControllerImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7d86ffc9/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 9b17352..6779205 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1980,10 +1980,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Service s = cluster.getService(serviceName); // find service component host ServiceComponent component = getClientComponentForRunningAction(cluster, s); -String componentName = component.getName(); +String componentName = component != null ? component.getName() : null; String clientHost = getClientHostForRunningAction(cluster, s, component); -String smokeTestRole = -actionMetadata.getServiceCheckAction(serviceName); +String smokeTestRole = actionMetadata.getServiceCheckAction(serviceName); if (clientHost == null || smokeTestRole == null) { LOG.info("Nothing to do for service check as could not find role or"
[1/2] git commit: AMBARI-7822. Events with Service Checks results in Exceptions in log.
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 c0b54499b -> 7d86ffc97 AMBARI-7822. Events with Service Checks results in Exceptions in log. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f93722d0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f93722d0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f93722d0 Branch: refs/heads/branch-1.7.0 Commit: f93722d0a684407a9c5c8451215ebb34ab0da852 Parents: c0b5449 Author: Siddharth Wagle Authored: Thu Oct 16 17:45:55 2014 -0700 Committer: Siddharth Wagle Committed: Thu Oct 16 17:45:55 2014 -0700 -- .../AmbariManagementControllerImpl.java | 44 +-- .../AmbariManagementControllerImplTest.java | 343 +-- 2 files changed, 254 insertions(+), 133 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f93722d0/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index d12b6fd..9b17352 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1979,7 +1979,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle for (String serviceName : smokeTestServices) { // Creates smoke test commands Service s = cluster.getService(serviceName); // find service component host -String clientHost = getClientHostForRunningAction(cluster, s); +ServiceComponent component = getClientComponentForRunningAction(cluster, s); +String componentName = component.getName(); +String clientHost = getClientHostForRunningAction(cluster, s, component); String smokeTestRole = actionMetadata.getServiceCheckAction(serviceName); @@ -1995,7 +1997,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle customCommandExecutionHelper.addServiceCheckAction(stage, clientHost, smokeTestRole, nowTimestamp, serviceName, - null, null); + componentName, null); } RoleCommandOrder rco = getRoleCommandOrder(cluster); @@ -2880,7 +2882,17 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } } - private String getClientHostForRunningAction(Cluster cluster, + protected String getClientHostForRunningAction(Cluster cluster, Service service, ServiceComponent serviceComponent) + throws AmbariException { +if (serviceComponent != null && !serviceComponent.getServiceComponentHosts().isEmpty()) { + Set candidateHosts = serviceComponent.getServiceComponentHosts().keySet(); + filterHostsForAction(candidateHosts, service, cluster, Resource.Type.Cluster); + return getHealthyHost(candidateHosts); +} +return null; + } + + protected ServiceComponent getClientComponentForRunningAction(Cluster cluster, Service service) throws AmbariException { /* * We assume Cluster level here. That means that we never run service @@ -2888,7 +2900,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle * That also means that we can not run service check if the only host * that has client component is in maintenance state */ -Resource.Type opLvl = Resource.Type.Cluster; StackId stackId = service.getDesiredStackVersion(); ComponentInfo compInfo = @@ -2896,13 +2907,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle stackId.getStackVersion(), service.getName()).getClientComponent(); if (compInfo != null) { try { -ServiceComponent serviceComponent = -service.getServiceComponent(compInfo.getName()); -if (!serviceComponent.getServiceComponentHosts().isEmpty()) { - Set candidateHosts = serviceComponent.getServiceComponentHosts().keySet(); - filterHostsForAction(candidateHosts, service, cluster, opLvl); - return getHealthyHost(candidateHosts); -} +return service.getServiceComponent(compInfo.getName()); } catch (ServiceComponentNotFoundException e) { LOG.warn("Could not find required component to run action" + ", clusterName=" + cluster.getClusterName() @@ -2913,17 +2918,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // a
git commit: AMBARI-7601 Service pluggability: refactor UI code to externalize metrics graph definition to a single file (salvi via jaoki)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 2414e599e -> c0b54499b AMBARI-7601 Service pluggability: refactor UI code to externalize metrics graph definition to a single file (salvi via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c0b54499 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c0b54499 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c0b54499 Branch: refs/heads/branch-1.7.0 Commit: c0b54499b202f1829bcc441f7344e6bf69eb7db7 Parents: 2414e59 Author: Jun Aoki Authored: Thu Oct 16 14:56:19 2014 -0700 Committer: Jun Aoki Committed: Thu Oct 16 14:56:19 2014 -0700 -- ambari-web/app/assets/test/tests.js | 2 + ambari-web/app/data/service_graph_config.js | 93 +++ .../app/views/main/service/info/summary.js | 96 ++-- .../views/main/service/info/summary_test.js | 24 - 4 files changed, 146 insertions(+), 69 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c0b54499/ambari-web/app/assets/test/tests.js -- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index b54452a..8682af3 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -163,6 +163,8 @@ var files = ['test/init_model_test', 'test/views/main/charts/heatmap/heatmap_host_test', 'test/views/main/service/item_test', 'test/views/main/service/info/config_test', + 'test/views/main/service/info/summary_test', + 'test/views/main/mirroring/edit_dataset_view_test', 'test/views/common/configs/services_config_test', 'test/views/wizard/step3/hostLogPopupBody_view_test', 'test/views/wizard/step3/hostWarningPopupBody_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/c0b54499/ambari-web/app/data/service_graph_config.js -- diff --git a/ambari-web/app/data/service_graph_config.js b/ambari-web/app/data/service_graph_config.js new file mode 100644 index 000..51a9f9e --- /dev/null +++ b/ambari-web/app/data/service_graph_config.js @@ -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. + */ + +var App = require('app'); + +/** +This determines the graphs to display on the service page under each service. + +This is based on the name of the object associated with it. + +The name of the object is of the format: 'App.ChartServiceMetrics' where +is one of the items below. +**/ +App.service_graph_config = { + 'hdfs': [ + 'HDFS_SpaceUtilization', + 'HDFS_FileOperations', + 'HDFS_BlockStatus', + 'HDFS_IO', + 'HDFS_RPC', + 'HDFS_GC', + 'HDFS_JVMHeap', + 'HDFS_JVMThreads' + ], + + 'yarn': [ + 'YARN_AllocatedMemory', + 'YARN_QMR', + 'YARN_AllocatedContainer', + 'YARN_NMS', + 'YARN_ApplicationCurrentStates', + 'YARN_ApplicationFinishedStates', + 'YARN_RPC', + 'YARN_GC', + 'YARN_JVMThreads', + 'YARN_JVMHeap' + ], + + 'mapreduce': [ + 'MapReduce_JobsStatus', + 'MapReduce_TasksRunningWaiting', + 'MapReduce_MapSlots', + 'MapReduce_ReduceSlots', + 'MapReduce_GC', + 'MapReduce_RPC', + 'MapReduce_JVMHeap', + 'MapReduce_JVMThreads' + ], + + 'hbase': [ + 'HBASE_ClusterRequests', + 'HBASE_RegionServerReadWriteRequests', + 'HBASE_RegionServerRegions', + 'HBASE_RegionServerQueueSize', + 'HBASE_HlogSplitTime', + 'HBASE_HlogSplitSize' + ], + + 'flume': [ + 'Flume_ChannelSizeMMA', + 'Flume_ChannelSizeSum', + 'Flu
git commit: AMBARI-7601 Service pluggability: refactor UI code to externalize metrics graph definition to a single file (salvi via jaoki)
Repository: ambari Updated Branches: refs/heads/trunk 1be4506a4 -> 1cf2b9852 AMBARI-7601 Service pluggability: refactor UI code to externalize metrics graph definition to a single file (salvi via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1cf2b985 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1cf2b985 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1cf2b985 Branch: refs/heads/trunk Commit: 1cf2b98520914f32ac33685951fc24cfadb55be6 Parents: 1be4506 Author: Jun Aoki Authored: Thu Oct 16 14:55:36 2014 -0700 Committer: Jun Aoki Committed: Thu Oct 16 14:55:36 2014 -0700 -- ambari-web/app/assets/test/tests.js | 2 + ambari-web/app/data/service_graph_config.js | 93 +++ .../app/views/main/service/info/summary.js | 96 ++-- .../views/main/service/info/summary_test.js | 24 - 4 files changed, 146 insertions(+), 69 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1cf2b985/ambari-web/app/assets/test/tests.js -- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 1dff1b2..65082ab 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -167,6 +167,8 @@ var files = ['test/init_model_test', 'test/views/main/charts/heatmap/heatmap_host_test', 'test/views/main/service/item_test', 'test/views/main/service/info/config_test', + 'test/views/main/service/info/summary_test', + 'test/views/main/mirroring/edit_dataset_view_test', 'test/views/common/configs/services_config_test', 'test/views/wizard/step3/hostLogPopupBody_view_test', 'test/views/wizard/step3/hostWarningPopupBody_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/1cf2b985/ambari-web/app/data/service_graph_config.js -- diff --git a/ambari-web/app/data/service_graph_config.js b/ambari-web/app/data/service_graph_config.js new file mode 100644 index 000..51a9f9e --- /dev/null +++ b/ambari-web/app/data/service_graph_config.js @@ -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. + */ + +var App = require('app'); + +/** +This determines the graphs to display on the service page under each service. + +This is based on the name of the object associated with it. + +The name of the object is of the format: 'App.ChartServiceMetrics' where +is one of the items below. +**/ +App.service_graph_config = { + 'hdfs': [ + 'HDFS_SpaceUtilization', + 'HDFS_FileOperations', + 'HDFS_BlockStatus', + 'HDFS_IO', + 'HDFS_RPC', + 'HDFS_GC', + 'HDFS_JVMHeap', + 'HDFS_JVMThreads' + ], + + 'yarn': [ + 'YARN_AllocatedMemory', + 'YARN_QMR', + 'YARN_AllocatedContainer', + 'YARN_NMS', + 'YARN_ApplicationCurrentStates', + 'YARN_ApplicationFinishedStates', + 'YARN_RPC', + 'YARN_GC', + 'YARN_JVMThreads', + 'YARN_JVMHeap' + ], + + 'mapreduce': [ + 'MapReduce_JobsStatus', + 'MapReduce_TasksRunningWaiting', + 'MapReduce_MapSlots', + 'MapReduce_ReduceSlots', + 'MapReduce_GC', + 'MapReduce_RPC', + 'MapReduce_JVMHeap', + 'MapReduce_JVMThreads' + ], + + 'hbase': [ + 'HBASE_ClusterRequests', + 'HBASE_RegionServerReadWriteRequests', + 'HBASE_RegionServerRegions', + 'HBASE_RegionServerQueueSize', + 'HBASE_HlogSplitTime', + 'HBASE_HlogSplitSize' + ], + + 'flume': [ + 'Flume_ChannelSizeMMA', + 'Flume_ChannelSizeSum', + 'Flume_IncommingMM
git commit: AMBARI-7352 Support create new PostgreSQL database for hive metastore when deploy hive.(adenisso via jaoki)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 b7910ab64 -> 2414e599e AMBARI-7352 Support create new PostgreSQL database for hive metastore when deploy hive.(adenisso via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2414e599 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2414e599 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2414e599 Branch: refs/heads/branch-1.7.0 Commit: 2414e599e32a9280f44fc1207d6f60db7497e905 Parents: b7910ab Author: Jun Aoki Authored: Thu Oct 16 13:33:24 2014 -0700 Committer: Jun Aoki Committed: Thu Oct 16 13:33:24 2014 -0700 -- .../controllers/main/service/info/configs.js| 2 +- .../app/controllers/wizard/step7_controller.js | 6 +- .../app/controllers/wizard/step8_controller.js | 12 ambari-web/app/messages.js | 3 +- .../app/models/stack_service_component.js | 2 +- ambari-web/app/views/wizard/controls_view.js| 4 +- .../test/controllers/wizard/step8_test.js | 61 +--- .../test/models/stack_service_component_test.js | 14 - 8 files changed, 75 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2414e599/ambari-web/app/controllers/main/service/info/configs.js -- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 8ef2bbf..1be52e9 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -1668,7 +1668,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM setHiveHostName: function (configs) { if (configs.someProperty('name', 'hive_database')) { var hiveDb = configs.findProperty('name', 'hive_database'); - if (hiveDb.value === 'New MySQL Database') { + if (hiveDb.value === 'New MySQL Database' || hiveDb.value === 'New PostgreSQL Database') { var ambariHost = configs.findProperty('name', 'hive_ambari_host'); if (ambariHost) { ambariHost.name = 'hive_hostname'; http://git-wip-us.apache.org/repos/asf/ambari/blob/2414e599/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 c6ffc3f..44d0a4e 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -1288,11 +1288,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, { var configMap = [ { serviceName: 'OOZIE', -ignored: Em.I18n.t('installer.step7.oozie.database.new') +ignored: [Em.I18n.t('installer.step7.oozie.database.new')] }, { serviceName: 'HIVE', -ignored: Em.I18n.t('installer.step7.hive.database.new') +ignored: [Em.I18n.t('installer.step7.hive.database.new.mysql'), Em.I18n.t('installer.step7.hive.database.new.postgres')] } ]; configMap.forEach(function (config) { @@ -1301,7 +1301,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, { if (service && service.get('isSelected') && !service.get('isInstalled')) { var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', config.serviceName).configs; var serviceDatabase = serviceConfigs.findProperty('name', config.serviceName.toLowerCase() + '_database').get('value'); -if (serviceDatabase !== config.ignored) { +if (!config.ignored.contains(serviceDatabase)) { var filledProperties = App.db.get('tmp', config.serviceName + '_connection'); if (!filledProperties || App.isEmptyObject(filledProperties)) { isConnectionNotTested = true; http://git-wip-us.apache.org/repos/asf/ambari/blob/2414e599/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 688f7ce..29e3cd6 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -246,6 +246,14 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, { hive_properties = Em.A(['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host', 'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database
git commit: AMBARI-7352 Support create new PostgreSQL database for hive metastore when deploy hive.(adenisso via jaoki)
Repository: ambari Updated Branches: refs/heads/trunk f873b147a -> 1be4506a4 AMBARI-7352 Support create new PostgreSQL database for hive metastore when deploy hive.(adenisso via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1be4506a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1be4506a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1be4506a Branch: refs/heads/trunk Commit: 1be4506a460e2c7a228970a512ba8639c4cf4fd2 Parents: f873b14 Author: Jun Aoki Authored: Thu Oct 16 13:32:26 2014 -0700 Committer: Jun Aoki Committed: Thu Oct 16 13:32:26 2014 -0700 -- .../controllers/main/service/info/configs.js| 2 +- .../app/controllers/wizard/step7_controller.js | 6 +- .../app/controllers/wizard/step8_controller.js | 12 ambari-web/app/messages.js | 3 +- .../app/models/stack_service_component.js | 2 +- ambari-web/app/views/wizard/controls_view.js| 4 +- .../test/controllers/wizard/step8_test.js | 61 +--- .../test/models/stack_service_component_test.js | 14 - 8 files changed, 75 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1be4506a/ambari-web/app/controllers/main/service/info/configs.js -- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index c676098..79c11b0 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -1668,7 +1668,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM setHiveHostName: function (configs) { if (configs.someProperty('name', 'hive_database')) { var hiveDb = configs.findProperty('name', 'hive_database'); - if (hiveDb.value === 'New MySQL Database') { + if (hiveDb.value === 'New MySQL Database' || hiveDb.value === 'New PostgreSQL Database') { var ambariHost = configs.findProperty('name', 'hive_ambari_host'); if (ambariHost) { ambariHost.name = 'hive_hostname'; http://git-wip-us.apache.org/repos/asf/ambari/blob/1be4506a/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 c6ffc3f..44d0a4e 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -1288,11 +1288,11 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, { var configMap = [ { serviceName: 'OOZIE', -ignored: Em.I18n.t('installer.step7.oozie.database.new') +ignored: [Em.I18n.t('installer.step7.oozie.database.new')] }, { serviceName: 'HIVE', -ignored: Em.I18n.t('installer.step7.hive.database.new') +ignored: [Em.I18n.t('installer.step7.hive.database.new.mysql'), Em.I18n.t('installer.step7.hive.database.new.postgres')] } ]; configMap.forEach(function (config) { @@ -1301,7 +1301,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, { if (service && service.get('isSelected') && !service.get('isInstalled')) { var serviceConfigs = this.get('stepConfigs').findProperty('serviceName', config.serviceName).configs; var serviceDatabase = serviceConfigs.findProperty('name', config.serviceName.toLowerCase() + '_database').get('value'); -if (serviceDatabase !== config.ignored) { +if (!config.ignored.contains(serviceDatabase)) { var filledProperties = App.db.get('tmp', config.serviceName + '_connection'); if (!filledProperties || App.isEmptyObject(filledProperties)) { isConnectionNotTested = true; http://git-wip-us.apache.org/repos/asf/ambari/blob/1be4506a/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 688f7ce..29e3cd6 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -246,6 +246,14 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, { hive_properties = Em.A(['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host', 'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
[20/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/nodes.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/nodes.py b/ambari-common/src/main/python/jinja2/jinja2/nodes.py deleted file mode 100644 index 6446c70..000 --- a/ambari-common/src/main/python/jinja2/jinja2/nodes.py +++ /dev/null @@ -1,901 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.nodes - - -This module implements additional nodes derived from the ast base node. - -It also provides some node tree helper functions like `in_lineno` and -`get_nodes` used by the parser and translator in order to normalize -python and jinja nodes. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import operator -from itertools import chain, izip -from collections import deque -from jinja2.utils import Markup, MethodType, FunctionType - - -#: the types we support for context functions -_context_function_types = (FunctionType, MethodType) - - -_binop_to_func = { -'*':operator.mul, -'/':operator.truediv, -'//': operator.floordiv, -'**': operator.pow, -'%':operator.mod, -'+':operator.add, -'-':operator.sub -} - -_uaop_to_func = { -'not': operator.not_, -'+':operator.pos, -'-':operator.neg -} - -_cmpop_to_func = { -'eq': operator.eq, -'ne': operator.ne, -'gt': operator.gt, -'gteq': operator.ge, -'lt': operator.lt, -'lteq': operator.le, -'in': lambda a, b: a in b, -'notin':lambda a, b: a not in b -} - - -class Impossible(Exception): -"""Raised if the node could not perform a requested action.""" - - -class NodeType(type): -"""A metaclass for nodes that handles the field and attribute -inheritance. fields and attributes from the parent class are -automatically forwarded to the child.""" - -def __new__(cls, name, bases, d): -for attr in 'fields', 'attributes': -storage = [] -storage.extend(getattr(bases[0], attr, ())) -storage.extend(d.get(attr, ())) -assert len(bases) == 1, 'multiple inheritance not allowed' -assert len(storage) == len(set(storage)), 'layout conflict' -d[attr] = tuple(storage) -d.setdefault('abstract', False) -return type.__new__(cls, name, bases, d) - - -class EvalContext(object): -"""Holds evaluation time information. Custom attributes can be attached -to it in extensions. -""" - -def __init__(self, environment, template_name=None): -if callable(environment.autoescape): -self.autoescape = environment.autoescape(template_name) -else: -self.autoescape = environment.autoescape -self.volatile = False - -def save(self): -return self.__dict__.copy() - -def revert(self, old): -self.__dict__.clear() -self.__dict__.update(old) - - -def get_eval_context(node, ctx): -if ctx is None: -if node.environment is None: -raise RuntimeError('if no eval context is passed, the ' - 'node must have an attached ' - 'environment.') -return EvalContext(node.environment) -return ctx - - -class Node(object): -"""Baseclass for all Jinja2 nodes. There are a number of nodes available -of different types. There are three major types: - -- :class:`Stmt`: statements -- :class:`Expr`: expressions -- :class:`Helper`: helper nodes -- :class:`Template`: the outermost wrapper node - -All nodes have fields and attributes. Fields may be other nodes, lists, -or arbitrary values. Fields are passed to the constructor as regular -positional arguments, attributes as keyword arguments. Each node has -two attributes: `lineno` (the line number of the node) and `environment`. -The `environment` attribute is set at the end of the parsing process for -all nodes automatically. -""" -__metaclass__ = NodeType -fields = () -attributes = ('lineno', 'environment') -abstract = True - -def __init__(self, *fields, **attributes): -if self.abstract: -raise TypeError('abstract nodes are not instanciable') -if fields: -if len(fields) != len(self.fields): -if not self.fields: -raise TypeError('%r takes 0 arguments' % -self.__class__.__name__) -raise TypeError('%r takes 0 or %d argument%s' % ( -self.__class__.__name__, -len(self.fields), -len(self.fields) != 1 and 's' or '' -)) -for name, arg in izip(self.fields, f
[18/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py b/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py deleted file mode 100644 index 008a0a9..000 --- a/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py +++ /dev/null @@ -1,390 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.testsuite.lexnparse -~~ - -All the unittests regarding lexing, parsing and syntax. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import os -import sys -import time -import tempfile -import unittest - -from jinja2.testsuite import JinjaTestCase - -from jinja2 import Environment, Template, TemplateSyntaxError, \ - UndefinedError, nodes - -env = Environment() - - -# how does a string look like in jinja syntax? -if sys.version_info < (3, 0): -def jinja_string_repr(string): -return repr(string)[1:] -else: -jinja_string_repr = repr - - -class LexerTestCase(JinjaTestCase): - -def test_raw1(self): -tmpl = env.from_string('{% raw %}foo{% endraw %}|' - '{%raw%}{{ bar }}|{% baz %}{% endraw %}') -assert tmpl.render() == 'foo|{{ bar }}|{% baz %}' - -def test_raw2(self): -tmpl = env.from_string('1 {%- raw -%} 2 {%- endraw -%} 3') -assert tmpl.render() == '123' - -def test_balancing(self): -env = Environment('{%', '%}', '${', '}') -tmpl = env.from_string('''{% for item in seq -%}${{'foo': item}|upper}{% endfor %}''') -assert tmpl.render(seq=range(3)) == "{'FOO': 0}{'FOO': 1}{'FOO': 2}" - -def test_comments(self): -env = Environment('', '{', '}') -tmpl = env.from_string('''\ - - - {item} - -''') -assert tmpl.render(seq=range(3)) == ("\n 0\n " - "1\n 2\n") - -def test_string_escapes(self): -for char in u'\0', u'\u2668', u'\xe4', u'\t', u'\r', u'\n': -tmpl = env.from_string('{{ %s }}' % jinja_string_repr(char)) -assert tmpl.render() == char -assert env.from_string('{{ "\N{HOT SPRINGS}" }}').render() == u'\u2668' - -def test_bytefallback(self): -from pprint import pformat -tmpl = env.from_string(u'''{{ 'foo'|pprint }}|{{ 'bär'|pprint }}''') -assert tmpl.render() == pformat('foo') + '|' + pformat(u'bär') - -def test_operators(self): -from jinja2.lexer import operators -for test, expect in operators.iteritems(): -if test in '([{}])': -continue -stream = env.lexer.tokenize('{{ %s }}' % test) -stream.next() -assert stream.current.type == expect - -def test_normalizing(self): -for seq in '\r', '\r\n', '\n': -env = Environment(newline_sequence=seq) -tmpl = env.from_string('1\n2\r\n3\n4\n') -result = tmpl.render() -assert result.replace(seq, 'X') == '1X2X3X4' - - -class ParserTestCase(JinjaTestCase): - -def test_php_syntax(self): -env = Environment('', '', '') -tmpl = env.from_string('''\ -\ - - -''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_erb_syntax(self): -env = Environment('<%', '%>', '<%=', '%>', '<%#', '%>') -tmpl = env.from_string('''\ -<%# I'm a comment, I'm not interesting %>\ -<% for item in seq -%> -<%= item %> -<%- endfor %>''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_comment_syntax(self): -env = Environment('', '${', '}', '') -tmpl = env.from_string('''\ -\ - -${item} -''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_balancing(self): -tmpl = env.from_string('''{{{'foo':'bar'}.foo}}''') -assert tmpl.render() == 'bar' - -def test_start_comment(self): -tmpl = env.from_string('''{# foo comment -and bar comment #} -{% macro blub() %}foo{% endmacro %} -{{ blub() }}''') -assert tmpl.render().strip() == 'foo' - -def test_line_syntax(self): -env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%') -tmpl = env.from_string('''\ -<%# regular comment %> -% for item in seq: -${item} -% endfor''') -assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ - range(5) - -env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%', '##') -tmpl = env.from_string('''\ -<%# regular comment %> -% for item in seq: -${item} ## the rest of the stuff -% endfor''') -assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ -range(5) - -def test_line_syntax_priority(self): -# XXX: why is
[48/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/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 new file mode 100644 index 000..8a4bdbc --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html @@ -0,0 +1,160 @@ + + + +Views +{{instance.ViewInstanceInfo.label}} Go to instance + + +Delete Instance +Delete Instance + + + + + +Settings + +Edit +Edit + + + + + +View Name + + + +View Version + + + + + Instance Name + + + + Display Name + + + + This field is required. + + + Must not contain any special characters. + + + + + Description + + + + This field is required. + + + + + + + + Visible + + + + + + +Save +Cancel + + + + + + + + + +Permissions + + + + + + + + Permission + Grant permission to these users + Grant permission to these groups + + + + + +{{permission.PermissionInfo.permission_name | translate}} + + + + + + + + + + + + There are no permissions defined for this view. + + + + + + +Properties + + Edit +Edit + + + + + + + {{property.name}}{{property.required ? '*' : ''}} + + + + This field is required. + + + + + +Save +Cancel + + + + + + There are no properties defined for this view. + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html new file mode 100644 index 000..70e12e3 --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listTable.html @@ -0,0 +1,97 @@ + + + + + + Views + + + + +×Close + + + + + + + + +View Name +Instances + + + + + + + + +{{view.view_name}} + + + + {{version}} + + + + + + + + ({{vData.count}}) + + + {{$last ? '' : ', '}} + + + {{view.description}} + + + + + + + + {{instance.label}} + +{{instance.ViewInstanceInfo.version}} +{{instance.ViewInstanceInfo.description || 'No description'}} + + + + + + + + Create Instance + + + + + + + + + + No views to display. + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html new file mode 100644 index 000..b49abb0 --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/modals/create.html @@ -0,0 +1,127 @@ + + + + Create View Instance + + + +http://placehold.it/64x64"; alt="" class="icon-big"> +http://placehold.it/32x32"; alt="" class="icon-small"> + + {{view.ViewVersionInfo.view_name}} + {{view.ViewVersionInfo.label}} | Version
[32/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py new file mode 100644 index 000..69ff4bc --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py @@ -0,0 +1,390 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.testsuite.lexnparse +~~ + +All the unittests regarding lexing, parsing and syntax. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import os +import sys +import time +import tempfile +import unittest + +from ambari_jinja2.testsuite import JinjaTestCase + +from ambari_jinja2 import Environment, Template, TemplateSyntaxError, \ + UndefinedError, nodes + +env = Environment() + + +# how does a string look like in jinja syntax? +if sys.version_info < (3, 0): +def jinja_string_repr(string): +return repr(string)[1:] +else: +jinja_string_repr = repr + + +class LexerTestCase(JinjaTestCase): + +def test_raw1(self): +tmpl = env.from_string('{% raw %}foo{% endraw %}|' + '{%raw%}{{ bar }}|{% baz %}{% endraw %}') +assert tmpl.render() == 'foo|{{ bar }}|{% baz %}' + +def test_raw2(self): +tmpl = env.from_string('1 {%- raw -%} 2 {%- endraw -%} 3') +assert tmpl.render() == '123' + +def test_balancing(self): +env = Environment('{%', '%}', '${', '}') +tmpl = env.from_string('''{% for item in seq +%}${{'foo': item}|upper}{% endfor %}''') +assert tmpl.render(seq=range(3)) == "{'FOO': 0}{'FOO': 1}{'FOO': 2}" + +def test_comments(self): +env = Environment('', '{', '}') +tmpl = env.from_string('''\ + + + {item} + +''') +assert tmpl.render(seq=range(3)) == ("\n 0\n " + "1\n 2\n") + +def test_string_escapes(self): +for char in u'\0', u'\u2668', u'\xe4', u'\t', u'\r', u'\n': +tmpl = env.from_string('{{ %s }}' % jinja_string_repr(char)) +assert tmpl.render() == char +assert env.from_string('{{ "\N{HOT SPRINGS}" }}').render() == u'\u2668' + +def test_bytefallback(self): +from pprint import pformat +tmpl = env.from_string(u'''{{ 'foo'|pprint }}|{{ 'bär'|pprint }}''') +assert tmpl.render() == pformat('foo') + '|' + pformat(u'bär') + +def test_operators(self): +from ambari_jinja2.lexer import operators +for test, expect in operators.iteritems(): +if test in '([{}])': +continue +stream = env.lexer.tokenize('{{ %s }}' % test) +stream.next() +assert stream.current.type == expect + +def test_normalizing(self): +for seq in '\r', '\r\n', '\n': +env = Environment(newline_sequence=seq) +tmpl = env.from_string('1\n2\r\n3\n4\n') +result = tmpl.render() +assert result.replace(seq, 'X') == '1X2X3X4' + + +class ParserTestCase(JinjaTestCase): + +def test_php_syntax(self): +env = Environment('', '', '') +tmpl = env.from_string('''\ +\ + + +''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_erb_syntax(self): +env = Environment('<%', '%>', '<%=', '%>', '<%#', '%>') +tmpl = env.from_string('''\ +<%# I'm a comment, I'm not interesting %>\ +<% for item in seq -%> +<%= item %> +<%- endfor %>''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_comment_syntax(self): +env = Environment('', '${', '}', '') +tmpl = env.from_string('''\ +\ + +${item} +''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_balancing(self): +tmpl = env.from_string('''{{{'foo':'bar'}.foo}}''') +assert tmpl.render() == 'bar' + +def test_start_comment(self): +tmpl = env.from_string('''{# foo comment +and bar comment #} +{% macro blub() %}foo{% endmacro %} +{{ blub() }}''') +assert tmpl.render().strip() == 'foo' + +def test_line_syntax(self): +env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%') +tmpl = env.from_string('''\ +<%# regular comment %> +% for item in seq: +${item} +% endfor''') +assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ + range(5) + +env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%', '##') +tmpl = env.from_string('''\ +<%# regular comment %> +% for item in seq: +${item} ## the rest of the stuff +% endfor''') +assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ +
[28/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/scripts/pylintrc -- diff --git a/ambari-common/src/main/python/ambari_jinja2/scripts/pylintrc b/ambari-common/src/main/python/ambari_jinja2/scripts/pylintrc new file mode 100644 index 000..6ebf385 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/scripts/pylintrc @@ -0,0 +1,301 @@ +# lint Python modules using external checkers. +# +# This is the main checker controling the other ones and the reports +# generation. It is itself both a raw checker and an astng checker in order +# to: +# * handle message activation / deactivation at the module level +# * handle some basic but necessary stats'data (number of classes, methods...) +# +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Profiled execution. +profile=no + +# Add to the black list. It should be a base name, not a +# path. You may set this option multiple times. +ignore=.svn + +# Pickle collected data for later comparisons. +persistent=yes + +# Set the cache size for astng objects. +cache-size=500 + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + + +[MESSAGES CONTROL] + +# Enable only checker(s) with the given id(s). This option conflict with the +# disable-checker option +#enable-checker= + +# Enable all checker(s) except those with the given id(s). This option conflict +# with the disable-checker option +#disable-checker= + +# Enable all messages in the listed categories. +#enable-msg-cat= + +# Disable all messages in the listed categories. +#disable-msg-cat= + +# Enable the message(s) with the given id(s). +#enable-msg= + +# Disable the message(s) with the given id(s). +disable-msg=C0323,W0142,C0301,C0103,C0111,E0213,C0302,C0203,W0703,R0201 + + +[REPORTS] + +# set the output format. Available formats are text, parseable, colorized and +# html +output-format=colorized + +# Include message's id in output +include-ids=yes + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells wether to display a full report or only the messages +reports=yes + +# Python expression which should return a note less than 10 (10 is the highest +# note).You have access to the variables errors warning, statement which +# respectivly contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (R0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Add a comment according to your evaluation note. This is used by the global +# evaluation report (R0004). +comment=no + +# Enable the report(s) with the given id(s). +#enable-report= + +# Disable the report(s) with the given id(s). +#disable-report= + + +# checks for +# * unused variables / imports +# * undefined variables +# * redefinition of variable from builtins or from an outer scope +# * use of variable before assigment +# +[VARIABLES] + +# Tells wether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching names used for dummy variables (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +# try to find bugs in the code using type inference +# +[TYPECHECK] + +# Tells wether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# When zope mode is activated, consider the acquired-members option to ignore +# access to some undefined attributes. +zope=no + +# List of members which are usually get through zope's acquisition mecanism and +# so shouldn't trigger E0201 when accessed (need zope=yes to be considered). +acquired-members=REQUEST,acl_users,aq_parent + + +# checks for : +# * doc strings +# * modules / classes / functions / methods / arguments / variables name +# * number of arguments, local variables, branchs, returns and statements in +# functions, methods +# * required module attributes +# * dangerous default values as arguments +# * redefinition of function / method / class +# * uses of the global statement +# +[BASIC] + +# Required attributes for module, separated by a comma +required-attributes= + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__ + +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct m
[01/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
Repository: ambari Updated Branches: refs/heads/branch-windows-dev 7e28d1e31 -> 9213dccaf http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java index d39518c..3cd336c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpProxyPropertyProvider.java @@ -26,6 +26,8 @@ import java.util.Map; import java.util.Set; import com.google.gson.JsonSyntaxException; +import com.google.inject.Injector; +import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.configuration.ComponentSSLConfiguration; import org.apache.ambari.server.controller.spi.Predicate; import org.apache.ambari.server.controller.spi.PropertyProvider; @@ -34,6 +36,8 @@ import org.apache.ambari.server.controller.spi.Resource; import org.apache.ambari.server.controller.spi.SystemException; import org.apache.ambari.server.controller.utilities.PropertyHelper; import org.apache.ambari.server.controller.utilities.StreamProvider; +import org.apache.ambari.server.state.Cluster; +import org.apache.ambari.server.state.Clusters; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,11 +55,26 @@ public class HttpProxyPropertyProvider extends BaseProvider implements PropertyP private static final Map URL_TEMPLATES = new HashMap(); private static final Map MAPPINGS = new HashMap(); + private static final Map PROPERTIES_TO_FILTER = new HashMap(); + + private static final String COMPONENT_RESOURCEMANAGER = "RESOURCEMANAGER"; + private static final String COMPONENT_NAGIOS_SERVER = "NAGIOS_SERVER"; + private static final String CONFIG_YARN_SITE = "yarn-site"; + private static final String CONFIG_CORE_SITE = "core-site"; + private static final String PROPERTY_YARN_HTTP_POLICY = "yarn.http.policy"; + private static final String PROPERTY_HADOOP_SSL_ENABLED = "hadoop.ssl.enabled"; + private static final String PROPERTY_YARN_HTTP_POLICY_VALUE_HTTPS_ONLY = "HTTPS_ONLY"; + private static final String PROPERTY_HADOOP_SSL_ENABLED_VALUE_TRUE = "true"; static { -URL_TEMPLATES.put("NAGIOS_SERVER", "http://%s/ambarinagios/nagios/nagios_alerts.php?q1=alerts&alert_type=all";); +URL_TEMPLATES.put(COMPONENT_NAGIOS_SERVER, "http://%s/ambarinagios/nagios/nagios_alerts.php?q1=alerts&"; + +"alert_type=all"); +URL_TEMPLATES.put(COMPONENT_RESOURCEMANAGER, "http://%s:8088/ws/v1/cluster/info";); -MAPPINGS.put("NAGIOS_SERVER", PropertyHelper.getPropertyId("HostRoles", "nagios_alerts")); +MAPPINGS.put(COMPONENT_NAGIOS_SERVER, PropertyHelper.getPropertyId("HostRoles", "nagios_alerts")); +MAPPINGS.put(COMPONENT_RESOURCEMANAGER, PropertyHelper.getPropertyId("HostRoles", "ha_state")); + +PROPERTIES_TO_FILTER.put(COMPONENT_RESOURCEMANAGER, "clusterInfo/haState"); } private final ComponentSSLConfiguration configuration; @@ -65,10 +84,14 @@ public class HttpProxyPropertyProvider extends BaseProvider implements PropertyP private String clusterNamePropertyId = null; private String hostNamePropertyId = null; private String componentNamePropertyId = null; + + private Injector injector; + private Clusters clusters; public HttpProxyPropertyProvider( StreamProvider stream, ComponentSSLConfiguration configuration, + Injector inject, String clusterNamePropertyId, String hostNamePropertyId, String componentNamePropertyId) { @@ -79,6 +102,8 @@ public class HttpProxyPropertyProvider extends BaseProvider implements PropertyP this.clusterNamePropertyId = clusterNamePropertyId; this.hostNamePropertyId = hostNamePropertyId; this.componentNamePropertyId = componentNamePropertyId; +this.injector = inject; +this.clusters = injector.getInstance(Clusters.class); } /** @@ -98,12 +123,13 @@ public class HttpProxyPropertyProvider extends BaseProvider implements PropertyP Object hostName = resource.getPropertyValue(hostNamePropertyId); Object componentName = resource.getPropertyValue(componentNamePropertyId); - + Object clusterName = resource.getPropertyValue(clusterNamePropertyId); + if (null != hostName && null != componentName && MAPPINGS.containsKey(componentName.toString()) && URL_TEMPLATES.containsKey(componentName.toString())) { -String template = getTemplate(componentName.toString()); +String template = getTemplate(componentNam
[27/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/docs/api.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/api.rst b/ambari-common/src/main/python/jinja2/docs/api.rst deleted file mode 100644 index 3bf8a94..000 --- a/ambari-common/src/main/python/jinja2/docs/api.rst +++ /dev/null @@ -1,787 +0,0 @@ -API -=== - -.. module:: jinja2 -:synopsis: public Jinja2 API - -This document describes the API to Jinja2 and not the template language. It -will be most useful as reference to those implementing the template interface -to the application and not those who are creating Jinja2 templates. - -Basics --- - -Jinja2 uses a central object called the template :class:`Environment`. -Instances of this class are used to store the configuration, global objects -and are used to load templates from the file system or other locations. -Even if you are creating templates from strings by using the constructor of -:class:`Template` class, an environment is created automatically for you, -albeit a shared one. - -Most applications will create one :class:`Environment` object on application -initialization and use that to load templates. In some cases it's however -useful to have multiple environments side by side, if different configurations -are in use. - -The simplest way to configure Jinja2 to load templates for your application -looks roughly like this:: - -from jinja2 import Environment, PackageLoader -env = Environment(loader=PackageLoader('yourapplication', 'templates')) - -This will create a template environment with the default settings and a -loader that looks up the templates in the `templates` folder inside the -`yourapplication` python package. Different loaders are available -and you can also write your own if you want to load templates from a -database or other resources. - -To load a template from this environment you just have to call the -:meth:`get_template` method which then returns the loaded :class:`Template`:: - -template = env.get_template('mytemplate.html') - -To render it with some variables, just call the :meth:`render` method:: - -print template.render(the='variables', go='here') - -Using a template loader rather then passing strings to :class:`Template` -or :meth:`Environment.from_string` has multiple advantages. Besides being -a lot easier to use it also enables template inheritance. - - -Unicode - -Jinja2 is using Unicode internally which means that you have to pass Unicode -objects to the render function or bytestrings that only consist of ASCII -characters. Additionally newlines are normalized to one end of line -sequence which is per default UNIX style (``\n``). - -Python 2.x supports two ways of representing string objects. One is the -`str` type and the other is the `unicode` type, both of which extend a type -called `basestring`. Unfortunately the default is `str` which should not -be used to store text based information unless only ASCII characters are -used. With Python 2.6 it is possible to make `unicode` the default on a per -module level and with Python 3 it will be the default. - -To explicitly use a Unicode string you have to prefix the string literal -with a `u`: ``u'Hänsel und Gretel sagen Hallo'``. That way Python will -store the string as Unicode by decoding the string with the character -encoding from the current Python module. If no encoding is specified this -defaults to 'ASCII' which means that you can't use any non ASCII identifier. - -To set a better module encoding add the following comment to the first or -second line of the Python module using the Unicode literal:: - -# -*- coding: utf-8 -*- - -We recommend utf-8 as Encoding for Python modules and templates as it's -possible to represent every Unicode character in utf-8 and because it's -backwards compatible to ASCII. For Jinja2 the default encoding of templates -is assumed to be utf-8. - -It is not possible to use Jinja2 to process non-Unicode data. The reason -for this is that Jinja2 uses Unicode already on the language level. For -example Jinja2 treats the non-breaking space as valid whitespace inside -expressions which requires knowledge of the encoding or operating on an -Unicode string. - -For more details about Unicode in Python have a look at the excellent -`Unicode documentation`_. - -Another important thing is how Jinja2 is handling string literals in -templates. A naive implementation would be using Unicode strings for -all string literals but it turned out in the past that this is problematic -as some libraries are typechecking against `str` explicitly. For example -`datetime.strftime` does not accept Unicode arguments. To not break it -completely Jinja2 is returning `str` for strings that fit into ASCII and -for everything else `unicode`: - ->>> m = Template(u"{% set a, b = 'foo', 'föö' %}").module ->>> m.a -'foo' ->>> m.b -u'f
[45/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/ambari_agent/apscheduler/job.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/apscheduler/job.py b/ambari-agent/src/main/python/ambari_agent/apscheduler/job.py new file mode 100644 index 000..e2af042 --- /dev/null +++ b/ambari-agent/src/main/python/ambari_agent/apscheduler/job.py @@ -0,0 +1,137 @@ +""" +Jobs represent scheduled tasks. +""" + +from threading import Lock +from datetime import timedelta + +from ambari_agent.apscheduler.util import to_unicode, ref_to_obj, get_callable_name,\ +obj_to_ref + + +class MaxInstancesReachedError(Exception): +pass + + +class Job(object): +""" +Encapsulates the actual Job along with its metadata. Job instances +are created by the scheduler when adding jobs, and should not be +directly instantiated. These options can be set when adding jobs +to the scheduler (see :ref:`job_options`). + +:var trigger: trigger that determines the execution times +:var func: callable to call when the trigger is triggered +:var args: list of positional arguments to call func with +:var kwargs: dict of keyword arguments to call func with +:var name: name of the job +:var misfire_grace_time: seconds after the designated run time that +the job is still allowed to be run +:var coalesce: run once instead of many times if the scheduler determines +that the job should be run more than once in succession +:var max_runs: maximum number of times this job is allowed to be +triggered +:var max_instances: maximum number of concurrently running +instances allowed for this job +:var runs: number of times this job has been triggered +:var instances: number of concurrently running instances of this job +""" +id = None +next_run_time = None + +def __init__(self, trigger, func, args, kwargs, misfire_grace_time, + coalesce, name=None, max_runs=None, max_instances=1): +if not trigger: +raise ValueError('The trigger must not be None') +if not hasattr(func, '__call__'): +raise TypeError('func must be callable') +if not hasattr(args, '__getitem__'): +raise TypeError('args must be a list-like object') +if not hasattr(kwargs, '__getitem__'): +raise TypeError('kwargs must be a dict-like object') +if misfire_grace_time <= 0: +raise ValueError('misfire_grace_time must be a positive value') +if max_runs is not None and max_runs <= 0: +raise ValueError('max_runs must be a positive value') +if max_instances <= 0: +raise ValueError('max_instances must be a positive value') + +self._lock = Lock() + +self.trigger = trigger +self.func = func +self.args = args +self.kwargs = kwargs +self.name = to_unicode(name or get_callable_name(func)) +self.misfire_grace_time = misfire_grace_time +self.coalesce = coalesce +self.max_runs = max_runs +self.max_instances = max_instances +self.runs = 0 +self.instances = 0 + +def compute_next_run_time(self, now): +if self.runs == self.max_runs: +self.next_run_time = None +else: +self.next_run_time = self.trigger.get_next_fire_time(now) + +return self.next_run_time + +def get_run_times(self, now): +""" +Computes the scheduled run times between ``next_run_time`` and ``now``. +""" +run_times = [] +run_time = self.next_run_time +increment = timedelta(microseconds=1) +while ((not self.max_runs or self.runs < self.max_runs) and + run_time and run_time <= now): +run_times.append(run_time) +run_time = self.trigger.get_next_fire_time(run_time + increment) + +return run_times + +def add_instance(self): +self._lock.acquire() +try: +if self.instances == self.max_instances: +raise MaxInstancesReachedError +self.instances += 1 +finally: +self._lock.release() + +def remove_instance(self): +self._lock.acquire() +try: +assert self.instances > 0, 'Already at 0 instances' +self.instances -= 1 +finally: +self._lock.release() + +def __getstate__(self): +# Prevents the unwanted pickling of transient or unpicklable variables +state = self.__dict__.copy() +state.pop('instances', None) +state.pop('func', None) +state.pop('_lock', None) +state['func_ref'] = obj_to_ref(self.func) +return state + +def __setstate__(self, state): +state['instances'] = 0 +state['func'] = ref_to_obj(state.pop('func_ref')) +st
[22/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/environment.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/environment.py b/ambari-common/src/main/python/jinja2/jinja2/environment.py deleted file mode 100644 index ac74a5c..000 --- a/ambari-common/src/main/python/jinja2/jinja2/environment.py +++ /dev/null @@ -1,1118 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.environment -~~ - -Provides a class that holds runtime and parsing time options. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import os -import sys -from jinja2 import nodes -from jinja2.defaults import * -from jinja2.lexer import get_lexer, TokenStream -from jinja2.parser import Parser -from jinja2.optimizer import optimize -from jinja2.compiler import generate -from jinja2.runtime import Undefined, new_context -from jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \ - TemplatesNotFound -from jinja2.utils import import_string, LRUCache, Markup, missing, \ - concat, consume, internalcode, _encode_filename - - -# for direct template usage we have up to ten living environments -_spontaneous_environments = LRUCache(10) - -# the function to create jinja traceback objects. This is dynamically -# imported on the first exception in the exception handler. -_make_traceback = None - - -def get_spontaneous_environment(*args): -"""Return a new spontaneous environment. A spontaneous environment is an -unnamed and unaccessible (in theory) environment that is used for -templates generated from a string and not from the file system. -""" -try: -env = _spontaneous_environments.get(args) -except TypeError: -return Environment(*args) -if env is not None: -return env -_spontaneous_environments[args] = env = Environment(*args) -env.shared = True -return env - - -def create_cache(size): -"""Return the cache class for the given size.""" -if size == 0: -return None -if size < 0: -return {} -return LRUCache(size) - - -def copy_cache(cache): -"""Create an empty copy of the given cache.""" -if cache is None: -return None -elif type(cache) is dict: -return {} -return LRUCache(cache.capacity) - - -def load_extensions(environment, extensions): -"""Load the extensions from the list and bind it to the environment. -Returns a dict of instanciated environments. -""" -result = {} -for extension in extensions: -if isinstance(extension, basestring): -extension = import_string(extension) -result[extension.identifier] = extension(environment) -return result - - -def _environment_sanity_check(environment): -"""Perform a sanity check on the environment.""" -assert issubclass(environment.undefined, Undefined), 'undefined must ' \ - 'be a subclass of undefined because filters depend on it.' -assert environment.block_start_string != \ - environment.variable_start_string != \ - environment.comment_start_string, 'block, variable and comment ' \ - 'start strings must be different' -assert environment.newline_sequence in ('\r', '\r\n', '\n'), \ - 'newline_sequence set to unknown line ending string.' -return environment - - -class Environment(object): -r"""The core component of Jinja is the `Environment`. It contains -important shared variables like configuration, filters, tests, -globals and others. Instances of this class may be modified if -they are not shared and if no template was loaded so far. -Modifications on environments after the first template was loaded -will lead to surprising effects and undefined behavior. - -Here the possible initialization parameters: - -`block_start_string` -The string marking the begin of a block. Defaults to ``'{%'``. - -`block_end_string` -The string marking the end of a block. Defaults to ``'%}'``. - -`variable_start_string` -The string marking the begin of a print statement. -Defaults to ``'{{'``. - -`variable_end_string` -The string marking the end of a print statement. Defaults to -``'}}'``. - -`comment_start_string` -The string marking the begin of a comment. Defaults to ``'{#'``. - -`comment_end_string` -The string marking the end of a comment. Defaults to ``'#}'``. - -`line_statement_prefix` -If given and a string, this will be used as prefix for line based -statements. See also :ref:`line-statements`. - -`line_comment_prefix` -If given and a string, this will be used as prefix for line based -based comments. See als
[06/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java index e8a60c8..2c233e6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java @@ -18,9 +18,12 @@ package org.apache.ambari.server.controller; +import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Set; +import com.google.common.collect.Multimap; import org.apache.ambari.server.state.DesiredConfig; import org.apache.ambari.server.state.State; import org.apache.ambari.server.state.ClusterHealthReport; @@ -36,6 +39,8 @@ public class ClusterResponse { private final String desiredStackVersion; private Map desiredConfigs; + + private Map> desiredServiceConfigVersions; private String provisioningState; @@ -177,4 +182,12 @@ public class ClusterResponse { public ClusterHealthReport getClusterHealthReport() { return clusterHealthReport; } + + public Map> getDesiredServiceConfigVersions() { +return desiredServiceConfigVersions; + } + + public void setDesiredServiceConfigVersions(Map> desiredServiceConfigVersions) { +this.desiredServiceConfigVersions = desiredServiceConfigVersions; + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java index 4c0d3a2..efa1a7e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java @@ -29,6 +29,7 @@ public class ConfigGroupRequest { private String groupName; private String tag; private String description; + private String serviceConfigVersionNote; private Set hosts; private Map configs; @@ -99,4 +100,12 @@ public class ConfigGroupRequest { public void setId(Long id) { this.id = id; } + + public String getServiceConfigVersionNote() { +return serviceConfigVersionNote; + } + + public void setServiceConfigVersionNote(String serviceConfigVersionNote) { +this.serviceConfigVersionNote = serviceConfigVersionNote; + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java index ba15afd..0e28a86 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java @@ -30,9 +30,12 @@ public class ConfigurationRequest { private String clusterName; private String type; private String tag; + private Long version; + private String serviceConfigVersionNote; private Map configs; private boolean selected = true; private Map> configsAttributes; + private boolean includeProperties; public ConfigurationRequest() { configs = new HashMap(); @@ -51,6 +54,7 @@ public class ConfigurationRequest { this.tag = tag; this.configs = configs; this.configsAttributes = configsAttributes; +this.includeProperties = (type != null && tag != null); } /** @@ -127,6 +131,24 @@ public class ConfigurationRequest { } /** + * Set whether properties should be included. + * + * @param includeProperties whether properties should be included + */ + public void setIncludeProperties(boolean includeProperties) { +this.includeProperties = includeProperties; + } + + /** + * Determine whether properties should be included. + * + * @return true if properties should be included; false otherwise + */ + public boolean includeProperties() { +return this.includeProperties; + } + + /** * @return Attributes of configs */ public Map> getPropertiesAttributes() { @@ -137,4 +159,20 @@ public class ConfigurationRequest { Map> configsAttributes) { this.configsAttributes = configsAttributes; } + + public Long getVersion() { +return version; + } + + public void setVersion(Long vers
[16/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/resource_management/core/shell.py -- diff --git a/ambari-common/src/main/python/resource_management/core/shell.py b/ambari-common/src/main/python/resource_management/core/shell.py new file mode 100644 index 000..d7ed5a8 --- /dev/null +++ b/ambari-common/src/main/python/resource_management/core/shell.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +""" +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. + +Ambari Agent + +""" +import os + +__all__ = ["checked_call", "call", "quote_bash_args"] + +import string +import subprocess +import threading +from multiprocessing import Queue +from exceptions import Fail +from exceptions import ExecuteTimeoutException +from resource_management.core.logger import Logger + +def checked_call(command, logoutput=False, + cwd=None, env=None, preexec_fn=None, user=None, wait_for_finish=True, timeout=None, path=None): + return _call(command, logoutput, True, cwd, env, preexec_fn, user, wait_for_finish, timeout, path) + +def call(command, logoutput=False, + cwd=None, env=None, preexec_fn=None, user=None, wait_for_finish=True, timeout=None, path=None): + return _call(command, logoutput, False, cwd, env, preexec_fn, user, wait_for_finish, timeout, path) + +def _call(command, logoutput=False, throw_on_failure=True, + cwd=None, env=None, preexec_fn=None, user=None, wait_for_finish=True, timeout=None, path=None): + """ + Execute shell command + + @param command: list/tuple of arguments (recommended as more safe - don't need to escape) + or string of the command to execute + @param logoutput: boolean, whether command output should be logged of not + @param throw_on_failure: if true, when return code is not zero exception is thrown + + @return: retrun_code, stdout + """ + # convert to string and escape + if isinstance(command, (list, tuple)): +command = ' '.join(quote_bash_args(x) for x in command) + + if path: +export_path_command = "export PATH=$PATH" + os.pathsep + os.pathsep.join(path) + " ; " + else: +export_path_command = "" + + if user: +subprocess_command = ["su", "-s", "/bin/bash", "-", user, "-c", export_path_command + command] + else: +subprocess_command = ["/bin/bash","--login","-c", export_path_command + command] + + proc = subprocess.Popen(subprocess_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + cwd=cwd, env=env, shell=False, + preexec_fn=preexec_fn) + + if not wait_for_finish: +return None, None + + if timeout: +q = Queue() +t = threading.Timer( timeout, on_timeout, [proc, q] ) +t.start() + + out = proc.communicate()[0].strip('\n') + + if timeout: +if q.empty(): + t.cancel() +# timeout occurred +else: + raise ExecuteTimeoutException() + + code = proc.returncode + + if logoutput and out: +Logger.info(out) + + if throw_on_failure and code: +err_msg = Logger.get_protected_text(("Execution of '%s' returned %d. %s") % (command, code, out)) +raise Fail(err_msg) + + return code, out + +def on_timeout(proc, q): + q.put(True) + if proc.poll() == None: +try: + proc.terminate() +except: + pass + +def quote_bash_args(command): + if not command: +return "''" + valid = set(string.ascii_letters + string.digits + '@%_-+=:,./') + for char in command: +if char not in valid: + return "'" + command.replace("'", "'\"'\"'") + "'" + return command \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/resource_management/core/source.py -- diff --git a/ambari-common/src/main/python/resource_management/core/source.py b/ambari-common/src/main/python/resource_management/core/source.py new file mode 100644 index 000..d87d897 --- /dev/null +++ b/ambari-common/src/main/python/resource_management/core/source.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +
[30/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst -- diff --git a/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst b/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst new file mode 100644 index 000..912bd39 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst @@ -0,0 +1,168 @@ +Introduction + + +This is the documentation for the Jinja2 general purpose templating language. +Jinja2 is a library for Python 2.4 and onwards that is designed to be flexible, +fast and secure. + +If you have any exposure to other text-based template languages, such as Smarty or +Django, you should feel right at home with Jinja2. It's both designer and +developer friendly by sticking to Python's principles and adding functionality +useful for templating environments. + +The key-features are... + +- ... **configurable syntax**. If you are generating LaTeX or other formats +with Jinja2 you can change the delimiters to something that integrates better +into the LaTeX markup. + +- ... **fast**. While performance is not the primarily target of Jinja2 it's +surprisingly fast. The overhead compared to regular Python code was reduced +to the very minimum. + +- ... **easy to debug**. Jinja2 integrates directly into the python traceback +system which allows you to debug Jinja2 templates with regular python +debugging helpers. + +- ... **secure**. It's possible to evaluate untrusted template code if the +optional sandbox is enabled. This allows Jinja2 to be used as templating +language for applications where users may modify the template design. + + +Prerequisites +- + +Jinja2 needs at least **Python 2.4** to run. Additionally a working C-compiler +that can create python extensions should be installed for the debugger if you +are using Python 2.4. + +If you don't have a working C-compiler and you are trying to install the source +release with the debugsupport you will get a compiler error. + +.. _ctypes: http://python.net/crew/theller/ctypes/ + + +Installation + + +You have multiple ways to install Jinja2. If you are unsure what to do, go +with the Python egg or tarball. + +As a Python egg (via easy_install) +~~ + +You can install the most recent Jinja2 version using `easy_install`_ or `pip`_:: + +easy_install Jinja2 +pip install Jinja2 + +This will install a Jinja2 egg in your Python installation's site-packages +directory. + +(If you are installing from the windows command line omit the `sudo` and make +sure to run the command as user with administrator rights) + +From the tarball release +~ + +1. Download the most recent tarball from the `download page`_ +2. Unpack the tarball +3. ``sudo python setup.py install`` + +Note that you either have to have setuptools or `distribute`_ installed, +the latter is preferred. + +This will install Jinja2 into your Python installation's site-packages directory. + +.. _distribute: http://pypi.python.org/pypi/distribute + +Installing the development version +~~ + +1. Install `git`_ +2. ``git clone git://github.com/mitsuhiko/ambari_jinja2.git`` +3. ``cd ambari_jinja2`` +4. ``ln -s ambari_jinja2 /usr/lib/python2.X/site-packages`` + +As an alternative to steps 4 you can also do ``python setup.py develop`` +which will install the package via distribute in development mode. This also +has the advantage that the C extensions are compiled. + +.. _download page: http://pypi.python.org/pypi/Jinja2 +.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools +.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall +.. _pip: http://pypi.python.org/pypi/pip +.. _git: http://git-scm.org/ + + +More Speed with MarkupSafe +~~ + +As of version 2.5.1 Jinja2 will check for an installed `MarkupSafe`_ +module. If it can find it, it will use the Markup class of that module +instead of the one that comes with Jinja2. `MarkupSafe` replaces the +older speedups module that came with Jinja2 and has the advantage that is +has a better setup script and will automatically attempt to install the C +version and nicely fall back to a pure Python implementation if that is +not possible. + +The C implementation of MarkupSafe is much faster and recommended when +using Jinja2 with autoescaping. + +.. _MarkupSafe: http://pypi.python.org/pypi/MarkupSafe + + +Enable the debug support Module +~~~ + +By default Jinja2 will not compile the debug support module. Enabling this +will fail if you don't have the Python headers or a working compiler. This +is often the case if you are installing Jinja2 from a windows machine. + +Because the debug support is only necessary for Python 2.4 you will not +hav
[02/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java index 464f116..2ef74db 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java @@ -23,18 +23,14 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.api.services.PersistKeyValueService; -import org.apache.ambari.server.controller.AmbariManagementController; -import org.apache.ambari.server.controller.ClusterRequest; -import org.apache.ambari.server.controller.ClusterResponse; -import org.apache.ambari.server.controller.ConfigGroupRequest; -import org.apache.ambari.server.controller.ConfigurationRequest; -import org.apache.ambari.server.controller.RequestStatusResponse; +import org.apache.ambari.server.controller.*; import org.apache.ambari.server.controller.spi.NoSuchParentResourceException; import org.apache.ambari.server.controller.spi.NoSuchResourceException; import org.apache.ambari.server.controller.spi.Predicate; @@ -47,11 +43,14 @@ 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.entities.BlueprintConfigEntity; import org.apache.ambari.server.orm.entities.BlueprintEntity; import org.apache.ambari.server.orm.entities.HostGroupEntity; import org.apache.ambari.server.state.Config; +import org.apache.ambari.server.state.ConfigHelper; import org.apache.ambari.server.state.ConfigImpl; import org.apache.ambari.server.state.PropertyInfo; +import org.apache.ambari.server.state.StackId; /** * Resource provider for cluster resources. @@ -63,27 +62,35 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor { // Clusters protected static final String CLUSTER_ID_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "cluster_id"); protected static final String CLUSTER_NAME_PROPERTY_ID= PropertyHelper.getPropertyId("Clusters", "cluster_name"); - protected static final String CLUSTER_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "version"); + protected static final String CLUSTER_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "version"); protected static final String CLUSTER_PROVISIONING_STATE_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "provisioning_state"); protected static final String CLUSTER_DESIRED_CONFIGS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "desired_configs"); + protected static final String CLUSTER_DESIRED_SERVICE_CONFIG_VERSIONS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "desired_service_config_versions"); protected static final String CLUSTER_TOTAL_HOSTS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "total_hosts"); protected static final String CLUSTER_HEALTH_REPORT_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "health_report"); protected static final String BLUEPRINT_PROPERTY_ID = PropertyHelper.getPropertyId(null, "blueprint"); - private static Set pkPropertyIds = - new HashSet(Arrays.asList(new String[]{CLUSTER_ID_PROPERTY_ID})); + /** + * Request info property ID. Allow internal getResources call to bypass permissions check. + */ + public static final String GET_IGNORE_PERMISSIONS_PROPERTY_ID = "get_resource/ignore_permissions"; - /** - * Maps properties to updaters which update the property when provisioning a cluster via a blueprint + /** + * The cluster primary key properties. */ - private Map propertyUpdaters = - new HashMap(); + private static Set pkPropertyIds = + new HashSet(Arrays.asList(new String[]{CLUSTER_ID_PROPERTY_ID})); /** * Maps configuration type (string) to associated properties */ private Map> mapClusterConfigurations = new HashMap>(); + /** + * Maps configuration type (string) to property attributes, and their values + */ + private Map>> mapClusterAttributes = + new HashMap>>(); // - Constructors @@ -100,21 +107,10 @@ public class Cluster
[40/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy -- diff --git a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy index 85c52a4..6d94c5d 100644 --- a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy +++ b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy @@ -23,6 +23,7 @@ import groovy.util.logging.Slf4j import groovyx.net.http.ContentType import groovyx.net.http.HttpResponseException import groovyx.net.http.RESTClient +import org.apache.commons.io.IOUtils import org.apache.http.NoHttpResponseException import org.apache.http.client.ClientProtocolException import java.net.ConnectException @@ -37,6 +38,7 @@ class AmbariClient { private static final int PAD = 30 private static final int OK_RESPONSE = 200 + private static final String SLAVE = "slave_" boolean debugEnabled = false; def RESTClient ambari def slurper = new JsonSlurper() @@ -92,6 +94,203 @@ class AmbariClient { } /** + * Adds a registered host to the cluster. + * + * @param hostName new node's hostname + * @throws HttpResponseException if the node is not registered with ambari + */ + def addHost(String hostName) throws HttpResponseException { +if (debugEnabled) { + println "[DEBUG] POST ${ambari.getUri()}clusters/${getClusterName()}/hosts/$hostName" +} +ambari.post(path: "clusters/${getClusterName()}/hosts/$hostName", { it }) + } + + /** + * Decommission and remove a host from the cluster. + * NOTE: this is a synchronous call, it wont return until all + * requests are finished + * + * Steps: + * 1, decommission services + * 2, stop services + * 3, delete host components + * 4, delete host + * 5, restart services + * + * @param hostName host to be deleted + */ + def removeHost(String hostName) { +def components = getHostComponentsMap(hostName).keySet() as List + +// decommission +if (components.contains("NODEMANAGER")) { + decommissionNodeManager(hostName) +} +if (components.contains("DATANODE")) { + decommissionDataNode(hostName) +} + +// stop services +def requests = stopComponentsOnHost(hostName, components) +waitForRequestsToFinish(requests.values() as List) + +// delete host components +deleteHostComponents(hostName, components) + +// delete host +deleteHost(hostName) + +// restart zookeper +def id = restartServiceComponents("ZOOKEEPER", ["ZOOKEEPER_SERVER"]) +waitForRequestsToFinish([id]) + +// restart nagios +if (getServiceComponentsMap().containsKey("NAGIOS")) { + id = restartServiceComponents("NAGIOS", ["NAGIOS_SERVER"]) + waitForRequestsToFinish([id]) +} + } + + /** + * Does not return until all the requests are finished. + * @param requestIds ids of the requests + */ + def waitForRequestsToFinish(List requestIds) { +def stopped = false +while (!stopped) { + def state = true + for (int id : requestIds) { +if (getRequestProgress(id) != 100.0) { + state = false; + break; +} + } + stopped = state + Thread.sleep(2000) +} + } + + /** + * Decommission the data node on a given host. + * + * @return id of the request to keep track its progress + */ + def int decommissionDataNode(String host) { +decommission(host, "DATANODE", "HDFS", "NAMENODE") + } + + /** + * Decommission the node manager on a given host. + * + * @return id of the request to keep track its progress + */ + def int decommissionNodeManager(String host) { +decommission(host, "NODEMANAGER", "YARN", "RESOURCEMANAGER") + } + + /** + * Decommission a host component on a given host. + * + * @param host hostName where the component is installed to + * @param slaveName slave to be decommissioned + * @param serviceName where the slave belongs to + * @param componentName where the slave belongs to + * @return id of the request to keep track its progress + */ + def int decommission(String host, String slaveName, String serviceName, String componentName) { +def requestInfo = [ + command : "DECOMMISSION", + context : "Decommission $slaveName", + parameters: ["slave_type": slaveName, "excluded_hosts": host] +] +def filter = [ + ["service_name": serviceName, "component_name": componentName] +] +Map bodyMap = [ + "RequestInfo" : requestInfo, + "Requests/resource_filters": filter +] +ambari.post(path: "clusters/${getClusterName()}/requests", body: new JsonBuilder(bodyMap).toPrettyString(), { +
[12/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java index db3dff8..1afae39 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java @@ -19,6 +19,7 @@ package org.apache.ambari.server.api.query.render; import org.apache.ambari.server.api.query.QueryInfo; +import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.api.services.Request; import org.apache.ambari.server.api.services.Result; import org.apache.ambari.server.api.services.ResultImpl; @@ -26,15 +27,25 @@ import org.apache.ambari.server.api.services.ResultPostProcessor; import org.apache.ambari.server.api.services.ResultPostProcessorImpl; import org.apache.ambari.server.api.util.TreeNode; import org.apache.ambari.server.api.util.TreeNodeImpl; +import org.apache.ambari.server.controller.AmbariManagementController; +import org.apache.ambari.server.controller.AmbariServer; +import org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor; +import org.apache.ambari.server.controller.internal.HostGroup; import org.apache.ambari.server.controller.internal.ResourceImpl; import org.apache.ambari.server.controller.spi.Resource; import org.apache.ambari.server.controller.utilities.PropertyHelper; +import org.apache.ambari.server.state.DesiredConfig; +import org.apache.ambari.server.state.HostConfig; +import org.apache.ambari.server.state.PropertyInfo; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -44,6 +55,18 @@ import java.util.Set; */ public class ClusterBlueprintRenderer extends BaseRenderer implements Renderer { + /** + * Management Controller used to get stack information. + */ + private AmbariManagementController controller = AmbariServer.getController(); + + /** + * Map of configuration type to configuration properties which are required that a user + * input. These properties will be stripped from the exported blueprint. + */ + private Map> propertiesToStrip = new HashMap>(); + + // - Renderer -- @Override @@ -55,6 +78,17 @@ public class ClusterBlueprintRenderer extends BaseRenderer implements Renderer { null, properties, queryProperties.getName()); copyPropertiesToResult(queryProperties, resultTree); + +String configType = Resource.Type.Configuration.name(); +if (resultTree.getChild(configType) == null) { + resultTree.addChild(new HashSet(), configType); +} + +String serviceType = Resource.Type.Service.name(); +if (resultTree.getChild(serviceType) == null) { + resultTree.addChild(new HashSet(), serviceType); +} + String hostType = Resource.Type.Host.name(); String hostComponentType = Resource.Type.HostComponent.name(); TreeNode> hostComponentNode = resultTree.getChild( @@ -67,6 +101,7 @@ public class ClusterBlueprintRenderer extends BaseRenderer implements Renderer { } hostComponentNode = hostNode.addChild(new HashSet(), hostComponentType); } +resultTree.getChild(configType).getObject().add("properties"); hostComponentNode.getObject().add("HostRoles/component_name"); return resultTree; @@ -106,50 +141,141 @@ public class ClusterBlueprintRenderer extends BaseRenderer implements Renderer { private Resource createBlueprintResource(TreeNode clusterNode) { Resource clusterResource = clusterNode.getObject(); Resource blueprintResource = new ResourceImpl(Resource.Type.Cluster); -String clusterName = (String) clusterResource.getPropertyValue( -PropertyHelper.getPropertyId("Clusters", "cluster_name")); -//todo: deal with name collision? -String blueprintName = "blueprint-" + clusterName; + String[] stackTokens = ((String) clusterResource.getPropertyValue( PropertyHelper.getPropertyId("Clusters", "version"))).split("-"); -blueprintResource.setProperty("Blueprints/blueprint_name", blueprintName); blueprintResource.setProperty("Blueprints/stack_name", stackTokens[0]); blueprintResource.setProperty("Blueprints/stack_version", stackTokens[1]); -blueprintResource.setProperty( -"host_groups", processHostGroups(cluste
[42/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py -- diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py deleted file mode 100644 index 24b497c..000 --- a/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -""" -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. - -Ambari Agent - -""" - -from resource_management.libraries.resources.execute_hadoop import * -from resource_management.libraries.resources.template_config import * -from resource_management.libraries.resources.xml_config import * -from resource_management.libraries.resources.properties_file import * -from resource_management.libraries.resources.repository import * -from resource_management.libraries.resources.monitor_webserver import * -from resource_management.libraries.resources.hdfs_directory import * -from resource_management.libraries.resources.copy_from_local import * \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/libraries/resources/copy_from_local.py -- diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/copy_from_local.py b/ambari-agent/src/main/python/resource_management/libraries/resources/copy_from_local.py deleted file mode 100644 index 328d9c2..000 --- a/ambari-agent/src/main/python/resource_management/libraries/resources/copy_from_local.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -""" -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. - -Ambari Agent - -""" - -_all__ = ["CopyFromLocal"] -from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument - -class CopyFromLocal(Resource): - action = ForcedListArgument(default="run") - - path = ResourceArgument(default=lambda obj: obj.name) - dest_dir = ResourceArgument(required=True) - owner = ResourceArgument(required=True) - group = ResourceArgument() - mode = ResourceArgument() - kinnit_if_needed = ResourceArgument(default='') - hadoop_conf_dir = ResourceArgument(default='/etc/hadoop/conf') - hdfs_user = ResourceArgument(default='hdfs') - - actions = Resource.actions + ["run"] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py -- diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py b/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py deleted file mode 100644 index 94daf5b..000 --- a/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -""" -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
[26/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/docs/templates.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/templates.rst b/ambari-common/src/main/python/jinja2/docs/templates.rst deleted file mode 100644 index 4a1f6ff..000 --- a/ambari-common/src/main/python/jinja2/docs/templates.rst +++ /dev/null @@ -1,1365 +0,0 @@ -Template Designer Documentation -=== - -.. highlight:: html+jinja - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Jinja templates. As the -template engine is very flexible the configuration from the application might -be slightly different from here in terms of delimiters and behavior of -undefined values. - - -Synopsis - - -A template is simply a text file. It can generate any text-based format -(HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, -``.html`` or ``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and tags, which control the logic of -the template. The template syntax is heavily inspired by Django and Python. - -Below is a minimal template that illustrates a few basics. We will cover -the details later in that document:: - - - - -My Webpage - - - -{% for item in navigation %} -{{ item.caption }} -{% endfor %} - - -My Webpage -{{ a_variable }} - - - -This covers the default settings. The application developer might have -changed the syntax from ``{% foo %}`` to ``<% foo %>`` or something similar. - -There are two kinds of delimiers. ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops or assign values, the -latter prints the result of the expression to the template. - -.. _variables: - -Variables -- - -The application passes variables to the templates you can mess around in the -template. Variables may have attributes or elements on them you can access -too. How a variable looks like, heavily depends on the application providing -those. - -You can use a dot (``.``) to access attributes of a variable, alternative the -so-called "subscript" syntax (``[]``) can be used. The following lines do -the same:: - -{{ foo.bar }} -{{ foo['bar'] }} - -It's important to know that the curly braces are *not* part of the variable -but the print statement. If you access variables inside tags don't put the -braces around. - -If a variable or attribute does not exist you will get back an undefined -value. What you can do with that kind of value depends on the application -configuration, the default behavior is that it evaluates to an empty string -if printed and that you can iterate over it, but every other operation fails. - -.. _notes-on-subscriptions: - -.. admonition:: Implementation - -For convenience sake ``foo.bar`` in Jinja2 does the following things on -the Python layer: - -- check if there is an attribute called `bar` on `foo`. -- if there is not, check if there is an item ``'bar'`` in `foo`. -- if there is not, return an undefined object. - -``foo['bar']`` on the other hand works mostly the same with the a small -difference in the order: - -- check if there is an item ``'bar'`` in `foo`. -- if there is not, check if there is an attribute called `bar` on `foo`. -- if there is not, return an undefined object. - -This is important if an object has an item or attribute with the same -name. Additionally there is the :func:`attr` filter that just looks up -attributes. - -.. _filters: - -Filters - -Variables can by modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. - -``{{ name|striptags|title }}`` for example will remove all HTML Tags from the -`name` and title-cases it. Filters that accept arguments have parentheses -around the arguments, like a function call. This example will join a list -by commas: ``{{ list|join(', ') }}``. - -The :ref:`builtin-filters` below describes all the builtin filters. - -.. _tests: - -Tests -- - -Beside filters there are also so called "tests" available. Tests can be used -to test a variable against a common expression. To test a variable or -expression you add `is` plus the name of the test after the variable. For -example to find out if a variable is defined you can do ``name is defined`` -which will then return true or false depending on if `name` is defined. - -Tests can accept arguments too. If the test only takes one argument you can -leave out the parentheses to group them. F
[07/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 7d49c1b..d12b6fd 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -18,11 +18,32 @@ package org.apache.ambari.server.controller; -import com.google.gson.Gson; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Singleton; -import com.google.inject.persist.Transactional; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_NAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_HOME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JCE_NAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_LOCATION; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_NAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MYSQL_JDBC_URL; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.ORACLE_JDBC_URL; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_REPO_INFO; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_NAME; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.STACK_VERSION; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.USER_LIST; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.GROUP_LIST; +import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.CLIENTS_TO_UPDATE_CONFIGS; + import java.io.File; import java.io.IOException; import java.net.InetAddress; @@ -30,14 +51,18 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; +import java.util.concurrent.TimeUnit; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.ClusterNotFoundException; @@ -57,28 +82,6 @@ import org.apache.ambari.server.actionmanager.RequestFactory; import org.apache.ambari.server.actionmanager.Stage; import org.apache.ambari.server.actionmanager.StageFactory; import org.apache.ambari.server.agent.ExecutionCommand; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_DRIVER; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_PASSWORD; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_URL; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.AMBARI_DB_RCA_USERNAME; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_DRIVER_FILENAME; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.DB_NAME; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JAVA_HOME; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JCE_NAME; -import st
[49/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js new file mode 100644 index 000..d9f5eb5 --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js @@ -0,0 +1,29 @@ +/** + * 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. + */ +'use strict'; + +angular.module('ambariAdminConsole') +.config(['$translateProvider', function($translateProvider) { + $translateProvider.translations('en',{ +'CLUSTER.OPERATE': 'Operator', +'CLUSTER.READ': 'Read-Only', +'VIEW.USE': 'Use' + }); + + $translateProvider.preferredLanguage('en'); +}]); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js new file mode 100644 index 000..e47c97d --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js @@ -0,0 +1,111 @@ +/** + * 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. + */ +'use strict'; + +angular.module('ambariAdminConsole') +.constant('ROUTES', { + root: { +url: '/', +templateUrl: 'views/main.html', +controller: 'MainCtrl' + }, + users: { +list: { + url: '/users', + templateUrl: 'views/users/list.html', + controller: 'UsersListCtrl' +}, +edit: { + url: '/users/:id/edit', + templateUrl: 'views/users/create.html', + controller: 'UsersCreateCtrl' +}, +create: { + url: '/users/new', + templateUrl: 'views/users/create.html', + controller: 'UsersCreateCtrl' +}, +show: { + url: '/users/:id', + templateUrl: 'views/users/show.html', + controller: 'UsersShowCtrl' +} + }, + groups: { +list: { + url: '/groups', + templateUrl: 'views/groups/list.html', + controller: 'GroupsListCtrl' +}, +edit: { + url: '/groups/:id/edit', + templateUrl: 'views/groups/edit.html', + controller: 'GroupsEditCtrl' +}, +create: { + url: '/groups/new', + templateUrl: 'views/groups/create.html', + controller: 'GroupsCreateCtrl' +} + }, + views: { +list: { + url: '/views', + templateUrl: 'views/ambariViews/listTable.html', + controller: 'ViewsListCtrl', +}, +edit: { + url: '/views/:viewId/versions/:version/instances/:instanceId/edit', + templateUrl: 'views/ambariViews/edit.html', + controller: 'ViewsEditCtrl' +}, +create: { + url: '/views/:viewId/versions/:version/new', + templateUrl: 'views/ambariViews/create.html', + controller: 'CreateViewInstanceCtrl' +} + }, + clusters:{ +manageAccess: { + url: '/clusters/:id/manageAccess', + templateUrl: 'views/clusters/manageAccess.html', + controller: 'ClustersManageAccessCtrl' +} + }, + dashboard:{ +url: '/dashboard', +controller: ['$window', function($window) { + $window.location.href = '/#/main/dashboard'; +}], +template: '' +
[39/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-client/python-client/src/main/python/ambari_client/model/host.py -- diff --git a/ambari-client/python-client/src/main/python/ambari_client/model/host.py b/ambari-client/python-client/src/main/python/ambari_client/model/host.py index f6c39d6..1fc1ecd 100644 --- a/ambari-client/python-client/src/main/python/ambari_client/model/host.py +++ b/ambari-client/python-client/src/main/python/ambari_client/model/host.py @@ -222,7 +222,7 @@ def _bootstrap_hosts(root_resource, hosts_list, ssh_key, ssh_user): payload_dic = { "verbose": True, "sshKey": ssh_key, -"hosts": str(hosts_list), +"hosts": hosts_list, "user": ssh_user} resp = root_resource.post( paths.BOOTSTRAP_PATH, @@ -321,3 +321,83 @@ class HostModel(BaseModel): self._get_cluster_name(), self.host_name, component_name) + +def install_all_components(self): +root_resource = self._get_resource_root() +path = paths.HOSTS_COMPONENTS_PATH % (self._get_cluster_name(), + self.host_name) +data = { +"RequestInfo": { +"context" :"Install All Components", +}, +"Body": { +"HostRoles": {"state": "INSTALLED"}, +}, +} +resp = root_resource.put(path=path, payload=data) +return utils.ModelUtils.create_model(status.StatusModel, resp, + root_resource, "NO_KEY") + +def start_all_components(self): +root_resource = self._get_resource_root() +path = paths.HOSTS_COMPONENTS_PATH % (self._get_cluster_name(), + self.host_name) +data = { +"RequestInfo": { +"context" :"Start All Components", +}, +"Body": { +"HostRoles": {"state": "STARTED"}, +}, +} +resp = root_resource.put(path=path, payload=data) +return utils.ModelUtils.create_model(status.StatusModel, resp, + root_resource, "NO_KEY") + +def stop_all_components(self): +root_resource = self._get_resource_root() +path = paths.HOSTS_COMPONENTS_PATH % (self._get_cluster_name(), + self.host_name) +data = { +"RequestInfo": { +"context" :"Stop All Components", +}, +"Body": { +"HostRoles": {"state": "INSTALLED"}, +}, +} +resp = root_resource.put(path=path, payload=data) +return utils.ModelUtils.create_model(status.StatusModel, resp, + root_resource, "NO_KEY") + +def enable_maintenance_mode(self): +root_resource = self._get_resource_root() +path = paths.HOSTS_COMPONENTS_PATH % (self._get_cluster_name(), + self.host_name) +data = { +"RequestInfo": { +"context" :"Start Maintanence Mode", +}, +"Body": { +"HostRoles": {"maintenance_state": "ON"}, +}, +} +resp = root_resource.put(path=path, payload=data) +return utils.ModelUtils.create_model(status.StatusModel, resp, + root_resource, "NO_KEY") + +def disable_maintenance_mode(self): +root_resource = self._get_resource_root() +path = paths.HOSTS_COMPONENTS_PATH % (self._get_cluster_name(), + self.host_name) +data = { +"RequestInfo": { +"context" :"Stop Maintanence Mode", +}, +"Body": { +"HostRoles": {"maintenance_state": "OFF"}, +}, +} +resp = root_resource.put(path=path, payload=data) +return utils.ModelUtils.create_model(status.StatusModel, resp, + root_resource, "NO_KEY") http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-client/python-client/src/main/python/ambari_client/model/paths.py -- diff --git a/ambari-client/python-client/src/main/python/ambari_client/model/paths.py b/ambari-client/python-client/src/main/python/ambari_client/model/paths.py index e111824..17a4633 100644 --- a/ambari-client/python-client/src/main/python/ambari_client/model/paths.py +++ b/ambari-client/python-client/src/main/python/ambari_client/model/paths.py @@ -21,7 +21,7 @@ CLUSTER_HOSTS_PATH = "/clusters/%s/hosts" CLUSTER_HOST_PATH = "/clusters/%s/hosts/%s" CLUSTER_START_ALL_SERVICES = "/clusters/%s/services?ServiceI
[34/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py new file mode 100644 index 000..804070c --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py @@ -0,0 +1,901 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.nodes + + +This module implements additional nodes derived from the ast base node. + +It also provides some node tree helper functions like `in_lineno` and +`get_nodes` used by the parser and translator in order to normalize +python and jinja nodes. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import operator +from itertools import chain, izip +from collections import deque +from ambari_jinja2.utils import Markup, MethodType, FunctionType + + +#: the types we support for context functions +_context_function_types = (FunctionType, MethodType) + + +_binop_to_func = { +'*':operator.mul, +'/':operator.truediv, +'//': operator.floordiv, +'**': operator.pow, +'%':operator.mod, +'+':operator.add, +'-':operator.sub +} + +_uaop_to_func = { +'not': operator.not_, +'+':operator.pos, +'-':operator.neg +} + +_cmpop_to_func = { +'eq': operator.eq, +'ne': operator.ne, +'gt': operator.gt, +'gteq': operator.ge, +'lt': operator.lt, +'lteq': operator.le, +'in': lambda a, b: a in b, +'notin':lambda a, b: a not in b +} + + +class Impossible(Exception): +"""Raised if the node could not perform a requested action.""" + + +class NodeType(type): +"""A metaclass for nodes that handles the field and attribute +inheritance. fields and attributes from the parent class are +automatically forwarded to the child.""" + +def __new__(cls, name, bases, d): +for attr in 'fields', 'attributes': +storage = [] +storage.extend(getattr(bases[0], attr, ())) +storage.extend(d.get(attr, ())) +assert len(bases) == 1, 'multiple inheritance not allowed' +assert len(storage) == len(set(storage)), 'layout conflict' +d[attr] = tuple(storage) +d.setdefault('abstract', False) +return type.__new__(cls, name, bases, d) + + +class EvalContext(object): +"""Holds evaluation time information. Custom attributes can be attached +to it in extensions. +""" + +def __init__(self, environment, template_name=None): +if callable(environment.autoescape): +self.autoescape = environment.autoescape(template_name) +else: +self.autoescape = environment.autoescape +self.volatile = False + +def save(self): +return self.__dict__.copy() + +def revert(self, old): +self.__dict__.clear() +self.__dict__.update(old) + + +def get_eval_context(node, ctx): +if ctx is None: +if node.environment is None: +raise RuntimeError('if no eval context is passed, the ' + 'node must have an attached ' + 'environment.') +return EvalContext(node.environment) +return ctx + + +class Node(object): +"""Baseclass for all Jinja2 nodes. There are a number of nodes available +of different types. There are three major types: + +- :class:`Stmt`: statements +- :class:`Expr`: expressions +- :class:`Helper`: helper nodes +- :class:`Template`: the outermost wrapper node + +All nodes have fields and attributes. Fields may be other nodes, lists, +or arbitrary values. Fields are passed to the constructor as regular +positional arguments, attributes as keyword arguments. Each node has +two attributes: `lineno` (the line number of the node) and `environment`. +The `environment` attribute is set at the end of the parsing process for +all nodes automatically. +""" +__metaclass__ = NodeType +fields = () +attributes = ('lineno', 'environment') +abstract = True + +def __init__(self, *fields, **attributes): +if self.abstract: +raise TypeError('abstract nodes are not instanciable') +if fields: +if len(fields) != len(self.fields): +if not self.fields: +raise TypeError('%r takes 0 arguments' % +self.__class__.__name__) +raise TypeError('%r takes 0 or %d argument%s' % ( +self.__class__.__name__, +len(self.fields), +len(self.fields) != 1 and 's' or '' +
[36/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py new file mode 100644 index 000..b3d6bc7 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py @@ -0,0 +1,1118 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.environment +~~ + +Provides a class that holds runtime and parsing time options. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import os +import sys +from ambari_jinja2 import nodes +from ambari_jinja2.defaults import * +from ambari_jinja2.lexer import get_lexer, TokenStream +from ambari_jinja2.parser import Parser +from ambari_jinja2.optimizer import optimize +from ambari_jinja2.compiler import generate +from ambari_jinja2.runtime import Undefined, new_context +from ambari_jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \ + TemplatesNotFound +from ambari_jinja2.utils import import_string, LRUCache, Markup, missing, \ + concat, consume, internalcode, _encode_filename + + +# for direct template usage we have up to ten living environments +_spontaneous_environments = LRUCache(10) + +# the function to create jinja traceback objects. This is dynamically +# imported on the first exception in the exception handler. +_make_traceback = None + + +def get_spontaneous_environment(*args): +"""Return a new spontaneous environment. A spontaneous environment is an +unnamed and unaccessible (in theory) environment that is used for +templates generated from a string and not from the file system. +""" +try: +env = _spontaneous_environments.get(args) +except TypeError: +return Environment(*args) +if env is not None: +return env +_spontaneous_environments[args] = env = Environment(*args) +env.shared = True +return env + + +def create_cache(size): +"""Return the cache class for the given size.""" +if size == 0: +return None +if size < 0: +return {} +return LRUCache(size) + + +def copy_cache(cache): +"""Create an empty copy of the given cache.""" +if cache is None: +return None +elif type(cache) is dict: +return {} +return LRUCache(cache.capacity) + + +def load_extensions(environment, extensions): +"""Load the extensions from the list and bind it to the environment. +Returns a dict of instanciated environments. +""" +result = {} +for extension in extensions: +if isinstance(extension, basestring): +extension = import_string(extension) +result[extension.identifier] = extension(environment) +return result + + +def _environment_sanity_check(environment): +"""Perform a sanity check on the environment.""" +assert issubclass(environment.undefined, Undefined), 'undefined must ' \ + 'be a subclass of undefined because filters depend on it.' +assert environment.block_start_string != \ + environment.variable_start_string != \ + environment.comment_start_string, 'block, variable and comment ' \ + 'start strings must be different' +assert environment.newline_sequence in ('\r', '\r\n', '\n'), \ + 'newline_sequence set to unknown line ending string.' +return environment + + +class Environment(object): +r"""The core component of Jinja is the `Environment`. It contains +important shared variables like configuration, filters, tests, +globals and others. Instances of this class may be modified if +they are not shared and if no template was loaded so far. +Modifications on environments after the first template was loaded +will lead to surprising effects and undefined behavior. + +Here the possible initialization parameters: + +`block_start_string` +The string marking the begin of a block. Defaults to ``'{%'``. + +`block_end_string` +The string marking the end of a block. Defaults to ``'%}'``. + +`variable_start_string` +The string marking the begin of a print statement. +Defaults to ``'{{'``. + +`variable_end_string` +The string marking the end of a print statement. Defaults to +``'}}'``. + +`comment_start_string` +The string marking the begin of a comment. Defaults to ``'{#'``. + +`comment_end_string` +The string marking the end of a comment. Defaults to ``'#}'``. + +`line_statement_prefix` +If given and a string, this will be used as prefix for line based +statements. See also :ref:`line-statements`. + +`line_comment_p
[13/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/agent/CancelCommand.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/CancelCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/CancelCommand.java new file mode 100644 index 000..7aa24c8 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/CancelCommand.java @@ -0,0 +1,52 @@ +/** + * 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.ambari.server.agent; + +import com.google.gson.annotations.SerializedName; + +/** + * Command to report the status of a list of services in roles. + */ +public class CancelCommand extends AgentCommand { + + public CancelCommand() { +super(AgentCommandType.CANCEL_COMMAND); + } + + @SerializedName("target_task_id") + private long targetTaskId; + + @SerializedName("reason") + private String reason; + + public long getTargetTaskId() { +return targetTaskId; + } + + public void setTargetTaskId(long targetTaskId) { +this.targetTaskId = targetTaskId; + } + + public String getReason() { +return reason; + } + + public void setReason(String reason) { +this.reason = reason; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java index 882f1e3..f0614e4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java @@ -18,6 +18,7 @@ package org.apache.ambari.server.agent; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -25,7 +26,8 @@ import org.apache.ambari.server.RoleCommand; import org.apache.ambari.server.utils.StageUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.codehaus.jackson.annotate.JsonProperty; + +import com.google.gson.annotations.SerializedName; /** @@ -33,63 +35,95 @@ import org.codehaus.jackson.annotate.JsonProperty; * persisted in the database for recovery. */ public class ExecutionCommand extends AgentCommand { - + private static Log LOG = LogFactory.getLog(ExecutionCommand.class); - + public ExecutionCommand() { super(AgentCommandType.EXECUTION_COMMAND); } + @SerializedName("clusterName") private String clusterName; + + @SerializedName("taskId") private long taskId; + + @SerializedName("commandId") private String commandId; + + @SerializedName("hostname") private String hostname; + + @SerializedName("role") private String role; + + @SerializedName("hostLevelParams") private Map hostLevelParams = new HashMap(); + + @SerializedName("roleParams") private Map roleParams = null; + + @SerializedName("roleCommand") private RoleCommand roleCommand; - private Map> clusterHostInfo = + + @SerializedName("clusterHostInfo") + private Map> clusterHostInfo = new HashMap>(); + + @SerializedName("configurations") private Map> configurations; + + @SerializedName("configuration_attributes") + private Map>> configurationAttributes; + + @SerializedName("configurationTags") private Map> configurationTags; - private Map commandParams; + + @SerializedName("forceRefreshConfigTags") + private Set forceRefreshConfigTags = new HashSet(); + + @SerializedName("commandParams") + private Map commandParams = new HashMap(); + + @SerializedName("serviceName") private String serviceName; + + @SerializedName("componentName") private String componentName; /** * Used for ignoring nagios alerts at agent */ + @SerializedName("passiveInfo") private Set> passiveInfo; - @JsonProperty("commandId") public String getCommandId() { -return this.commandId; +ret
[29/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/examples/bench.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/examples/bench.py b/ambari-common/src/main/python/ambari_jinja2/examples/bench.py new file mode 100644 index 000..0f4f982 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/examples/bench.py @@ -0,0 +1,433 @@ +"""\ +This benchmark compares some python templating engines with Jinja 2 so +that we get a picture of how fast Jinja 2 is for a semi real world +template. If a template engine is not installed the test is skipped.\ +""" +import sys +import cgi +from timeit import Timer +from ambari_jinja2 import Environment as JinjaEnvironment + +context = { +'page_title': 'mitsuhiko\'s benchmark', +'table': [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)] +} + +jinja_template = JinjaEnvironment( +line_statement_prefix='%', +variable_start_string="${", +variable_end_string="}" +).from_string("""\ + + + +${page_title|e} + + + + ${page_title|e} + + +% for href, caption in [ +('index.html', 'Index'), +('downloads.html', 'Downloads'), +('products.html', 'Products') + ] + ${caption|e} +% endfor + + + + % for row in table + +% for cell in row + ${cell} +% endfor + + % endfor + + + +\ +""") + +def test_jinja(): +jinja_template.render(context) + +try: +from tornado.template import Template +except ImportError: +test_tornado = None +else: +tornado_template = Template("""\ + + + +{{ page_title }} + + + + {{ page_title }} + + +{% for href, caption in [ \ +('index.html', 'Index'), \ +('downloads.html', 'Downloads'), \ +('products.html', 'Products') \ + ] %} + {{ caption }} +{% end %} + + + + {% for row in table %} + +{% for cell in row %} + {{ cell }} +{% end %} + + {% end %} + + + +\ +""") + +def test_tornado(): +tornado_template.generate(**context) + +try: +from django.conf import settings +settings.configure() +from django.template import Template as DjangoTemplate, Context as DjangoContext +except ImportError: +test_django = None +else: +django_template = DjangoTemplate("""\ + + + +{{ page_title }} + + + + {{ page_title }} + + +{% for href, caption in navigation %} + {{ caption }} +{% endfor %} + + + + {% for row in table %} + +{% for cell in row %} + {{ cell }} +{% endfor %} + + {% endfor %} + + + +\ +""") + +def test_django(): +c = DjangoContext(context) +c['navigation'] = [('index.html', 'Index'), ('downloads.html', 'Downloads'), + ('products.html', 'Products')] +django_template.render(c) + +try: +from mako.template import Template as MakoTemplate +except ImportError: +test_mako = None +else: +mako_template = MakoTemplate("""\ + + + +${page_title|h} + + + + ${page_title|h} + + +% for href, caption in [('index.html', 'Index'), ('downloads.html', 'Downloads'), ('products.html', 'Products')]: + ${caption|h} +% endfor + + + + % for row in table: + +% for cell in row: + ${cell} +% endfor + + % endfor + + + +\ +""") + +def test_mako(): +mako_template.render(**context) + +try: +from genshi.template import MarkupTemplate as GenshiTemplate +except ImportError: +test_genshi = None +else: +genshi_template = GenshiTemplate("""\ +http://www.w3.org/1999/xhtml"; xmlns:py="http://genshi.edgewall.org/";> + +${page_title} + + + + ${page_title} + + + ${caption} + + + + + ${cell} + + + + +\ +""") + +def test_genshi(): +genshi_template.generate(**context).render('html', strip_whitespace=False) + +try: +from Cheetah.Template import Template as CheetahTemplate +except ImportError: +test_cheetah = None +else: +cheetah_template = CheetahTemplate("""\ +#import cgi + + + +$cgi.escape($page_title) + + + + $cgi.escape($page_title) + + +#for $href, $caption in [('index.html', 'Index'), ('downloads.html', 'Downloads'), ('products.html', 'Products')]: + $cgi.escape($caption) +#end for + + + + #for $row in $table: + +#for $cell in $row: + $cell +#end for + + #end for + + + +\ +""", searchList=[dict(context)]) + +def test_cheetah(): +unicode(cheetah
[05/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java index 4103b65..a660d5a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java @@ -18,9 +18,6 @@ package org.apache.ambari.server.controller.internal; -import org.apache.ambari.server.controller.spi.PropertyProvider; -import org.apache.ambari.server.controller.utilities.PropertyHelper; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; @@ -31,6 +28,9 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.ambari.server.controller.spi.PropertyProvider; +import org.apache.ambari.server.controller.utilities.PropertyHelper; + /** * Abstract property provider implementation. */ @@ -123,12 +123,13 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P return; } -String regExpKey = getRegExpKey(propertyId); +Map.Entry regexEntry = getRegexEntry(propertyId); -if (regExpKey != null) { - propertyInfo = componentMetricMap.get(regExpKey); +if (regexEntry != null) { + String regexKey = regexEntry.getKey(); + propertyInfo = componentMetricMap.get(regexKey); if (propertyInfo != null) { -propertyInfoMap.put(regExpKey, propertyInfo); +propertyInfoMap.put(regexKey, propertyInfo); return; } } @@ -144,14 +145,14 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P } } -if (regExpKey != null) { - if (!regExpKey.endsWith("/")){ -regExpKey += "/"; - } +if (regexEntry != null) { + // in the event that a category is being requested, the pattern must + // match all child properties; append \S* for this + String regexPattern = regexEntry.getValue().pattern(); + regexPattern += "(\\S*)"; - for (Map.Entry entry : componentMetricMap.entrySet()) { -if (entry.getKey().startsWith(regExpKey)) { +if (entry.getKey().matches(regexPattern)) { propertyInfoMap.put(entry.getKey(), entry.getValue()); } } @@ -278,15 +279,18 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P protected void updateComponentMetricMap( Map componentMetricMap, String propertyId) { -String regExpKey = getRegExpKey(propertyId); - +String regexKey = null; +Map.Entry regexEntry = getRegexEntry(propertyId); +if (null != regexEntry) { + regexKey = regexEntry.getKey(); +} -if (!componentMetricMap.containsKey(propertyId) && regExpKey != null && - !regExpKey.equals(propertyId)) { +if (!componentMetricMap.containsKey(propertyId) && regexKey != null +&& !regexKey.equals(propertyId)) { - PropertyInfo propertyInfo = componentMetricMap.get(regExpKey); + PropertyInfo propertyInfo = componentMetricMap.get(regexKey); if (propertyInfo != null) { -List regexGroups = getRegexGroups(regExpKey, propertyId); +List regexGroups = getRegexGroups(regexKey, propertyId); String key = propertyInfo.getPropertyId(); for (String regexGroup : regexGroups) { regexGroup = regexGroup.replace("/", "."); http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java index 3e59c63..8b49d4e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java @@ -18,10 +18,22 @@ package org.apache.ambari.server.controller.internal; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.Role; im
[09/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java new file mode 100644 index 000..b35076d --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java @@ -0,0 +1,356 @@ +/** + * 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.ambari.server.api.services.stackadvisor.commands; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.apache.ambari.server.api.resources.ResourceInstance; +import org.apache.ambari.server.api.services.AmbariMetaInfo; +import org.apache.ambari.server.api.services.BaseService; +import org.apache.ambari.server.api.services.LocalUriInfo; +import org.apache.ambari.server.api.services.Request; +import org.apache.ambari.server.api.services.StacksService.StackUriInfo; +import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException; +import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest; +import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse; +import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner; +import org.apache.ambari.server.controller.spi.Resource; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.node.ArrayNode; +import org.codehaus.jackson.node.ObjectNode; +import org.codehaus.jackson.node.TextNode; + +/** + * Parent for all commands. + */ +public abstract class StackAdvisorCommand extends BaseService { + + /** + * Type of response object provided by extending classes when + * {@link #invoke(StackAdvisorRequest)} is called. + */ + private Class type; + + protected static Log LOG = LogFactory.getLog(StackAdvisorCommand.class); + + private static final String GET_HOSTS_INFO_URI = "/api/v1/hosts" + + "?fields=*&Hosts/host_name.in(%s)"; + private static final String GET_SERVICES_INFO_URI = "/api/v1/stacks/%s/versions/%s" + + "?fields=Versions/stack_name,Versions/stack_version,Versions/parent_stack_version" + + ",services/StackServices/service_name,services/StackServices/service_version" + + ",services/components/StackServiceComponents,services/components/dependencies,services/components/auto_deploy" + + "&services/StackServices/service_name.in(%s)"; + private static final String SERVICES_PROPETRY = "services"; + private static final String SERVICES_COMPONENTS_PROPETRY = "components"; + private static final String COMPONENT_INFO_PROPETRY = "StackServiceComponents"; + private static final String COMPONENT_NAME_PROPERTY = "component_name"; + private static final String COMPONENT_HOSTNAMES_PROPETRY = "hostnames"; + private static final String CONFIGURATIONS_PROPETRY = "configurations"; + + private File recommendationsDir; + private String stackAdvisorScript; + + private int requestId; + private File requestDirectory; + private StackAdvisorRunner saRunner; + + protected ObjectMapper mapper; + + private final AmbariMetaInfo metaInfo; + + @SuppressWarnings("unchecked") + public StackAdvisorCommand(File recommendationsDir, String stackAdvisorScript, int requestId, + StackAdvisorRunner
[21/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/filters.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/filters.py b/ambari-common/src/main/python/jinja2/jinja2/filters.py deleted file mode 100644 index d1848e4..000 --- a/ambari-common/src/main/python/jinja2/jinja2/filters.py +++ /dev/null @@ -1,719 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.filters -~~ - -Bundled jinja filters. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import re -import math -from random import choice -from operator import itemgetter -from itertools import imap, groupby -from jinja2.utils import Markup, escape, pformat, urlize, soft_unicode -from jinja2.runtime import Undefined -from jinja2.exceptions import FilterArgumentError, SecurityError - - -_word_re = re.compile(r'\w+(?u)') - - -def contextfilter(f): -"""Decorator for marking context dependent filters. The current -:class:`Context` will be passed as first argument. -""" -f.contextfilter = True -return f - - -def evalcontextfilter(f): -"""Decorator for marking eval-context dependent filters. An eval -context object is passed as first argument. For more information -about the eval context, see :ref:`eval-context`. - -.. versionadded:: 2.4 -""" -f.evalcontextfilter = True -return f - - -def environmentfilter(f): -"""Decorator for marking evironment dependent filters. The current -:class:`Environment` is passed to the filter as first argument. -""" -f.environmentfilter = True -return f - - -def do_forceescape(value): -"""Enforce HTML escaping. This will probably double escape variables.""" -if hasattr(value, '__html__'): -value = value.__html__() -return escape(unicode(value)) - - -@evalcontextfilter -def do_replace(eval_ctx, s, old, new, count=None): -"""Return a copy of the value with all occurrences of a substring -replaced with a new one. The first argument is the substring -that should be replaced, the second is the replacement string. -If the optional third argument ``count`` is given, only the first -``count`` occurrences are replaced: - -.. sourcecode:: jinja - -{{ "Hello World"|replace("Hello", "Goodbye") }} --> Goodbye World - -{{ "argh"|replace("a", "d'oh, ", 2) }} --> d'oh, d'oh, aaargh -""" -if count is None: -count = -1 -if not eval_ctx.autoescape: -return unicode(s).replace(unicode(old), unicode(new), count) -if hasattr(old, '__html__') or hasattr(new, '__html__') and \ - not hasattr(s, '__html__'): -s = escape(s) -else: -s = soft_unicode(s) -return s.replace(soft_unicode(old), soft_unicode(new), count) - - -def do_upper(s): -"""Convert a value to uppercase.""" -return soft_unicode(s).upper() - - -def do_lower(s): -"""Convert a value to lowercase.""" -return soft_unicode(s).lower() - - -@evalcontextfilter -def do_xmlattr(_eval_ctx, d, autospace=True): -"""Create an SGML/XML attribute string based on the items in a dict. -All values that are neither `none` nor `undefined` are automatically -escaped: - -.. sourcecode:: html+jinja - - -... - - -Results in something like this: - -.. sourcecode:: html - - -... - - -As you can see it automatically prepends a space in front of the item -if the filter returned something unless the second parameter is false. -""" -rv = u' '.join( -u'%s="%s"' % (escape(key), escape(value)) -for key, value in d.iteritems() -if value is not None and not isinstance(value, Undefined) -) -if autospace and rv: -rv = u' ' + rv -if _eval_ctx.autoescape: -rv = Markup(rv) -return rv - - -def do_capitalize(s): -"""Capitalize a value. The first character will be uppercase, all others -lowercase. -""" -return soft_unicode(s).capitalize() - - -def do_title(s): -"""Return a titlecased version of the value. I.e. words will start with -uppercase letters, all remaining characters are lowercase. -""" -return soft_unicode(s).title() - - -def do_dictsort(value, case_sensitive=False, by='key'): -"""Sort a dict and yield (key, value) pairs. Because python dicts are -unsorted you may want to use this function to order them by either -key or value: - -.. sourcecode:: jinja - -{% for item in mydict|dictsort %} -sort the dict by key, case insensitive - -{% for item in mydict|dicsort(true) %} -sort the dict by key, case sensitive - -{% for item in mydict|dictsort(false, 'value') %} -sort the dict by key, case insensitive, sorted -normally and ordered by v
[24/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py b/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py deleted file mode 100644 index 1161b7f..000 --- a/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2._stringdefs -~~ - -Strings of all Unicode characters of a certain category. -Used for matching in Unicode-aware languages. Run to regenerate. - -Inspired by chartypes_create.py from the MoinMoin project, original -implementation from Pygments. - -:copyright: Copyright 2006-2009 by the Jinja team, see AUTHORS. -:license: BSD, see LICENSE for details. -""" - -Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f' - -Cf = u'\xad\u0600\u0601\u0602\u0603\u06dd\u070f\u17b4\u17b5\u200b\u200c\u200d\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2060\u2061\u2062\u2063\u206a\u206b\u206c\u206d\u206e\u206f\ufeff\ufff9\ufffa\ufffb' - -Cn = u'\u0242\u0243\u0244\u0245\u0246\u0247\u0248\u0249\u024a\u024b\u024c\u024d\u024e\u024f\u0370\u0371\u0372\u0373\u0376\u0377\u0378\u0379\u037b\u037c\u037d\u037f\u0380\u0381\u0382\u0383\u038b\u038d\u03a2\u03cf\u0487\u04cf\u04fa\u04fb\u04fc\u04fd\u04fe\u04ff\u0510\u0511\u0512\u0513\u0514\u0515\u0516\u0517\u0518\u0519\u051a\u051b\u051c\u051d\u051e\u051f\u0520\u0521\u0522\u0523\u0524\u0525\u0526\u0527\u0528\u0529\u052a\u052b\u052c\u052d\u052e\u052f\u0530\u0557\u0558\u0560\u0588\u058b\u058c\u058d\u058e\u058f\u0590\u05ba\u05c8\u05c9\u05ca\u05cb\u05cc\u05cd\u05ce\u05cf\u05eb\u05ec\u05ed\u05ee\u05ef\u05f5\u05f6\u05f7\u05f8\u05f9\u05fa\u05fb\u05fc\u05fd\u05fe\u05ff\u0604\u0605\u0606\u0607\u0608\u0609\u060a\u0616\u0617\u0618\u0619\u061a\u061c\u061d\u0620\u063b\u063c\u063d\u063e\u063f\u065f\u070e\u074b\u074c\u076e\u076f\u0770\u0771\u0772\u0773\u0774\u0775\u0776\u0777\u0778\u0779\u077a\u077b\u077c\u077d\u077e\u077f\u07b2\u07b3\u07b4\u07b5\u07b6\u07b7\u07b8\u07b9\u07ba\u07bb\u07bc\u07bd\u07be \u07bf\u07c0\u07c1\u07c2\u07c3\u07c4\u07c5\u07c6\u07c7\u07c8\u07c9\u07ca\u07cb\u07cc\u07cd\u07ce\u07cf\u07d0\u07d1\u07d2\u07d3\u07d4\u07d5\u07d6\u07d7\u07d8\u07d9\u07da\u07db\u07dc\u07dd\u07de\u07df\u07e0\u07e1\u07e2\u07e3\u07e4\u07e5\u07e6\u07e7\u07e8\u07e9\u07ea\u07eb\u07ec\u07ed\u07ee\u07ef\u07f0\u07f1\u07f2\u07f3\u07f4\u07f5\u07f6\u07f7\u07f8\u07f9\u07fa\u07fb\u07fc\u07fd\u07fe\u07ff\u0800\u0801\u0802\u0803\u0804\u0805\u0806\u0807\u0808\u0809\u080a\u080b\u080c\u080d\u080e\u080f\u0810\u0811\u0812\u0813\u0814\u0815\u0816\u0817\u0818\u0819\u081a\u081b\u081c\u081d\u081e\u081f\u0820\u0821\u0822\u0823\u0824\u0825\u0826\u0827\u0828\u0829\u082a\u082b\u082c\u082d\u082e\u082f\u0830\u0831\u0832\u0833\u0834\u0835\u0836\u0837\u0838\u0839\u083a\u083b\u083c\u083d\u083e\u083f\u0840\u0841\u0842\u0843\u0844\u0845\u0846\u0847\u0848\u0849\u084a\u084b\u084c\u084d\u084e\u084f\u0850\u0851\u0852\u0853\u0854\u0855\u0856\u0857\u0858\u0859\u085a\u085b\u085c\u085d\u085e\u085f\u0860\u0861\u0862\u0863\u0864\ u0865\u0866\u0867\u0868\u0869\u086a\u086b\u086c\u086d\u086e\u086f\u0870\u0871\u0872\u0873\u0874\u0875\u0876\u0877\u0878\u0879\u087a\u087b\u087c\u087d\u087e\u087f\u0880\u0881\u0882\u0883\u0884\u0885\u0886\u0887\u0888\u0889\u088a\u088b\u088c\u088d\u088e\u088f\u0890\u0891\u0892\u0893\u0894\u0895\u0896\u0897\u0898\u0899\u089a\u089b\u089c\u089d\u089e\u089f\u08a0\u08a1\u08a2\u08a3\u08a4\u08a5\u08a6\u08a7\u08a8\u08a9\u08aa\u08ab\u08ac\u08ad\u08ae\u08af\u08b0\u08b1\u08b2\u08b3\u08b4\u08b5\u08b6\u08b7\u08b8\u08b9\u08ba\u08bb\u08bc\u08bd\u08be\u08bf\u08c0\u08c1\u08c2\u08c3\u08c4\u08c5\u08c6\u08c7\u08c8\u08c9\u08ca\u08cb\u08cc\u08cd\u08ce\u08cf\u08d0\u08d1\u08d2\u08d3\u08d4\u08d5\u08d6\u08d7\u08d8\u08d9\u08da\u08db\u08dc\u08dd\u08de\u08df\u08e0\u08e1\u08e2\u08e3\u08e4\u08e5\u08e6\u08e7\u08e8\u08e9\u08ea\u08eb\u08ec\u08ed\u08ee\u08ef\u08f0\u08f1\u08f2\u08f3\u08f4\u08f5\u08f6\u08f7\u08f8\u08f9\u08fa\u08fb\u08fc\u08fd\u08fe\u08ff\u0900\u093a\u093b\u094e\u094f\u0955\u0956\u0957\u0971\u0972\u0973\u 0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097e\u097f\u0980\u0984\u098d\u098e\u0991\u0992\u09a9\u09b1\u09b3\u09b4\u09b5\u09ba\u09bb\u09c5\u09c6\u09c9\u09ca\u09cf\u09d0\u09d1\u09d2\u09d3\u09d4\u09d5\u09d6\u09d8\u09d9\u09da\u09db\u09de\u09e4\u09e5\u09fb\u09fc\u09fd\u09fe\u09ff\u0a00\u0a04\u0a0b\u0a0c\u0a0d\u0a0e\u0a11\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a\u0a3b\u0a3d\u0a43\u0a44\u0a45\u0a46\u0a49\u0a4a\u0a4e\u0a4f\u0a50\u0a51\u0a52\u0a53\u0a54\u0a55\u0a56\u0a57\u0a58\u0a5d\u0a5f\u0a60\u0a61\u0a62\u0a63\u0a64\u0a65\u0a75\u0a76\u0a77\u0a78\u0a79\u0a7a\u0a7b\u0a7c\u0a7d\u0a7e\u0a7f\u0a80\u0a84\u0
[50/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/pom.xml -- diff --git a/ambari-admin/pom.xml b/ambari-admin/pom.xml index 559a13d..8251860 100644 --- a/ambari-admin/pom.xml +++ b/ambari-admin/pom.xml @@ -15,7 +15,7 @@ limitations under the License. --> http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> org.apache.ambari ambari-project @@ -59,6 +59,89 @@ +com.github.eirslett +frontend-maven-plugin +0.0.14 + + v0.10.26 + 1.4.3 + src/main/resources/ui/admin-web/ + + + +install node and npm +generate-sources + + install-node-and-npm + + + +npm install +generate-sources + + npm + + + install --unsafe-perm + + + + + +exec-maven-plugin +org.codehaus.mojo + + +Bower install +generate-sources + + exec + + + ${basedir}/src/main/resources/ui/admin-web + ${basedir}/src/main/resources/ui/admin-web/node/${executable.node} + + ${basedir}/src/main/resources/ui/admin-web/node_modules/bower/bin/bower +install +--allow-root + + + + +Gulp build +generate-sources + + exec + + + ${basedir}/src/main/resources/ui/admin-web + ${basedir}/src/main/resources/ui/admin-web/node/${executable.node} + + ${basedir}/src/main/resources/ui/admin-web/node_modules/gulp/bin/gulp +build + + + + + + + maven-compiler-plugin 3.0 @@ -71,22 +154,91 @@ - org.vafer - jdeb - 1.0.1 - - - none - - jdeb - - - - - true - false - +org.vafer +jdeb +1.0.1 + + +none + +jdeb + + + + +true +false + + + +org.apache.rat +apache-rat-plugin + + + src/main/resources/ui/admin-web/bower_components/** +src/main/resources/ui/admin-web/dist/** +src/main/resources/ui/admin-web/node/** +src/main/resources/ui/admin-web/node_modules/** + src/main/resources/ui/admin-web/app/bower_components/** + src/main/resources/ui/admin-web/test/bower_components/** +src/main/resources/ui/admin-web/mock.js +src/main/resources/ui/admin-web/bower.json +src/main/resources/ui/admin-web/test/bower.json +src/main/resources/ui/admin-web/test/.bowerrc +src/main/resources/ui/admin-web/.bowerrc +src/main/resources/ui/admin-web/package.json +src/main/resources/ui/admin-web/.jshintrc + + + + +test + + check + + + + + +src/main/resources +false + + META-INF/**/* + view.xml + + + +src/main/resources/ui/admin-web/dist +false + + + + +windows + + +win + + + +win +node.exe + + + +linux + + +unix + + + +linux +node + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/.bowerrc -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/.bowerrc b/ambari-admin/src/main/resources/ui/admin-web/.bowerrc new file mode 100644 index 000..d0f0b6f --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/.bowerrc @@ -0,0 +1,3 @@ +{ +"directory": "app/bower_components" +} \ No newlin
[47/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/test/index.html -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/index.html b/ambari-admin/src/main/resources/ui/admin-web/test/index.html new file mode 100644 index 000..d0f320f --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/test/index.html @@ -0,0 +1,44 @@ + + + + + + +Mocha Spec Runner + + + + + +mocha.setup('bdd') + + +var assert = chai.assert; +var expect = chai.expect; +var should = chai.should(); + + + + + + + +mocha.run() + + http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js b/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js new file mode 100644 index 000..bb514cd --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/test/karma.conf.js @@ -0,0 +1,68 @@ +/** + * 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. + */ + +module.exports = function(config){ + config.set({ + +basePath : '../', + +files : [ + 'app/bower_components/jquery/dist/jquery.js', + 'app/bower_components/angular/angular.js', + 'app/bower_components/angular-animate/angular-animate.js', + 'app/bower_components/angular-bootstrap/ui-bootstrap.js', + 'app/bower_components/angular-bootstrap-toggle-switch/angular-toggle-switch.js', + 'app/bower_components/angular-route/angular-route.js', + 'app/bower_components/angular-translate/angular-translate.js', + 'app/bower_components/underscore/underscore.js', + 'app/bower_components/restangular/dist/restangular.js', + 'app/bower_components/mocha/mocha.js', + 'app/bower_components/chai/chai.js', + 'app/bower_components/sinon/lib/sinon.js', + 'app/bower_components/angular-mocks/angular-mocks.js', + 'app/scripts/**/*.js', + 'test/unit/**/*.js', + 'app/views/directives/*.html' +], + +autoWatch : true, + +frameworks: ['jasmine'], + +browsers: ['PhantomJS'], + +plugins : [ +'karma-jasmine', +'karma-phantomjs-launcher', +'karma-ng-html2js-preprocessor' +], + +junitReporter : { + outputFile: 'test_out/unit.xml', + suite: 'unit' +}, + +preprocessors: { + 'app/views/directives/*.html': ['ng-html2js'] +}, +ngHtml2JsPreprocessor: { + 'stripPrefix': 'app/' +} + + }); +}; http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js b/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js new file mode 100644 index 000..e8d871a --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/test/protractor-conf.js @@ -0,0 +1,50 @@ +/** + * 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. + */ + +exports.config = { + allScriptsTimeout: 11000, + + specs: [ +'e2e/*.js' + ], + + capabilities: { +'browserName': 'chrome' + }, + + chromeOn
[37/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py new file mode 100644 index 000..e728209 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.bccache +~~ + +This module implements the bytecode cache system Jinja is optionally +using. This is useful if you have very complex template situations and +the compiliation of all those templates slow down your application too +much. + +Situations where this is useful are often forking web applications that +are initialized on the first request. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD. +""" +from os import path, listdir +import marshal +import tempfile +import cPickle as pickle +import fnmatch +from cStringIO import StringIO +try: +from hashlib import sha1 +except ImportError: +from sha import new as sha1 +from ambari_jinja2.utils import open_if_exists + + +bc_version = 1 +bc_magic = 'j2'.encode('ascii') + pickle.dumps(bc_version, 2) + + +class Bucket(object): +"""Buckets are used to store the bytecode for one template. It's created +and initialized by the bytecode cache and passed to the loading functions. + +The buckets get an internal checksum from the cache assigned and use this +to automatically reject outdated cache material. Individual bytecode +cache subclasses don't have to care about cache invalidation. +""" + +def __init__(self, environment, key, checksum): +self.environment = environment +self.key = key +self.checksum = checksum +self.reset() + +def reset(self): +"""Resets the bucket (unloads the bytecode).""" +self.code = None + +def load_bytecode(self, f): +"""Loads bytecode from a file or file like object.""" +# make sure the magic header is correct +magic = f.read(len(bc_magic)) +if magic != bc_magic: +self.reset() +return +# the source code of the file changed, we need to reload +checksum = pickle.load(f) +if self.checksum != checksum: +self.reset() +return +# now load the code. Because marshal is not able to load +# from arbitrary streams we have to work around that +if isinstance(f, file): +self.code = marshal.load(f) +else: +self.code = marshal.loads(f.read()) + +def write_bytecode(self, f): +"""Dump the bytecode into the file or file like object passed.""" +if self.code is None: +raise TypeError('can\'t write empty bucket') +f.write(bc_magic) +pickle.dump(self.checksum, f, 2) +if isinstance(f, file): +marshal.dump(self.code, f) +else: +f.write(marshal.dumps(self.code)) + +def bytecode_from_string(self, string): +"""Load bytecode from a string.""" +self.load_bytecode(StringIO(string)) + +def bytecode_to_string(self): +"""Return the bytecode as string.""" +out = StringIO() +self.write_bytecode(out) +return out.getvalue() + + +class BytecodeCache(object): +"""To implement your own bytecode cache you have to subclass this class +and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of +these methods are passed a :class:`~ambari_jinja2.bccache.Bucket`. + +A very basic bytecode cache that saves the bytecode on the file system:: + +from os import path + +class MyCache(BytecodeCache): + +def __init__(self, directory): +self.directory = directory + +def load_bytecode(self, bucket): +filename = path.join(self.directory, bucket.key) +if path.exists(filename): +with open(filename, 'rb') as f: +bucket.load_bytecode(f) + +def dump_bytecode(self, bucket): +filename = path.join(self.directory, bucket.key) +with open(filename, 'wb') as f: +bucket.write_bytecode(f) + +A more advanced version of a filesystem based bytecode cache is part of +Jinja2. +""" + +def load_bytecode(self, bucket): +"""Subclasses have to override this method to load bytecode into a +bucket. If they are not able to find code in the cache for the +bucket, it must not do anything. +""" +raise NotImplementedError() + +def dump_bytecode(self, bucket): +"""Subclasses have to override this method to write the bytecode +from a bucket back
[31/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py new file mode 100644 index 000..fd0ea68 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py @@ -0,0 +1,21 @@ +from lib2to3 import fixer_base, pytree +from lib2to3.fixer_util import Name, BlankLine, Name, Attr, ArgList + + +class FixBrokenReraising(fixer_base.BaseFix): +PATTERN = """ +raise_stmt< 'raise' any ',' val=any ',' tb=any > +""" + +# run before the broken 2to3 checker with the same goal +# tries to rewrite it with a rule that does not work out for jinja +run_order = 1 + +def transform(self, node, results): +tb = results['tb'].clone() +tb.prefix = '' +with_tb = Attr(results['val'].clone(), Name('with_traceback')) + \ + [ArgList([tb])] +new = pytree.Node(self.syms.simple_stmt, [Name("raise")] + with_tb) +new.prefix = node.prefix +return new http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py new file mode 100644 index 000..5d35e50 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py @@ -0,0 +1,11 @@ +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name, BlankLine + + +# whyever this is necessary.. + +class FixXrange2(fixer_base.BaseFix): +PATTERN = "'xrange'" + +def transform(self, node, results): +node.replace(Name('range', prefix=node.prefix)) http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/docs/Makefile -- diff --git a/ambari-common/src/main/python/ambari_jinja2/docs/Makefile b/ambari-common/src/main/python/ambari_jinja2/docs/Makefile new file mode 100644 index 000..5e24ec1 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/docs/Makefile @@ -0,0 +1,75 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS= +SPHINXBUILD = sphinx-build +PAPER = + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " pickleto make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + -rm -rf _build/* + +html: + mkdir -p _build/html _build/doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html + @echo + @echo "Build finished. The HTML pages are in _build/html." + +pickle: + mkdir -p _build/pickle _build/doctrees + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle + @echo + @echo "Build finished; now you can process the pickle files" + +json: + mkdir -p _build/json _build/doctrees + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json + @echo + @echo "Build finished; now you can process the json files" + +web: pickle + +htmlhelp: + mkdir -p _build/htmlhelp _build/doctrees + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in _build/htmlhelp." + +latex: + mkdir -p _build/latex _build/doctrees + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex + @echo + @echo "Build finished; the LaTeX files are in _build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + mkdir -p _build/changes _build/doctrees + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes + @echo + @echo "The overview file is in _build/changes." + +linkcheck: + mkdir -p _build/lin
[35/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py new file mode 100644 index 000..bdb545e --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py @@ -0,0 +1,719 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.filters +~~ + +Bundled jinja filters. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import re +import math +from random import choice +from operator import itemgetter +from itertools import imap, groupby +from ambari_jinja2.utils import Markup, escape, pformat, urlize, soft_unicode +from ambari_jinja2.runtime import Undefined +from ambari_jinja2.exceptions import FilterArgumentError, SecurityError + + +_word_re = re.compile(r'\w+(?u)') + + +def contextfilter(f): +"""Decorator for marking context dependent filters. The current +:class:`Context` will be passed as first argument. +""" +f.contextfilter = True +return f + + +def evalcontextfilter(f): +"""Decorator for marking eval-context dependent filters. An eval +context object is passed as first argument. For more information +about the eval context, see :ref:`eval-context`. + +.. versionadded:: 2.4 +""" +f.evalcontextfilter = True +return f + + +def environmentfilter(f): +"""Decorator for marking evironment dependent filters. The current +:class:`Environment` is passed to the filter as first argument. +""" +f.environmentfilter = True +return f + + +def do_forceescape(value): +"""Enforce HTML escaping. This will probably double escape variables.""" +if hasattr(value, '__html__'): +value = value.__html__() +return escape(unicode(value)) + + +@evalcontextfilter +def do_replace(eval_ctx, s, old, new, count=None): +"""Return a copy of the value with all occurrences of a substring +replaced with a new one. The first argument is the substring +that should be replaced, the second is the replacement string. +If the optional third argument ``count`` is given, only the first +``count`` occurrences are replaced: + +.. sourcecode:: jinja + +{{ "Hello World"|replace("Hello", "Goodbye") }} +-> Goodbye World + +{{ "argh"|replace("a", "d'oh, ", 2) }} +-> d'oh, d'oh, aaargh +""" +if count is None: +count = -1 +if not eval_ctx.autoescape: +return unicode(s).replace(unicode(old), unicode(new), count) +if hasattr(old, '__html__') or hasattr(new, '__html__') and \ + not hasattr(s, '__html__'): +s = escape(s) +else: +s = soft_unicode(s) +return s.replace(soft_unicode(old), soft_unicode(new), count) + + +def do_upper(s): +"""Convert a value to uppercase.""" +return soft_unicode(s).upper() + + +def do_lower(s): +"""Convert a value to lowercase.""" +return soft_unicode(s).lower() + + +@evalcontextfilter +def do_xmlattr(_eval_ctx, d, autospace=True): +"""Create an SGML/XML attribute string based on the items in a dict. +All values that are neither `none` nor `undefined` are automatically +escaped: + +.. sourcecode:: html+jinja + + +... + + +Results in something like this: + +.. sourcecode:: html + + +... + + +As you can see it automatically prepends a space in front of the item +if the filter returned something unless the second parameter is false. +""" +rv = u' '.join( +u'%s="%s"' % (escape(key), escape(value)) +for key, value in d.iteritems() +if value is not None and not isinstance(value, Undefined) +) +if autospace and rv: +rv = u' ' + rv +if _eval_ctx.autoescape: +rv = Markup(rv) +return rv + + +def do_capitalize(s): +"""Capitalize a value. The first character will be uppercase, all others +lowercase. +""" +return soft_unicode(s).capitalize() + + +def do_title(s): +"""Return a titlecased version of the value. I.e. words will start with +uppercase letters, all remaining characters are lowercase. +""" +return soft_unicode(s).title() + + +def do_dictsort(value, case_sensitive=False, by='key'): +"""Sort a dict and yield (key, value) pairs. Because python dicts are +unsorted you may want to use this function to order them by either +key or value: + +.. sourcecode:: jinja + +{% for item in mydict|dictsort %} +sort the dict by key, case insensitive + +{% for item in mydict|dicsort(true) %} +sort the dict by key, case sensitive + +{% for item in mydict|dictsort(false, 'value') %} +sort
[03/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java new file mode 100644 index 000..9663486 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -0,0 +1,989 @@ +/** + * 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.ambari.server.controller.internal; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Updates configuration properties based on cluster topology. This is done when exporting + * a blueprint and when a cluster is provisioned via a blueprint. + */ +public class BlueprintConfigurationProcessor { + + /** + * Single host topology updaters + */ + private static Map> singleHostTopologyUpdaters = + new HashMap>(); + + /** + * Multi host topology updaters + */ + private static Map> multiHostTopologyUpdaters = + new HashMap>(); + + /** + * Database host topology updaters + */ + private static Map> dbHostTopologyUpdaters = + new HashMap>(); + + /** + * Updaters for properties which need 'm' appended + */ + private static Map> mPropertyUpdaters = + new HashMap>(); + + /** + * Updaters that preserve the original property value, functions + * as a placeholder for DB-related properties that need to be + * removed from export, but do not require an update during + * cluster creation + */ + private static Map> removePropertyUpdaters = +new HashMap>(); + + /** + * Collection of all updaters + */ + private static Collection>> allUpdaters = + new ArrayList>>(); + + /** + * Compiled regex for hostgroup token. + */ + private static Pattern HOSTGROUP_REGEX = Pattern.compile("%HOSTGROUP::(\\S+)%"); + + /** + * Compiled regex for hostgroup token with port information. + */ + private static Pattern HOSTGROUP_PORT_REGEX = Pattern.compile("%HOSTGROUP::(\\w+|\\d+)%:?(\\d+)?"); + + /** + * Statically-defined set of properties that can support using a nameservice name + * in the configuration, rather than just a host name. + */ + private static Set configPropertiesWithHASupport = +new HashSet(Arrays.asList("fs.defaultFS", "hbase.rootdir")); + + + /** + * Configuration properties to be updated + */ + private Map> properties; + + + /** + * Constructor. + * + * @param properties properties to update + */ + public BlueprintConfigurationProcessor(Map> properties) { +this.properties = properties; + } + + /** + * Update properties for cluster creation. This involves updating topology related properties with + * concrete topology information. + * + * @param hostGroups host groups of cluster to be deployed + * + * @return updated properties + */ + public Map> doUpdateForClusterCreate(Map hostGroups) { +for (Map> updaterMap : createCollectionOfUpdaters()) { + for (Map.Entry> entry : updaterMap.entrySet()) { +String type = entry.getKey(); +for (Map.Entry updaterEntry : entry.getValue().entrySet()) { + String propertyName = updaterEntry.getKey(); + PropertyUpdater updater = updaterEntry.getValue(); + + Map typeMap = properties.get(type); + if (typeMap != null && typeMap.containsKey(propertyName)) { +typeMap.put(propertyName, updater.updateForClusterCreate( +hostGroups, typeMap.get(propertyName), properties)); + } +} + } +} +return properties; + } + + /** + * Creates a Collection of PropertyUpdater maps that will handle th
[43/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/core/resources/packaging.py -- diff --git a/ambari-agent/src/main/python/resource_management/core/resources/packaging.py b/ambari-agent/src/main/python/resource_management/core/resources/packaging.py deleted file mode 100644 index c2ff20e..000 --- a/ambari-agent/src/main/python/resource_management/core/resources/packaging.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -""" -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. - -Ambari Agent - -""" - -__all__ = ["Package"] - -from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument - - -class Package(Resource): - action = ForcedListArgument(default="install") - package_name = ResourceArgument(default=lambda obj: obj.name) - location = ResourceArgument(default=lambda obj: obj.package_name) - version = ResourceArgument() - actions = ["install", "upgrade", "remove"] - build_vars = ForcedListArgument(default=[]) http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/core/resources/service.py -- diff --git a/ambari-agent/src/main/python/resource_management/core/resources/service.py b/ambari-agent/src/main/python/resource_management/core/resources/service.py deleted file mode 100644 index 20d5c1b..000 --- a/ambari-agent/src/main/python/resource_management/core/resources/service.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -""" -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. - -Ambari Agent - -""" - -__all__ = ["Service"] - -from resource_management.core.base import Resource, ResourceArgument, ForcedListArgument - - -class Service(Resource): - action = ForcedListArgument(default="start") - service_name = ResourceArgument(default=lambda obj: obj.name) - #enabled = ResourceArgument() # Maybe add support to put in/out autostart. - start_command = ResourceArgument() - stop_command = ResourceArgument() - restart_command = ResourceArgument() - reload_command = ResourceArgument() # reload the config file without interrupting pending operations - status_command = ResourceArgument() - - actions = ["nothing", "start", "stop", "restart", "reload"] http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/resource_management/core/resources/system.py -- diff --git a/ambari-agent/src/main/python/resource_management/core/resources/system.py b/ambari-agent/src/main/python/resource_management/core/resources/system.py deleted file mode 100644 index 0952c48..000 --- a/ambari-agent/src/main/python/resource_management/core/resources/system.py +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env python -""" -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, -WIT
[33/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py new file mode 100644 index 000..020c82a --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py @@ -0,0 +1,271 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2.sandbox +~~ + +Adds a sandbox layer to Jinja as it was the default behavior in the old +Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the +default behavior is easier to use. + +The behavior can be changed by subclassing the environment. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD. +""" +import operator +from ambari_jinja2.runtime import Undefined +from ambari_jinja2.environment import Environment +from ambari_jinja2.exceptions import SecurityError +from ambari_jinja2.utils import FunctionType, MethodType, TracebackType, CodeType, \ + FrameType, GeneratorType + + +#: maximum number of items a range may produce +MAX_RANGE = 10 + +#: attributes of function objects that are considered unsafe. +UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict', + 'func_defaults', 'func_globals']) + +#: unsafe method attributes. function attributes are unsafe for methods too +UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self']) + + +import warnings + +# make sure we don't warn in python 2.6 about stuff we don't care about +warnings.filterwarnings('ignore', 'the sets module', DeprecationWarning, +module='ambari_jinja2.sandbox') + +from collections import deque + +_mutable_set_types = (set,) +_mutable_mapping_types = (dict,) +_mutable_sequence_types = (list,) + + +# on python 2.x we can register the user collection types +try: +from UserDict import UserDict, DictMixin +from UserList import UserList +_mutable_mapping_types += (UserDict, DictMixin) +_mutable_set_types += (UserList,) +except ImportError: +pass + +# if sets is still available, register the mutable set from there as well +try: +from sets import Set +_mutable_set_types += (Set,) +except ImportError: +pass + +#: register Python 2.6 abstract base classes +try: +from collections import MutableSet, MutableMapping, MutableSequence +_mutable_set_types += (MutableSet,) +_mutable_mapping_types += (MutableMapping,) +_mutable_sequence_types += (MutableSequence,) +except ImportError: +pass + +_mutable_spec = ( +(_mutable_set_types, frozenset([ +'add', 'clear', 'difference_update', 'discard', 'pop', 'remove', +'symmetric_difference_update', 'update' +])), +(_mutable_mapping_types, frozenset([ +'clear', 'pop', 'popitem', 'setdefault', 'update' +])), +(_mutable_sequence_types, frozenset([ +'append', 'reverse', 'insert', 'sort', 'extend', 'remove' +])), +(deque, frozenset([ +'append', 'appendleft', 'clear', 'extend', 'extendleft', 'pop', +'popleft', 'remove', 'rotate' +])) +) + + +def safe_range(*args): +"""A range that can't generate ranges with a length of more than +MAX_RANGE items. +""" +rng = xrange(*args) +if len(rng) > MAX_RANGE: +raise OverflowError('range too big, maximum size for range is %d' % +MAX_RANGE) +return rng + + +def unsafe(f): +""" +Mark a function or method as unsafe:: + +@unsafe +def delete(self): +pass +""" +f.unsafe_callable = True +return f + + +def is_internal_attribute(obj, attr): +"""Test if the attribute given is an internal python attribute. For +example this function returns `True` for the `func_code` attribute of +python objects. This is useful if the environment method +:meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. + +>>> from ambari_jinja2.sandbox import is_internal_attribute +>>> is_internal_attribute(lambda: None, "func_code") +True +>>> is_internal_attribute((lambda x:x).func_code, 'co_code') +True +>>> is_internal_attribute(str, "upper") +False +""" +if isinstance(obj, FunctionType): +if attr in UNSAFE_FUNCTION_ATTRIBUTES: +return True +elif isinstance(obj, MethodType): +if attr in UNSAFE_FUNCTION_ATTRIBUTES or \ + attr in UNSAFE_METHOD_ATTRIBUTES: +return True +elif isinstance(obj, type): +if attr == 'mro': +return True +elif isinstance(obj, (CodeType, TracebackType, FrameType)): +return True +elif isinstance(obj, GeneratorType): +if attr == 'gi_frame': +return True +return attr.startswith('__') + + +
[41/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py index 23b9bed..721cbe9 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py +++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py @@ -18,9 +18,11 @@ See the License for the specific language governing permissions and limitations under the License. ''' import ConfigParser +from multiprocessing.pool import ThreadPool import os import pprint +import shell from unittest import TestCase import threading @@ -37,6 +39,8 @@ import sys from AgentException import AgentException from FileCache import FileCache from LiveStatus import LiveStatus +from BackgroundCommandExecutionHandle import BackgroundCommandExecutionHandle +from ambari_agent.ActionQueue import ActionQueue class TestCustomServiceOrchestrator(TestCase): @@ -47,9 +51,11 @@ class TestCustomServiceOrchestrator(TestCase): sys.stdout = out # generate sample config tmpdir = tempfile.gettempdir() +exec_tmp_dir = os.path.join(tmpdir, 'tmp') self.config = ConfigParser.RawConfigParser() self.config.add_section('agent') self.config.set('agent', 'prefix', tmpdir) +self.config.set('agent', 'tmp_dir', exec_tmp_dir) self.config.set('agent', 'cache_dir', "/cachedir") self.config.add_section('python') self.config.set('python', 'custom_actions_dir', tmpdir) @@ -183,6 +189,8 @@ class TestCustomServiceOrchestrator(TestCase): '/hooks_dir/prefix-command') dummy_controller = MagicMock() orchestrator = CustomServiceOrchestrator(self.config, dummy_controller) +unix_process_id = 111 +orchestrator.commands_in_progress = {command['taskId']: unix_process_id} get_hook_base_dir_mock.return_value = "/hooks/" # normal run case run_file_mock.return_value = { @@ -206,9 +214,9 @@ class TestCustomServiceOrchestrator(TestCase): ret = orchestrator.runCommand(command, "out.txt", "err.txt", forced_command_name=CustomServiceOrchestrator.COMMAND_NAME_STATUS) ## Check that override_output_files was true only during first call -self.assertEquals(run_file_mock.call_args_list[0][0][7], True) -self.assertEquals(run_file_mock.call_args_list[1][0][7], False) -self.assertEquals(run_file_mock.call_args_list[2][0][7], False) +self.assertEquals(run_file_mock.call_args_list[0][0][10], True) +self.assertEquals(run_file_mock.call_args_list[1][0][10], False) +self.assertEquals(run_file_mock.call_args_list[2][0][10], False) ## Check that forced_command_name was taken into account self.assertEqual(run_file_mock.call_args_list[0][0][1][0], CustomServiceOrchestrator.COMMAND_NAME_STATUS) @@ -227,6 +235,146 @@ class TestCustomServiceOrchestrator(TestCase): pass + @patch("shell.kill_process_with_children") + @patch.object(CustomServiceOrchestrator, "resolve_script_path") + @patch.object(CustomServiceOrchestrator, "resolve_hook_script_path") + @patch.object(FileCache, "get_service_base_dir") + @patch.object(FileCache, "get_hook_base_dir") + @patch.object(CustomServiceOrchestrator, "dump_command_to_json") + @patch.object(PythonExecutor, "run_file") + @patch.object(FileCache, "__init__") + def test_cancel_command(self, FileCache_mock, + run_file_mock, dump_command_to_json_mock, + get_hook_base_dir_mock, get_service_base_dir_mock, + resolve_hook_script_path_mock, resolve_script_path_mock, + kill_process_with_children_mock): +FileCache_mock.return_value = None +command = { + 'role' : 'REGION_SERVER', + 'hostLevelParams' : { +'stack_name' : 'HDP', +'stack_version' : '2.0.7', +'jdk_location' : 'some_location' + }, + 'commandParams': { +'script_type': 'PYTHON', +'script': 'scripts/hbase_regionserver.py', +'command_timeout': '600', +'service_package_folder' : 'HBASE' + }, + 'taskId' : '3', + 'roleCommand': 'INSTALL' +} +get_service_base_dir_mock.return_value = "/basedir/" +resolve_script_path_mock.return_value = "/basedir/scriptpath" +resolve_hook_script_path_mock.return_value = \ + ('/hooks_dir/prefix-command/scripts/hook.py', + '/hooks_dir/prefix-command') +dummy_controller = MagicMock() +orchestrator = CustomServiceOrchestrator(self.config, dummy_controller) +unix_process_id = 111 +orchestrator.commands_in_progress = {command['taskId']: unix_process_id} +get_hook_base_dir_mock.return_value = "/hooks/" +run_file_mock_return_value = { + 'std
[46/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/ambari_agent/Controller.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py index 80deec7..53aaecd 100644 --- a/ambari-agent/src/main/python/ambari_agent/Controller.py +++ b/ambari-agent/src/main/python/ambari_agent/Controller.py @@ -32,15 +32,16 @@ import pprint from random import randint import hostname +import security +import ssl import AmbariConfig from Heartbeat import Heartbeat from Register import Register from ActionQueue import ActionQueue -import security +from FileCache import FileCache from NetUtil import NetUtil -import ssl from LiveStatus import LiveStatus - +from AlertSchedulerHandler import AlertSchedulerHandler logger = logging.getLogger() @@ -65,7 +66,7 @@ class Controller(threading.Thread): self.safeMode = True self.credential = None self.config = config -self.hostname = hostname.hostname() +self.hostname = hostname.hostname(config) self.serverHostname = config.get('server', 'hostname') server_secured_url = 'https://' + self.serverHostname + \ ':' + config.get('server', 'secured_url_port') @@ -85,75 +86,100 @@ class Controller(threading.Thread): # List of callbacks that are called at agent registration self.registration_listeners = [] +# pull config directory out of config +cache_dir = config.get('agent', 'cache_dir') +if cache_dir is None: + cache_dir = '/var/lib/ambari-agent/cache' + +stacks_cache_dir = os.path.join(cache_dir, FileCache.STACKS_CACHE_DIRECTORY) +alerts_cache_dir = os.path.join(cache_dir, 'alerts') +self.alert_scheduler_handler = AlertSchedulerHandler(alerts_cache_dir, stacks_cache_dir) + def __del__(self): logger.info("Server connection disconnected.") pass - + def registerWithServer(self): +""" +:return: returning from current method without setting self.isRegistered +to True will lead to agent termination. +""" LiveStatus.SERVICES = [] LiveStatus.CLIENT_COMPONENTS = [] LiveStatus.COMPONENTS = [] -id = -1 ret = {} while not self.isRegistered: - try: -data = json.dumps(self.register.build(id)) + try: +data = json.dumps(self.register.build()) prettyData = pprint.pformat(data) - + try: server_ip = socket.gethostbyname(self.hostname) logger.info("Registering with %s (%s) (agent=%s)", self.hostname, server_ip, prettyData) -except socket.error: - logger.warn("Unable to determine the IP address of '%s', agent registration may fail (agent=%s)", +except socket.error: + logger.warn("Unable to determine the IP address of '%s', agent registration may fail (agent=%s)", self.hostname, prettyData) - + ret = self.sendRequest(self.registerUrl, data) - + # exitstatus is a code of error which was rised on server side. # exitstatus = 0 (OK - Default) # exitstatus = 1 (Registration failed because different version of agent and server) exitstatus = 0 if 'exitstatus' in ret.keys(): exitstatus = int(ret['exitstatus']) - + if exitstatus == 1: - # log - message, which will be printed to agents log + # log - message, which will be printed to agents log if 'log' in ret.keys(): -log = ret['log'] - - logger.error(log) +log = ret['log'] +logger.error(log) self.isRegistered = False - self.repeatRegistration=False + self.repeatRegistration = False return ret - + logger.info("Registration Successful (response=%s)", pprint.pformat(ret)) self.responseId = int(ret['responseId']) self.isRegistered = True if 'statusCommands' in ret.keys(): - logger.info("Got status commands on registration " + pprint.pformat(ret['statusCommands']) ) + logger.info("Got status commands on registration " + pprint.pformat(ret['statusCommands'])) self.addToStatusQueue(ret['statusCommands']) pass else: self.hasMappedComponents = False + +if 'alertDefinitionCommands' in ret.keys(): + logger.info("Got alert definition update on registration " + pprint.pformat(ret['alertDefinitionCommands'])) + self.alert_scheduler_handler.update_definitions(ret['alertDefinitionCommands']) + pass + pass except ssl.SSLError: -self.repeatRegistration=False +self.repeatRegistration = False self.isRegistered = False return except Exce
[17/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/resource_management/core/base.py -- diff --git a/ambari-common/src/main/python/resource_management/core/base.py b/ambari-common/src/main/python/resource_management/core/base.py new file mode 100644 index 000..10a8c42 --- /dev/null +++ b/ambari-common/src/main/python/resource_management/core/base.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python +""" +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. + +Ambari Agent + +""" + +__all__ = ["Resource", "ResourceArgument", "ForcedListArgument", + "BooleanArgument"] + +from resource_management.core.exceptions import Fail, InvalidArgument +from resource_management.core.environment import Environment +from resource_management.core.logger import Logger + +class ResourceArgument(object): + def __init__(self, default=None, required=False): +self.required = False # Prevents the initial validate from failing +if hasattr(default, '__call__'): + self.default = default +else: + self.default = self.validate(default) +self.required = required + + def validate(self, value): +if self.required and value is None: + raise InvalidArgument("Required argument %s missing" % self.name) +return value + + +class ForcedListArgument(ResourceArgument): + def validate(self, value): +value = super(ForcedListArgument, self).validate(value) +if not isinstance(value, (tuple, list)): + value = [value] +return value + + +class BooleanArgument(ResourceArgument): + def validate(self, value): +value = super(BooleanArgument, self).validate(value) +if not value in (True, False): + raise InvalidArgument( +"Expected a boolean for %s received %r" % (self.name, value)) +return value + + +class Accessor(object): + def __init__(self, name): +self.name = name + + def __get__(self, obj, cls): +try: + return obj.arguments[self.name] +except KeyError: + val = obj._arguments[self.name].default + if hasattr(val, '__call__'): +val = val(obj) + return val + + def __set__(self, obj, value): +obj.arguments[self.name] = obj._arguments[self.name].validate(value) + + +class ResourceMetaclass(type): + # def __new__(cls, name, bases, attrs): + # super_new = super(ResourceMetaclass, cls).__new__ + # return super_new(cls, name, bases, attrs) + + def __init__(mcs, _name, bases, attrs): +mcs._arguments = getattr(bases[0], '_arguments', {}).copy() +for key, value in list(attrs.items()): + if isinstance(value, ResourceArgument): +value.name = key +mcs._arguments[key] = value +setattr(mcs, key, Accessor(key)) + + +class Resource(object): + __metaclass__ = ResourceMetaclass + + action = ForcedListArgument(default="nothing") + ignore_failures = BooleanArgument(default=False) + not_if = ResourceArgument() # pass command e.g. not_if = ('ls','/root/jdk') + only_if = ResourceArgument() # pass command + initial_wait = ResourceArgument() # in seconds + + actions = ["nothing"] + + def __new__(cls, name, env=None, provider=None, **kwargs): +if isinstance(name, list): + while len(name) != 1: +cls(name.pop(0), env, provider, **kwargs) + + name = name[0] + +env = env or Environment.get_instance() +provider = provider or getattr(cls, 'provider', None) + +r_type = cls.__name__ +if r_type not in env.resources: + env.resources[r_type] = {} + +obj = super(Resource, cls).__new__(cls) +env.resources[r_type][name] = obj +env.resource_list.append(obj) +return obj + + def __init__(self, name, env=None, provider=None, **kwargs): +if isinstance(name, list): + name = name.pop(0) + +if hasattr(self, 'name'): + return + +self.env = env or Environment.get_instance() +self.name = name + +self.provider = provider or getattr(self, 'provider', None) + +self.arguments = {} +for key, value in kwargs.items(): + try: +arg = self._arguments[key] + except KeyError: +raise Fail("%s received unsupported argument %s" % (self, key)) + else: +try: + self.arguments[key] = ar
[15/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/resource_management/libraries/providers/repository.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/repository.py b/ambari-common/src/main/python/resource_management/libraries/providers/repository.py new file mode 100644 index 000..258df1f --- /dev/null +++ b/ambari-common/src/main/python/resource_management/libraries/providers/repository.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +""" +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. + +Ambari Agent + +""" + +import os +import filecmp +import tempfile +from ambari_commons import OSCheck +from resource_management import * + +class RhelSuseRepositoryProvider(Provider): + def action_create(self): +with Environment.get_instance_copy() as env: + repo_file_name = self.resource.repo_file_name + repo_dir = repos_dirs[env.system.os_family] + repo_template = self.resource.repo_template + File(format("{repo_dir}/{repo_file_name}.repo"), +content = Template(repo_template, repo_id=self.resource.repo_id, repo_file_name=self.resource.repo_file_name, base_url=self.resource.base_url, mirror_list=self.resource.mirror_list) + ) + + def action_remove(self): +with Environment.get_instance_copy() as env: + repo_file_name = self.resource.repo_file_name + repo_dir = repos_dirs[env.system.os_family] + + File(format("{repo_dir}/{repo_file_name}.repo"), + action = "delete") + + +repos_dirs = { + 'redhat': '/etc/yum.repos.d', + 'suse': '/etc/zypp/repos.d' +} + + +class UbuntuRepositoryProvider(Provider): + package_type = "deb" + repo_dir = "/etc/apt/sources.list.d" + update_cmd = 'apt-get update -qq -o Dir::Etc::sourcelist="sources.list.d/{repo_file_name}" -o APT::Get::List-Cleanup="0"' + missing_pkey_regex = "The following signatures couldn't be verified because the public key is not available: NO_PUBKEY (.+)" + add_pkey_cmd = "apt-key adv --recv-keys --keyserver keyserver.ubuntu.com {pkey}" + + def action_create(self): +with Environment.get_instance_copy() as env: + with tempfile.NamedTemporaryFile() as tmpf: +File(tmpf.name, + content = Template(self.resource.repo_template, + package_type=self.package_type, base_url=self.resource.base_url, components=' '.join(self.resource.components)) +) + +repo_file_name = format("{repo_file_name}.list",repo_file_name = self.resource.repo_file_name) +repo_file_path = format("{repo_dir}/{repo_file_name}", repo_dir = self.repo_dir) + +if not os.path.isfile(repo_file_path) or not filecmp.cmp(tmpf.name, repo_file_path): + File(repo_file_path, + content = StaticFile(tmpf.name) + ) + + # this is time expensive + retcode, out = checked_call(format(self.update_cmd)) + + # add public keys for new repos + missing_pkeys = set(re.findall(self.missing_pkey_regex, out)) + for pkey in missing_pkeys: +Execute(format(self.add_pkey_cmd), +timeout = 15, # in case we are on the host w/o internet (using localrepo), we should ignore hanging +ignore_failures = True +) + + def action_remove(self): +with Environment.get_instance_copy() as env: + repo_file_name = format("{repo_file_name}.list",repo_file_name = self.resource.repo_file_name) + repo_file_path = format("{repo_dir}/{repo_file_name}", repo_dir = self.repo_dir) + + if os.path.isfile(repo_file_path): +File(repo_file_path, + action = "delete") + +# this is time expensive +Execute(format(self.update_cmd)) http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/resource_management/libraries/providers/template_config.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/template_config.py b/ambari-common/src/main/python/resource_management/libraries/providers/template_config.py new file mode 100644 index 000..4972
[38/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py new file mode 100644 index 000..83d1528 --- /dev/null +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" +ambari_jinja2._stringdefs +~~ + +Strings of all Unicode characters of a certain category. +Used for matching in Unicode-aware languages. Run to regenerate. + +Inspired by chartypes_create.py from the MoinMoin project, original +implementation from Pygments. + +:copyright: Copyright 2006-2009 by the Jinja team, see AUTHORS. +:license: BSD, see LICENSE for details. +""" + +Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f' + +Cf = u'\xad\u0600\u0601\u0602\u0603\u06dd\u070f\u17b4\u17b5\u200b\u200c\u200d\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2060\u2061\u2062\u2063\u206a\u206b\u206c\u206d\u206e\u206f\ufeff\ufff9\ufffa\ufffb' + +Cn = u'\u0242\u0243\u0244\u0245\u0246\u0247\u0248\u0249\u024a\u024b\u024c\u024d\u024e\u024f\u0370\u0371\u0372\u0373\u0376\u0377\u0378\u0379\u037b\u037c\u037d\u037f\u0380\u0381\u0382\u0383\u038b\u038d\u03a2\u03cf\u0487\u04cf\u04fa\u04fb\u04fc\u04fd\u04fe\u04ff\u0510\u0511\u0512\u0513\u0514\u0515\u0516\u0517\u0518\u0519\u051a\u051b\u051c\u051d\u051e\u051f\u0520\u0521\u0522\u0523\u0524\u0525\u0526\u0527\u0528\u0529\u052a\u052b\u052c\u052d\u052e\u052f\u0530\u0557\u0558\u0560\u0588\u058b\u058c\u058d\u058e\u058f\u0590\u05ba\u05c8\u05c9\u05ca\u05cb\u05cc\u05cd\u05ce\u05cf\u05eb\u05ec\u05ed\u05ee\u05ef\u05f5\u05f6\u05f7\u05f8\u05f9\u05fa\u05fb\u05fc\u05fd\u05fe\u05ff\u0604\u0605\u0606\u0607\u0608\u0609\u060a\u0616\u0617\u0618\u0619\u061a\u061c\u061d\u0620\u063b\u063c\u063d\u063e\u063f\u065f\u070e\u074b\u074c\u076e\u076f\u0770\u0771\u0772\u0773\u0774\u0775\u0776\u0777\u0778\u0779\u077a\u077b\u077c\u077d\u077e\u077f\u07b2\u07b3\u07b4\u07b5\u07b6\u07b7\u07b8\u07b9\u07ba\u07bb\u07bc\u07bd\u07be \u07bf\u07c0\u07c1\u07c2\u07c3\u07c4\u07c5\u07c6\u07c7\u07c8\u07c9\u07ca\u07cb\u07cc\u07cd\u07ce\u07cf\u07d0\u07d1\u07d2\u07d3\u07d4\u07d5\u07d6\u07d7\u07d8\u07d9\u07da\u07db\u07dc\u07dd\u07de\u07df\u07e0\u07e1\u07e2\u07e3\u07e4\u07e5\u07e6\u07e7\u07e8\u07e9\u07ea\u07eb\u07ec\u07ed\u07ee\u07ef\u07f0\u07f1\u07f2\u07f3\u07f4\u07f5\u07f6\u07f7\u07f8\u07f9\u07fa\u07fb\u07fc\u07fd\u07fe\u07ff\u0800\u0801\u0802\u0803\u0804\u0805\u0806\u0807\u0808\u0809\u080a\u080b\u080c\u080d\u080e\u080f\u0810\u0811\u0812\u0813\u0814\u0815\u0816\u0817\u0818\u0819\u081a\u081b\u081c\u081d\u081e\u081f\u0820\u0821\u0822\u0823\u0824\u0825\u0826\u0827\u0828\u0829\u082a\u082b\u082c\u082d\u082e\u082f\u0830\u0831\u0832\u0833\u0834\u0835\u0836\u0837\u0838\u0839\u083a\u083b\u083c\u083d\u083e\u083f\u0840\u0841\u0842\u0843\u0844\u0845\u0846\u0847\u0848\u0849\u084a\u084b\u084c\u084d\u084e\u084f\u0850\u0851\u0852\u0853\u0854\u0855\u0856\u0857\u0858\u0859\u085a\u085b\u085c\u085d\u085e\u085f\u0860\u0861\u0862\u0863\u0864\ u0865\u0866\u0867\u0868\u0869\u086a\u086b\u086c\u086d\u086e\u086f\u0870\u0871\u0872\u0873\u0874\u0875\u0876\u0877\u0878\u0879\u087a\u087b\u087c\u087d\u087e\u087f\u0880\u0881\u0882\u0883\u0884\u0885\u0886\u0887\u0888\u0889\u088a\u088b\u088c\u088d\u088e\u088f\u0890\u0891\u0892\u0893\u0894\u0895\u0896\u0897\u0898\u0899\u089a\u089b\u089c\u089d\u089e\u089f\u08a0\u08a1\u08a2\u08a3\u08a4\u08a5\u08a6\u08a7\u08a8\u08a9\u08aa\u08ab\u08ac\u08ad\u08ae\u08af\u08b0\u08b1\u08b2\u08b3\u08b4\u08b5\u08b6\u08b7\u08b8\u08b9\u08ba\u08bb\u08bc\u08bd\u08be\u08bf\u08c0\u08c1\u08c2\u08c3\u08c4\u08c5\u08c6\u08c7\u08c8\u08c9\u08ca\u08cb\u08cc\u08cd\u08ce\u08cf\u08d0\u08d1\u08d2\u08d3\u08d4\u08d5\u08d6\u08d7\u08d8\u08d9\u08da\u08db\u08dc\u08dd\u08de\u08df\u08e0\u08e1\u08e2\u08e3\u08e4\u08e5\u08e6\u08e7\u08e8\u08e9\u08ea\u08eb\u08ec\u08ed\u08ee\u08ef\u08f0\u08f1\u08f2\u08f3\u08f4\u08f5\u08f6\u08f7\u08f8\u08f9\u08fa\u08fb\u08fc\u08fd\u08fe\u08ff\u0900\u093a\u093b\u094e\u094f\u0955\u0956\u0957\u0971\u0972\u0973\u 0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097e\u097f\u0980\u0984\u098d\u098e\u0991\u0992\u09a9\u09b1\u09b3\u09b4\u09b5\u09ba\u09bb\u09c5\u09c6\u09c9\u09ca\u09cf\u09d0\u09d1\u09d2\u09d3\u09d4\u09d5\u09d6\u09d8\u09d9\u09da\u09db\u09de\u09e4\u09e5\u09fb\u09fc\u09fd\u09fe\u09ff\u0a00\u0a04\u0a0b\u0a0c\u0a0d\u0a0e\u0a11\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a\u0a3b\u0a3d\u0a43\u0a44\u0a45\u0a46\u0a49\u0a4a\u0a4e\u0a4f\u0a50\u0a51\u0a52\u0a53\u0a54\u0a55\u0a56\u0a57\u0a58\u0a5d\u0a5f\u0a60\u0a61\u0a62\u0a63\u0a64\u0a65\u0a75\u0a76\u0a77\u0
[23/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/bccache.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/bccache.py b/ambari-common/src/main/python/jinja2/jinja2/bccache.py deleted file mode 100644 index 1e2236c..000 --- a/ambari-common/src/main/python/jinja2/jinja2/bccache.py +++ /dev/null @@ -1,280 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.bccache -~~ - -This module implements the bytecode cache system Jinja is optionally -using. This is useful if you have very complex template situations and -the compiliation of all those templates slow down your application too -much. - -Situations where this is useful are often forking web applications that -are initialized on the first request. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD. -""" -from os import path, listdir -import marshal -import tempfile -import cPickle as pickle -import fnmatch -from cStringIO import StringIO -try: -from hashlib import sha1 -except ImportError: -from sha import new as sha1 -from jinja2.utils import open_if_exists - - -bc_version = 1 -bc_magic = 'j2'.encode('ascii') + pickle.dumps(bc_version, 2) - - -class Bucket(object): -"""Buckets are used to store the bytecode for one template. It's created -and initialized by the bytecode cache and passed to the loading functions. - -The buckets get an internal checksum from the cache assigned and use this -to automatically reject outdated cache material. Individual bytecode -cache subclasses don't have to care about cache invalidation. -""" - -def __init__(self, environment, key, checksum): -self.environment = environment -self.key = key -self.checksum = checksum -self.reset() - -def reset(self): -"""Resets the bucket (unloads the bytecode).""" -self.code = None - -def load_bytecode(self, f): -"""Loads bytecode from a file or file like object.""" -# make sure the magic header is correct -magic = f.read(len(bc_magic)) -if magic != bc_magic: -self.reset() -return -# the source code of the file changed, we need to reload -checksum = pickle.load(f) -if self.checksum != checksum: -self.reset() -return -# now load the code. Because marshal is not able to load -# from arbitrary streams we have to work around that -if isinstance(f, file): -self.code = marshal.load(f) -else: -self.code = marshal.loads(f.read()) - -def write_bytecode(self, f): -"""Dump the bytecode into the file or file like object passed.""" -if self.code is None: -raise TypeError('can\'t write empty bucket') -f.write(bc_magic) -pickle.dump(self.checksum, f, 2) -if isinstance(f, file): -marshal.dump(self.code, f) -else: -f.write(marshal.dumps(self.code)) - -def bytecode_from_string(self, string): -"""Load bytecode from a string.""" -self.load_bytecode(StringIO(string)) - -def bytecode_to_string(self): -"""Return the bytecode as string.""" -out = StringIO() -self.write_bytecode(out) -return out.getvalue() - - -class BytecodeCache(object): -"""To implement your own bytecode cache you have to subclass this class -and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of -these methods are passed a :class:`~jinja2.bccache.Bucket`. - -A very basic bytecode cache that saves the bytecode on the file system:: - -from os import path - -class MyCache(BytecodeCache): - -def __init__(self, directory): -self.directory = directory - -def load_bytecode(self, bucket): -filename = path.join(self.directory, bucket.key) -if path.exists(filename): -with open(filename, 'rb') as f: -bucket.load_bytecode(f) - -def dump_bytecode(self, bucket): -filename = path.join(self.directory, bucket.key) -with open(filename, 'wb') as f: -bucket.write_bytecode(f) - -A more advanced version of a filesystem based bytecode cache is part of -Jinja2. -""" - -def load_bytecode(self, bucket): -"""Subclasses have to override this method to load bytecode into a -bucket. If they are not able to find code in the cache for the -bucket, it must not do anything. -""" -raise NotImplementedError() - -def dump_bytecode(self, bucket): -"""Subclasses have to override this method to write the bytecode -from a bucket back to the cache. If it unable to do so it must not -fail silently bu
[04/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java new file mode 100644 index 000..f6b6082 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java @@ -0,0 +1,191 @@ +/** + * 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.ambari.server.controller.internal; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.controller.AmbariManagementController; +import org.apache.ambari.server.controller.spi.NoSuchParentResourceException; +import org.apache.ambari.server.controller.spi.NoSuchResourceException; +import org.apache.ambari.server.controller.spi.Predicate; +import org.apache.ambari.server.controller.spi.Request; +import org.apache.ambari.server.controller.spi.Resource; +import org.apache.ambari.server.controller.spi.SystemException; +import org.apache.ambari.server.controller.spi.UnsupportedPropertyException; +import org.apache.ambari.server.orm.dao.AlertsDAO; +import org.apache.ambari.server.orm.entities.AlertCurrentEntity; +import org.apache.ambari.server.orm.entities.AlertDefinitionEntity; +import org.apache.ambari.server.orm.entities.AlertHistoryEntity; +import org.apache.ambari.server.state.Cluster; + +import com.google.inject.Inject; +import com.google.inject.Injector; + +/** + * ResourceProvider for Alert instances + */ +public class AlertResourceProvider extends ReadOnlyResourceProvider { + + protected static final String ALERT_CLUSTER_NAME = "Alert/cluster_name"; + protected static final String ALERT_ID = "Alert/id"; + protected static final String ALERT_NAME = "Alert/name"; + protected static final String ALERT_LATEST_TIMESTAMP = "Alert/latest_timestamp"; + protected static final String ALERT_MAINTENANCE_STATE = "Alert/maintenance_state"; + protected static final String ALERT_ORIGINAL_TIMESTAMP = "Alert/original_timestamp"; + protected static final String ALERT_INSTANCE = "Alert/instance"; + protected static final String ALERT_LABEL = "Alert/label"; + protected static final String ALERT_STATE = "Alert/state"; + protected static final String ALERT_TEXT = "Alert/text"; + protected static final String ALERT_COMPONENT = "Alert/component_name"; + protected static final String ALERT_HOST = "Alert/host_name"; + protected static final String ALERT_SERVICE = "Alert/service_name"; + protected static final String ALERT_SCOPE = "Alert/scope"; + + private static Set pkPropertyIds = new HashSet( + Arrays.asList(ALERT_ID, ALERT_NAME)); + + private static AlertsDAO alertsDAO = null; + + /** + * @param injector the injector + */ + @Inject + public static void init(Injector injector) { +alertsDAO = injector.getInstance(AlertsDAO.class); + } + + AlertResourceProvider(Set propertyIds, + Map keyPropertyIds, + AmbariManagementController managementController) { + +super(propertyIds, keyPropertyIds, managementController); + } + + @Override + protected Set getPKPropertyIds() { +return pkPropertyIds; + } + + + @Override + public Set getResources(Request request, Predicate predicate) + throws SystemException, UnsupportedPropertyException, + NoSuchResourceException, NoSuchParentResourceException { + +Set requestPropertyIds = getRequestPropertyIds(request, predicate); + +Set results = new HashSet(); + +for (Map propertyMap : getPropertyMaps(predicate)) { + + String clusterName = (String) propertyMap.get(ALERT_CLUSTER_NAME); + + if (null == clusterName || clusterName.isEmpty()) { +throw new IllegalArgumentException("Invalid argument, cluster name is required"); + } + + String id = (String) propertyMap.get
[11/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.java new file mode 100644 index 000..b3375c0 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertService.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.ambari.server.api.services; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.ambari.server.api.resources.ResourceInstance; +import org.apache.ambari.server.controller.spi.Resource; + +/** + * Endpoint for alert data. + */ +public class AlertService extends BaseService { + + private String clusterName = null; + private String serviceName = null; + private String hostName = null; + + AlertService(String clusterName, String serviceName, String hostName) { +this.clusterName = clusterName; +this.serviceName = serviceName; +this.hostName = hostName; + } + + /** + * Gets all the definitions for the target + */ + @GET + @Produces("text/plain") + public Response getAlerts(String body, + @Context HttpHeaders headers, + @Context UriInfo ui) { +return handleRequest(headers, body, ui, Request.Type.GET, + createResourceInstance(null)); + } + + + /** + * Gets a specific alert's instance + */ + @GET + @Path("{alertId}") + @Produces("text/plain") + public Response getAlert(String body, + @Context HttpHeaders headers, + @Context UriInfo ui, + @PathParam("alertId") Long id) { +return handleRequest(headers, body, ui, Request.Type.GET, + createResourceInstance(id)); + } + + + /** + * Create an alert resource instance + * @param alertId the alert id, if requesting a specific one + * @return the resource instance + */ + private ResourceInstance createResourceInstance(Long alertId) { +Map mapIds = new HashMap(); +mapIds.put(Resource.Type.Cluster, clusterName); +mapIds.put(Resource.Type.Service, serviceName); +mapIds.put(Resource.Type.Host, hostName); +mapIds.put(Resource.Type.Alert, null == alertId ? null : alertId.toString()); + +return createResource(Resource.Type.Alert, mapIds); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertTargetService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertTargetService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertTargetService.java new file mode 100644 index 000..2a2ecdf --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AlertTargetService.java @@ -0,0 +1,106 @@ +/** + * 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.ambari.server.api.services; + +import java.util.HashMap; +imp
[10/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java new file mode 100644 index 000..ca5646e --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RecommendationService.java @@ -0,0 +1,71 @@ +/** + * 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.ambari.server.api.services; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +import org.apache.ambari.server.api.resources.ResourceInstance; +import org.apache.ambari.server.controller.spi.Resource; + +/** + * Service responsible for preparing recommendations for host-layout and + * configurations. + */ +@Path("/stacks/{stackName}/versions/{stackVersion}/recommendations") +public class RecommendationService extends BaseService { + + /** + * Returns host-layout recommendations for list of hosts and services. + * + * @param body http body + * @param headers http headers + * @param ui uri info + * @param stackName stack name + * @param stackVersion stack version + * @return recommendations for host-layout + */ + @POST + @Produces(MediaType.TEXT_PLAIN) + public Response getRecommendation(String body, @Context HttpHeaders headers, @Context UriInfo ui, + @PathParam("stackName") String stackName, @PathParam("stackVersion") String stackVersion) { + +return handleRequest(headers, body, ui, Request.Type.POST, +createRecommendationResource(stackName, stackVersion)); + } + + ResourceInstance createRecommendationResource(String stackName, String stackVersion) { +Map mapIds = new HashMap(); +mapIds.put(Resource.Type.Stack, stackName); +mapIds.put(Resource.Type.StackVersion, stackVersion); + +return createResource(Resource.Type.Recommendation, mapIds); + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java index 9483254..fc1b515 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestService.java @@ -24,6 +24,7 @@ import org.apache.ambari.server.controller.spi.Resource; import javax.ws.rs.GET; import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -104,6 +105,23 @@ public class RequestService extends BaseService { } /** + * Handles: PUT /clusters/{clusterId}/requests/{requestId} or /requests/{requestId} + * Change state of existing requests. Usually used to cancel running requests + * + * @param bodyhttp body + * @param headers http headers + * @param ui uri info + * @return information regarding the created services + */ + @PUT + @Path("{requestId}") + @Produces("text/plain") + public Response updateRequests(String body, @Context HttpHeaders headers, @Context UriInfo ui, + @PathParam("requestId") String requestId) { +return handleRequest(headers, body, ui, Request.Type.PUT, createRequestResource(m_clusterName, requestId)); + } + + /** * Handles: POST /clusters/{clusterId}/requests or /requests * Create multiple services. * http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/
[08/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/AlertNoticeRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AlertNoticeRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AlertNoticeRequest.java new file mode 100644 index 000..40c7c67 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AlertNoticeRequest.java @@ -0,0 +1,34 @@ +/** + * 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.ambari.server.controller; + +import org.apache.ambari.server.controller.spi.Predicate; +import org.apache.ambari.server.orm.entities.AlertNoticeEntity; + +/** + * The {@link AlertNoticeRequest} encapsulates the data necessary to make a + * backend request for {@link AlertNoticeEntity}. + */ +public class AlertNoticeRequest { + + /** + * An Ambari predicate. + */ + public Predicate Predicate; + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java index 8ef40f6..4808a77 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java @@ -20,7 +20,6 @@ package org.apache.ambari.server.controller; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMMAND_TIMEOUT; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.COMPONENT_CATEGORY; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.JDK_LOCATION; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE; @@ -206,12 +205,10 @@ public class AmbariActionExecutionHelper { * Add tasks to the stage based on the requested action execution * @param actionContext the context associated with the action * @param stage stage into which tasks must be inserted - * @param hostLevelParams host level params to send with the command * @throws AmbariException */ public void addExecutionCommandsToStage( - final ActionExecutionContext actionContext, - Stage stage, Map hostLevelParams) + final ActionExecutionContext actionContext, Stage stage) throws AmbariException { String actionName = actionContext.getActionName(); @@ -272,11 +269,13 @@ public class AmbariActionExecutionHelper { } } ); - LOG.debug("Ignoring action for hosts due to maintenance state." + + if (! ignoredHosts.isEmpty()) { +LOG.debug("Ignoring action for hosts due to maintenance state." + "Ignored hosts =" + ignoredHosts + ", component=" + componentName + ", service=" + serviceName + ", cluster=" + cluster.getClusterName() + ", " + "actionName=" + actionContext.getActionName()); + } } // If request did not specify hosts and there exists no host @@ -331,14 +330,14 @@ public class AmbariActionExecutionHelper { serviceName); Map> configurations = new TreeMap>(); + Map>> configurationAttributes = new TreeMap>>(); Map> configTags = null; if (!serviceName.isEmpty() && null != cluster) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostName); } - Map commandParams = actionContext.getParameters(); + Map commandParams = new TreeMap(); commandParams.put(COMMAND_TIMEOUT, actionContext.getTimeout().toString()); - commandParams.put(JDK_LOCATION, managementController.getJdkResourceUrl()); commandParams.put(
[19/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/jinja2/sandbox.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/sandbox.py b/ambari-common/src/main/python/jinja2/jinja2/sandbox.py deleted file mode 100644 index 7497195..000 --- a/ambari-common/src/main/python/jinja2/jinja2/sandbox.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- -""" -jinja2.sandbox -~~ - -Adds a sandbox layer to Jinja as it was the default behavior in the old -Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the -default behavior is easier to use. - -The behavior can be changed by subclassing the environment. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD. -""" -import operator -from jinja2.runtime import Undefined -from jinja2.environment import Environment -from jinja2.exceptions import SecurityError -from jinja2.utils import FunctionType, MethodType, TracebackType, CodeType, \ - FrameType, GeneratorType - - -#: maximum number of items a range may produce -MAX_RANGE = 10 - -#: attributes of function objects that are considered unsafe. -UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict', - 'func_defaults', 'func_globals']) - -#: unsafe method attributes. function attributes are unsafe for methods too -UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self']) - - -import warnings - -# make sure we don't warn in python 2.6 about stuff we don't care about -warnings.filterwarnings('ignore', 'the sets module', DeprecationWarning, -module='jinja2.sandbox') - -from collections import deque - -_mutable_set_types = (set,) -_mutable_mapping_types = (dict,) -_mutable_sequence_types = (list,) - - -# on python 2.x we can register the user collection types -try: -from UserDict import UserDict, DictMixin -from UserList import UserList -_mutable_mapping_types += (UserDict, DictMixin) -_mutable_set_types += (UserList,) -except ImportError: -pass - -# if sets is still available, register the mutable set from there as well -try: -from sets import Set -_mutable_set_types += (Set,) -except ImportError: -pass - -#: register Python 2.6 abstract base classes -try: -from collections import MutableSet, MutableMapping, MutableSequence -_mutable_set_types += (MutableSet,) -_mutable_mapping_types += (MutableMapping,) -_mutable_sequence_types += (MutableSequence,) -except ImportError: -pass - -_mutable_spec = ( -(_mutable_set_types, frozenset([ -'add', 'clear', 'difference_update', 'discard', 'pop', 'remove', -'symmetric_difference_update', 'update' -])), -(_mutable_mapping_types, frozenset([ -'clear', 'pop', 'popitem', 'setdefault', 'update' -])), -(_mutable_sequence_types, frozenset([ -'append', 'reverse', 'insert', 'sort', 'extend', 'remove' -])), -(deque, frozenset([ -'append', 'appendleft', 'clear', 'extend', 'extendleft', 'pop', -'popleft', 'remove', 'rotate' -])) -) - - -def safe_range(*args): -"""A range that can't generate ranges with a length of more than -MAX_RANGE items. -""" -rng = xrange(*args) -if len(rng) > MAX_RANGE: -raise OverflowError('range too big, maximum size for range is %d' % -MAX_RANGE) -return rng - - -def unsafe(f): -""" -Mark a function or method as unsafe:: - -@unsafe -def delete(self): -pass -""" -f.unsafe_callable = True -return f - - -def is_internal_attribute(obj, attr): -"""Test if the attribute given is an internal python attribute. For -example this function returns `True` for the `func_code` attribute of -python objects. This is useful if the environment method -:meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. - ->>> from jinja2.sandbox import is_internal_attribute ->>> is_internal_attribute(lambda: None, "func_code") -True ->>> is_internal_attribute((lambda x:x).func_code, 'co_code') -True ->>> is_internal_attribute(str, "upper") -False -""" -if isinstance(obj, FunctionType): -if attr in UNSAFE_FUNCTION_ATTRIBUTES: -return True -elif isinstance(obj, MethodType): -if attr in UNSAFE_FUNCTION_ATTRIBUTES or \ - attr in UNSAFE_METHOD_ATTRIBUTES: -return True -elif isinstance(obj, type): -if attr == 'mro': -return True -elif isinstance(obj, (CodeType, TracebackType, FrameType)): -return True -elif isinstance(obj, GeneratorType): -if attr == 'gi_frame': -return True -return attr.startswith('__') - - -def modifies_known_mutable(obj, attr): -"""This function checks if an attribute on a builtin mutabl
[14/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/pom.xml -- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 2228eb9..7397fc3 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -25,6 +25,8 @@ UTF-8 python >= 2.6 + +${python.ver} python (>= 2.6) amd64 openssl, postgresql (>= 8.1), ${deb.python.ver}, curl @@ -32,8 +34,11 @@ http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.1.1.0 http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json /usr/lib/ambari-server/lib/ambari_commons + /usr/lib/ambari-server/lib/resource_management + /usr/lib/ambari-server/lib/ambari_jinja2 ${basedir}/../ambari-web/public ${basedir}/../ambari-admin +${basedir}/../contrib/views @@ -161,6 +166,10 @@ src/main/resources/stacks/HDP/2.1.GlusterFS/services/YARN/package/templates/exclude_hosts_list.j2 src/main/windows/ambari-server.cmd src/main/windows/ambari-server.ps1 + src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log + src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log + src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer.log + src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/balancer-emulator/balancer-err.log conf/unix/ca.config conf/unix/krb5JAASLogin.conf conf/windows/ca.config @@ -172,6 +181,7 @@ **/repo_suse_rhel.j2 **/repo_debian.j2 **/cluster.properties.j2 +**/repo_ubuntu.j2 **/.pydev* @@ -219,7 +229,7 @@ org.eclipse.persistence eclipselink -2.4.0 +2.4.2 @@ -240,10 +250,12 @@ 2012, Apache Software Foundation Development Maven Recipe: RPM Package. + no postgresql-server >= 8.1 openssl ${python.ver} +${python.xml.package} src/main/package/rpm/postinstall.sh @@ -257,6 +269,10 @@ src/main/package/rpm/preremove.sh utf-8 + +src/main/package/rpm/posttrans_server.sh +utf-8 + 644 755 root @@ -296,6 +312,29 @@ + + ${resource_management.install.dir} + + + + ${project.basedir}/../ambari-common/src/main/python/resource_management + + + + + + ${jinja.install.dir} + root + root + + + ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2 + + ${project.basedir}/../ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite + + + + /usr/sbin 755 @@ -384,6 +423,9 @@ /var/run/ambari-server/bootstrap + /var/run/ambari-server/stack-recommendations + + /var/log/ambari-server @@ -431,6 +473,17 @@ + /var/lib/ambari-server/resources/apps + 755 + root + root + + + src/main/resources/slider_resources/README.txt + + + + /var/lib/ambari-server/resources/scripts 755 @@ -447,7 +500,10 @@ 755 - ${ambari-admin-dir}/target/ambari-admin-${project.version}.jar + ${ambari-admin-dir}/target + +*.jar + @@ -471,10 +527,21 @@ - /var/lib/ambari-server/resources/stacks/HDP + /var/lib/ambari-server/resources/stacks/${stack.distribution} - target/classes/stacks/HDP + target/classes/stacks/${stack.distribution} + + + + + /var/lib/ambari-server/resources/stacks + 755 + root + root +
[44/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-agent/src/main/python/ambari_agent/security.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/security.py b/ambari-agent/src/main/python/ambari_agent/security.py index dd9e8e1..46eddca 100644 --- a/ambari-agent/src/main/python/ambari_agent/security.py +++ b/ambari-agent/src/main/python/ambari_agent/security.py @@ -31,7 +31,7 @@ import platform logger = logging.getLogger() -GEN_AGENT_KEY='openssl req -new -newkey rsa:1024 -nodes -keyout "%(keysdir)s'+os.sep+'%(hostname)s.key" '\ +GEN_AGENT_KEY = 'openssl req -new -newkey rsa:1024 -nodes -keyout "%(keysdir)s'+os.sep+'%(hostname)s.key" '\ '-subj /OU=%(hostname)s/ -out "%(keysdir)s'+os.sep+'%(hostname)s.csr"' @@ -39,30 +39,34 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection): """ Connecting using ssl wrapped sockets """ def __init__(self, host, port=None, config=None): httplib.HTTPSConnection.__init__(self, host, port=port) -self.config=config -self.two_way_ssl_required=False +self.two_way_ssl_required = False +self.config = config def connect(self): +self.two_way_ssl_required = self.config.isTwoWaySSLConnection() +logger.debug("Server two-way SSL authentication required: %s" % str(self.two_way_ssl_required)) +if self.two_way_ssl_required is True: + logger.info('Server require two-way SSL authentication. Use it instead of one-way...') if not self.two_way_ssl_required: try: -sock=self.create_connection() +sock = self.create_connection() self.sock = ssl.wrap_socket(sock, cert_reqs=ssl.CERT_NONE) logger.info('SSL connection established. Two-way SSL authentication is ' 'turned off on the server.') except (ssl.SSLError, AttributeError): -self.two_way_ssl_required=True +self.two_way_ssl_required = True logger.info('Insecure connection to https://' + self.host + ':' + self.port + '/ failed. Reconnecting using two-way SSL authentication..') if self.two_way_ssl_required: - self.certMan=CertificateManager(self.config) + self.certMan = CertificateManager(self.config) self.certMan.initSecurity() agent_key = self.certMan.getAgentKeyName() agent_crt = self.certMan.getAgentCrtName() server_crt = self.certMan.getSrvrCrtName() - sock=self.create_connection() + sock = self.create_connection() try: self.sock = ssl.wrap_socket(sock, @@ -88,41 +92,40 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection): self.sock.close() logger.info("SSL Connect being called.. connecting to the server") sock = socket.create_connection((self.host, self.port), 60) -sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) +sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) if self._tunnel_host: self.sock = sock self._tunnel() return sock + class CachedHTTPSConnection: """ Caches a ssl socket and uses a single https connection to the server. """ - + def __init__(self, config): -self.connected = False; +self.connected = False self.config = config self.server = config.get('server', 'hostname') self.port = config.get('server', 'secured_url_port') self.connect() - + def connect(self): -if not self.connected: +if not self.connected: self.httpsconn = VerifiedHTTPSConnection(self.server, self.port, self.config) self.httpsconn.connect() self.connected = True # possible exceptions are caught and processed in Controller - - def forceClear(self): self.httpsconn = VerifiedHTTPSConnection(self.server, self.port, self.config) self.connect() - - def request(self, req): + + def request(self, req): self.connect() try: - self.httpsconn.request(req.get_method(), req.get_full_url(), - req.get_data(), req.headers) + self.httpsconn.request(req.get_method(), req.get_full_url(), + req.get_data(), req.headers) response = self.httpsconn.getresponse() readResponse = response.read() except Exception as ex: @@ -133,59 +136,60 @@ class CachedHTTPSConnection: self.connected = False raise IOError("Error occured during connecting to the server: " + str(ex)) return readResponse - + + class CertificateManager(): def __init__(self, config): self.config = config self.keysdir = os.path.abspath(self.config.get('security', 'keysdir')) -self.server_crt=self.config.get('security', 'server_crt') +self.server_crt = self.config.get('security', 'server_crt') self.server_url = 'https://' + self.config.get('server', 'hostname') + ':' \ + self.config.get('server', 'url_port') - + def getAgentKeyName(s
[25/51] [partial] AMBARI-7718. Rebase branch-windows-dev against trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html deleted file mode 100644 index c4c6303..000 --- a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html +++ /dev/null @@ -1,31 +0,0 @@ -<%! - from rwbench import dateformat -%> -<%inherit file="layout.html" /> -<%namespace file="helpers.html" import="input_field, textarea, form" /> -<%def name="page_title()">Index Page -% for article in articles: - <% if not article.published: continue %> - - ${article.title|h} - written by ${article.user.username|h} on ${dateformat(article.pub_date)} - ${article.body} - -% endfor -<%call expr="form()"> - -Name -${input_field('name')} -E-Mail -${input_field('email')} -URL -${input_field('url')} -Comment -${textarea('comment')} -Captcha -${input_field('captcha')} - - ${input_field(type='submit', value='Submit')} - ${input_field(name='cancel', type='submit', value='Cancel')} - http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html deleted file mode 100644 index a9c353e..000 --- a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html +++ /dev/null @@ -1,30 +0,0 @@ -http://www.w3.org/TR/html4/strict.dtd";> - - - ${self.page_title()} | RealWorld Benchmark - - - - - - RealWorld Benchmark - -A less stupid benchmark for Mako and Jinja2 to get an impression how -code changes affect runtime performance. - - - -% for href, caption in page_navigation: - ${caption} -% endfor - - - ${self.body()} - - - © Copyright 2008 by I don't know who. - - - - -<%def name="page_title()"> http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py b/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py deleted file mode 100644 index 813dd56..000 --- a/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- -""" -RealWorldish Benchmark -~~ - -A more real-world benchmark of Jinja2. Like the other benchmark in the -Jinja2 repository this has no real-world usefulnes (despite the name). -Just go away and ignore it. NOW! - -:copyright: (c) 2009 by the Jinja Team. -:license: BSD. -""" -import sys -from os.path import join, dirname, abspath -try: -from cProfile import Profile -except ImportError: -from profile import Profile -from pstats import Stats -ROOT = abspath(dirname(__file__)) - -from random import choice, randrange -from datetime import datetime -from timeit import Timer -from jinja2 import Environment, FileSystemLoader -from jinja2.utils import generate_lorem_ipsum -from mako.lookup import TemplateLookup -from genshi.template import TemplateLoader as GenshiTemplateLoader - - -def dateformat(x): -return x.strftime('%Y-%m-%d') - - -jinja_env = Environment(loader=FileSystemLoader(join(ROOT, 'jinja'))) -jinja_env.filters['dateformat'] = dateformat -mako_lookup = TemplateLookup(directories=[join(ROOT, 'mako')]) -genshi_loader = GenshiTemplateLoader([join(ROOT, 'genshi')]) - -class Article(object): - -def __init__(self, id): -self.id = id -self.href = '/article/%d' % self.id -self.title = generate_lorem_ipsum(1, False, 5, 10) -self.user = choice(users) -self.body = generate_lorem_ipsum() -self.pub_date = datetime.utcfromtimestamp(randrange(10 ** 9, 2 * 10 ** 9)) -self.published = True - - -class User(object): - -def __init__(self, username): -self.href = '/user/%s' % username -self.username = username - - -users = map(User, [u'John Doe', u'Jane Doe', u'Peter Somewhat']) -articles = map(Article, range(20)) -navigation = [ -('index', 'Index'), -('about', 'About'), -('foo?bar=1', 'Foo with Bar'), -('foo?bar=2&s=x', 'Foo with X'), -('blah','Blub Blah'), -('hehe','Haha'), -] * 5 - -context = dict(users=users, articles=articles, page_navigation=navigation) - - -jinja_template = jinja_env.get_template('index.html') -mako_template = mako_lookup.get_template('index.html')
git commit: AMBARI-7766. Admin View: IE10 issues when sorting a new user, and toggling visibility of View (alejandro)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 0c1e34c2c -> b7910ab64 AMBARI-7766. Admin View: IE10 issues when sorting a new user, and toggling visibility of View (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b7910ab6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b7910ab6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b7910ab6 Branch: refs/heads/branch-1.7.0 Commit: b7910ab64de6f96dda9f912a1cdd2806ac333175 Parents: 0c1e34c Author: Alejandro Fernandez Authored: Thu Oct 16 13:04:22 2014 -0700 Committer: Alejandro Fernandez Committed: Thu Oct 16 13:04:22 2014 -0700 -- .../resources/ui/admin-web/app/scripts/app.js | 13 ++ .../ui/admin-web/test/unit/common/app_test.js | 42 .../unit/controllers/CreateViewInstanceCtrl.js | 4 +- .../test/unit/controllers/mainCtrl_test.js | 4 +- 4 files changed, 59 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b7910ab6/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js index e949527..f1a48f6 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js @@ -58,6 +58,19 @@ angular.module('ambariAdminConsole', [ } }]); + $provide.factory('TimestampHttpInterceptor', [function($q) { +return { + request: function(config) { +if (config && config.method === 'GET' && config.url.indexOf('html') === -1) { + config.url += config.url.indexOf('?') < 0 ? '?' : '&'; + config.url += '_=' + new Date().getTime(); + } + return config || $q.when(config); + } + }; + }]); + $httpProvider.interceptors.push('TimestampHttpInterceptor'); + $provide.decorator('ngFormDirective', ['$delegate', function($delegate) { var ngForm = $delegate[0], controller = ngForm.controller; ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) { http://git-wip-us.apache.org/repos/asf/ambari/blob/b7910ab6/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js new file mode 100644 index 000..184acdf --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js @@ -0,0 +1,42 @@ +/** + * 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. + */ + +describe('#App', function () { + + describe('HTTP', function () { +var $httpBackend, $http; + +beforeEach(module('ambariAdminConsole', function($provide){ + +})); +afterEach(function() { + $httpBackend.verifyNoOutstandingExpectation(); + $httpBackend.verifyNoOutstandingRequest(); +}); +beforeEach(inject(function (_$httpBackend_, _$http_, $rootScope) { + $http = _$http_; + $httpBackend = _$httpBackend_; +})); + +it('should add "_" as timestamp to all GET requests', function () { + $httpBackend.expectGET(/\/api\/v1\/testresource\?_=\d+/).respond(200); + $http.get('/api/v1/testresource'); + $httpBackend.flush(); +}); + }); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/b7910ab6/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js index c5a7d67..69ebf66 100644 --- a/ambari-admin/
git commit: AMBARI-7766. Admin View: IE10 issues when sorting a new user, and toggling visibility of View (alejandro)
Repository: ambari Updated Branches: refs/heads/trunk 0a4408162 -> f873b147a AMBARI-7766. Admin View: IE10 issues when sorting a new user, and toggling visibility of View (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f873b147 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f873b147 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f873b147 Branch: refs/heads/trunk Commit: f873b147a431c539e52a74670e0d0cc16ed307e6 Parents: 0a44081 Author: Alejandro Fernandez Authored: Mon Oct 13 14:12:32 2014 -0700 Committer: Alejandro Fernandez Committed: Thu Oct 16 13:01:17 2014 -0700 -- .../resources/ui/admin-web/app/scripts/app.js | 13 ++ .../ui/admin-web/test/unit/common/app_test.js | 42 .../unit/controllers/CreateViewInstanceCtrl.js | 4 +- .../test/unit/controllers/mainCtrl_test.js | 4 +- 4 files changed, 59 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f873b147/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js index e949527..f1a48f6 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js @@ -58,6 +58,19 @@ angular.module('ambariAdminConsole', [ } }]); + $provide.factory('TimestampHttpInterceptor', [function($q) { +return { + request: function(config) { +if (config && config.method === 'GET' && config.url.indexOf('html') === -1) { + config.url += config.url.indexOf('?') < 0 ? '?' : '&'; + config.url += '_=' + new Date().getTime(); + } + return config || $q.when(config); + } + }; + }]); + $httpProvider.interceptors.push('TimestampHttpInterceptor'); + $provide.decorator('ngFormDirective', ['$delegate', function($delegate) { var ngForm = $delegate[0], controller = ngForm.controller; ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) { http://git-wip-us.apache.org/repos/asf/ambari/blob/f873b147/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js new file mode 100644 index 000..184acdf --- /dev/null +++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/common/app_test.js @@ -0,0 +1,42 @@ +/** + * 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. + */ + +describe('#App', function () { + + describe('HTTP', function () { +var $httpBackend, $http; + +beforeEach(module('ambariAdminConsole', function($provide){ + +})); +afterEach(function() { + $httpBackend.verifyNoOutstandingExpectation(); + $httpBackend.verifyNoOutstandingRequest(); +}); +beforeEach(inject(function (_$httpBackend_, _$http_, $rootScope) { + $http = _$http_; + $httpBackend = _$httpBackend_; +})); + +it('should add "_" as timestamp to all GET requests', function () { + $httpBackend.expectGET(/\/api\/v1\/testresource\?_=\d+/).respond(200); + $http.get('/api/v1/testresource'); + $httpBackend.flush(); +}); + }); +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/f873b147/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js -- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js index c5a7d67..69ebf66 100644 --- a/ambari-admin/src/main/resou
git commit: AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin)
Repository: ambari Updated Branches: refs/heads/trunk ad9928969 -> 0a4408162 AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0a440816 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0a440816 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0a440816 Branch: refs/heads/trunk Commit: 0a4408162d7511099aaa8725fa72322eb4b8edb8 Parents: ad99289 Author: Jaimin Jetly Authored: Thu Oct 16 12:15:46 2014 -0700 Committer: Jaimin Jetly Committed: Thu Oct 16 12:17:04 2014 -0700 -- .../stacks/HDP/2.2/services/KNOX/metainfo.xml | 2 +- ambari-web/app/assets/test/tests.js | 1 + ambari-web/app/views/main/service/item.js | 7 ++- ambari-web/test/app_test.js | 18 ++ ambari-web/test/views/main/service/item_test.js | 66 5 files changed, 78 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml index 571b73b..79d40e6 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml @@ -22,7 +22,7 @@ KNOX Knox Provides a single point of authentication and access for Apache Hadoop services in a cluster - 0.5.0 + 0.5.0.2.2.0.0 KNOX_GATEWAY http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/app/assets/test/tests.js -- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 6e54875..1dff1b2 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -165,6 +165,7 @@ var files = ['test/init_model_test', 'test/views/main/host/details/host_component_view_test', 'test/views/main/host/details/host_component_views/decommissionable_test', 'test/views/main/charts/heatmap/heatmap_host_test', + 'test/views/main/service/item_test', 'test/views/main/service/info/config_test', 'test/views/common/configs/services_config_test', 'test/views/wizard/step3/hostLogPopupBody_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/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 171f5ad..e52b2d8 100644 --- a/ambari-web/app/views/main/service/item.js +++ b/ambari-web/app/views/main/service/item.js @@ -40,7 +40,8 @@ App.MainServiceItemView = Em.View.extend({ mastersExcludedCommands: { 'NAMENODE': ['DECOMMISSION', 'REBALANCEHDFS'], 'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'], -'HBASE_MASTER': ['DECOMMISSION'] +'HBASE_MASTER': ['DECOMMISSION'], +'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'] }, actionMap: function() { @@ -65,6 +66,7 @@ App.MainServiceItemView = Em.View.extend({ }, REFRESH_YARN_QUEUE: { action: 'refreshYarnQueues', +customCommand: 'REFRESHQUEUES', label: Em.I18n.t('services.service.actions.run.yarnRefreshQueues.menu'), cssClass: 'icon-refresh', disabled: false @@ -104,18 +106,21 @@ App.MainServiceItemView = Em.View.extend({ }, STARTDEMOLDAP: { action: 'startLdapKnox', +customCommand: 'STARTDEMOLDAP', label: Em.I18n.t('services.service.actions.run.startLdapKnox.context'), cssClass: 'icon-play-sign', disabled: false }, STOPDEMOLDAP: { action: 'stopLdapKnox', +customCommand: 'STOPDEMOLDAP', label: Em.I18n.t('services.service.actions.run.stopLdapKnox.context'), cssClass: 'icon-stop', disabled: false }, REBALANCE_HDFS: { action: 'rebalanceHdfsNodes', +customCommand: 'REBALANCEHDFS', context: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'), label: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes'), cssClass: 'icon-refresh', http://git-wip-us.apache.org/repos/asf/ambari/blob/0a440816/ambari-web/test/app_test.js -- diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js index fb35c86..80b71a5 100644 --- a/ambari-web/te
git commit: AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 77f185b0c -> 0c1e34c2c AMBARI-7805. Knox custom commands are shown twice in the service menu. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0c1e34c2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0c1e34c2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0c1e34c2 Branch: refs/heads/branch-1.7.0 Commit: 0c1e34c2c02fe8c1358dad6ddea3f553744b4c18 Parents: 77f185b Author: Jaimin Jetly Authored: Thu Oct 16 12:15:46 2014 -0700 Committer: Jaimin Jetly Committed: Thu Oct 16 12:16:19 2014 -0700 -- .../stacks/HDP/2.2/services/KNOX/metainfo.xml | 2 +- ambari-web/app/assets/test/tests.js | 1 + ambari-web/app/views/main/service/item.js | 7 ++- ambari-web/test/app_test.js | 18 ++ ambari-web/test/views/main/service/item_test.js | 66 5 files changed, 78 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0c1e34c2/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml index 571b73b..79d40e6 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml @@ -22,7 +22,7 @@ KNOX Knox Provides a single point of authentication and access for Apache Hadoop services in a cluster - 0.5.0 + 0.5.0.2.2.0.0 KNOX_GATEWAY http://git-wip-us.apache.org/repos/asf/ambari/blob/0c1e34c2/ambari-web/app/assets/test/tests.js -- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 8ab531c..b54452a 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -161,6 +161,7 @@ var files = ['test/init_model_test', 'test/views/main/host/details/host_component_view_test', 'test/views/main/host/details/host_component_views/decommissionable_test', 'test/views/main/charts/heatmap/heatmap_host_test', + 'test/views/main/service/item_test', 'test/views/main/service/info/config_test', 'test/views/common/configs/services_config_test', 'test/views/wizard/step3/hostLogPopupBody_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/0c1e34c2/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 171f5ad..e52b2d8 100644 --- a/ambari-web/app/views/main/service/item.js +++ b/ambari-web/app/views/main/service/item.js @@ -40,7 +40,8 @@ App.MainServiceItemView = Em.View.extend({ mastersExcludedCommands: { 'NAMENODE': ['DECOMMISSION', 'REBALANCEHDFS'], 'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'], -'HBASE_MASTER': ['DECOMMISSION'] +'HBASE_MASTER': ['DECOMMISSION'], +'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'] }, actionMap: function() { @@ -65,6 +66,7 @@ App.MainServiceItemView = Em.View.extend({ }, REFRESH_YARN_QUEUE: { action: 'refreshYarnQueues', +customCommand: 'REFRESHQUEUES', label: Em.I18n.t('services.service.actions.run.yarnRefreshQueues.menu'), cssClass: 'icon-refresh', disabled: false @@ -104,18 +106,21 @@ App.MainServiceItemView = Em.View.extend({ }, STARTDEMOLDAP: { action: 'startLdapKnox', +customCommand: 'STARTDEMOLDAP', label: Em.I18n.t('services.service.actions.run.startLdapKnox.context'), cssClass: 'icon-play-sign', disabled: false }, STOPDEMOLDAP: { action: 'stopLdapKnox', +customCommand: 'STOPDEMOLDAP', label: Em.I18n.t('services.service.actions.run.stopLdapKnox.context'), cssClass: 'icon-stop', disabled: false }, REBALANCE_HDFS: { action: 'rebalanceHdfsNodes', +customCommand: 'REBALANCEHDFS', context: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'), label: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes'), cssClass: 'icon-refresh', http://git-wip-us.apache.org/repos/asf/ambari/blob/0c1e34c2/ambari-web/test/app_test.js -- diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js index fb35c86..80b71a5 100644 --- a
[1/2] git commit: AMBARI-7816. hive CLI not starting on HDP-2.2 when hive engine is TEZ (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 a410ca3b8 -> 77f185b0c refs/heads/trunk 799a0d54a -> ad9928969 AMBARI-7816. hive CLI not starting on HDP-2.2 when hive engine is TEZ (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ad992896 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ad992896 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ad992896 Branch: refs/heads/trunk Commit: ad99289698452fe168e203d6423d9850dcc83576 Parents: 799a0d5 Author: Lisnichenko Dmitro Authored: Thu Oct 16 20:53:17 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 20:54:19 2014 +0300 -- .../HDP/2.0.6/services/HIVE/package/scripts/install_jars.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ad992896/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py index 67d97f5..08a0a50 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py @@ -53,7 +53,7 @@ def install_tez_jars(): app_dir_path = None lib_dir_path = None -if len(destination_hdfs_dirs) > 1: +if len(destination_hdfs_dirs) > 0: for path in destination_hdfs_dirs: if 'lib' in path: lib_dir_path = path @@ -99,6 +99,9 @@ def get_tez_hdfs_dir_paths(tez_lib_uris = None): lib_dir_path = path.replace(hdfs_path_prefix, '') lib_dir_path = lib_dir_path if lib_dir_path.endswith(os.sep) else lib_dir_path + os.sep lib_dir_paths.append(lib_dir_path) + else: +lib_dir_path = path.replace(hdfs_path_prefix, '') +lib_dir_paths.append(os.path.dirname(lib_dir_path)) pass pass
[2/2] git commit: AMBARI-7816. hive CLI not starting on HDP-2.2 when hive engine is TEZ (dlysnichenko)
AMBARI-7816. hive CLI not starting on HDP-2.2 when hive engine is TEZ (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/77f185b0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/77f185b0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/77f185b0 Branch: refs/heads/branch-1.7.0 Commit: 77f185b0c981d99a40128dafef18974ebffe8516 Parents: a410ca3 Author: Lisnichenko Dmitro Authored: Thu Oct 16 20:53:17 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 20:54:49 2014 +0300 -- .../HDP/2.0.6/services/HIVE/package/scripts/install_jars.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/77f185b0/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py index 67d97f5..08a0a50 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/install_jars.py @@ -53,7 +53,7 @@ def install_tez_jars(): app_dir_path = None lib_dir_path = None -if len(destination_hdfs_dirs) > 1: +if len(destination_hdfs_dirs) > 0: for path in destination_hdfs_dirs: if 'lib' in path: lib_dir_path = path @@ -99,6 +99,9 @@ def get_tez_hdfs_dir_paths(tez_lib_uris = None): lib_dir_path = path.replace(hdfs_path_prefix, '') lib_dir_path = lib_dir_path if lib_dir_path.endswith(os.sep) else lib_dir_path + os.sep lib_dir_paths.append(lib_dir_path) + else: +lib_dir_path = path.replace(hdfs_path_prefix, '') +lib_dir_paths.append(os.path.dirname(lib_dir_path)) pass pass
git commit: AMBARI-7807. Integrate Kafka with Ambari. (Sriharsha Chintalapani via Jaimin Jetly)
Repository: ambari Updated Branches: refs/heads/trunk 7092d80d3 -> 799a0d54a AMBARI-7807. Integrate Kafka with Ambari. (Sriharsha Chintalapani via Jaimin Jetly) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/799a0d54 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/799a0d54 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/799a0d54 Branch: refs/heads/trunk Commit: 799a0d54ad0dd560c37482c24290cd954d9bfeeb Parents: 7092d80 Author: Jaimin Jetly Authored: Thu Oct 16 10:08:55 2014 -0700 Committer: Jaimin Jetly Committed: Thu Oct 16 10:10:46 2014 -0700 -- .../NAGIOS/package/files/nagios_alerts.php | 1 + .../services/NAGIOS/package/scripts/params.py | 33 +- .../templates/hadoop-servicegroups.cfg.j2 | 7 + .../package/templates/hadoop-services.cfg.j2| 14 + .../stacks/HDP/2.2/role_command_order.json | 2 + .../KAFKA/configuration/kafka-broker.xml| 324 +++ .../services/KAFKA/configuration/kafka-env.xml | 55 .../KAFKA/configuration/kafka-log4j.xml | 116 +++ .../stacks/HDP/2.2/services/KAFKA/metainfo.xml | 74 + .../2.2/services/KAFKA/package/scripts/kafka.py | 64 .../KAFKA/package/scripts/kafka_broker.py | 63 .../services/KAFKA/package/scripts/params.py| 57 .../KAFKA/package/scripts/properties_config.py | 32 ++ .../KAFKA/package/scripts/service_check.py | 58 .../KAFKA/package/scripts/status_params.py | 26 ++ .../stacks/2.2/KAFKA/test_kafka_broker.py | 48 +++ .../test/python/stacks/2.2/configs/default.json | 82 - ambari-web/app/data/HDP2/site_properties.js | 93 ++ ambari-web/app/models/service_config.js | 4 + ambari-web/app/models/stack_service.js | 5 + 20 files changed, 1144 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/799a0d54/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php index 878f0dc..c7aa517 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php @@ -418,6 +418,7 @@ function hdp_mon_generate_response( $response_data ) case "STORM": case "FALCON": case "KNOX": + case "KAFKA": case "PUPPET": break; default: http://git-wip-us.apache.org/repos/asf/ambari/blob/799a0d54/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py index e1100c4..5a0ffbb 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py @@ -91,8 +91,12 @@ nagios_principal_name = default("/configurations/nagios-env/nagios_principal_nam oozie_server_port = get_port_from_url(config['configurations']['oozie-site']['oozie.base.url']) namenode_host = default("/clusterHostInfo/namenode_host", None) +_rm_host = default("/clusterHostInfo/rm_host", None) +if type(_rm_host) is list: + rm_hosts_in_str = ','.join(_rm_host) has_namenode = not namenode_host == None +has_rm = not _rm_host == None # - test for HDFS or HCFS (glusterfs) if 'namenode_host' in config['clusterHostInfo']: @@ -110,15 +114,18 @@ dfs_http_policy = HADOOP_HTTP_POLICY yarn_http_policy = HADOOP_HTTP_POLICY mapreduce_http_policy = HADOOP_HTTP_POLICY -# -if 'dfs.http.policy' in config['configurations']['hdfs-site']: - dfs_http_policy = config['configurations']['hdfs-site']['dfs.http.policy'] - -if 'yarn.http.policy' in config['configurations']['yarn-site']: - yarn_http_policy = config['configurations']['yarn-site']['yarn.http.policy'] +# +if has_namenode: + if 'dfs.http.policy' in config['configurations']['hdfs-site']: +dfs_http_policy = config['configurations']['hdfs-site']['dfs.http.policy'] + if dfs_http_policy == HADOOP_HTTPS_POLICY: +hdfs_ssl_enabled = True +if has_rm: + if 'yarn.http.policy' in config['configurations']['yarn-site']: +yarn_http_policy = config['configurations']['yarn-site']['yarn.http.policy'] -if '
git commit: AMBARI-7807. Integrate Kafka with Ambari. (Sriharsha Chintalapani via Jaimin Jetly)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 41b2d35fd -> a410ca3b8 AMBARI-7807. Integrate Kafka with Ambari. (Sriharsha Chintalapani via Jaimin Jetly) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a410ca3b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a410ca3b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a410ca3b Branch: refs/heads/branch-1.7.0 Commit: a410ca3b8f27412140553e8cfc2a2392154af0c9 Parents: 41b2d35 Author: Jaimin Jetly Authored: Thu Oct 16 10:08:55 2014 -0700 Committer: Jaimin Jetly Committed: Thu Oct 16 10:09:07 2014 -0700 -- .../NAGIOS/package/files/nagios_alerts.php | 1 + .../services/NAGIOS/package/scripts/params.py | 33 +- .../templates/hadoop-servicegroups.cfg.j2 | 7 + .../package/templates/hadoop-services.cfg.j2| 14 + .../stacks/HDP/2.2/role_command_order.json | 2 + .../KAFKA/configuration/kafka-broker.xml| 324 +++ .../services/KAFKA/configuration/kafka-env.xml | 55 .../KAFKA/configuration/kafka-log4j.xml | 116 +++ .../stacks/HDP/2.2/services/KAFKA/metainfo.xml | 74 + .../2.2/services/KAFKA/package/scripts/kafka.py | 64 .../KAFKA/package/scripts/kafka_broker.py | 63 .../services/KAFKA/package/scripts/params.py| 57 .../KAFKA/package/scripts/properties_config.py | 32 ++ .../KAFKA/package/scripts/service_check.py | 58 .../KAFKA/package/scripts/status_params.py | 26 ++ .../stacks/2.2/KAFKA/test_kafka_broker.py | 48 +++ .../test/python/stacks/2.2/configs/default.json | 82 - ambari-web/app/data/HDP2/site_properties.js | 93 ++ ambari-web/app/models/service_config.js | 4 + ambari-web/app/models/stack_service.js | 5 + 20 files changed, 1144 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a410ca3b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php index 878f0dc..c7aa517 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/nagios_alerts.php @@ -418,6 +418,7 @@ function hdp_mon_generate_response( $response_data ) case "STORM": case "FALCON": case "KNOX": + case "KAFKA": case "PUPPET": break; default: http://git-wip-us.apache.org/repos/asf/ambari/blob/a410ca3b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py index e1100c4..5a0ffbb 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/params.py @@ -91,8 +91,12 @@ nagios_principal_name = default("/configurations/nagios-env/nagios_principal_nam oozie_server_port = get_port_from_url(config['configurations']['oozie-site']['oozie.base.url']) namenode_host = default("/clusterHostInfo/namenode_host", None) +_rm_host = default("/clusterHostInfo/rm_host", None) +if type(_rm_host) is list: + rm_hosts_in_str = ','.join(_rm_host) has_namenode = not namenode_host == None +has_rm = not _rm_host == None # - test for HDFS or HCFS (glusterfs) if 'namenode_host' in config['clusterHostInfo']: @@ -110,15 +114,18 @@ dfs_http_policy = HADOOP_HTTP_POLICY yarn_http_policy = HADOOP_HTTP_POLICY mapreduce_http_policy = HADOOP_HTTP_POLICY -# -if 'dfs.http.policy' in config['configurations']['hdfs-site']: - dfs_http_policy = config['configurations']['hdfs-site']['dfs.http.policy'] - -if 'yarn.http.policy' in config['configurations']['yarn-site']: - yarn_http_policy = config['configurations']['yarn-site']['yarn.http.policy'] +# +if has_namenode: + if 'dfs.http.policy' in config['configurations']['hdfs-site']: +dfs_http_policy = config['configurations']['hdfs-site']['dfs.http.policy'] + if dfs_http_policy == HADOOP_HTTPS_POLICY: +hdfs_ssl_enabled = True +if has_rm: + if 'yarn.http.policy' in config['configurations']['yarn-site']: +yarn_http_policy = config['configurations']['yarn-site']['yarn.http.po
[1/4] AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 9024fa41f -> 41b2d35fd refs/heads/trunk d1e4a81cb -> 7092d80d3 http://git-wip-us.apache.org/repos/asf/ambari/blob/41b2d35f/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py new file mode 100644 index 000..8bb139f --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py @@ -0,0 +1,459 @@ +#!/usr/bin/env python + +''' +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. +''' +import StringIO + +import os, sys +import pprint +import subprocess +from unittest import TestCase +from mock.mock import Mock, MagicMock, patch +import mm_wrapper + +class TestOrWrapper(TestCase): + + dummy_ignore_file = """ +vm-4.vm HIVE HIVE_METASTORE +vm-5.vm GANGLIA GANGLIA_MONITOR +vm-4.vm YARN NODEMANAGER +vm-3.vm YARN NODEMANAGER +vm-3.vm HBASE HBASE_REGIONSERVER +vm-4.vm HBASE HBASE_REGIONSERVER +vm-4.vm STORM STORM_REST_API +vm-4.vm HDFS DATANODE +vm-4.vm STORM SUPERVISOR +vm-4.vm STORM NIMBUS +vm-4.vm STORM STORM_UI_SERVER +vm-3.vm STORM SUPERVISOR +vm-4.vm HDFS SECONDARY_NAMENODE +vm-3.vm FLUME FLUME_HANDLER +vm-4.vm GANGLIA GANGLIA_SERVER +vm-4.vm HIVE HIVE_SERVER +vm-4.vm ZOOKEEPER ZOOKEEPER_SERVER +vm-4.vm WEBHCAT WEBHCAT_SERVER +vm-3.vm HBASE HBASE_MASTER +vm-4.vm GANGLIA GANGLIA_MONITOR +vm-3.vm GANGLIA GANGLIA_MONITOR +vm-3.vm HDFS NAMENODE +vm-4.vm HIVE MYSQL_SERVER +vm-4.vm YARN APP_TIMELINE_SERVER +vm-4.vm FALCON FALCON_SERVER +vm-3.vm HDFS DATANODE +vm-4.vm YARN RESOURCEMANAGER +vm-4.vm OOZIE OOZIE_SERVER +vm-4.vm MAPREDUCE2 HISTORYSERVER +vm-4.vm STORM DRPC_SERVER +vm-4.vm FLUME FLUME_HANDLER +vm-3.vm ZOOKEEPER ZOOKEEPER_SERVER +""" + + default_empty_check_result = { +'message': 'No checks have been run (no hostnames provided)', +'retcode': -1, +'real_retcode': None + } + + + @patch("__builtin__.open") + def test_ignored_host_list(self, open_mock): +# Check with empty file content +open_mock.return_value.__enter__.return_value.readlines.return_value = [] +lst = mm_wrapper.ignored_host_list('STORM', 'SUPERVISOR') +self.assertEqual(pprint.pformat(lst), '[]') +# Check with dummy content +open_mock.return_value.__enter__.return_value.readlines.return_value = self.dummy_ignore_file.splitlines() +lst = mm_wrapper.ignored_host_list('STORM', 'SUPERVISOR') +self.assertEqual(pprint.pformat(lst), "['vm-4.vm', 'vm-3.vm']") +# Check if service name/comp name are not defined +open_mock.return_value.__enter__.return_value.readlines.return_value = self.dummy_ignore_file.splitlines() +lst = mm_wrapper.ignored_host_list('', '') +self.assertEqual(pprint.pformat(lst), "[]") + + + @patch("sys.exit") + def test_print_usage(self, exit_mock): +mm_wrapper.print_usage() +self.assertTrue(exit_mock.called) +self.assertEqual(exit_mock.call_args_list[0][0][0], 1) + + + def test_get_real_component(self): +with patch.dict(os.environ, {'NAGIOS_SERVICEDESC': 'SUPERVISOR::Supervisors process'}, clear=True): + component = mm_wrapper.get_real_component() + self.assertEqual(component, 'SUPERVISOR') +with patch.dict(os.environ, {'NAGIOS_SERVICEDESC': 'JOBHISTORY::HistoryServer process'}, clear=True): + component = mm_wrapper.get_real_component() + self.assertEqual(component, 'MAPREDUCE2') + + + @patch("mm_wrapper.print_usage") + def test_parse_args(self, print_usage_mock): +args = ['or', 'h1', 'h2', '--', 'prog', '-h', '^^', '-opt', 'yet', 'another', 'opt'] +mode, hostnames, command_line = mm_wrapper.parse_args(args) +self.assertEquals(mode, mm_wrapper.OR) +self.assertEquals(hostnames, ['h1', 'h2']) +self.assertEquals(command_line, ['prog', '-h', '^^', '-opt', 'yet', 'another', 'opt']) + +args = ['and', 'h1', 'h2', '--', 'prog', '-h', '^^', '-opt', 'yet', 'another', 'opt'] +mode, hostnames, command_line = mm_wrapper.parse_args(args) +self.assertEquals(mode, mm_wrapper.AND) +self.assertEquals(hostnames, ['h1', 'h2']) +self.assertEquals(command_line, ['pr
[2/4] git commit: AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko)
AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/41b2d35f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/41b2d35f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/41b2d35f Branch: refs/heads/branch-1.7.0 Commit: 41b2d35fd7c01ef2b95002b304cad5495ba7ea28 Parents: 9024fa4 Author: Lisnichenko Dmitro Authored: Mon Sep 1 19:17:32 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 19:25:47 2014 +0300 -- ambari-server/src/main/python/ambari-server.py | 2 +- .../NAGIOS/package/files/check_wrapper.sh | 91 .../services/NAGIOS/package/files/mm_wrapper.py | 326 + .../package/scripts/nagios_server_config.py | 2 +- .../package/templates/hadoop-commands.cfg.j2| 38 +- .../package/templates/hadoop-services.cfg.j2| 13 - .../NAGIOS/package/templates/nagios.cfg.j2 | 2 +- .../package/files/check_checkpoint_time.py | 2 +- .../NAGIOS/package/files/check_wrapper.sh | 94 .../services/NAGIOS/package/files/mm_wrapper.py | 326 + .../package/scripts/nagios_server_config.py | 2 +- .../package/templates/hadoop-commands.cfg.j2| 46 +- .../package/templates/hadoop-services.cfg.j2| 15 - .../NAGIOS/package/templates/nagios.cfg.j2 | 2 +- .../stacks/1.3.2/NAGIOS/test_mm_wrapper.py | 459 +++ .../stacks/1.3.2/NAGIOS/test_nagios_server.py | 8 +- .../stacks/2.0.6/NAGIOS/test_mm_wrapper.py | 459 +++ .../stacks/2.0.6/NAGIOS/test_nagios_server.py | 10 +- ambari-server/src/test/python/unitTests.py | 9 +- 19 files changed, 1632 insertions(+), 274 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/41b2d35f/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 4988708..a36bb77 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -2939,7 +2939,7 @@ def status(args): status, pid = is_server_runing() if status: print "Ambari Server running" -print "Found Ambari Server PID: '" + str(pid) + " at: " + PID_DIR + os.sep + PID_NAME +print "Found Ambari Server PID: " + str(pid) + " at: " + PID_DIR + os.sep + PID_NAME else: print "Ambari Server not running. Stale PID File at: " + PID_DIR + os.sep + PID_NAME http://git-wip-us.apache.org/repos/asf/ambari/blob/41b2d35f/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh -- diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh deleted file mode 100644 index 8c36a79..000 --- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# -# 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. -# -# - -function real_service() { - desc=$NAGIOS_SERVICEGROUPNAME - eval "$1='$desc'" -} - -function real_component() { - arrDesc=(${NAGIOS_SERVICEDESC//::/ }) - - compName="${arrDesc[0]}" - - case "$compName" in -HBASEMASTER) - realCompName="HBASE_MASTER" -;; -REGIONSERVER) - realCompName="HBASE_REGIONSERVER" -;; -HIVE-METASTORE) - realCompName="HIVE_METASTORE" -;; -HIVE-SERVER) - realCompName="HIVE_SERVER" -;; -FLUME) - realCompName="FLUME_SERVER" -;; -HUE) - realCompName="HUE_SERVER" -;; -WEBHCAT) - realCompName="WEBHCAT_SERVER" -;; -*) - realCompName=$compName -;; - esac - - eval "$1='$realCompName'" -} - -real_service_var="" -real_service real
[4/4] git commit: AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko)
AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7092d80d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7092d80d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7092d80d Branch: refs/heads/trunk Commit: 7092d80d32a39e80b4f0d71c645a48f9a2090889 Parents: d1e4a81 Author: Lisnichenko Dmitro Authored: Mon Sep 1 19:17:32 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 19:29:39 2014 +0300 -- ambari-server/src/main/python/ambari-server.py | 2 +- .../NAGIOS/package/files/check_wrapper.sh | 91 .../services/NAGIOS/package/files/mm_wrapper.py | 326 + .../package/scripts/nagios_server_config.py | 2 +- .../package/templates/hadoop-commands.cfg.j2| 38 +- .../package/templates/hadoop-services.cfg.j2| 13 - .../NAGIOS/package/templates/nagios.cfg.j2 | 2 +- .../package/files/check_checkpoint_time.py | 2 +- .../NAGIOS/package/files/check_wrapper.sh | 94 .../services/NAGIOS/package/files/mm_wrapper.py | 326 + .../package/scripts/nagios_server_config.py | 2 +- .../package/templates/hadoop-commands.cfg.j2| 46 +- .../package/templates/hadoop-services.cfg.j2| 15 - .../NAGIOS/package/templates/nagios.cfg.j2 | 2 +- .../stacks/1.3.2/NAGIOS/test_mm_wrapper.py | 459 +++ .../stacks/1.3.2/NAGIOS/test_nagios_server.py | 8 +- .../stacks/2.0.6/NAGIOS/test_mm_wrapper.py | 459 +++ .../stacks/2.0.6/NAGIOS/test_nagios_server.py | 10 +- ambari-server/src/test/python/unitTests.py | 9 +- 19 files changed, 1632 insertions(+), 274 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7092d80d/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 50fc75e..d066162 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -2945,7 +2945,7 @@ def status(args): status, pid = is_server_runing() if status: print "Ambari Server running" -print "Found Ambari Server PID: '" + str(pid) + " at: " + PID_DIR + os.sep + PID_NAME +print "Found Ambari Server PID: " + str(pid) + " at: " + PID_DIR + os.sep + PID_NAME else: print "Ambari Server not running. Stale PID File at: " + PID_DIR + os.sep + PID_NAME http://git-wip-us.apache.org/repos/asf/ambari/blob/7092d80d/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh -- diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh deleted file mode 100644 index 8c36a79..000 --- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/files/check_wrapper.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# -# 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. -# -# - -function real_service() { - desc=$NAGIOS_SERVICEGROUPNAME - eval "$1='$desc'" -} - -function real_component() { - arrDesc=(${NAGIOS_SERVICEDESC//::/ }) - - compName="${arrDesc[0]}" - - case "$compName" in -HBASEMASTER) - realCompName="HBASE_MASTER" -;; -REGIONSERVER) - realCompName="HBASE_REGIONSERVER" -;; -HIVE-METASTORE) - realCompName="HIVE_METASTORE" -;; -HIVE-SERVER) - realCompName="HIVE_SERVER" -;; -FLUME) - realCompName="FLUME_SERVER" -;; -HUE) - realCompName="HUE_SERVER" -;; -WEBHCAT) - realCompName="WEBHCAT_SERVER" -;; -*) - realCompName=$compName -;; - esac - - eval "$1='$realCompName'" -} - -real_service_var="" -real_service real_servic
[3/4] AMBARI-7791. HBase Master CPU utilization alert is not suppressed at MM (dlysnichenko)
http://git-wip-us.apache.org/repos/asf/ambari/blob/7092d80d/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py new file mode 100644 index 000..8bb139f --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.0.6/NAGIOS/test_mm_wrapper.py @@ -0,0 +1,459 @@ +#!/usr/bin/env python + +''' +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. +''' +import StringIO + +import os, sys +import pprint +import subprocess +from unittest import TestCase +from mock.mock import Mock, MagicMock, patch +import mm_wrapper + +class TestOrWrapper(TestCase): + + dummy_ignore_file = """ +vm-4.vm HIVE HIVE_METASTORE +vm-5.vm GANGLIA GANGLIA_MONITOR +vm-4.vm YARN NODEMANAGER +vm-3.vm YARN NODEMANAGER +vm-3.vm HBASE HBASE_REGIONSERVER +vm-4.vm HBASE HBASE_REGIONSERVER +vm-4.vm STORM STORM_REST_API +vm-4.vm HDFS DATANODE +vm-4.vm STORM SUPERVISOR +vm-4.vm STORM NIMBUS +vm-4.vm STORM STORM_UI_SERVER +vm-3.vm STORM SUPERVISOR +vm-4.vm HDFS SECONDARY_NAMENODE +vm-3.vm FLUME FLUME_HANDLER +vm-4.vm GANGLIA GANGLIA_SERVER +vm-4.vm HIVE HIVE_SERVER +vm-4.vm ZOOKEEPER ZOOKEEPER_SERVER +vm-4.vm WEBHCAT WEBHCAT_SERVER +vm-3.vm HBASE HBASE_MASTER +vm-4.vm GANGLIA GANGLIA_MONITOR +vm-3.vm GANGLIA GANGLIA_MONITOR +vm-3.vm HDFS NAMENODE +vm-4.vm HIVE MYSQL_SERVER +vm-4.vm YARN APP_TIMELINE_SERVER +vm-4.vm FALCON FALCON_SERVER +vm-3.vm HDFS DATANODE +vm-4.vm YARN RESOURCEMANAGER +vm-4.vm OOZIE OOZIE_SERVER +vm-4.vm MAPREDUCE2 HISTORYSERVER +vm-4.vm STORM DRPC_SERVER +vm-4.vm FLUME FLUME_HANDLER +vm-3.vm ZOOKEEPER ZOOKEEPER_SERVER +""" + + default_empty_check_result = { +'message': 'No checks have been run (no hostnames provided)', +'retcode': -1, +'real_retcode': None + } + + + @patch("__builtin__.open") + def test_ignored_host_list(self, open_mock): +# Check with empty file content +open_mock.return_value.__enter__.return_value.readlines.return_value = [] +lst = mm_wrapper.ignored_host_list('STORM', 'SUPERVISOR') +self.assertEqual(pprint.pformat(lst), '[]') +# Check with dummy content +open_mock.return_value.__enter__.return_value.readlines.return_value = self.dummy_ignore_file.splitlines() +lst = mm_wrapper.ignored_host_list('STORM', 'SUPERVISOR') +self.assertEqual(pprint.pformat(lst), "['vm-4.vm', 'vm-3.vm']") +# Check if service name/comp name are not defined +open_mock.return_value.__enter__.return_value.readlines.return_value = self.dummy_ignore_file.splitlines() +lst = mm_wrapper.ignored_host_list('', '') +self.assertEqual(pprint.pformat(lst), "[]") + + + @patch("sys.exit") + def test_print_usage(self, exit_mock): +mm_wrapper.print_usage() +self.assertTrue(exit_mock.called) +self.assertEqual(exit_mock.call_args_list[0][0][0], 1) + + + def test_get_real_component(self): +with patch.dict(os.environ, {'NAGIOS_SERVICEDESC': 'SUPERVISOR::Supervisors process'}, clear=True): + component = mm_wrapper.get_real_component() + self.assertEqual(component, 'SUPERVISOR') +with patch.dict(os.environ, {'NAGIOS_SERVICEDESC': 'JOBHISTORY::HistoryServer process'}, clear=True): + component = mm_wrapper.get_real_component() + self.assertEqual(component, 'MAPREDUCE2') + + + @patch("mm_wrapper.print_usage") + def test_parse_args(self, print_usage_mock): +args = ['or', 'h1', 'h2', '--', 'prog', '-h', '^^', '-opt', 'yet', 'another', 'opt'] +mode, hostnames, command_line = mm_wrapper.parse_args(args) +self.assertEquals(mode, mm_wrapper.OR) +self.assertEquals(hostnames, ['h1', 'h2']) +self.assertEquals(command_line, ['prog', '-h', '^^', '-opt', 'yet', 'another', 'opt']) + +args = ['and', 'h1', 'h2', '--', 'prog', '-h', '^^', '-opt', 'yet', 'another', 'opt'] +mode, hostnames, command_line = mm_wrapper.parse_args(args) +self.assertEquals(mode, mm_wrapper.AND) +self.assertEquals(hostnames, ['h1', 'h2']) +self.assertEquals(command_line, ['prog', '-h', '^^', '-opt', 'yet', 'another', 'opt']) + +args = ['env_only', 'h1', 'h2', '--', 'prog', '-h', '^^', '-opt', 'yet'
git commit: AMBARI-7814 Flume agent on Ambari uses the default Java on machine (dsen)
Repository: ambari Updated Branches: refs/heads/trunk 456dcb246 -> d1e4a81cb AMBARI-7814 Flume agent on Ambari uses the default Java on machine (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d1e4a81c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d1e4a81c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d1e4a81c Branch: refs/heads/trunk Commit: d1e4a81cb24658eaf335dc91567f286093568317 Parents: 456dcb2 Author: Dmytro Sen Authored: Thu Oct 16 18:32:17 2014 +0300 Committer: Dmytro Sen Committed: Thu Oct 16 18:32:17 2014 +0300 -- .../services/FLUME/configuration/flume-env.xml | 38 .../services/FLUME/package/scripts/flume.py | 5 +++ .../services/FLUME/package/scripts/params.py| 2 ++ .../python/stacks/2.0.6/FLUME/test_flume.py | 11 +- .../python/stacks/2.0.6/configs/default.json| 8 +++-- .../2.0.6/configs/default.non_gmetad_host.json | 6 +++- .../stacks/2.0.6/configs/flume_target.json | 4 +++ .../python/stacks/2.0.6/configs/secured.json| 4 +++ 8 files changed, 74 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d1e4a81c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml index 7b11bde..902b3ca 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml @@ -37,4 +37,42 @@ USER Flume User + + + +content +This is the jinja template for flume-env.sh file + +# 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. + +# If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced +# during Flume startup. + +# Enviroment variables can be set here. + +export JAVA_HOME={{java_home}} + +# Give Flume more memory and pre-allocate, enable remote monitoring via JMX +# export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote" + +# Note that the Flume conf directory is always included in the classpath. +#FLUME_CLASSPATH="" + +# export HIVE_HOME=/usr/lib/hive +# export HCAT_HOME=/usr/lib/hive-hcatalog + + http://git-wip-us.apache.org/repos/asf/ambari/blob/d1e4a81c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py index 45d0c8f..2db4039 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py @@ -33,6 +33,11 @@ def flume(action = None): Directory(params.flume_conf_dir, recursive=True) Directory(params.flume_log_dir, owner=params.flume_user) +File(format("{flume_conf_dir}/flume-env.sh"), + owner=params.flume_user, + content=InlineTemplate(params.flume_env_sh_template) +) + flume_agents = {} if params.flume_conf_content is not None: flume_agents = build_flume_topology(params.flume_conf_content) http://git-wip-us.apache.org/repos/asf/ambari/blob/d1e4a81c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py index e0bec7b..55a6d29 100644 --- a/ambari-se
git commit: AMBARI-7814 Flume agent on Ambari uses the default Java on machine (dsen)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 6c0d5097e -> 9024fa41f AMBARI-7814 Flume agent on Ambari uses the default Java on machine (dsen) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9024fa41 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9024fa41 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9024fa41 Branch: refs/heads/branch-1.7.0 Commit: 9024fa41f23a1e203602611eb4ff9b2e44f2d41e Parents: 6c0d509 Author: Dmytro Sen Authored: Thu Oct 16 18:30:14 2014 +0300 Committer: Dmytro Sen Committed: Thu Oct 16 18:30:14 2014 +0300 -- .../services/FLUME/configuration/flume-env.xml | 38 .../services/FLUME/package/scripts/flume.py | 5 +++ .../services/FLUME/package/scripts/params.py| 2 ++ .../python/stacks/2.0.6/FLUME/test_flume.py | 11 +- .../python/stacks/2.0.6/configs/default.json| 8 +++-- .../2.0.6/configs/default.non_gmetad_host.json | 6 +++- .../stacks/2.0.6/configs/flume_target.json | 4 +++ .../python/stacks/2.0.6/configs/secured.json| 4 +++ 8 files changed, 74 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9024fa41/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml index 7b11bde..902b3ca 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml @@ -37,4 +37,42 @@ USER Flume User + + + +content +This is the jinja template for flume-env.sh file + +# 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. + +# If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced +# during Flume startup. + +# Enviroment variables can be set here. + +export JAVA_HOME={{java_home}} + +# Give Flume more memory and pre-allocate, enable remote monitoring via JMX +# export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote" + +# Note that the Flume conf directory is always included in the classpath. +#FLUME_CLASSPATH="" + +# export HIVE_HOME=/usr/lib/hive +# export HCAT_HOME=/usr/lib/hive-hcatalog + + http://git-wip-us.apache.org/repos/asf/ambari/blob/9024fa41/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py index 45d0c8f..2db4039 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py @@ -33,6 +33,11 @@ def flume(action = None): Directory(params.flume_conf_dir, recursive=True) Directory(params.flume_log_dir, owner=params.flume_user) +File(format("{flume_conf_dir}/flume-env.sh"), + owner=params.flume_user, + content=InlineTemplate(params.flume_env_sh_template) +) + flume_agents = {} if params.flume_conf_content is not None: flume_agents = build_flume_topology(params.flume_conf_content) http://git-wip-us.apache.org/repos/asf/ambari/blob/9024fa41/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py index e0bec7b..55a6d29 100644 --
git commit: AMBARI-7806 - Views: Instance Data Storage doesn't work
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 9ab8371a4 -> 6c0d5097e AMBARI-7806 - Views: Instance Data Storage doesn't work Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6c0d5097 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6c0d5097 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6c0d5097 Branch: refs/heads/branch-1.7.0 Commit: 6c0d5097e3b11afb63abb334a895cb979e38cdad Parents: 9ab8371 Author: tbeerbower Authored: Thu Oct 16 09:50:49 2014 -0400 Committer: tbeerbower Committed: Thu Oct 16 09:51:11 2014 -0400 -- .../org/apache/ambari/server/view/ViewRegistry.java | 16 ++-- .../apache/ambari/server/view/ViewRegistryTest.java | 11 ++- 2 files changed, 12 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6c0d5097/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java index cf15ef1..f2173ac 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java @@ -1097,11 +1097,6 @@ public class ViewRegistry { persistedView = viewDAO.merge(view); } -Map xmlInstanceEntityMap = new HashMap(); -for( ViewInstanceEntity instance : view.getInstances()) { - xmlInstanceEntityMap.put(instance.getName(), instance); -} - view.setResourceType(persistedView.getResourceType()); view.setPermissions(persistedView.getPermissions()); @@ -,8 +1106,6 @@ public class ViewRegistry { String instanceName = persistedInstance.getName(); ViewInstanceEntity instance = view.getInstanceDefinition(instanceName); - xmlInstanceEntityMap.remove(instanceName); - // if the persisted instance is not in the view ... if (instance == null) { if (persistedInstance.isXmlDriven()) { @@ -1128,15 +1121,10 @@ public class ViewRegistry { } } else { instance.setResource(persistedInstance.getResource()); +instance.setViewInstanceId(persistedInstance.getViewInstanceId()); +instance.setData(persistedInstance.getData()); } } - -// these instances appear in the view.xml but are not present in the db... -// add them to db -for (ViewInstanceEntity instance : xmlInstanceEntityMap.values()) { - instance.setResource(createViewInstanceResource(resourceType)); - instanceDAO.merge(instance); -} } // create an admin resource to represent a view instance http://git-wip-us.apache.org/repos/asf/ambari/blob/6c0d5097/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java index 071f5af..1bd47f3 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java @@ -205,6 +205,10 @@ public class ViewRegistryTest { viewDefinition.setResourceType(resourceTypeEntity); Set viewInstanceEntities = ViewInstanceEntityTest.getViewInstanceEntities(viewDefinition); + +for (ViewInstanceEntity viewInstanceEntity : viewInstanceEntities) { + viewInstanceEntity.putInstanceData("p1", "v1"); +} viewDefinition.setInstances(viewInstanceEntities); Map viewConfigs = @@ -308,7 +312,12 @@ public class ViewRegistryTest { Assert.assertNotNull(view); Assert.assertEquals(ViewDefinition.ViewStatus.DEPLOYED, view.getStatus()); -Assert.assertEquals(2, registry.getInstanceDefinitions(view).size()); +Collection instanceDefinitions = registry.getInstanceDefinitions(view); +Assert.assertEquals(2, instanceDefinitions.size()); + +for (ViewInstanceEntity viewInstanceEntity : instanceDefinitions) { + Assert.assertEquals("v1", viewInstanceEntity.getInstanceData("p1").getValue()); +} // verify mocks verify(configuration, viewDir, extractedArchiveDir, viewArchive, archiveDir, entryFile, classesDir,
git commit: AMBARI-7806 - Views: Instance Data Storage doesn't work
Repository: ambari Updated Branches: refs/heads/trunk 59d2cc8ca -> 456dcb246 AMBARI-7806 - Views: Instance Data Storage doesn't work Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/456dcb24 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/456dcb24 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/456dcb24 Branch: refs/heads/trunk Commit: 456dcb246bb575c4c84c4294a7341e77932a566f Parents: 59d2cc8 Author: tbeerbower Authored: Thu Oct 16 09:46:03 2014 -0400 Committer: tbeerbower Committed: Thu Oct 16 09:46:35 2014 -0400 -- .../org/apache/ambari/server/view/ViewRegistry.java | 16 ++-- .../apache/ambari/server/view/ViewRegistryTest.java | 11 ++- 2 files changed, 12 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/456dcb24/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java index f5dc8b9..1f5db9a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java @@ -1092,11 +1092,6 @@ public class ViewRegistry { persistedView = viewDAO.merge(view); } -Map xmlInstanceEntityMap = new HashMap(); -for( ViewInstanceEntity instance : view.getInstances()) { - xmlInstanceEntityMap.put(instance.getName(), instance); -} - view.setResourceType(persistedView.getResourceType()); view.setPermissions(persistedView.getPermissions()); @@ -1106,8 +1101,6 @@ public class ViewRegistry { String instanceName = persistedInstance.getName(); ViewInstanceEntity instance = view.getInstanceDefinition(instanceName); - xmlInstanceEntityMap.remove(instanceName); - // if the persisted instance is not in the view ... if (instance == null) { if (persistedInstance.isXmlDriven()) { @@ -1123,15 +1116,10 @@ public class ViewRegistry { } } else { instance.setResource(persistedInstance.getResource()); +instance.setViewInstanceId(persistedInstance.getViewInstanceId()); +instance.setData(persistedInstance.getData()); } } - -// these instances appear in the view.xml but are not present in the db... -// add them to db -for (ViewInstanceEntity instance : xmlInstanceEntityMap.values()) { - instance.setResource(createViewInstanceResource(resourceType)); - instanceDAO.merge(instance); -} } // create an admin resource to represent a view instance http://git-wip-us.apache.org/repos/asf/ambari/blob/456dcb24/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java index ffcac6b..7c0cade 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java @@ -204,6 +204,10 @@ public class ViewRegistryTest { viewDefinition.setResourceType(resourceTypeEntity); Set viewInstanceEntities = ViewInstanceEntityTest.getViewInstanceEntities(viewDefinition); + +for (ViewInstanceEntity viewInstanceEntity : viewInstanceEntities) { + viewInstanceEntity.putInstanceData("p1", "v1"); +} viewDefinition.setInstances(viewInstanceEntities); Map viewConfigs = @@ -307,7 +311,12 @@ public class ViewRegistryTest { Assert.assertNotNull(view); Assert.assertEquals(ViewDefinition.ViewStatus.DEPLOYED, view.getStatus()); -Assert.assertEquals(2, registry.getInstanceDefinitions(view).size()); +Collection instanceDefinitions = registry.getInstanceDefinitions(view); +Assert.assertEquals(2, instanceDefinitions.size()); + +for (ViewInstanceEntity viewInstanceEntity : instanceDefinitions) { + Assert.assertEquals("v1", viewInstanceEntity.getInstanceData("p1").getValue()); +} // verify mocks verify(configuration, viewDir, extractedArchiveDir, viewArchive, archiveDir, entryFile, classesDir,
[2/2] git commit: AMBARI-7797. All letters in "Yarn" should be capital at Download Client Configs drop-down (dlysnichenko)
AMBARI-7797. All letters in "Yarn" should be capital at Download Client Configs drop-down (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9ab8371a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9ab8371a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9ab8371a Branch: refs/heads/branch-1.7.0 Commit: 9ab8371a428e8d50dabb03daacb6b10b97bbcb38 Parents: 26503de Author: Lisnichenko Dmitro Authored: Thu Oct 16 16:19:17 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 16:20:16 2014 +0300 -- .../main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml | 2 +- .../main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml | 2 +- ambari-server/src/test/python/stacks/2.1/common/services.json| 4 ++-- .../test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9ab8371a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml index b9d4236..11a8695 100644 --- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml @@ -85,7 +85,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT 1+ http://git-wip-us.apache.org/repos/asf/ambari/blob/9ab8371a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml index a53167e..2778073 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml @@ -73,7 +73,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT 1+ http://git-wip-us.apache.org/repos/asf/ambari/blob/9ab8371a/ambari-server/src/test/python/stacks/2.1/common/services.json -- diff --git a/ambari-server/src/test/python/stacks/2.1/common/services.json b/ambari-server/src/test/python/stacks/2.1/common/services.json index 44ed562..c4af73c 100644 --- a/ambari-server/src/test/python/stacks/2.1/common/services.json +++ b/ambari-server/src/test/python/stacks/2.1/common/services.json @@ -980,7 +980,7 @@ "component_category" : "CLIENT", "component_name" : "YARN_CLIENT", "custom_commands" : [ ], -"display_name" : "Yarn Client", +"display_name" : "YARN Client", "is_client" : true, "is_master" : false, "service_name" : "YARN", @@ -1033,4 +1033,4 @@ } ] } ], "configurations" : { } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/9ab8371a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml index 01e93c2..de0b1c0 100644 --- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml +++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml @@ -72,7 +72,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT true 0+
[1/2] git commit: AMBARI-7797. All letters in "Yarn" should be capital at Download Client Configs drop-down (dlysnichenko)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 26503deb0 -> 9ab8371a4 refs/heads/trunk 90bb18e7c -> 59d2cc8ca AMBARI-7797. All letters in "Yarn" should be capital at Download Client Configs drop-down (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59d2cc8c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59d2cc8c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59d2cc8c Branch: refs/heads/trunk Commit: 59d2cc8ca99cfdbb902c0a12365811f298897e43 Parents: 90bb18e Author: Lisnichenko Dmitro Authored: Thu Oct 16 16:19:17 2014 +0300 Committer: Lisnichenko Dmitro Committed: Thu Oct 16 16:19:17 2014 +0300 -- .../main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml | 2 +- .../main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml | 2 +- ambari-server/src/test/python/stacks/2.1/common/services.json| 4 ++-- .../test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/59d2cc8c/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml index b9d4236..11a8695 100644 --- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/YARN/metainfo.xml @@ -85,7 +85,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT 1+ http://git-wip-us.apache.org/repos/asf/ambari/blob/59d2cc8c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml index a53167e..2778073 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml @@ -73,7 +73,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT 1+ http://git-wip-us.apache.org/repos/asf/ambari/blob/59d2cc8c/ambari-server/src/test/python/stacks/2.1/common/services.json -- diff --git a/ambari-server/src/test/python/stacks/2.1/common/services.json b/ambari-server/src/test/python/stacks/2.1/common/services.json index 44ed562..c4af73c 100644 --- a/ambari-server/src/test/python/stacks/2.1/common/services.json +++ b/ambari-server/src/test/python/stacks/2.1/common/services.json @@ -980,7 +980,7 @@ "component_category" : "CLIENT", "component_name" : "YARN_CLIENT", "custom_commands" : [ ], -"display_name" : "Yarn Client", +"display_name" : "YARN Client", "is_client" : true, "is_master" : false, "service_name" : "YARN", @@ -1033,4 +1033,4 @@ } ] } ], "configurations" : { } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ambari/blob/59d2cc8c/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml -- diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml index 01e93c2..de0b1c0 100644 --- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml +++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/services/YARN/metainfo.xml @@ -72,7 +72,7 @@ YARN_CLIENT - Yarn Client + YARN Client CLIENT true 0+
git commit: AMBARI-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko)
Repository: ambari Updated Branches: refs/heads/trunk 718a90918 -> 90bb18e7c AMBARI-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/90bb18e7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/90bb18e7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/90bb18e7 Branch: refs/heads/trunk Commit: 90bb18e7c47216d842caee64441878e99e659b26 Parents: 718a909 Author: Oleg Nechiporenko Authored: Thu Oct 16 15:16:29 2014 +0300 Committer: Oleg Nechiporenko Committed: Thu Oct 16 15:16:29 2014 +0300 -- .../createAppWizard/step2_controller.js | 35 .../processes/create_new_app_test.js| 31 - 2 files changed, 51 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/90bb18e7/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js -- diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js index 7adbf08..181e81d 100644 --- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js +++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js @@ -77,24 +77,31 @@ App.CreateAppWizardStep2Controller = Ember.ArrayController.extend({ /** * Fill content with objects created from App.SliderAppTypeComponent + * If user come from 3 or 4 step, newApp.components are used * @method loadTypeComponents */ loadTypeComponents: function () { var content = [], -component = this.get('typeComponent'), -allTypeComponents = this.get('newApp.appType.components'); -if (allTypeComponents && allTypeComponents.get('length')) { - allTypeComponents.forEach(function (typeComponent) { -content.push(component.create({ - displayName: typeComponent.get('displayName'), - name: typeComponent.get('name'), - priority: typeComponent.get('priority'), - numInstances: typeComponent.get('defaultNumInstances').toString(), - yarnMemory: typeComponent.get('defaultYARNMemory').toString(), - yarnCPU: typeComponent.get('defaultYARNCPU').toString() -})); - }); - this.set('content', content); + component = this.get('typeComponent'), + allTypeComponents = this.get('newApp.appType.components'), + existingComponents = this.get('appWizardController.newApp.components'); // user may back to current step from 3 or 4 +if (existingComponents && existingComponents.get('length')) { + this.set('content', existingComponents); +} +else { + if (allTypeComponents && allTypeComponents.get('length')) { +allTypeComponents.forEach(function (typeComponent) { + content.push(component.create({ +displayName: typeComponent.get('displayName'), +name: typeComponent.get('name'), +priority: typeComponent.get('priority'), +numInstances: typeComponent.get('defaultNumInstances').toString(), +yarnMemory: typeComponent.get('defaultYARNMemory').toString(), +yarnCPU: typeComponent.get('defaultYARNCPU').toString() + })); +}); +this.set('content', content); + } } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/90bb18e7/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js -- diff --git a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js index a26d22c..ddef342 100644 --- a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js +++ b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js @@ -75,7 +75,7 @@ var appTypes = { var selectors = { buttonNext: 'button.next-btn', -buttonBack: 'button.btn:eq(1)', +buttonBack: '.btn-area button.btn:eq(1)', step2: { content: '#step2 table tbody' }, @@ -96,6 +96,7 @@ var selectors = { HBASE_MASTER: 4, HBASE_REGIONSERVER: 5 }, +yarnLabel: 'SOME LABEL', categoriesCount: 6, newConfig: { name: 'new_property', @@ -318,4 +319,32 @@ test('check step3', function () { }); }); }); +}); + +test('check step3 back', function () { + + visit('/createAppWi
git commit: AMBARI-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 7df59aa3f -> 26503deb0 AMBARI-7813. Slider View. Add App Wizard. Back from 3rd to 2nd step issue. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26503deb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26503deb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26503deb Branch: refs/heads/branch-1.7.0 Commit: 26503deb0d993d71197009f2f416bf9d2bfcc794 Parents: 7df59aa Author: Oleg Nechiporenko Authored: Thu Oct 16 15:22:12 2014 +0300 Committer: Oleg Nechiporenko Committed: Thu Oct 16 15:22:12 2014 +0300 -- .../createAppWizard/step2_controller.js | 35 .../processes/create_new_app_test.js| 31 - 2 files changed, 51 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/26503deb/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js -- diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js index 7adbf08..181e81d 100644 --- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js +++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js @@ -77,24 +77,31 @@ App.CreateAppWizardStep2Controller = Ember.ArrayController.extend({ /** * Fill content with objects created from App.SliderAppTypeComponent + * If user come from 3 or 4 step, newApp.components are used * @method loadTypeComponents */ loadTypeComponents: function () { var content = [], -component = this.get('typeComponent'), -allTypeComponents = this.get('newApp.appType.components'); -if (allTypeComponents && allTypeComponents.get('length')) { - allTypeComponents.forEach(function (typeComponent) { -content.push(component.create({ - displayName: typeComponent.get('displayName'), - name: typeComponent.get('name'), - priority: typeComponent.get('priority'), - numInstances: typeComponent.get('defaultNumInstances').toString(), - yarnMemory: typeComponent.get('defaultYARNMemory').toString(), - yarnCPU: typeComponent.get('defaultYARNCPU').toString() -})); - }); - this.set('content', content); + component = this.get('typeComponent'), + allTypeComponents = this.get('newApp.appType.components'), + existingComponents = this.get('appWizardController.newApp.components'); // user may back to current step from 3 or 4 +if (existingComponents && existingComponents.get('length')) { + this.set('content', existingComponents); +} +else { + if (allTypeComponents && allTypeComponents.get('length')) { +allTypeComponents.forEach(function (typeComponent) { + content.push(component.create({ +displayName: typeComponent.get('displayName'), +name: typeComponent.get('name'), +priority: typeComponent.get('priority'), +numInstances: typeComponent.get('defaultNumInstances').toString(), +yarnMemory: typeComponent.get('defaultYARNMemory').toString(), +yarnCPU: typeComponent.get('defaultYARNCPU').toString() + })); +}); +this.set('content', content); + } } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/26503deb/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js -- diff --git a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js index a26d22c..ddef342 100644 --- a/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js +++ b/contrib/views/slider/src/main/resources/ui/test/integration/processes/create_new_app_test.js @@ -75,7 +75,7 @@ var appTypes = { var selectors = { buttonNext: 'button.next-btn', -buttonBack: 'button.btn:eq(1)', +buttonBack: '.btn-area button.btn:eq(1)', step2: { content: '#step2 table tbody' }, @@ -96,6 +96,7 @@ var selectors = { HBASE_MASTER: 4, HBASE_REGIONSERVER: 5 }, +yarnLabel: 'SOME LABEL', categoriesCount: 6, newConfig: { name: 'new_property', @@ -318,4 +319,32 @@ test('check step3', function () { }); }); }); +}); + +test('check step3 back', function () { + + visit
[1/2] git commit: AMBARI-7788. Nagios password can be changed on the UI, but it's not reflected in Nagios Web itself (the password never updates) (aonishuk)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 690fa082a -> 7df59aa3f refs/heads/trunk 9000f4379 -> 718a90918 AMBARI-7788. Nagios password can be changed on the UI, but it's not reflected in Nagios Web itself (the password never updates) (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/718a9091 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/718a9091 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/718a9091 Branch: refs/heads/trunk Commit: 718a90918bb74a91946a3f897be7b1c6930707e3 Parents: 9000f43 Author: Andrew Onishuk Authored: Thu Oct 16 14:38:24 2014 +0300 Committer: Andrew Onishuk Committed: Thu Oct 16 14:38:24 2014 +0300 -- .../stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py | 5 + .../stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py | 5 + .../stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py | 5 + .../src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py | 3 +-- .../src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py | 3 +-- 5 files changed, 5 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/718a9091/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py index ca2d64c..a63ea38 100644 --- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py @@ -91,10 +91,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b {conf_dir}/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} {conf_dir}/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( format("{conf_dir}/htpasswd.users"), owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/718a9091/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py index 7756c47..1f7a04c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py @@ -78,10 +78,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b /etc/nagios/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} /etc/nagios/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( "/etc/nagios/htpasswd.users", owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/718a9091/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py index ca2d64c..a63ea38 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py @@ -91,10 +91,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b {conf_dir}/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} {conf_dir}/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( format("{conf_dir}/htpasswd.users"), owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/718a9091/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py -- diff --git a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py index 17f0dca..d5a35bc 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py +++ b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py @@ -2
[2/2] git commit: AMBARI-7788. Nagios password can be changed on the UI, but it's not reflected in Nagios Web itself (the password never updates) (aonishuk)
AMBARI-7788. Nagios password can be changed on the UI, but it's not reflected in Nagios Web itself (the password never updates) (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7df59aa3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7df59aa3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7df59aa3 Branch: refs/heads/branch-1.7.0 Commit: 7df59aa3f38149f2386aa086a7aaac2c06ee6c9a Parents: 690fa08 Author: Andrew Onishuk Authored: Thu Oct 16 14:38:27 2014 +0300 Committer: Andrew Onishuk Committed: Thu Oct 16 14:38:27 2014 +0300 -- .../stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py | 5 + .../stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py | 5 + .../stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py | 5 + .../src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py | 3 +-- .../src/test/python/stacks/2.0.6/NAGIOS/test_nagios_server.py | 3 +-- 5 files changed, 5 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7df59aa3/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py index ca2d64c..a63ea38 100644 --- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/NAGIOS/package/scripts/nagios.py @@ -91,10 +91,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b {conf_dir}/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} {conf_dir}/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( format("{conf_dir}/htpasswd.users"), owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/7df59aa3/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py index 7756c47..1f7a04c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/NAGIOS/package/scripts/nagios.py @@ -78,10 +78,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b /etc/nagios/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} /etc/nagios/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( "/etc/nagios/htpasswd.users", owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/7df59aa3/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py index ca2d64c..a63ea38 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/scripts/nagios.py @@ -91,10 +91,7 @@ def set_web_permisssions(): import params cmd = format("{htpasswd_cmd} -c -b {conf_dir}/htpasswd.users {nagios_web_login} {nagios_web_password!p}") - test = format("grep {nagios_web_login} {conf_dir}/htpasswd.users") - Execute( cmd, -not_if = test - ) + Execute(cmd) File( format("{conf_dir}/htpasswd.users"), owner = params.nagios_user, http://git-wip-us.apache.org/repos/asf/ambari/blob/7df59aa3/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py -- diff --git a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py index 17f0dca..d5a35bc 100644 --- a/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py +++ b/ambari-server/src/test/python/stacks/1.3.2/NAGIOS/test_nagios_server.py @@ -260,8 +260,7 @@ class TestNagiosServer(RMFTestCase): mode=0755 ) self.assertResourc