(self, group, gid, users=None)
return FileUtil(self.group_file).putdata(line, 'a')
Add a group to a /etc/passwd file
Add a group to a /etc/passwd file
Add a group to a / etc / passwd file
def add_group(self, group, gid, users=None):
        """Add a group to a /etc/passwd file"""
        users_str = ""
        if isinstance(users, list):
            for username in users:
                users_str += "%s," % (username)
        line = "%s:x:%s:%s\n" % (group, gid, users_str)
        if line in FileUtil(self.group_file).getdata('r'):
            return True
        return FileUtil(self.group_file).putdata(line, 'a')
def add_group ( self , group , gid , users = None ) : users_str = "" if isinstance ( users , list ) : for username in users : users_str += "%s," % ( username ) line = "%s:x:%s:%s\n" % ( group , gid , users_str ) if line in FileUtil ( self . group_file ) . getdata ( 'r' ) : return True return FileUtil ( self . group_file ) . putdata ( line , 'a' )