error: Type mismatch on rhs - expected type f for boolean constraint 'perms'

53 views
Skip to first unread message

Christian Linden

unread,
May 2, 2016, 11:22:27 AM5/2/16
to help-cfengine
Hi,

This worked well:

bundle agent printlines
{
        files:
          "/srv/www/htdocs/oo-data/hslinux-$(sys.fqhost).substatus"
                perms => system,
                create => "true";

}

body perms system
{
        mode => "0640";
}

I just switched to another namespace before this and get now the error.. 
Please advice.. 

Cheers,
Chris

Nick Anderson

unread,
May 2, 2016, 11:24:48 AM5/2/16
to Christian Linden, help-cfengine
On 05/02/2016 10:22 AM, Christian Linden wrote:
> I just switched to another namespace before this and get now the error..
> Please advice..

When you are not in the default namespace you will need to specify it
when your using bodies or bundles from the default namespace.

try this:

body file control
{
namespace => "my_non_default_namespace";
}

bundle agent printlines
{
files:
"/srv/www/htdocs/oo-data/hslinux-$(sys.fqhost).substatus"
perms => default:system,
create => "true";

}

signature.asc

Christian Linden

unread,
May 2, 2016, 11:32:26 AM5/2/16
to help-cfengine, lindo...@gmail.com
did that.. still same..

Nick Anderson

unread,
May 2, 2016, 11:34:23 AM5/2/16
to Christian Linden, help-cfengine
On 05/02/2016 10:32 AM, Christian Linden wrote:
> did that.. still same..

Try posting a self contained example.

signature.asc

Christian Linden

unread,
May 2, 2016, 11:43:29 AM5/2/16
to help-cfengine, lindo...@gmail.com
body file control
{
        namespace => "MySpace";
}

bundle agent damned_rhs
{
        files:
          "/srv/www/htdocs/oo-data/hslinux-$(sys.fqhost).substatus"
                perms => default:system,
                create => "true";
}

body perms system
{
        mode => "0640";
}

 cf-promises
/var/cfengine/inputs/R4Promises/damned_rhs.cf:10:0: error: Undefined body system with type perms


c

Christian Linden

unread,
May 2, 2016, 12:10:10 PM5/2/16
to help-cfengine, lindo...@gmail.com
In the below example:
the body perms system is defined in the MySpace namespace and hence should
be found within it w/o default:system but just perms => system, right?

c

Nick Anderson

unread,
May 2, 2016, 12:15:38 PM5/2/16
to help-c...@googlegroups.com
On 05/02/2016 11:10 AM, Christian Linden wrote:
> In the below example:
> the body perms system is defined in the MySpace namespace and hence should
> be found within it w/o default:system but just perms => system, right?

I mis-read initially. I thought you were trying to include =body perms
system=
from the default namespace. You have defined =body perms system= after the
namespace declaration in that file, so you need to specify the "MySpace"
namespace for the body.

#+begin_src cfengine3 :tangle /tmp/using_namespaced_body.cf
body file control
{
inputs => {
"$(sys.libdir)/stdlib.cf",
};
}
bundle agent main
{
methods:
"" usebundle => MySpace:stuff;
}

body file control
{
namespace => "MySpace";
}

bundle agent stuff
{
files:
"/tmp/$(sys.fqhost).substatus"
perms => MySpace:system,
create => "true";
}

body perms system
{
mode => "0640";
}
#+end_src

#+BEGIN_SRC sh :results raw :exports both
cf-agent -KIf /tmp/using_namespaced_body.cf
#+END_SRC
#+RESULTS:
info: Created file '/tmp/nickanderson-thinkpad-w550s.substatus',
mode 0640





signature.asc

Christian Linden

unread,
May 3, 2016, 1:29:44 PM5/3/16
to help-cfengine
Got that solved out a bit.. but need some more practise... 
Not sure yet what the difference is to put the file control namespace ahead of the bundle containing
the method calls or below..

Cheers,
Chris

Ted Zlatanov

unread,
May 4, 2016, 10:35:06 AM5/4/16
to help-c...@googlegroups.com
On Tue, 3 May 2016 10:29:43 -0700 (PDT) Christian Linden <lindo...@gmail.com> wrote:

CL> Got that solved out a bit.. but need some more practise...
CL> Not sure yet what the difference is to put the file control namespace ahead
CL> of the bundle containing
CL> the method calls or below..

The order matters. Think of it as "from here on, the namespace is X"
instead of "this whole file's namespace is X."

Ted

Christian Linden

unread,
May 5, 2016, 5:58:41 AM5/5/16
to help-c...@googlegroups.com
Thanks Ted, no idea yet what (whole file in seperate namespace or ahead of bundle/s) to
use when and whatfor. Actually I need to access the resultclasses from a bundle in promise-a.cf
in a bundle promise-b.cf

If a bundle in a specific namespace is called via a method and the next method calls the bundle
below the first one is the 2nd in the same namespace or do I have to put a file control ahead
each bundle? Is a namespace inherited as well if inheritance => true?

Cheers,
Chris

Nick Anderson

unread,
May 5, 2016, 9:01:02 AM5/5/16
to help-c...@googlegroups.com, Christian Linden
Body file control manages namespaces not the calling bundle.

When you have body file control introduce a namespace it applies for the rest to that file, or until you introduce a new body file control namespace (similar to promise types and classes).

Sent from my mobile device.
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to help-cfengin...@googlegroups.com.
To post to this group, send email to help-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/help-cfengine.
For more options, visit https://groups.google.com/d/optout.

Christian Linden

unread,
May 6, 2016, 9:01:59 AM5/6/16
to Nick Anderson, help-c...@googlegroups.com
Why do I need to „address“ (in another than the default-namespace) results, classes_generic etc
with the default: prefix but not the expressions like fileexists or strcmp? Why are those found?
=)

c

Nick Anderson

unread,
May 6, 2016, 9:41:25 AM5/6/16
to Christian Linden, Nick Anderson, help-c...@googlegroups.com
On 05/06/2016 08:01 AM, Christian Linden wrote:
> Why do I need to „address“ (in another than the default-namespace)
> results, classes_generic etc

results and classes_generic are both *bodies* that are defined *in policy*.

https://docs.cfengine.com/lts/reference-standard-library-common.html#results

> with the default: prefix but not the expressions like fileexists or
> strcmp? Why are those found?

fileexists() and strcmp() are *functions* not *policy*
https://docs.cfengine.com/lts/reference-functions.html

signature.asc

Christian Linden

unread,
May 6, 2016, 10:57:34 AM5/6/16
to help-cfengine, lindo...@gmail.com, nick.a...@cfengine.com
interesting =)
Reply all
Reply to author
Forward
0 new messages