integ/config/puppet-4.8.2/centos/patches/1002-Set-hasstatus-to-false-by-default.patch
slin14 c745dcef93 de-fuzz puppet patch
With rpm version < 4.13, patch cmd will create .orig file for fuzzy
patch in default. And this .orig file may lead to rpmbuild failure
"error: Installed (but unpackaged) file(s) found:"

Please visit below link to get more detail info:
https://bugs.launchpad.net/starlingx/+bug/1794611

Story: 2003917
Task: 26965

Change-Id: I3d68b3008688d4b32957f4ba335dea5207a4be65
Signed-off-by: slin14 <shuicheng.lin@intel.com>
2018-10-09 23:01:46 +08:00

50 lines
1.8 KiB
Diff

From 3e0ed33dcd0871fbccefd5b561f41fb46c35e32a Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Fri, 30 Dec 2016 10:59:44 -0500
Subject: Set hasstatus to false by default
Many of the WR init scripts do not have proper status functions,
so set "hasstatus" to false by default.
---
lib/puppet/provider/service/init.rb | 9 ++++++++-
lib/puppet/type/service.rb | 3 ++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index 2806ee0..17f727a 100644
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -98,7 +98,14 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
next if exclude.include? name
next if not FileTest.executable?(fullpath)
next if not is_init?(fullpath)
- instances << new(:name => name, :path => path, :hasstatus => true)
+
+ # Try to determine whether the init script has "status" support via grep
+ grepcmd = "grep -q '\\<status)' #{fullpath} 2>/dev/null && echo true || echo false"
+ if Puppet::Util::Execution.execute(grepcmd) =~ /true/
+ instances << new(:name => name, :path => path, :hasstatus => true)
+ else
+ instances << new(:name => name, :path => path, :hasstatus => false)
+ end
end
end
instances
diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb
index 1f8d266..61498b5 100644
--- a/lib/puppet/type/service.rb
+++ b/lib/puppet/type/service.rb
@@ -154,7 +154,8 @@ module Puppet
newvalues(:true, :false)
- defaultto :true
+ # WRS: Change hasstatus default to false
+ defaultto :false
end
newparam(:name) do
desc <<-EOT
--
2.7.4