Ori.livneh has submitted this change and it was merged.

Change subject: Fix 'status' checks in *ctl scripts
......................................................................


Fix 'status' checks in *ctl scripts

There are several fooctl-style scripts in the Puppet repo that did not set a
correct exit code for status checks, causing Puppet not to recognize that the
service was stopped.

Change-Id: I91672ef280129904cc2f3118b61a06b3f63754a9
---
M modules/eventlogging/files/eventloggingctl
M modules/mwprof/files/mwprofctl
M modules/rcstream/files/rcstreamctl
M modules/uwsgi/files/uwsgictl
4 files changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/eventlogging/files/eventloggingctl 
b/modules/eventlogging/files/eventloggingctl
index e0c50ed..f1bbba1 100755
--- a/modules/eventlogging/files/eventloggingctl
+++ b/modules/eventlogging/files/eventloggingctl
@@ -7,7 +7,8 @@
 case "$command" in
     status)
         initctl list | grep -Po '(?<=eventlogging/)(?!init).*' | sort -k5 \
-                | sed 's/, process//' | column -ts'( )'
+                | sed 's/, process//' | column -ts'( )' \
+                | perl -pe 'END { exit $status } $status=1 if /stop\/waiting/;'
         ;;
     start|restart)
         initctl emit eventlogging.start
diff --git a/modules/mwprof/files/mwprofctl b/modules/mwprof/files/mwprofctl
index 7ad3db1..fa441b2 100755
--- a/modules/mwprof/files/mwprofctl
+++ b/modules/mwprof/files/mwprofctl
@@ -6,7 +6,8 @@
 shift
 case "$command" in
     status)
-        initctl list | grep -P '^mwprof/(?!init)' | sort
+        initctl list | grep -P '^mwprof/(?!init)' | sort | \
+            perl -pe 'END { exit $status } $status=1 if /stop\/waiting/;'
         ;;
     check)
         $0 status 2>&1 >/dev/null || {
diff --git a/modules/rcstream/files/rcstreamctl 
b/modules/rcstream/files/rcstreamctl
index 988d814..bffb2fb 100755
--- a/modules/rcstream/files/rcstreamctl
+++ b/modules/rcstream/files/rcstreamctl
@@ -7,7 +7,8 @@
 case "$command" in
     status)
         initctl list | grep -Po '(?<=rcstream/)(?!init).*' | sort -k5 \
-                | sed 's/, process//' | column -ts'( )'
+                | sed 's/, process//' | column -ts'( )' \
+                | perl -pe 'END { exit $status } $status=1 if /stop\/waiting/;'
         ;;
     start)
         initctl emit rcstream.start
diff --git a/modules/uwsgi/files/uwsgictl b/modules/uwsgi/files/uwsgictl
index 88d957c..e9ee706 100755
--- a/modules/uwsgi/files/uwsgictl
+++ b/modules/uwsgi/files/uwsgictl
@@ -6,7 +6,8 @@
 shift
 case "$command" in
     status)
-        initctl list | grep -P '^uwsgi/(?!init)' | sort
+        initctl list | grep -P '^uwsgi/(?!init)' | sort | \
+            perl -pe 'END { exit $code } $code=1 if /stop\/waiting/;'
         ;;
     check)
         $0 status 2>&1 >/dev/null || {

-- 
To view, visit https://gerrit.wikimedia.org/r/133180
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91672ef280129904cc2f3118b61a06b3f63754a9
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to