Re: user list
thierry thunot <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
Thank you very much for your answer it's great Le mardi 3 janvier 2023 à 23:40:39 UTC+1, [email protected] a écrit : > 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 <(785)%20550-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/2fe092aa-08fe-4a04-a0a5-6c35f509a641n%40googlegroups.com.