

def chgid(name, gid):
    "\n    Change the default group of the user\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' user.chgid foo 4376\n    "
    pre_info = info(name)
    if (not pre_info):
        raise CommandExecutionError("User '{0}' does not exist".format(name))
    if (gid == pre_info['gid']):
        return True
    cmd = ['pw', 'usermod', '-g', gid, '-n', name]
    __salt__['cmd.run'](cmd, python_shell=False)
    return (info(name).get('gid') == gid)

dataset/ETHPy150Open saltstack/salt/salt/modules/pw_user.py chgid/original