Browse Source

Add Tobiko run command

Add basic structure file for supporting Tobiko run command.

The command will be used for generating configuration and run
the tests.

Change-Id: I046b3a85e2ad3d73f983d2be0c804ee863d56d9c
changes/61/633061/3
abregman 3 years ago
parent
commit
3b72d757d6
  1. 2
      Pipfile
  2. 8
      README.rst
  3. 2
      extra-requirements.txt
  4. 1
      setup.cfg
  5. 62
      tobiko/cmd/run.py

2
Pipfile

@ -7,6 +7,8 @@ name = "pypi"
tobiko = {editable = true,path = "."}
ansible = "*"
testscenarios = "*"
crayons = "*"
cryptography = "2.2.2"
[dev-packages]

8
README.rst

@ -7,3 +7,11 @@ Tempest plugin for testing upgrades
* Free software: Apache license
* Source: https://git.openstack.org/cgit/openstack/tobiko
* Bugs: https://bugs.launchpad.net/tobiko
Usage
-----
Run Neutorn tests::
tox -e neutron

2
extra-requirements.txt

@ -3,3 +3,5 @@
ansible>=2.4.0 # GPLv3
os-faults>=0.1.18 # Apache-2.0
tempest>=17.1.0 # Apache-2.0
crayons>=0.1.2
cryptography<=2.2.2

1
setup.cfg

@ -30,6 +30,7 @@ console_scripts =
tobiko-create = tobiko.cmd.create:main
tobiko-delete = tobiko.cmd.delete:main
tobiko-list = tobiko.cmd.list:main
tobiko = tobiko.cmd.run:main
[global]
setup-hooks =

62
tobiko/cmd/run.py

@ -0,0 +1,62 @@
# Copyright 2018 Red Hat
#
# 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.
from __future__ import absolute_import
import argparse
import sys
import crayons
import paramiko
from oslo_log import log
LOG = log.getLogger(__name__)
class Tobiko():
def __init__(self):
self.parser = self.get_parser()
self.args = (self.parser).parse_args()
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
def get_parser(self):
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument(
'--host',
help="The name of the host where your cloud is deployed.\n")
parser.add_argument(
'--key', '-k',
help="They SSH key to use to connect the host.")
return parser
def verify_connection(self):
"""Verifies it's able to connect the host provided by the user."""
try:
self.ssh.connect(self.args.host)
except paramiko.ssh_exception.AuthenticationException:
LOG.error("Unable to connect {}".format(
crayons.red(self.args.host)))
def main():
"""Run CLI main entry."""
tobiko = Tobiko()
tobiko.verify_connection()
# run.discover_environment()
if __name__ == '__main__':
sys.exit(main())
Loading…
Cancel
Save