You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2018/05/22 11:18:00 UTC

[ambari] branch trunk updated: [AMBARI-23917] Infra Solr: show start/sop command output in ambari command. (#1339)

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

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 64838b8  [AMBARI-23917] Infra Solr: show start/sop command output in ambari command. (#1339)
64838b8 is described below

commit 64838b886b44693ef117575ceeb8cc69ee453c47
Author: Olivér Szabó <ol...@gmail.com>
AuthorDate: Tue May 22 13:17:56 2018 +0200

    [AMBARI-23917] Infra Solr: show start/sop command output in ambari command. (#1339)
    
    * AMBARI-23917. Infra Solr: show start/sop command output in ambari command.
    
    * AMBARI-23917. Remove PIPESTATUS from ambari format
---
 .../0.1.0/package/scripts/infra_solr.py                 | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/infra_solr.py b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/infra_solr.py
index a11f207..da1eaa8 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/infra_solr.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/infra_solr.py
@@ -54,12 +54,14 @@ class InfraSolr(Script):
     generate_logfeeder_input_config('ambari-infra', Template("input.config-ambari-infra.json.j2", extra_imports=[default]))
 
     setup_solr_znode_env()
-    start_cmd = format('{solr_bindir}/solr start -cloud -noprompt -s {infra_solr_datadir} -Dsolr.kerberos.name.rules=\'{infra_solr_kerberos_name_rules}\' >> {infra_solr_log} 2>&1') \
-            if params.security_enabled else format('{solr_bindir}/solr start -cloud -noprompt -s {infra_solr_datadir} >> {infra_solr_log} 2>&1')
+    start_cmd = format('{solr_bindir}/solr start -cloud -noprompt -s {infra_solr_datadir} -Dsolr.kerberos.name.rules=\'{infra_solr_kerberos_name_rules}\' 2>&1') \
+            if params.security_enabled else format('{solr_bindir}/solr start -cloud -noprompt -s {infra_solr_datadir} 2>&1')
+    piped_start_cmd = format('{start_cmd} | tee {infra_solr_log}') + '; (exit "${PIPESTATUS[0]}")'
     Execute(
-      start_cmd,
+      piped_start_cmd,
       environment={'SOLR_INCLUDE': format('{infra_solr_conf}/infra-solr-env.sh')},
-      user=params.infra_solr_user
+      user=params.infra_solr_user,
+      logoutput=True
     )
 
   def stop(self, env, upgrade_type=None):
@@ -67,10 +69,13 @@ class InfraSolr(Script):
     env.set_params(params)
 
     try:
-      Execute(format('{solr_bindir}/solr stop -all >> {infra_solr_log}'),
+      stop_cmd=format('{solr_bindir}/solr stop -all')
+      piped_stop_cmd=format('{stop_cmd} | tee {infra_solr_log}') + '; (exit "${PIPESTATUS[0]}")'
+      Execute(piped_stop_cmd,
               environment={'SOLR_INCLUDE': format('{infra_solr_conf}/infra-solr-env.sh')},
               user=params.infra_solr_user,
-              only_if=format("test -f {prev_infra_solr_pidfile}")
+              only_if=format("test -f {prev_infra_solr_pidfile}"),
+              logoutput=True
               )
 
       File(params.prev_infra_solr_pidfile,

-- 
To stop receiving notification emails like this one, please contact
oleewere@apache.org.