Il giorno 13/lug/2013 11:40, "Michele Tartara" <[email protected]> ha scritto: > > > Il giorno 12/lug/2013 20:44, "Iustin Pop" <[email protected]> ha scritto: > > > > > On Fri, Jul 12, 2013 at 06:16:20PM +0200, Michele Tartara wrote: > > > The haskell library functions only allow to change file ownership using > > > uid/gid. A function for doing that with explicit names is added by this > > > commit. > > > > > > Signed-off-by: Michele Tartara <[email protected]> > > > > Hi Michele, > > Hi Iustin, > > > > > > +-- | Set the owner and the group of a file (given as names, not numeric id). > > > +setOwnerAndGroupFromNames :: FilePath -> String -> String -> IO () > > > +setOwnerAndGroupFromNames filename username groupname = do > > > + let nameUid = fmap userID (getUserEntryForName username) > > > + nameGid = fmap groupID (getGroupEntryForName groupname) > > > + uid <- nameUid > > > + gid <- nameGid > > > + setOwnerAndGroup filename uid gid > > > > Do you really need this to be generic? For ganeti-specific users, you > > could/should use instead Runtime.hs/getEnts and the users/group maps it > > returns, so that all name resolving is in a single place. Especially at > > runtime, after the daemons have started, we should try to avoid user > > lookups as depending on the nsswitch configuration this could have > > arbitrary delays. > > > > iustin > > Of course, doing is for Ganeti users only is more than enough, but I didn't know we had uids and gods cached already.
s/gods/gids/ Bad idea replying from the cellphone :-p > > Thanks for pointing it out, I'll modify the function to use them. > > Thanks, > Michele
