

def group_mod(name, new_name, gid):
    cmd = ['/usr/sbin/groupmod']
    if new_name:
        cmd += ['--new-name', ('%s' % new_name)]
    if gid:
        cmd += ['--gid', ('%s' % gid)]
    cmd.append(name)
    ret = exec_cmd(' '.join(cmd))
    if (ret['returncode'] != 0):
        raise ResourceException(ret['stderr'])

dataset/ETHPy150Open comodit/synapse-agent/synapse/resources/groups-plugin/unix-groups.py group_mod/original