[PATCH/puppet 0/2] Minor Red Hat initscript fixes

3 views
Skip to first unread message

Todd Zullinger

unread,
Aug 8, 2009, 11:37:03 PM8/8/09
to puppe...@googlegroups.com
We talked about the first patch a while back¹ and I started to rewrite
the initscripts to be better compliant with current Fedora/Red Hat
packaging guidelines, using LSB headers and return codes, etc. I've
yet to make time to finish that properly, but I think these two fixes
are worth having for 0.25.0.

¹ http://groups.google.com/group/puppet-dev/browse_thread/thread/c3767380b2420bb7

Todd Zullinger (2):
conf/redhat/client.init: Fix #2123, status options on older RHEL
conf/redhat/*.init: Fix condrestart/try-restart

conf/redhat/client.init | 15 ++++++++++++---
conf/redhat/server.init | 11 ++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)

Todd Zullinger

unread,
Aug 8, 2009, 11:37:04 PM8/8/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
also reported by Aaron Dummer in Red Hat bug #501577.

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

diff --git a/conf/redhat/client.init b/conf/redhat/client.init
index 114fb18..bccb45c 100644
--- a/conf/redhat/client.init
+++ b/conf/redhat/client.init
@@ -62,6 +62,11 @@ restart() {
start
}

+rh_status() {
+ status | grep -q -- '-p' 2>/dev/null && statusopts="-p $pidfile"
+ status $statusopts $puppetd
+}
+
genconfig() {
echo -n $"Generate configuration puppet: "
$puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} --genconfig
@@ -84,8 +89,7 @@ case "$1" in
[ -f "$pidfile" ] && restart
;;
status)
- status -p "$pidfile" $puppetd
- RETVAL=$?
+ rh_status
;;
once)
shift
--
1.6.4

Todd Zullinger

unread,
Aug 8, 2009, 11:37:05 PM8/8/09
to puppe...@googlegroups.com
Previously, the Red Hat init scripts used the $pidfile or $lockfile as a
test for whether to restart the daemons. This caused condrestart to
start the daemons even when they were not running, in cases where they
had died or been killed without cleaning up the $pidfile/$lockfile.

This was reported by Ingvar Hagelund in Red Hat bug #480600.

Signed-off-by: Todd Zullinger <t...@pobox.com>
---

conf/redhat/client.init | 7 ++++++-
conf/redhat/server.init | 11 ++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/conf/redhat/client.init b/conf/redhat/client.init
index bccb45c..401151c 100644
--- a/conf/redhat/client.init
+++ b/conf/redhat/client.init
@@ -67,6 +67,10 @@ rh_status() {
status $statusopts $puppetd
}

+rh_status_q() {
+ rh_status >/dev/null 2>&1


+}
+
genconfig() {
echo -n $"Generate configuration puppet: "
$puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} --genconfig

@@ -86,7 +90,8 @@ case "$1" in
reload
;;
condrestart|try-restart)
- [ -f "$pidfile" ] && restart
+ rh_status_q || exit 0
+ restart
;;
status)
rh_status
diff --git a/conf/redhat/server.init b/conf/redhat/server.init
index 8f05387..4bc44b9 100644
--- a/conf/redhat/server.init
+++ b/conf/redhat/server.init
@@ -89,7 +89,7 @@ genconfig() {
$PUPPETMASTER $PUPPETMASTER_OPTS --genconfig
}

-puppetmaster_status() {
+rh_status() {
if [ -n "$PUPPETMASTER_PORTS" ] && [ ${#PUPPETMASTER_PORTS[@]} -gt 1 ]; then
for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
echo -en "Port ${PUPPETMASTER_PORTS[$i]}: "
@@ -103,6 +103,10 @@ puppetmaster_status() {
return $RETVAL
}

+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
case "$1" in
start)
start
@@ -114,10 +118,11 @@ case "$1" in
restart
;;
condrestart)
- [ -f "$lockfile" ] && restart
+ rh_status_q || exit 0
+ restart
;;
status)
- puppetmaster_status
+ rh_status
;;
genconfig)
genconfig
--
1.6.4

Todd Zullinger

unread,
Aug 9, 2009, 9:25:57 AM8/9/09
to puppe...@googlegroups.com
James,

I forgot to mention that these patches are available at
git://jet.mox.net/~tmz/puppet.git on the feature/master/initscripts
branch.

--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I could never recommend the use of drugs or alcohol to anyone, but
they've always worked for me.
-- Hunter S. Thompson

James Turnbull

unread,
Aug 10, 2009, 8:19:55 PM8/10/09
to puppe...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Todd Zullinger wrote:
> James,
>
> I forgot to mention that these patches are available at
> git://jet.mox.net/~tmz/puppet.git on the feature/master/initscripts
> branch.
>

Todd

Can you open a ticket for these and I'll mark it for 0.25.0.

Thanks

James Turnbull

- --
Author of:
* Pro Linux Systems Administration (http://tinyurl.com/linuxadmin)
* Pulling Strings with Puppet (http://tinyurl.com/pupbook)
* Pro Nagios 2.0 (http://tinyurl.com/pronagios)
* Hardening Linux (http://tinyurl.com/hardeninglinux)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKgLkr9hTGvAxC30ARAgkKAKCVMM4WRHfe5GVge8nHNdtwcr8lTwCgn9hq
WC1z5TjyKC/Te/R+sGes6Gg=
=T48S
-----END PGP SIGNATURE-----

Todd Zullinger

unread,
Aug 11, 2009, 12:06:58 AM8/11/09
to puppe...@googlegroups.com
Hi James,

James Turnbull wrote:
> Can you open a ticket for these and I'll mark it for 0.25.0.

I updated http://projects.reductivelabs.com/issues/2123 for the first
patch and created http://projects.reductivelabs.com/issues/2526 for
the second. Both are marked with 0.25.0 as the target version.

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

Sometimes I wonder whether the world is being run by smart people who
are putting us on or by imbeciles who really mean it.
-- Mark Twain

Luke Kanies

unread,
Aug 12, 2009, 3:15:37 AM8/12/09
to puppe...@googlegroups.com
+1
--
The Internet, of course, is more than just a place to find pictures of
people having sex with dogs. -- Time Magazine, 3 July 1995
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Luke Kanies

unread,
Aug 12, 2009, 3:16:21 AM8/12/09
to puppe...@googlegroups.com
I assume +1 here, because it seems to be all special Red Hat service
management stuff.

On Aug 8, 2009, at 8:37 PM, Todd Zullinger wrote:

>
--
You can't build a reputation on what you are going to do.
-- Henry Ford
Reply all
Reply to author
Forward
0 new messages