Bad choice: double or non body common control

124 views
Skip to first unread message

Christian Linden

unread,
Aug 10, 2015, 10:15:05 AM8/10/15
to help-cfengine
Hi,

if I run my promise solo, including:
body common control
 {
           bundlesequence => { "c04_collect_inventories"};
                  inputs => {"/var/cfengine/masterfiles/libraries/cfengine_stdlib.cf"};
 }

by: cf-agent -KIvf /var/cfengine/inputs/R4Promises/c04CollectInventories.cf

the cf-serverd log on the box I want to pull the file from tells me:
2015-08-10T16:02:32+0200  verbose: Checking policy with command '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/promises.cf"'
/var/cfengine/inputs/promises.cf:9:0: error: Duplicate definition of body control with type common
/var/cfengine/inputs/R4Promises/c04CollectInventories.cf:2:0: error: Duplicate definition of body control with type common
2015-08-10T16:02:32+0200    error: Policy failed validation with command '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/promises.cf"'

If I run it w/o:
the cf-serverd on the box I'm pulling from tells me:
2015-08-10T16:12:49+0200  verbose: Input file is outside default repository, validating it
2015-08-10T16:12:49+0200  verbose: Promises seem to change
2015-08-10T16:12:49+0200  verbose: Input file is changed since last validation, validating it
2015-08-10T16:12:49+0200  verbose: Verifying the syntax of the inputs...
2015-08-10T16:12:49+0200  verbose: Checking policy with command '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/R4Promises/c04CollectInventories.cf"'
:0:0: error: Policy is not runnable (does not contain a body common control)
2015-08-10T16:12:49+0200    error: Policy failed validation with command '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/R4Promises/c04CollectInventories.cf"'
unixha3:/home/clinden/cfengine_workbench/masterfiles #

So what? 

Chris

Nick Anderson

unread,
Aug 10, 2015, 10:31:16 AM8/10/15
to help-c...@googlegroups.com
On 08/10/2015 09:15 AM, Christian Linden wrote:
> Hi,
>
> if I run my promise solo, including:
> body common control
> {
> bundlesequence => { "c04_collect_inventories"};
> inputs =>
> {"/var/cfengine/masterfiles/libraries/cfengine_stdlib.cf"};
> }
>
> by: cf-agent -KIvf /var/cfengine/inputs/R4Promises/c04CollectInventories.cf
>
> the cf-serverd log on the box I want to pull the file from tells me:
> 2015-08-10T16:02:32+0200 verbose: Checking policy with command
> '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/promises.cf"'
> /var/cfengine/inputs/promises.cf:9:0: error: Duplicate definition of body
> control with type common

Duplicate definition of body control with type common indicates that you
have defined multiple body common controls. There is a body common ntrol
in /var/cfengine/inputs/promises.cf, but you have also added a body
common control into a policy file (that is probably included into your
policy from promises.cf).


There can be only one body common control (like highlander).

It looks like you added body common control to c04CollectInventories.cf
because you wanted to be able to use something from the standard library
and activate the policy file directly.

Christian Linden

unread,
Aug 10, 2015, 10:43:07 AM8/10/15
to help-cfengine
>>

Am Montag, 10. August 2015 16:31:16 UTC+2 schrieb Nick Anderson:
On 08/10/2015 09:15 AM, Christian Linden wrote:
> Hi,
>
> if I run my promise solo, including:
> body common control
>  {
>            bundlesequence => { "c04_collect_inventories"};
>                   inputs =>
> {"/var/cfengine/masterfiles/libraries/cfengine_stdlib.cf"};
>  }
>
> by: cf-agent -KIvf /var/cfengine/inputs/R4Promises/c04CollectInventories.cf
>
> the cf-serverd log on the box I want to pull the file from tells me:
> 2015-08-10T16:02:32+0200  verbose: Checking policy with command
> '"/var/cfengine/bin/cf-promises" -c "/var/cfengine/inputs/promises.cf"'
> /var/cfengine/inputs/promises.cf:9:0: error: Duplicate definition of body
> control with type common

Duplicate definition of body control with type common indicates that you
have defined multiple body common controls. There is a body common ntrol
in /var/cfengine/inputs/promises.cf, but you have also added a body
common control into a policy file (that is probably included into your
policy from promises.cf).

>> absolutely clear!! Added that to be able to run it seperately.


There can be only one body common control (like highlander).
 
>> absolutely clear!! 

It looks like you added body common control to c04CollectInventories.cf
because you wanted to be able to use something from the standard library
and activate the policy file directly.

But if I remove it from there I get the other message, that  there none defined.. aaaahhh just thinking.. then I can't run it separetly anymore.. =(
right?

Christian Linden

unread,
Aug 10, 2015, 10:44:22 AM8/10/15
to help-cfengine
But file is not being pulled.. cf-serverd logs are boring.. where can I get a hint?


Am Montag, 10. August 2015 16:31:16 UTC+2 schrieb Nick Anderson:

Christian Linden

unread,
Aug 10, 2015, 10:45:08 AM8/10/15
to help-cfengine
cf-serverd log on both boxes (puller and box to be pulled from) are both boring..

Nick Anderson

unread,
Aug 10, 2015, 10:49:00 AM8/10/15
to Christian Linden, help-cfengine
On 08/10/2015 09:43 AM, Christian Linden wrote:
> But if I remove it from there I get the other message, that there none
> defined.. aaaahhh just thinking.. then I can't run it separetly anymore.. =(
> right?

You can remove the extra body common control and then when you run your
policy you can manually specify the bundlesequence so that you only run
the one bundle you want to.

cf-agent --bundlesequence my_first_bundle,my_second_bundle

If you're running version 3.6 or later you can use body file control
inputs to include files as well.

body file control
{
inputs => { "$(sys.libdir)/stdlib.cf" };
}

Nick Anderson

unread,
Aug 10, 2015, 10:49:53 AM8/10/15
to Christian Linden, help-cfengine
On 08/10/2015 09:44 AM, Christian Linden wrote:
> But file is not being pulled.. cf-serverd logs are boring.. where can I get
> a hint?

I don't think your going to get any files being pulled until you first
resolve the duplicate definitions.

Christian Linden

unread,
Aug 10, 2015, 11:07:10 AM8/10/15
to help-cfengine, lindo...@gmail.com
did that already.. now neither get the file nor any hint..

Christian Linden

unread,
Aug 10, 2015, 11:08:54 AM8/10/15
to help-cfengine, lindo...@gmail.com
can I run cf-agent -vF as well?

Nick Anderson

unread,
Aug 10, 2015, 11:17:39 AM8/10/15
to Christian Linden, help-cfengine
On 08/10/2015 10:08 AM, Christian Linden wrote:
> can I run cf-agent -vF as well?

/var/cfengine/bin/cf-agent -v

Will run the agent in verbose mode

Christian Linden

unread,
Aug 10, 2015, 11:45:09 AM8/10/15
to Nick Anderson, help-cfengine
very good to know!

Christian Linden

unread,
Aug 10, 2015, 11:53:04 AM8/10/15
to Nick Anderson, help-cfengine
That helped.. put the server bundle into the agents bundlesequence in a special file here as well..
RESOLVED!

Thanks!
Reply all
Reply to author
Forward
0 new messages