> I'm agree with you, executing commands will never be convergent, filexist 
> isn't enought too (it doesn't ensure that is a device). For me, cfengine has 
> a lack in *nix device management. I don't really like to run mknod each time 
> but you're right, it seems to be the only things to do to ensure right 
> configuration.

You *could* capture output of "ls -l" using execresult() function, and
then use regcmp() function to compare it to the correct pattern for
the device in question.

For example, on my system:

[tsalolia@tashkent ~]$ ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Nov 21  2011 /dev/null
[tsalolia@tashkent ~]$

The pattern I would compare against is:

^c\S+ \d+ root root 1, 3 .* /dev/null

That would check that it's a character special file, owned by user
root and group root, and with device numbers 1 and 3.

So you can set a class based on the result of regcmp.


That said, it would be nice to be able to create device files natively.

I could envision that as an "mknod" attribute of "files" type promise,
where it's values are the type (character or block) and the major and
minor numbers.  Or perhaps a few of attributes:
"special_file" with possible values "character" or "block"; and
"mknod_major" and "mknod_minor" of type int.  I'll leave that to the
language designers.

Best,
-at
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to