[stable/7.0]Improve 'run_on_remote' for more general use
Author: Maksym Strukov
To use method in cases when ec is expected to be not zero and reduce
duplicated code in asserts messages new parameters in 'run_on_remote'
method proposed with following logic:
* 'assert_ec_equal' with default '[0]'. Error message will be logged only
when exit_code != assert_ec_equal. Can pass xrange(1,8) or [1, 4, 5]
* 'raise_on_assert' with default 'True'. Exception now can be
surpressed when exit_code != assert_ec_equal if 'raiseOnAssert' is 'False'
Also:
* 'run_on_remote_get_results' return dict with:
'command',
'host',
'stdout',
'stdout_str',
'stdout_len',
'stdout_json', if jsonify=true
'stderr',
'stderr_str',
'stderr_len',
'exit_code', instead of just stdout string
* 'run_on_remote' wrapper leaved for compatibility
Change-Id: I32a9d743929d01857a88844976074df719d9880a
Closes-Bug: #1489165
(cherry picked from commit 32b6bc8cea5c595aa92e2c2c825762b53c49e191)
Reviewed: https:/ /review. openstack. org/224499 /git.openstack. org/cgit/ stackforge/ fuel-qa/ commit/ ?id=d27d5627ea8 21ccd486120d033 795d6f0c1ffe1a
Committed: https:/
Submitter: Jenkins
Branch: stable/7.0
commit d27d5627ea821cc d486120d033795d 6f0c1ffe1a
Author: Maksym Strukov <email address hidden>
Date: Wed Aug 26 23:59:36 2015 +0300
[stable/ 7.0]Improve 'run_on_remote' for more general use
Author: Maksym Strukov
To use method in cases when ec is expected to be not zero and reduce
duplicated code in asserts messages new parameters in 'run_on_remote'
method proposed with following logic:
* 'assert_ec_equal' with default '[0]'. Error message will be logged only
when exit_code != assert_ec_equal. Can pass xrange(1,8) or [1, 4, 5]
* 'raise_on_assert' with default 'True'. Exception now can be
surpressed when exit_code != assert_ec_equal if 'raiseOnAssert' is 'False'
Also: remote_ get_results' return dict with: stdout_ json', if jsonify=true
* 'run_on_
'command',
'host',
'stdout',
'stdout_str',
'stdout_len',
'
'stderr',
'stderr_str',
'stderr_len',
'exit_code', instead of just stdout string
* 'run_on_remote' wrapper leaved for compatibility
Change-Id: I32a9d743929d01 857a88844976074 df719d9880a aa92e2c2c825762 b53c49e191)
Closes-Bug: #1489165
(cherry picked from commit 32b6bc8cea5c595