Add quiet option in xdsh call

Add quiet option in xdsh call to ignore warnings and ssh banner message.

To fix the defect that xdsh call failed when ssh banner enabled.

Change-Id: Ifbc13e9868a968afe6f66ed7383eee9961a9201d
This commit is contained in:
Huang Rui 2016-04-26 16:02:33 +08:00
parent 2f95254b70
commit 85c4ed3395
2 changed files with 4 additions and 2 deletions

View File

@ -308,7 +308,9 @@ def xdsh(node, commands):
def xdsh_execute(node, commands):
"""Invoke xCAT REST API to execute command on node."""
xdsh_commands = 'command=%s' % commands
body = [xdsh_commands]
# Add -q (quiet) option to ignore ssh warnings and banner msg
opt = 'options=-q'
body = [xdsh_commands, opt]
url = XCATUrl().xdsh('/' + node)
return xcat_request("PUT", url, body)

View File

@ -119,7 +119,7 @@ class TestZVMUtils(base.BaseTestCase):
zvmutils.xdsh('node', 'cmds')
xcat_req.assert_any_call('PUT',
'/xcatws/nodes/node/dsh?userName=user&password=pwd&format=json',
['command=cmds'])
['command=cmds', 'options=-q'])
@mock.patch('ceilometer_zvm.compute.virt.zvm.utils.xcat_request')
def test_get_node_hostname(self, xcat_req):