From 0796ab2164af2d11da7617187c9c496a2e733517 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 16 Dec 2013 10:58:28 -0800 Subject: [PATCH] fix various lint errors in hadoop module --- salt/modules/hadoop.py | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/salt/modules/hadoop.py b/salt/modules/hadoop.py index bb2262ccb2..217880483a 100644 --- a/salt/modules/hadoop.py +++ b/salt/modules/hadoop.py @@ -10,15 +10,8 @@ Support for hadoop ''' -# Import python libs -import os -import sys -import shlex - # Import salt libs import salt.utils -from salt.state import STATE_INTERNAL_KEYWORDS as _STATE_INTERNAL_KEYWORDS -from salt.exceptions import SaltException __authorized_modules__ = ['namenode', 'dfsadmin', 'dfs', 'fs'] @@ -46,7 +39,7 @@ def version(): def _hadoop_cmd(module, command, *args): ''' - Hadoop command wrapper + Hadoop command wrapper In order to prevent random execution the module name is checked @@ -56,21 +49,21 @@ def _hadoop_cmd(module, command, *args): ''' out = None if module and command: - if module in __authorized_modules__: - cmd = 'hadoop %s -%s %s' % (module, command, ' '.join(args)) - out = __salt__['cmd.run'](cmd) - else: - return 'Error: Unknown module' + if module in __authorized_modules__: + cmd = 'hadoop %s -%s %s' % (module, command, ' '.join(args)) + out = __salt__['cmd.run'](cmd) + else: + return 'Error: Unknown module' else: - return 'Error: Module and command not defined' + return 'Error: Module and command not defined' return out def dfs(command=None, *args): ''' Execute a command on DFS - CLI Example: - + CLI Example: + .. code-block:: bash salt '*' hadoop.dfs ls / @@ -83,7 +76,7 @@ def dfs(command=None, *args): def dfs_present(path): ''' Check if a file or directory is present on the distributed FS. - + CLI Example: .. code-block:: bash @@ -96,14 +89,14 @@ def dfs_present(path): cmd_return = _hadoop_cmd('dfs', 'stat', path) if 'No such file or directory' in cmd_return: - return False + return False else: - return True + return True def dfs_absent(path): ''' Check if a file or directory is absent on the distributed FS. - + CLI Example: .. code-block:: bash @@ -115,9 +108,9 @@ def dfs_absent(path): cmd_return = _hadoop_cmd('dfs', 'stat', path) if 'No such file or directory' in cmd_return: - return True + return True else: - return False + return False def namenode_format(force=None): '''