浏览代码

AMBARI-7713. Slider service should specify what client configs can be downloaded

Sumit Mohanty 10 年之前
父节点
当前提交
cf8e48d9d7

+ 0 - 5
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-client.xml

@@ -20,11 +20,6 @@
  */
 -->
 <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>

+ 43 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/configuration/slider-env.xml

@@ -0,0 +1,43 @@
+<?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>
+  <!-- slider-env.sh -->
+  <property>
+    <name>content</name>
+    <description>This is the jinja template for slider-env.sh file</description>
+    <value>
+# Set Slider-specific environment variables here.
+
+# The only required environment variable is JAVA_HOME.  All others are
+# optional.  When running a distributed configuration it is best to
+# set JAVA_HOME in this file, so that it is correctly defined on
+# remote nodes.
+
+# The java implementation to use.  Required.
+export JAVA_HOME={{java64_home}}
+# The hadoop conf directory.  Optional as slider-client.xml can be edited to add properties.
+export HADOOP_CONF_DIR={{hadoop_conf_dir}}
+    </value>
+  </property>
+  
+</configuration>

+ 33 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml

@@ -50,6 +50,38 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <configFiles>
+            <configFile>
+              <type>xml</type>
+              <fileName>slider-client.xml</fileName>
+              <dictionaryName>slider-client</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>xml</type>
+              <fileName>core-site.xml</fileName>
+              <dictionaryName>core-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>xml</type>
+              <fileName>hdfs-site.xml</fileName>
+              <dictionaryName>hdfs-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>xml</type>
+              <fileName>yarn-site.xml</fileName>
+              <dictionaryName>yarn-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>slider-env.sh</fileName>
+              <dictionaryName>slider-env</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>log4j.properties</fileName>
+              <dictionaryName>slider-log4j</dictionaryName>
+            </configFile>
+          </configFiles>
         </component>
       </components>
       <osSpecifics>
@@ -78,6 +110,7 @@
       <configuration-dependencies>
         <config-type>slider-log4j</config-type>
         <config-type>slider-client</config-type>
+        <config-type>slider-env</config-type>
       </configuration-dependencies>
 
     </service>

+ 1 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/params.py

@@ -38,6 +38,7 @@ smokeuser = config['configurations']['cluster-env']['smokeuser']
 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"])
+slider_env_sh_template = config['configurations']['slider-env']['content']
 
 java64_home = config['hostLevelParams']['java_home']
 log4j_props = config['configurations']['slider-log4j']['content']

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/scripts/slider.py

@@ -37,7 +37,7 @@ def slider():
 
   File(format("{slider_conf_dir}/slider-env.sh"),
        mode=0755,
-       content=Template('slider-env.sh.j2')
+       content=InlineTemplate(params.slider_env_sh_template)
   )
 
   if (params.log4j_props != None):

+ 0 - 38
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/package/templates/slider-env.sh.j2

@@ -1,38 +0,0 @@
-{#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" 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.
-# */
-export JAVA_HOME={{java64_home}}
-export HADOOP_CONF_DIR={{hadoop_conf_dir}}

+ 4 - 5
ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py

@@ -40,11 +40,10 @@ class TestSliderClient(RMFTestCase):
                               configurations=self.getConfig()['configurations']['slider-client']
     )
 
-    self.assertResourceCalled('File',
-                              '/etc/slider/conf/slider-env.sh',
-                              content=Template('slider-env.sh.j2'),
-                              mode=0755
-    )
+    self.assertResourceCalled('File', '/etc/slider/conf/slider-env.sh',
+                              content = InlineTemplate(self.getConfig()['configurations']['slider-env']['content']),
+                              mode = 0755,
+                              )
 
     self.assertResourceCalled('File',
                               '/etc/slider/conf/log4j.properties',

+ 6 - 0
ambari-server/src/test/python/stacks/2.2/configs/default.json

@@ -53,6 +53,9 @@
         },
         "slider-log4j": {
             "content": "log4jproperties\nline2"
+        },
+        "slider-env": {
+            "content": "envproperties\nline2"
         }
     },
     "configuration_attributes": {
@@ -85,6 +88,9 @@
         "slider-log4j": {
             "tag": "version1"
         },
+        "slider-env": {
+            "tag": "version1"
+        },
         "core-site": {
             "tag": "version1"
         },

+ 6 - 0
ambari-server/src/test/python/stacks/2.2/configs/secured.json

@@ -48,6 +48,9 @@
         },
         "slider-log4j": {
             "content": "log4jproperties\nline2"
+        },
+        "slider-env": {
+            "content": "envproperties\nline2"
         }
     },
     "configuration_attributes": {},
@@ -57,6 +60,9 @@
         },
         "slider-log4j": {
             "tag": "version1"
+        },
+        "slider-env": {
+            "tag": "version1"
         }
     },
     "commandId": "7-1",