Re: user list

"'Nick Anderson' via help-cfengine" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
thierry thunot <[email protected]> writes:


      I am facing a problem I am trying to filter my users and to
      establish a list of users whose UID is greater than 999.

      i used getusers but I feel like the function's uid filter
      doesn't apply.... i tried this solution : "allusers" slist
      => getusers("","0"); to have uid 0 but there is no result

      or "allusers" slist => getusers("","[1-9]{1,3}"); or have
      you got solution to extract all users whith UID greater than
      999???

I think the documentation isn't very clear about it. The list is a
string, specifically a comma separated string of uids to filter.

You can use `expandrange()' and `join()' to generate a comma separated
string of ids from 0 to 999 being used as a filter:

,----
| bundle agent __main__
| {
|   vars:
|     "users" slist => getusers( "", "");
|     "users_id_gt_999" slist => getusers( "", join( ",", expandrange( "[0-999]", 1 ) ) );
| }
`----
,----
| [root@hub masterfiles]# cf-agent -KIf ./example.cf --show-evaluated-vars=default:main\\.
| Variable name                            Variable value                                               Meta tags                                Comment
| default:main.users                        {"root","bin","daemon","adm","lp","sync","shutdown","halt","mail","operator","games","ftp","nobody","systemd-network","dbus","polkitd","rpc","tss","rpcuser","nfsnobody","sshd","postfix","chrony","vagrant","cfapache","cfpostgres"} source=promise
| default:main.users_id_gt_999              {"nfsnobody","vagrant"}                                     source=promise
`----


-- Nick Anderson | Doer of Things | (+1) 785-550-1767 |
<https://northern.tech>

-- 
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/87fscrfdi3.fsf%40northern.tech.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.