neutron-lbaas/neutron_lbaas/tests/tempest/lib/common/commands.py
Doug Wiegley a4f03623d7 Pull lbaasv1 tempest tests in-tree, use installed neutron for v1/v2 job
Fix the lbaas v2 api job to use the installed neutron and neutron-lbaas
in CI land. I'm not super happy about tox still being in the mix, so
expect it to run testr directly in a future commit, but the output
gets all horked when I switch, and I'd rather get the job fixed and
tackle that second.

Also pulls in a subset of tempest, to be used during the migration
to tempest-lib. Future test commits need to move us away from the
in-tree tempest, and start removing it.

Also yank the check_bash check, which was removed from neutron.

Change-Id: I2790239b8cd361bc4ac7905b4118f34648b97840
2015-05-29 16:29:21 +00:00

40 lines
1.5 KiB
Python

# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import shlex
import subprocess
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
def copy_file_to_host(file_from, dest, host, username, pkey):
dest = "%s@%s:%s" % (username, host, dest)
cmd = "scp -v -o UserKnownHostsFile=/dev/null " \
"-o StrictHostKeyChecking=no " \
"-i %(pkey)s %(file1)s %(dest)s" % {'pkey': pkey,
'file1': file_from,
'dest': dest}
args = shlex.split(cmd.encode('utf-8'))
subprocess_args = {'stdout': subprocess.PIPE,
'stderr': subprocess.STDOUT}
proc = subprocess.Popen(args, **subprocess_args)
stdout, stderr = proc.communicate()
if proc.returncode != 0:
LOG.error(("Command {0} returned with exit status {1},"
"output {2}, error {3}").format(cmd, proc.returncode,
stdout, stderr))
return stdout