You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/09/18 16:44:06 UTC
[17/34] git commit: AMBARI-7350. Add SLIDER service to the stacks
AMBARI-7350. Add SLIDER service to the stacks
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dcc03bc7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dcc03bc7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dcc03bc7
Branch: refs/heads/branch-alerts-dev
Commit: dcc03bc735f1258ba5503847b38d11ef8c725ecd
Parents: 2a5759c
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Wed Sep 17 15:59:44 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Wed Sep 17 15:59:44 2014 -0700
----------------------------------------------------------------------
.../SLIDER/configuration/slider-client.xml | 56 +++++++++
.../SLIDER/configuration/slider-log4j.xml | 89 ++++++++++++++
.../stacks/HDP/2.2/services/SLIDER/metainfo.xml | 72 ++++++++++++
.../SLIDER/package/files/hbaseSmokeVerify.sh | 34 ++++++
.../services/SLIDER/package/scripts/__init__.py | 19 +++
.../services/SLIDER/package/scripts/params.py | 45 ++++++++
.../SLIDER/package/scripts/service_check.py | 45 ++++++++
.../services/SLIDER/package/scripts/slider.py | 68 +++++++++++
.../SLIDER/package/scripts/slider_client.py | 43 +++++++
.../SLIDER/package/templates/slider-wrapper.j2 | 42 +++++++
.../stacks/2.2/SLIDER/test_slider_client.py | 109 ++++++++++++++++++
.../test/python/stacks/2.2/configs/default.json | 115 +++++++++++++++++++
.../test/python/stacks/2.2/configs/secured.json | 79 +++++++++++++
13 files changed, 816 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-client.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-client.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-client.xml
new file mode 100644
index 0000000..7d55760
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-client.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="true">
+ <property>
+ <name>slider.yarn.queue</name>
+ <value>default</value>
+ <description>YARN queue for the Application Master</description>
+ </property>
+ <property>
+ <name>slider.zookeeper.quorum</name>
+ <value>localhost:2181</value>
+ <description>ZK quorum</description>
+ </property>
+ <!--<property>
+ <name>yarn.resourcemanager.address</name>
+ <value>localhost:8050</value>
+ <description>The address of the applications manager interface in the RM.</description>
+ </property>
+ <property>
+ <name>yarn.resourcemanager.scheduler.address</name>
+ <value>localhost:8030</value>
+ <description>The address of the scheduler interface.</description>
+ </property>
+ <property>
+ <name>yarn.application.classpath</name>
+ <value>
+ /etc/hadoop/conf,/usr/lib/hadoop/*,/usr/lib/hadoop/lib/*,/usr/lib/hadoop-hdfs/*,/usr/lib/hadoop-hdfs/lib/*,/usr/lib/hadoop-yarn/*,/usr/lib/hadoop-yarn/lib/*,/usr/lib/hadoop-mapreduce/*,/usr/lib/hadoop-mapreduce/lib/*
+ </value>
+ <description>Default application classpath.</description>
+ </property>
+ <property>
+ <name>fs.defaultFS</name>
+ <value>hdfs://localhost:8020</value>
+ <description>The name of the default file system. Either the
+ literal string "local" or a host:port for NDFS.</description>
+ </property>-->
+</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-log4j.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-log4j.xml
new file mode 100644
index 0000000..709867c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-log4j.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+
+<configuration supports_final="false">
+
+ <property>
+ <name>content</name>
+ <description>Custom log4j.properties</description>
+ <value>
+# 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.
+
+
+# Define some default values that can be overridden by system properties
+log4j.rootLogger=INFO,stdout
+log4j.threshhold=ALL
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# log layout skips stack-trace creation operations by avoiding line numbers and method
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} - %m%n
+
+# debug edition is much more expensive
+#log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} (%F:%M(%L)) - %m%n
+
+
+log4j.appender.subprocess=org.apache.log4j.ConsoleAppender
+log4j.appender.subprocess.layout=org.apache.log4j.PatternLayout
+log4j.appender.subprocess.layout.ConversionPattern=[%c{1}]: %m%n
+#log4j.logger.org.apache.slider.yarn.appmaster.SliderAppMasterer.master=INFO,subprocess
+
+# for debugging Slider
+#log4j.logger.org.apache.slider=DEBUG
+#log4j.logger.org.apache.slider=DEBUG
+
+# uncomment to debug service lifecycle issues
+#log4j.logger.org.apache.hadoop.yarn.service.launcher=DEBUG
+#log4j.logger.org.apache.hadoop.yarn.service=DEBUG
+
+# uncomment for YARN operations
+#log4j.logger.org.apache.hadoop.yarn.client=DEBUG
+
+# uncomment this to debug security problems
+#log4j.logger.org.apache.hadoop.security=DEBUG
+
+#crank back on some noise
+log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR
+log4j.logger.org.apache.hadoop.hdfs=WARN
+
+
+log4j.logger.org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor=WARN
+log4j.logger.org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl=WARN
+log4j.logger.org.apache.zookeeper=WARN
+ </value>
+ </property>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml
new file mode 100644
index 0000000..22f5efe
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" 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.
+-->
+<metainfo>
+ <schemaVersion>2.0</schemaVersion>
+ <services>
+ <service>
+ <name>SLIDER</name>
+ <displayName>Slider</displayName>
+ <comment>Apache Slider is a YARN application to deploy existing distributed applications on YARN, monitor them and make them larger or smaller as desired -even while the application is running.</comment>
+ <version>0.51.0</version>
+ <components>
+ <component>
+ <name>SLIDER</name>
+ <displayName>Slider</displayName>
+ <category>CLIENT</category>
+ <cardinality>0+</cardinality>
+ <commandScript>
+ <script>scripts/slider_client.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>600</timeout>
+ </commandScript>
+ </component>
+ </components>
+ <osSpecifics>
+ <osSpecific>
+ <osFamily>any</osFamily>
+ <packages>
+ <package>
+ <name>slider</name>
+ </package>
+ </packages>
+ </osSpecific>
+ </osSpecifics>
+
+ <commandScript>
+ <script>scripts/service_check.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>300</timeout>
+ </commandScript>
+
+ <requiredServices>
+ <service>YARN</service>
+ <service>HDFS</service>
+ <service>ZOOKEEPER</service>
+ </requiredServices>
+
+ <configuration-dependencies>
+ <config-type>slider-log4j</config-type>
+ <config-type>slider-client</config-type>
+ <config-type>hdfs-site</config-type>
+ <config-type>yarn-site</config-type>
+ <config-type>core-site</config-type>
+ </configuration-dependencies>
+
+ </service>
+ </services>
+</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/files/hbaseSmokeVerify.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/files/hbaseSmokeVerify.sh b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/files/hbaseSmokeVerify.sh
new file mode 100644
index 0000000..5c320c0
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/files/hbaseSmokeVerify.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env 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.
+#
+#
+conf_dir=$1
+data=$2
+hbase_cmd=$3
+echo "scan 'ambarismoketest'" | $hbase_cmd --config $conf_dir shell > /tmp/hbase_chk_verify
+cat /tmp/hbase_chk_verify
+echo "Looking for $data"
+grep -q $data /tmp/hbase_chk_verify
+if [ "$?" -ne 0 ]
+then
+ exit 1
+fi
+
+grep -q '1 row(s)' /tmp/hbase_chk_verify
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/__init__.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/__init__.py
new file mode 100644
index 0000000..5561e10
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/__init__.py
@@ -0,0 +1,19 @@
+#!/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.
+
+"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/params.py
new file mode 100644
index 0000000..af6939c
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/params.py
@@ -0,0 +1,45 @@
+#!/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.
+
+"""
+
+from resource_management import *
+
+# server configurations
+config = Script.get_config()
+
+#RPM versioning support
+rpm_version = default("/configurations/hadoop-env/rpm_version", None)
+
+#hadoop params
+if rpm_version is not None:
+ slider_conf_dir = format('/usr/lib/{rpm_version}/slider/conf')
+ slider_bin_dir = format('/usr/lib/{rpm_version}/slider/bin')
+else:
+ slider_conf_dir = "/usr/lib/slider/conf"
+ slider_bin_dir = "/usr/lib/slider/bin"
+
+smokeuser = config['configurations']['cluster-env']['smokeuser']
+user_group = config['configurations']['cluster-env']['user_group']
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+smokeuser_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
+
+java64_home = config['hostLevelParams']['java_home']
+log4j_props = config['configurations']['slider-log4j']['content']
+slider_cmd = format("{slider_bin_dir}/slider-wrapper")
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/service_check.py
new file mode 100644
index 0000000..bb54dc8
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/service_check.py
@@ -0,0 +1,45 @@
+#!/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.
+
+"""
+
+from resource_management import *
+
+
+class SliderServiceCheck(Script):
+ def service_check(self, env):
+ import params
+
+ env.set_params(params)
+
+ smokeuser_kinit_cmd = format(
+ "{kinit_path_local} -kt {smokeuser_keytab} {smokeuser};") if params.security_enabled else ""
+
+ servicecheckcmd = format("{smokeuser_kinit_cmd} {slider_cmd} list")
+
+ Execute(servicecheckcmd,
+ tries=3,
+ try_sleep=5,
+ user=params.smokeuser,
+ logoutput=True
+ )
+
+
+if __name__ == "__main__":
+ SliderServiceCheck().execute()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider.py
new file mode 100644
index 0000000..d9d0693
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider.py
@@ -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.
+
+Ambari Agent
+
+"""
+import os
+
+from resource_management import *
+
+
+def slider():
+ import params
+
+ Directory(params.slider_conf_dir
+ )
+
+ XmlConfig("slider-client.xml",
+ conf_dir=params.slider_conf_dir,
+ configurations=params.config['configurations']['slider-client']
+ )
+
+ XmlConfig("core-site.xml",
+ conf_dir=params.slider_conf_dir,
+ configurations=params.config['configurations']['core-site'],
+ configuration_attributes=params.config['configuration_attributes']['core-site']
+ )
+
+ XmlConfig("hdfs-site.xml",
+ conf_dir=params.slider_conf_dir,
+ configurations=params.config['configurations']['hdfs-site'],
+ configuration_attributes=params.config['configuration_attributes']['hdfs-site']
+ )
+
+ XmlConfig("yarn-site.xml",
+ conf_dir=params.slider_conf_dir,
+ configurations=params.config['configurations']['yarn-site'],
+ configuration_attributes=params.config['configuration_attributes']['yarn-site']
+ )
+
+ File(format("{slider_bin_dir}/slider-wrapper"),
+ mode=0755,
+ content=Template('slider-wrapper.j2')
+ )
+
+ if (params.log4j_props != None):
+ File(format("{params.slider_conf_dir}/log4j.properties"),
+ mode=0644,
+ content=params.log4j_props
+ )
+ elif (os.path.exists(format("{params.slider_conf_dir}/log4j.properties"))):
+ File(format("{params.slider_conf_dir}/log4j.properties"),
+ mode=0644
+ )
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider_client.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider_client.py
new file mode 100644
index 0000000..cb22a99
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider_client.py
@@ -0,0 +1,43 @@
+#!/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.
+
+"""
+
+from resource_management import *
+
+from slider import slider
+
+
+class SliderClient(Script):
+ def install(self, env):
+ self.install_packages(env)
+ self.configure(env)
+
+ def configure(self, env):
+ import params
+
+ env.set_params(params)
+
+ slider()
+
+ def status(self, env):
+ raise ClientComponentHasNoStatus()
+
+
+if __name__ == "__main__":
+ SliderClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/templates/slider-wrapper.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/templates/slider-wrapper.j2 b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/templates/slider-wrapper.j2
new file mode 100644
index 0000000..ba0b013
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/templates/slider-wrapper.j2
@@ -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.
+#}
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#/*
+# * 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 slider
+import os, sys
+
+if __name__ == '__main__':
+ os.environ["JAVA_HOME"] = "{{java64_home}}"
+ slider.main()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
new file mode 100644
index 0000000..c33c938
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py
@@ -0,0 +1,109 @@
+#!/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.
+'''
+from stacks.utils.RMFTestCase import *
+
+
+class TestSliderClient(RMFTestCase):
+ def test_configure_default(self):
+ self.maxDiff = None
+ self.executeScript("2.2/services/SLIDER/package/scripts/slider_client.py",
+ classname="SliderClient",
+ command="configure",
+ config_file="default.json"
+ )
+
+ self.assertResourceCalled('Directory', '/usr/lib/slider/conf'
+ )
+
+ self.assertResourceCalled('XmlConfig',
+ 'slider-client.xml',
+ conf_dir='/usr/lib/slider/conf',
+ configurations=self.getConfig()['configurations']['slider-client']
+ )
+
+ self.assertResourceCalled('XmlConfig',
+ 'core-site.xml',
+ conf_dir='/usr/lib/slider/conf',
+ configurations=self.getConfig()['configurations']['core-site'],
+ configuration_attributes=self.getConfig()['configuration_attributes']['core-site']
+ )
+
+ self.assertResourceCalled('XmlConfig',
+ 'hdfs-site.xml',
+ conf_dir='/usr/lib/slider/conf',
+ configurations=self.getConfig()['configurations']['hdfs-site'],
+ configuration_attributes=self.getConfig()['configuration_attributes']['hdfs-site']
+ )
+
+ self.assertResourceCalled('XmlConfig',
+ 'yarn-site.xml',
+ conf_dir='/usr/lib/slider/conf',
+ configurations=self.getConfig()['configurations']['yarn-site'],
+ configuration_attributes=self.getConfig()['configuration_attributes']['yarn-site']
+ )
+
+ self.assertResourceCalled('File',
+ '/usr/lib/slider/bin/slider-wrapper',
+ content=Template('slider-wrapper.j2'),
+ mode=0755
+ )
+
+ self.assertResourceCalled('File',
+ '/usr/lib/slider/conf/log4j.properties',
+ mode=0644,
+ content='log4jproperties\nline2'
+ )
+
+ self.assertNoMoreResources()
+
+
+ def test_svc_check_secured(self):
+ self.maxDiff = None
+ self.executeScript("2.2/services/SLIDER/package/scripts/service_check.py",
+ classname="SliderServiceCheck",
+ command="service_check",
+ config_file="secured.json"
+ )
+
+ self.assertResourceCalled('Execute',
+ '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa; /usr/lib/slider/bin/slider-wrapper list',
+ logoutput=True,
+ tries=3,
+ user='ambari-qa',
+ try_sleep=5,
+ )
+ self.assertNoMoreResources()
+
+ def test_svc_check_default(self):
+ self.maxDiff = None
+ self.executeScript("2.2/services/SLIDER/package/scripts/service_check.py",
+ classname="SliderServiceCheck",
+ command="service_check",
+ config_file="default.json"
+ )
+
+ self.assertResourceCalled('Execute', ' /usr/lib/slider/bin/slider-wrapper list',
+ logoutput=True,
+ tries=3,
+ user='ambari-qa',
+ try_sleep=5,
+ )
+ self.assertNoMoreResources()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/test/python/stacks/2.2/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/default.json b/ambari-server/src/test/python/stacks/2.2/configs/default.json
new file mode 100644
index 0000000..07c4c32
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.2/configs/default.json
@@ -0,0 +1,115 @@
+{
+ "roleCommand": "SERVICE_CHECK",
+ "clusterName": "c1",
+ "hostname": "c6401.ambari.apache.org",
+ "hostLevelParams": {
+ "jdk_location": "http://c6401.ambari.apache.org:8080/resources/",
+ "ambari_db_rca_password": "mapred",
+ "ambari_db_rca_url": "jdbc:postgresql://c6401.ambari.apache.org/ambarirca",
+ "jce_name": "UnlimitedJCEPolicyJDK7.zip",
+ "stack_version": "2.1",
+ "stack_name": "HDP",
+ "ambari_db_rca_driver": "org.postgresql.Driver",
+ "jdk_name": "jdk-7u45-linux-x64.tar.gz",
+ "ambari_db_rca_username": "mapred",
+ "java_home": "/usr/jdk64/jdk1.7.0_45",
+ "db_name": "ambari"
+ },
+ "commandType": "EXECUTION_COMMAND",
+ "roleParams": {},
+ "serviceName": "SLIDER",
+ "role": "SLIDER",
+ "commandParams": {
+ "command_timeout": "300",
+ "service_package_folder": "OOZIE",
+ "script_type": "PYTHON",
+ "script": "scripts/service_check.py",
+ "excluded_hosts": "host1,host2"
+ },
+ "taskId": 152,
+ "public_hostname": "c6401.ambari.apache.org",
+ "configurations": {
+ "slider-client": {
+ "slider.zookeeper.quorum": "c6401.ambari.apache.org:2181",
+ "slider.yarn.queue": "default"
+ },
+ "core-site": {
+ "fs.defaultFS": "hdfs://c6401.ambari.apache.org:8020"
+ },
+ "hdfs-site": {
+ "a": "b"
+ },
+ "yarn-site": {
+ "yarn.application.classpath": "/etc/hadoop/conf,/usr/lib/hadoop/*,/usr/lib/hadoop/lib/*,/usr/lib/hadoop-hdfs/*,/usr/lib/hadoop-hdfs/lib/*,/usr/lib/hadoop-yarn/*,/usr/lib/hadoop-yarn/lib/*,/usr/lib/hadoop-mapreduce/*,/usr/lib/hadoop-mapreduce/lib/*",
+ "yarn.resourcemanager.address": "c6401.ambari.apache.org:8050",
+ "yarn.resourcemanager.scheduler.address": "c6401.ambari.apache.org:8030"
+ },
+ "cluster-env": {
+ "security_enabled": "false",
+ "ignore_groupsusers_create": "false",
+ "smokeuser": "ambari-qa",
+ "kerberos_domain": "EXAMPLE.COM",
+ "user_group": "hadoop"
+ },
+ "slider-log4j": {
+ "content": "log4jproperties\nline2"
+ }
+ },
+ "configuration_attributes": {
+ "yarn-site": {
+ "final": {
+ "yarn.nodemanager.disk-health-checker.min-healthy-disks": "true",
+ "yarn.nodemanager.container-executor.class": "true",
+ "yarn.nodemanager.local-dirs": "true"
+ }
+ },
+ "hdfs-site": {
+ "final": {
+ "dfs.web.ugi": "true",
+ "dfs.support.append": "true",
+ "dfs.cluster.administrators": "true"
+ }
+ },
+ "core-site": {
+ "final": {
+ "hadoop.proxyuser.hive.groups": "true",
+ "webinterface.private.actions": "true",
+ "hadoop.proxyuser.oozie.hosts": "true"
+ }
+ }
+ },
+ "configurationTags": {
+ "slider-client": {
+ "tag": "version1"
+ },
+ "slider-log4j": {
+ "tag": "version1"
+ },
+ "core-site": {
+ "tag": "version1"
+ },
+ "hdfs-site": {
+ "tag": "version1"
+ },
+ "yarn-site": {
+ "tag": "version1"
+ }
+ },
+ "commandId": "7-1",
+ "clusterHostInfo": {
+ "ambari_server_host": [
+ "c6401.ambari.apache.org"
+ ],
+ "all_ping_ports": [
+ "8670",
+ "8670"
+ ],
+ "rm_host": [
+ "c6402.ambari.apache.org"
+ ],
+ "all_hosts": [
+ "c6401.ambari.apache.org",
+ "c6402.ambari.apache.org"
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dcc03bc7/ambari-server/src/test/python/stacks/2.2/configs/secured.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/secured.json b/ambari-server/src/test/python/stacks/2.2/configs/secured.json
new file mode 100644
index 0000000..d7818bc
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.2/configs/secured.json
@@ -0,0 +1,79 @@
+{
+ "roleCommand": "SERVICE_CHECK",
+ "clusterName": "c1",
+ "hostname": "c6401.ambari.apache.org",
+ "hostLevelParams": {
+ "jdk_location": "http://c6401.ambari.apache.org:8080/resources/",
+ "ambari_db_rca_password": "mapred",
+ "ambari_db_rca_url": "jdbc:postgresql://c6401.ambari.apache.org/ambarirca",
+ "jce_name": "UnlimitedJCEPolicyJDK7.zip",
+ "stack_version": "2.1",
+ "stack_name": "HDP",
+ "ambari_db_rca_driver": "org.postgresql.Driver",
+ "jdk_name": "jdk-7u45-linux-x64.tar.gz",
+ "ambari_db_rca_username": "mapred",
+ "java_home": "/usr/jdk64/jdk1.7.0_45",
+ "db_name": "ambari"
+ },
+ "commandType": "EXECUTION_COMMAND",
+ "roleParams": {},
+ "serviceName": "SLIDER",
+ "role": "SLIDER",
+ "commandParams": {
+ "command_timeout": "300",
+ "service_package_folder": "OOZIE",
+ "script_type": "PYTHON",
+ "script": "scripts/service_check.py",
+ "excluded_hosts": "host1,host2"
+ },
+ "taskId": 152,
+ "public_hostname": "c6401.ambari.apache.org",
+ "configurations": {
+ "slider-client": {
+ "slider.zookeeper.quorum": "c6401.ambari.apache.org:2181",
+ "yarn.application.classpath": "/etc/hadoop/conf,/usr/lib/hadoop/*,/usr/lib/hadoop/lib/*,/usr/lib/hadoop-hdfs/*,/usr/lib/hadoop-hdfs/lib/*,/usr/lib/hadoop-yarn/*,/usr/lib/hadoop-yarn/lib/*,/usr/lib/hadoop-mapreduce/*,/usr/lib/hadoop-mapreduce/lib/*",
+ "yarn.resourcemanager.address": "c6401.ambari.apache.org:8050",
+ "yarn.resourcemanager.scheduler.address": "c6401.ambari.apache.org:8030",
+ "slider.yarn.queue": "default",
+ "fs.defaultFS": "hdfs://c6401.ambari.apache.org:8020"
+ },
+ "cluster-env": {
+ "security_enabled": "true",
+ "ignore_groupsusers_create": "false",
+ "smokeuser": "ambari-qa",
+ "kerberos_domain": "EXAMPLE.COM",
+ "user_group": "hadoop",
+ "smokeuser_keytab": "/etc/security/keytabs/smokeuser.headless.keytab",
+ "kinit_path_local": "/usr/bin"
+ },
+ "slider-log4j": {
+ "content": "log4jproperties\nline2"
+ }
+ },
+ "configuration_attributes": {},
+ "configurationTags": {
+ "slider-client": {
+ "tag": "version1"
+ },
+ "slider-log4j": {
+ "tag": "version1"
+ }
+ },
+ "commandId": "7-1",
+ "clusterHostInfo": {
+ "ambari_server_host": [
+ "c6401.ambari.apache.org"
+ ],
+ "all_ping_ports": [
+ "8670",
+ "8670"
+ ],
+ "rm_host": [
+ "c6402.ambari.apache.org"
+ ],
+ "all_hosts": [
+ "c6401.ambari.apache.org",
+ "c6402.ambari.apache.org"
+ ]
+ }
+}