def _hadoop_cmd(module, command, *args):
    '''
       Hadoop command wrapper

       In order to prevent random execution the module name is checked

       Follows hadoop command template:
          hadoop module -command args
       E.g.: hadoop dfs -ls /
    '''
    out = None
    if module and command:
        if module in __authorized_modules__:
            cmd = 'hadoop {0} -{1} {2}'.format(module, command, ' '.join(args))
            out = __salt__['cmd.run'](cmd, python_shell=False)
        else:
            return 'Error: Unknown module'
    else:
        return 'Error: Module and command not defined'
    return out
dataset/ETHPy150Open saltstack/salt/salt/modules/hadoop.py/_hadoop_cmd/original