[PATCH 2/2] conf/redhat/client.init: Check status accepts -p

2 views
Skip to first unread message

Todd Zullinger

unread,
May 31, 2009, 12:11:36 PM5/31/09
to puppe...@googlegroups.com
On RHEL < 5, the status function does not accept a -p option. Using it
causes 'service puppet status' to produce erroneous output. (This was
reported by Aaron Dummer as Red Hat bug #501577.)

Signed-off-by: Todd Zullinger <t...@pobox.com>
---
conf/redhat/client.init | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/conf/redhat/client.init b/conf/redhat/client.init
index 34c99aa..a6109c4 100644
--- a/conf/redhat/client.init
+++ b/conf/redhat/client.init
@@ -84,7 +84,10 @@ case "$1" in
[ -f "$pidfile" ] && restart
;;
status)
- status -p "$pidfile" $puppetd
+ if status | grep -q -- '-p' 2>/dev/null; then
+ statusopts="-p '$pidfile'"
+ fi
+ status $statusopts $puppetd
RETVAL=$?
;;
once)
--
1.6.3.1

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If everything seems to be going well, you have obviously overlooked
something.

Luke Kanies

unread,
May 31, 2009, 10:46:46 PM5/31/09
to puppe...@googlegroups.com
+1
--
It is absurd to divide people into good and bad. People are either
charming or tedious. -- Oscar Wilde
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

David Lutterkort

unread,
May 31, 2009, 11:21:06 PM5/31/09
to puppe...@googlegroups.com
On Sun, 2009-05-31 at 12:11 -0400, Todd Zullinger wrote:
> On RHEL < 5, the status function does not accept a -p option. Using it
> causes 'service puppet status' to produce erroneous output. (This was
> reported by Aaron Dummer as Red Hat bug #501577.)
>
> Signed-off-by: Todd Zullinger <t...@pobox.com>
> ---
> conf/redhat/client.init | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/conf/redhat/client.init b/conf/redhat/client.init
> index 34c99aa..a6109c4 100644
> --- a/conf/redhat/client.init
> +++ b/conf/redhat/client.init
> @@ -84,7 +84,10 @@ case "$1" in
> [ -f "$pidfile" ] && restart
> ;;
> status)
> - status -p "$pidfile" $puppetd
> + if status | grep -q -- '-p' 2>/dev/null; then
> + statusopts="-p '$pidfile'"
> + fi
> + status $statusopts $puppetd

Instead of doing this at runtime, couldn't we just patch client.init for
RHEL 4 ?

David


Todd Zullinger

unread,
May 31, 2009, 11:37:46 PM5/31/09
to puppe...@googlegroups.com
David Lutterkort wrote:
> Instead of doing this at runtime, couldn't we just patch client.init
> for RHEL 4 ?

Sure, if that's preferable, it's not a problem.

After I looked at the init scripts, I ran across another Red Hat bug
(#480600¹). I spent some time and updated the init scripts to add LSB
headers, the try-restart action, and exit code usage. Perhaps it's
better to hold off on this one and consider that slightly larger
change? If that sounds reasonable, I'll send an updated 2/2.

¹ https://bugzilla.redhat.com/480600

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Never argue with an idiot. First, they drag you down to their level,
then beat you with experience.
-- Ben Adams

David Lutterkort

unread,
Jun 1, 2009, 5:40:13 PM6/1/09
to puppe...@googlegroups.com
On Sun, 2009-05-31 at 23:37 -0400, Todd Zullinger wrote:
> David Lutterkort wrote:
> > Instead of doing this at runtime, couldn't we just patch client.init
> > for RHEL 4 ?
>
> Sure, if that's preferable, it's not a problem.
>
> After I looked at the init scripts, I ran across another Red Hat bug
> (#480600¹). I spent some time and updated the init scripts to add LSB
> headers, the try-restart action, and exit code usage. Perhaps it's
> better to hold off on this one and consider that slightly larger
> change? If that sounds reasonable, I'll send an updated 2/2.

Yes, I think a patch that addresses that bz would be very good -
thinking some more about the 'status -p' thing, maybe the cleanest
solution is to just hide the mechanics of calling status in a function
in the init script; that would avoid a RHEL4-specific patch, and still
keep the initscript pretty readable.

David


Reply all
Reply to author
Forward
0 new messages