Convert the group id to the group name on this system

    gid
        gid to convert to a group name

    CLI Example:

    .. code-block:: bash

        salt '*' file.gid_to_group 0
760419
def gid_to_group(gid):
    '''
    
    '''
    try:
        gid = int(gid)
    except ValueError:
        # This is not an integer, maybe it's already the group name?
        gid = group_to_gid(gid)

    if gid == '':
        # Don't even bother to feed it to grp
        return ''

    try:
        return grp.getgrgid(gid).gr_name
    except (KeyError, NameError):
        # If group is not present, fall back to the gid.
        return gid
490140
def members(name, members_list):
    '''
    
    '''
    retcode = 1
    grp_info = __salt__['group.info'](name)
    if grp_info and name in grp_info['name']:
        cmd = '/usr/bin/dscl . -delete /Groups/{0} GroupMembership'.format(name)
        retcode = __salt__['cmd.retcode'](cmd) == 0
        for user in members_list.split(','):
            cmd = '/usr/bin/dscl . -merge /Groups/{0} GroupMembership {1}'.format(name, user)
            retcode = __salt__['cmd.retcode'](cmd)
            if not retcode == 0:
                break
            # provided list is '': users previously deleted from group
            else:
                retcode = 0

    return retcode == 0
203460
def create_filebase_name(self, group_info, extension='gz', file_name=None):
        
        dirname = self.filebase.formatted_dirname(groups=group_info)
        if not file_name:
            file_name = self.filebase.prefix_template + '.' + extension
        return dirname, file_name
526128
def map_gid(self, tiled_gid):
        
        try:
            return self.gidmap[int(tiled_gid)]
        except KeyError:
            return None
        except TypeError:
            msg = "GIDs must be an integer"
            logger.debug(msg)
            raise TypeError
168366
def delete(name):
    '''
    
    '''
    if salt.utils.stringutils.contains_whitespace(name):
        raise SaltInvocationError('Group name cannot contain whitespace')
    if name.startswith('_'):
        raise SaltInvocationError(
            'Salt will not remove groups beginning with underscores'
        )
    if not info(name):
        return True
    cmd = ['dseditgroup', '-o', 'delete', name]
    return __salt__['cmd.retcode'](cmd, python_shell=False) == 0
1158255
public static String getGroupName(long gid) throws IOException {
    if (OSUtils.isLinux()) {
      String script = "getent group " + gid + " | cut -d: -f1";
      return ShellUtils.execCommand("bash", "-c", script).trim();
    } else if (OSUtils.isMacOS()) {
      String script = "dscl . list /Groups PrimaryGroupID | awk '($2 == \""
          + gid + "\") { print $1 }'";
      return ShellUtils.execCommand("bash", "-c", script).trim();
    }
    return "";
  }
1126917
def set_group_name(self, group, old_name, new_name):
        
        lgroup = self._get_group(old_name)
        rename(lgroup, database=self._database, cn=new_name)
957309
def getGroupIDs(self, groupNames,communityInfo=None):
        
        group_ids=[]
        if communityInfo is None:
            communityInfo = self.communitySelf

        if isinstance(groupNames,list):
            groupNames = map(str.upper, groupNames)
        else:
            groupNames = groupNames.upper()
        if 'groups' in communityInfo:
            for gp in communityInfo['groups']:

                if str(gp['title']).upper() in groupNames:
                    group_ids.append(gp['id'])
        del communityInfo
        return group_ids
912465
def get_secgroup_id(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The get_secgroup_id function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    if name is None:
        raise SaltCloudSystemExit(
            'The get_secgroup_id function requires a \'name\'.'
        )

    try:
        ret = list_security_groups()[name]['id']
    except KeyError:
        raise SaltCloudSystemExit(
            'The security group \'{0}\' could not be found.'.format(name)
        )

    return ret
229845
function rename_group($gid, $name, &$new_gid)
    {
        // make sure we have a unique name
        $name = $this->unique_groupname($name);

        $sql_result = $this->db->query(
            "UPDATE " . $this->db->table_name($this->db_groups, true).
            " SET `name` = ?, `changed` = ".$this->db->now().
            " WHERE `contactgroup_id` = ?".
                " AND `user_id` = ?",
            $name, $gid, $this->user_id
        );

        return $this->db->affected_rows($sql_result) ? $name : false;
    }
660176
def create_group(self, name):
        
        name = to_text(name)
        return self.post(
            url="https://api.weixin.qq.com/cgi-bin/groups/create",
            data={"group": {
                "name": name
            }}
        )
609199
def do_group(self):
        
        group_id = self.config.group
        systems = {'machine_id': generate_machine_id()}
        self.group_systems(group_id, systems)
1190759
def get_group(self, group_id):
    

    group = self.group_id_map.get(group_id)

    if group:
      return group

    self.logger.error('Group ID "%s" is not in datafile.' % group_id)
    self.error_handler.handle_error(exceptions.InvalidGroupException(enums.Errors.INVALID_GROUP_ID_ERROR))
    return None
1083889
def NameGroups(data_arr,id_key):
		
		new_data_arr = []
		for data in data_arr:
			try:
				data_arr[id_key] = clc._GROUP_MAPPING[data[id_key]]
			except:
				pass
			new_data_arr.append(data)
		if clc.args:  clc.v1.output.Status("ERROR",2,"Group name conversion not yet implemented")
		return(new_data_arr)
514112
def cli(ctx, group, user):
    
    return ctx.gi.users.add_to_group(group, user)
200504
public CommandGroup getCommandGroup(String groupId) {
        
        if (logger.isDebugEnabled()) {
            logger.debug("Attempting to retrieve command group with id ["
                         + groupId
                         + "] from the command registry.");
        }
        
        Object command = getCommand(groupId, CommandGroup.class);
        
        return (CommandGroup) command;
        
    }
1269942
def group_to_gid(group):
    '''
    
    '''
    if group is None:
        return ''
    try:
        if isinstance(group, int):
            return group
        return grp.getgrnam(group).gr_gid
    except KeyError:
        return ''