code: def _getgrnam(name, root=None):
      '''
      Alternative implementation for getgrnam, that use only /etc/group
      '''
      root = root or '/'
      passwd = os.path.join(root, 'etc/group')
      with salt.utils.files.fopen(passwd) as fp_:
          for line in fp_:
              line = salt.utils.stringutils.to_unicode(line)
              comps = line.strip().split(':')
              if len(comps) < 4:
                  log.debug('Ignoring group line: %s', line)
                  continue
              if comps[0] == name:
                  # Generate a getpwnam compatible output
                  comps[2] = int(comps[2])
                  comps[3] = comps[3].split(',') if comps[3] else []
                  return grp.struct_group(comps)
      raise KeyError('getgrnam(): name not found: {}'.format(name)f _getgrnam(name, root=None):
      '''
      Alternative implementation for getgrnam, that use only /etc/group
      '''
      root = root or '/'
      passwd = os.path.join(root, 'etc/group')
      with salt.utils.files.fopen(passwd) as fp_:
          for line in fp_:
              line = salt.utils.stringutils.to_unicode(line)
              comps = line.strip().split(':')
              if len(comps) < 4:
                  log.debug('Ignoring group line: %s', line)
                  continue
              if comps[0] == name:
                  # Generate a getpwnam compatible output
                  comps[2] = int(comps[2])
                  comps[3] = comps[3].split(',') if comps[3] else []
                  return grp.struct_group(comps)
      raise KeyError('getgrnam(): name not found: {}'.format(name))
docs: Alternative implementation for getgrnam, that use only /etc/group