This is an automated email from the ASF dual-hosted git repository.

hapylestat pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new a4529ad  AMBARI-14526 Proper SystemD configuration(TasksMax) on SLES12 
without any bad impact on other linux distributions.
a4529ad is described below

commit a4529ad5b42cbadeec06213968e7a15c4444f7db
Author: eberhardtp <eberhar...@cloudera.com>
AuthorDate: Thu Nov 14 14:14:19 2019 +0100

    AMBARI-14526 Proper SystemD configuration(TasksMax) on SLES12 without any 
bad impact on other linux distributions.
---
 .../{ambari-agent.service => custom/sles12.sh}     | 32 +++++-----------------
 ambari-agent/conf/unix/install-helper.sh           | 11 ++++++++
 ambari-agent/pom.xml                               |  4 +--
 ambari-agent/src/packages/tarball/all.xml          | 11 ++++----
 4 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/ambari-agent/conf/unix/ambari-agent.service 
b/ambari-agent/conf/unix/custom/sles12.sh
similarity index 50%
rename from ambari-agent/conf/unix/ambari-agent.service
rename to ambari-agent/conf/unix/custom/sles12.sh
index adc22de..02b3601 100644
--- a/ambari-agent/conf/unix/ambari-agent.service
+++ b/ambari-agent/conf/unix/custom/sles12.sh
@@ -10,30 +10,12 @@
 # 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
+# See the License for the specific language governing permissions and
+# limitations under the License
 
-# This service unit file is tuned for SLES 12.x. It is not suitable for RHEL 
like distributions due to different
-# paths for ExecStart/ExecStop.
+# This is a custom SLES12 dependent script which contains postinstall steps
+# to execute. Please note executing this might cause unexpected errors on
+# other linux distributions.
 
-[Unit]
-Description=Ambari Agent Service for SLES
-Before=runlevel3.target
-Before=runlevel5.target
-Before=shutdown.target
-After=remote-fs.target
-After=network-online.target
-Wants=network-online.target
-Conflicts=shutdown.target
-
-[Service]
-Type=forking
-PIDFile=/run/ambari-agent/ambari-agent.pid
-Restart=no
-TimeoutSec=5min
-IgnoreSIGPIPE=no
-KillMode=process
-GuessMainPID=no
-RemainAfterExit=no
-TasksMax=infinity
-ExecStart=/etc/init.d/ambari-agent start
-ExecStop=/etc/init.d/ambari-agent stop
+systemctl enable ambari-agent
+systemctl set-property ambari-agent TasksMax=infinity
diff --git a/ambari-agent/conf/unix/install-helper.sh 
b/ambari-agent/conf/unix/install-helper.sh
index d333331..ed01d24 100644
--- a/ambari-agent/conf/unix/install-helper.sh
+++ b/ambari-agent/conf/unix/install-helper.sh
@@ -118,6 +118,15 @@ install_autostart(){
   fi
 }
 
+install_custom(){
+   if [ -d "/etc/ambari-agent/conf/custom" ]; then
+     for f in /etc/ambari-agent/conf/custom/*.sh; do
+       echo "${f}"
+       bash "$f" -H
+     done
+  fi
+}
+
 locate_python(){
   local python_binaries="/usr/bin/python;/usr/bin/python2;/usr/bin/python2.7"
 
@@ -154,6 +163,8 @@ do_install(){
 
   install_autostart 1>>${LOG_FILE} 2>&1
 
+  install_custom 1>>${LOG_FILE} 2>&1
+
   # remove old python wrapper
   rm -f "${PYTHON_WRAPER_TARGET}"
 
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index 07b9b99..1d0b914 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -726,14 +726,14 @@
               <group>Development</group>
               <mappings>
                 <mapping>
-                  <directory>/usr/lib/systemd/system/</directory>
+                  <directory>/var/lib/${project.artifactId}/tmp</directory>
                   <username>root</username>
                   <groupname>root</groupname>
                   <filemode>644</filemode>
                   <directoryIncluded>false</directoryIncluded>
                   <sources>
                     <source>
-                      
<location>${project.build.directory}${dirsep}${project.artifactId}-${project.version}${dirsep}usr${dirsep}lib${dirsep}systemd${dirsep}system${dirsep}ambari-agent.service</location>
+                      
<location>${project.build.directory}${dirsep}${project.artifactId}-${project.version}${dirsep}etc${dirsep}ambari-agent${dirsep}conf${dirsep}custom${dirsep}sles12.sh</location>
                     </source>
                   </sources>
                 </mapping>
diff --git a/ambari-agent/src/packages/tarball/all.xml 
b/ambari-agent/src/packages/tarball/all.xml
index 5f8c273..1cf7f17 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -146,6 +146,12 @@
       <directory>${pluggableStackDefinitionOutput}/custom_actions</directory>
       
<outputDirectory>/var/lib/ambari-agent/cache/custom_actions</outputDirectory>
     </fileSet>
+    <fileSet>
+      <directoryMode>755</directoryMode>
+      <fileMode>755</fileMode>
+      <directory>conf/unix/custom</directory>
+      <outputDirectory>/var/lib/${project.artifactId}/tmp</outputDirectory>
+    </fileSet>
   </fileSets>
   <!-- Single files. Syntax:
          <files>
@@ -186,11 +192,6 @@
       <outputDirectory>/etc/ambari-agent/conf</outputDirectory>
     </file>
     <file>
-      <fileMode>644</fileMode>
-      <source>conf/unix/ambari-agent.service</source>
-      <outputDirectory>/usr/lib/systemd/system</outputDirectory>
-    </file>
-    <file>
       <fileMode>755</fileMode>
       <source>${basedir}/target/src/ambari-agent</source>
       <outputDirectory>/var/lib/ambari-agent/bin</outputDirectory>

Reply via email to