View difference between Paste ID: NNESbWuy and bJ6rDYsQ
SHOW: | | - or go back to the newest paste.
1
Running the underlying module command with cmd.retcode:
2
3
[root@hd-qa-apps1 salt]# salt-call cmd.retcode 'hdfs dfs -stat /tmp_salt';
4
[INFO    ] Executing command 'hdfs dfs -stat /tmp_salt' in directory '/root'
5
[INFO    ] output: 2014-06-20 01:01:05
6
local:
7
    0
8
[root@hd-qa-apps1 salt]# salt-call cmd.retcode 'hdfs dfs -stat /non-existent-dir'
9
[INFO    ] Executing command 'hdfs dfs -stat /non-existent-dir' in directory '/root'
10
[ERROR   ] Command 'hdfs dfs -stat /non-existent-dir' failed with return code: 1
11
[ERROR   ] output: stat: `/non-existent-dir': No such file or directory
12
local:
13-
    1
13+
    1
14
15
16
17
Execution the hadoop module with --out json:
18
19
[root@hd-qa-apps1 salt]# salt-call hadoop.dfs_absent /tmpasd --out json
20
[INFO    ] Executing command 'hdfs dfs -stat /tmpasd' in directory '/root'
21
[ERROR   ] Command 'hdfs dfs -stat /tmpasd' failed with return code: 1
22
[ERROR   ] output: stat: `/tmpasd': No such file or directory
23
{
24
    "local": true
25
}
26
[root@hd-qa-apps1 salt]# salt-call hadoop.dfs_absent /tmp --out json
27
[INFO    ] Executing command 'hdfs dfs -stat /tmp' in directory '/root'
28
[INFO    ] output: 2014-06-18 19:45:28
29
{
30
    "local": false
31
}