Use cli.base.execute of tempest-lib

For the change[1] has been merged and released, this work around is
unnecessary.

[1] https://review.openstack.org/#/c/218870/

Change-Id: I9a07a37c5a3a3f61f13fa54fcb1e16852beb2206
This commit is contained in:
liusheng 2016-02-26 11:42:48 +08:00
parent 8ef682fa2a
commit ef224f96ea
2 changed files with 3 additions and 32 deletions

View File

@ -11,9 +11,6 @@
# under the License.
import os
import shlex
import six
import subprocess
import time
import uuid
@ -43,34 +40,8 @@ class AodhClient(object):
flags = creds + ' ' + flags
# FIXME(sileht): base.execute is broken in py3 in tempest-lib
# see: https://review.openstack.org/#/c/218870/
# return base.execute("aodh", action, flags, params, fail_ok,
# merge_stderr, self.cli_dir)
cmd = "aodh"
# from fixed tempestlib
cmd = ' '.join([os.path.join(self.cli_dir, cmd),
flags, action, params])
if six.PY2:
cmd = cmd.encode('utf-8')
cmd = shlex.split(cmd)
result = ''
result_err = ''
stdout = subprocess.PIPE
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr)
result, result_err = proc.communicate()
if not fail_ok and proc.returncode != 0:
raise exceptions.CommandFailed(proc.returncode,
cmd,
result,
result_err)
if six.PY2:
return result
else:
return os.fsdecode(result)
return base.execute("aodh", action, flags, params, fail_ok,
merge_stderr, self.cli_dir)
class ClientTestBase(base.ClientTestBase):

View File

@ -10,7 +10,7 @@ python-subunit>=0.0.18
sphinx!=1.2.0,!=1.3b1,>=1.1.2
oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0
tempest-lib>=0.6.1
tempest-lib>=0.9.0 # Apache-2.0
testrepository>=0.0.18
testscenarios>=0.4
testtools>=1.4.0