integ/config/puppet-5.5.22/debian/patches/0002-Set-hasstatus-to-false-by-default.patch
Charles Short 99e0438c90 Add debian infrastructure for puppet
Add debian packaging directory to build puppet 5.5.22 for starlingx.

Story: 2009101
Task: 43247

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: If2f36cd2781f4d1485f1b47c510f415014ad2d43
2021-10-21 08:19:54 -04:00

52 lines
1.8 KiB
Diff

From 2bf29aea0a6320c67e10400c97b69c6427e49044 Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Fri, 30 Dec 2016 10:59:44 -0500
Subject: [PATCH 2/5] 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.
Signed-off-by: Robert Church <robert.church@windriver.com>
---
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 3ab27b3..6b82baa 100644
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -99,7 +99,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 a4e835e..0e6db86 100644
--- a/lib/puppet/type/service.rb
+++ b/lib/puppet/type/service.rb
@@ -152,7 +152,8 @@ module Puppet
newvalues(:true, :false)
- defaultto :true
+ # StarlingX: Change hasstatus default to false
+ defaultto :false
end
newparam(:name) do
desc <<-EOT
--
2.16.6