Command return value in cfengine 3.2

18 views
Skip to first unread message

Bob

unread,
Jun 18, 2015, 12:26:47 PM6/18/15
to help-c...@googlegroups.com
First, I am working to upgrade to cfengine 3.6.

However, I am using cfengine 3.2 now. I need to run a command to check if the kernel on disk matches the kernel that is running. The command has 3 return values:

0 means they match
1 means they do no match
anything else means the result could not be determined

Is there a way with cfengine 3.2 I can detect all 3 of these conditions?

Ted Zlatanov

unread,
Jun 18, 2015, 1:07:38 PM6/18/15
to help-c...@googlegroups.com
On Thu, 18 Jun 2015 09:26:47 -0700 (PDT) Bob <buha...@gmail.com> wrote:

B> However, I am using cfengine 3.2 now. I need to run a command to check if
B> the kernel on disk matches the kernel that is running. The command has 3
B> return values:

B> 0 means they match
B> 1 means they do no match
B> anything else means the result could not be determined

B> Is there a way with cfengine 3.2 I can detect all 3 of these conditions?

You can use the three possible sets of return codes
(kept/failed/repaired):
https://docs.cfengine.com/docs/3.5/reference-promise-types.html#kept_returncodes

Ted

Neil Watson

unread,
Jun 18, 2015, 1:12:39 PM6/18/15
to help-c...@googlegroups.com
Does that work in 3.2? If not write a module to output classes based on
your results.
https://docs.cfengine.com/latest/reference-promise-types-commands.html#module

--
Neil H Watson
Sr. Partner, Architecture and Infrastructure
CFEngine reporting: https://github.com/evolvethinking/delta_reporting
CFEngine policy: https://github.com/evolvethinking/evolve_cfengine_freelib
CFEngine and vim: https://github.com/neilhwatson/vim_cf3
CFEngine support: http://evolvethinking.com

Ted Zlatanov

unread,
Jun 18, 2015, 1:29:42 PM6/18/15
to help-c...@googlegroups.com
On Thu, 18 Jun 2015 13:12:36 -0400 Neil Watson <cfen...@watson-wilson.ca> wrote:

NW> On Thu, Jun 18, 2015 at 01:07:17PM -0400, Ted Zlatanov wrote:
>> On Thu, 18 Jun 2015 09:26:47 -0700 (PDT) Bob <buha...@gmail.com> wrote:
B> 0 means they match
B> 1 means they do no match
B> anything else means the result could not be determined
>>
B> Is there a way with cfengine 3.2 I can detect all 3 of these conditions?
>>
>> You can use the three possible sets of return codes
>> (kept/failed/repaired):
>> https://docs.cfengine.com/docs/3.5/reference-promise-types.html#kept_returncodes

NW> Does that work in 3.2? If not write a module to output classes based on
NW> your results.
NW> https://docs.cfengine.com/latest/reference-promise-types-commands.html#module

According to the docs these body attributes were introduced in 3.1.3.

Ted

Bob

unread,
Jun 18, 2015, 2:46:42 PM6/18/15
to help-c...@googlegroups.com
In this case, I think the module is a better solution because no real repair can be done.

I appreciate both suggestions.


Reply all
Reply to author
Forward
0 new messages