mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #9293 from hulu/hadoop-fixes
fix various lint errors in hadoop module
This commit is contained in:
commit
81a4447853
@ -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']
|
||||
|
||||
@ -56,13 +49,13 @@ 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):
|
||||
@ -96,9 +89,9 @@ 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):
|
||||
'''
|
||||
@ -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):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user