Users and groups are handled through "methods" typically. Check out the
solutions guide -
- which we are in the process of updating. Or look again in a week or so.There
are also
examples un the tests/units directory, but we are organizing all our info at
the moment.
(We have too much content!)
M
Andrew J. Millar wrote:
> Indeed, the internal function is great and makes much more sense - I wasn't
> aware there was one for packages (have only recently started using CFEngine
> properyl, so still learning the ropes).
>
> Is there a similar method for managing users and groups? I had come up
> with the following (similar lines to what I had started trying to do
> with rpms), but I want it to report when a user does not exist.
>
> My aim here is eventually have cfengine add any missing users/groups, and
> correct any wrong uids/gids:
>
> body common control
>
> {
> bundlesequence => { "usermanagement" };
> }
>
> ###########################################################
>
> bundle agent usermanagement
>
> {
> vars:
>
> linux::
> "users" slist => {
> "root",
> "test2",
> };
>
> "id[root]" int => "0";
> "id[test2]" int => "3001";
>
>
> "users_exist" string => canonify(userexists("$(users)")),
> comment => "Check if $(users) exist";
>
> reports:
>
>
> linux::
> "/bin/echo $(users) exists",
> ifvarclass => canonify(userexists("$(users)"));
>
> "/bin/echo $(users) UID and GID is $(id[$(users)])";
>
> }
>
> On Thu, Feb 04, 2010 at 02:11:47PM +0100, Mark Burgess wrote:
>> Don't try to call shell commands, use the exit status of a "packages"
>> promise otherwise you are just writing a shell script and you lose all the
>> optimizations.
>> I don't have time to come up with an example right now, but perhaps this
>> will push you in
>> the right direction.
>>
>
>
> Shop spring’s building blocks at NET-A-PORTER.COM
> ______________________________________________________________________
>
> CONFIDENTIALITY NOTICE
> The information in this email is confidential and is intended solely for the
> addressee. Access to this email by anyone else is unauthorised. If you are
> not the intended recipient, you must not read, use or disseminate the
> information. Any views expressed in this message are those of the individual
> sender, except where the sender specifically states them to be the views of
> Net a Porter Ltd.
>
> Net A Porter Ltd is a company registered in England & Wales Number: 3820604
> Registered Office: The Dome, Whiteleys Centre, 151 Queensway, London, W2 4YN.
> _____________________________________________________________________
--
Mark Burgess
-------------------------------------------------
Professor of Network and System Administration
Oslo University College, Norway
Personal Web: http://www.iu.hio.no/~mark
Office Telf : +47 22453272
-------------------------------------------------
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine