Had some strange experiences while trying to write some promises
concerning starting of Unix services (Community 3.0.2). Let me show some
examples:
28 commands:
29
30 "${daemon_path}/${service}"
31 comment => "Executing command '${daemon_path}/${service}
start'",
32 ifvarclass => "${service}_up",
33 args => "start";
This causes: "Body type mismatch for body reference "start" in promise at
line 31 of /var/cfengine/inputs/services.cf" when running cf-promises.
If I change this to
28 commands:
29
30 "${daemon_path}/${service}"
31 comment => "Executing command '${daemon_path}/${service}
start'",
32 ifvarclass => "${service}_up",
33 args => " start"; # space added before start
it's OK! Note that it's a different line number than complained by
cf-promises.
This variable definition
20 "start_args" string => "start";
causes cf-promises to issue: "Body type mismatch for body reference
"start" in promise at line 20 of /var/cfengine/inputs/services.cf".
Again if I add a space before 'start' or if I turn 'start' into any other
value, cf-promises does not complain.
What did I spot here (bug, feature, ...)? ;-)
For the sake of completeness here's the whole bundle:
15 bundle agent check_service_running {
16
17 vars:
18 "service" slist => {"ntp"};
19 "daemon_path" string => "/etc/init.d";
20 "start_args" string => "start";
21
22 processes:
23
24 # buildserver::
25 "$(service)"
26 comment => "Counting amount of processes for
'$(service)'",
27 process_count => up("$(service)");
28
29 commands:
30
31 "${daemon_path}/${service}"
32 comment => "Executing command '${daemon_path}/${service}
start'",
33 ifvarclass => "${service}_up",
34 args => " start";
35 }
36
37 body process_count up(s) {
38
39 match_range => "0,0";
40 in_range_define => {"$(s)_up"};
41 ifelapsed => "1";
42 }
Thanks in advance for any help!
Bernd
InterComponentWare AG:
Vorstand: Dr. Lutz Kleinholz (Vors.), Dr. Georg Ralle, Jörg Stadler /
Aufsichtsratsvors.: Prof. Dr. Christof Hettich
Firmensitz: 69190 Walldorf, Industriestraße 41 / AG Mannheim HRB 351761 /
USt.-IdNr.: DE 198388516 _______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine