Fix gate-watcherclient-dsvm-functional-ubuntu-xenial job

Closes-Bug: #1722212
Change-Id: I8d5cb2fd1a17beb6049fb5d2a560fc31ba77fe3d
This commit is contained in:
Alexander Chadin 2017-10-09 13:47:10 +03:00
parent ad0a32886d
commit e92dd4db20

@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import re
import shlex
import subprocess
@ -20,9 +22,24 @@ from tempest.lib.cli import output_parser
from tempest.lib import exceptions
def credentials():
creds = {
'--os-username': os.environ.get('OS_USERNAME', 'admin'),
'--os-password': os.environ.get('OS_PASSWORD', 'secretadmin'),
'--os-project-name': os.environ.get('OS_PROJECT_NAME', 'admin'),
'--os-auth-url': os.environ.get('OS_AUTH_URL',
'http://10.0.1.94/identity'),
'--os-project-domain-id': os.environ.get('OS_PROJECT_DOMAIN_ID',
'default'),
'--os-user-domain-id': os.environ.get('OS_USER_DOMAIN_ID', 'default'),
}
return [x for sub in creds.items() for x in sub]
def execute(cmd, fail_ok=False, merge_stderr=False):
"""Executes specified command for the given action."""
cmdlist = shlex.split(cmd)
cmdlist.extend(credentials())
stdout = subprocess.PIPE
stderr = subprocess.STDOUT if merge_stderr else subprocess.PIPE
proc = subprocess.Popen(cmdlist, stdout=stdout, stderr=stderr)