Migrate to using osc-lib

This new library provides the common logic used by openstack
clients. Replacing the imports from openstackclient and cliff.

Depends-On-External: https://review.rdoproject.org/r/#/c/2088/
Depends-On: I095209c241876c6ab48595962e07144fc5cc34a6
Closes-Bug: #1620964
Change-Id: I103a13ff6c0af94b82f5e48652380adfbf331d34
This commit is contained in:
Dougal Matthews 2016-06-29 12:55:58 +01:00
parent cc92d2e49d
commit 133e8cf91a
28 changed files with 52 additions and 53 deletions

View File

@ -4,7 +4,6 @@
pbr>=1.6 # Apache-2.0
Babel>=2.3.4 # BSD
cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
ipaddress>=1.0.7;python_version<'3.3' # PSF
passlib>=1.6 # BSD
python-ironic-inspector-client>=1.5.0 # Apache-2.0
@ -14,6 +13,7 @@ python-mistralclient>=2.0.0 # Apache-2.0
python-openstackclient>=2.1.0 # Apache-2.0
six>=1.9.0 # MIT
os-cloud-config # Apache-2.0
osc-lib>=1.0.2 # Apache-2.0
websocket-client>=0.32.0 # LGPLv2+
# tripleoclient is tied to tripleo-common and expects to use the latest code.

View File

@ -10,3 +10,4 @@ oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
sphinx!=1.3b1,<1.3,>=1.2.1 # BSD
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT
requests-mock>=1.0 # Apache-2.0

View File

@ -20,7 +20,7 @@ import logging
import uuid
import websocket
from openstackclient.common import utils
from osc_lib import utils
from swiftclient import client as swift_client
LOG = logging.getLogger(__name__)

View File

@ -57,7 +57,7 @@ class TestCase(testtools.TestCase):
class TestCommand(TestCase):
"""Test cliff command classes"""
"""Test command classes"""
def setUp(self):
super(TestCommand, self).setUp()

View File

@ -16,7 +16,7 @@
import mock
import ironic_inspector_client
from openstackclient.tests import utils
from osc_lib.tests import utils
class FakeBaremetalNodeClient(object):

View File

@ -14,7 +14,7 @@
#
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
from tripleoclient.tests import fakes

View File

@ -23,7 +23,7 @@ import yaml
from keystoneclient import exceptions as kscexc
import mock
from openstackclient.common import exceptions as oscexc
from osc_lib import exceptions as oscexc
from swiftclient.exceptions import ClientException as ObjectClientException
from tripleoclient import constants

View File

@ -16,7 +16,7 @@
import mock
from uuid import uuid4
from openstackclient.tests import utils
from osc_lib.tests import utils
from tripleoclient.tests.v1.overcloud_deploy import fakes
from tripleoclient.v1 import overcloud_deploy

View File

@ -16,7 +16,7 @@
import mock
import os
from openstackclient.common import exceptions
from osc_lib import exceptions
from tripleoclient.tests.v1.test_plugin import TestPluginV1
from tripleoclient.v1 import overcloud_image
@ -304,13 +304,13 @@ class TestUploadOvercloudImage(TestPluginV1):
self.cmd._read_image_file_pointer = mock.Mock(return_value=b'IMGDATA')
self.cmd._check_file_exists = mock.Mock(return_value=True)
@mock.patch('openstackclient.common.utils.find_resource')
@mock.patch('osc_lib.utils.find_resource')
def test_get_image_exists(self, mock_find_resource):
image_mock = mock.Mock(name='imagename')
mock_find_resource.return_value = image_mock
self.assertEqual(self.cmd._get_image('imagename'), image_mock)
@mock.patch('openstackclient.common.utils.find_resource')
@mock.patch('osc_lib.utils.find_resource')
def test_get_image_none(self, mock_find_resource):
mock_find_resource.side_effect = exceptions.CommandError('')
self.assertEqual(self.cmd._get_image('noimagename'), None)

View File

@ -13,7 +13,7 @@
# under the License.
#
from openstackclient.tests import utils
from osc_lib.tests import utils
class TestValidateOvercloudNetenv(utils.TestCommand):

View File

@ -14,7 +14,7 @@
#
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
class FakeClientWrapper(object):

View File

@ -19,7 +19,7 @@ import mock
import os
import tempfile
from openstackclient.tests import utils as test_utils
from osc_lib.tests import utils as test_utils
from tripleoclient import exceptions
from tripleoclient.tests.v1.overcloud_node import fakes

View File

@ -14,7 +14,7 @@
#
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
class FakeClientWrapper(object):

View File

@ -14,7 +14,7 @@
#
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
class FakeClientWrapper(object):

View File

@ -12,7 +12,7 @@
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
from tripleoclient import exceptions
from tripleoclient.v1 import overcloud_plan

View File

@ -14,7 +14,7 @@
import mock
from openstackclient.tests import utils
from osc_lib.tests import utils
from tripleoclient import exceptions
from tripleoclient.workflows import baremetal

View File

@ -32,7 +32,7 @@ import yaml
from heatclient.common import event_utils
from heatclient.exc import HTTPNotFound
from openstackclient.i18n import _
from osc_lib.i18n import _
from six.moves import configparser
from six.moves import urllib

View File

@ -21,9 +21,8 @@ import logging
import time
import uuid
from cliff import command
from cliff import lister
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
from tripleoclient import exceptions
from tripleoclient import utils
@ -237,7 +236,7 @@ class StartBaremetalIntrospectionBulk(command.Command):
baremetal.provide_manageable_nodes(clients, queue_name=queue_name)
class StatusBaremetalIntrospectionBulk(lister.Lister):
class StatusBaremetalIntrospectionBulk(command.Lister):
"""Get the status of all baremetal nodes"""
log = logging.getLogger(__name__ + ".StatusBaremetalIntrospectionBulk")
@ -427,7 +426,7 @@ class ConfigureBaremetalBoot(command.Command):
)
class ShowNodeCapabilities(lister.Lister):
class ShowNodeCapabilities(command.Lister):
"""List the capabilities for all Nodes"""
log = logging.getLogger(__name__ + ".ShowNodeProfile")

View File

@ -28,16 +28,16 @@ import time
import uuid
import yaml
from cliff import command
from heatclient.common import event_utils
from heatclient.common import template_utils
from keystoneclient import exceptions as kscexc
from openstackclient.common import exceptions as oscexc
from openstackclient.common import utils as osc_utils
from openstackclient.i18n import _
from os_cloud_config import keystone
from os_cloud_config import keystone_pki
from os_cloud_config.utils import clients
from osc_lib.command import command
from osc_lib import exceptions as oscexc
from osc_lib.i18n import _
from osc_lib import utils as osc_utils
from swiftclient.exceptions import ClientException
from tripleo_common import update

View File

@ -19,7 +19,7 @@ import os.path
import re
import uuid
from cliff import command
from osc_lib.command import command
class RemoteExecute(command.Command):

View File

@ -29,11 +29,12 @@ import sys
import time
import warnings
from cliff import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib.i18n import _
from osc_lib import utils
from prettytable import PrettyTable
from tripleoclient import utils as plugin_utils

View File

@ -18,9 +18,9 @@ import itertools
import logging
import os
from cliff import command
import ipaddress
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
import six
import yaml

View File

@ -17,9 +17,9 @@ import argparse
import logging
import uuid
from cliff import command
from openstackclient.common import utils
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
from osc_lib import utils
from tripleo_common import scale
from tripleoclient import constants

View File

@ -14,14 +14,13 @@ import json
import logging
import uuid
from cliff import command
from cliff import lister
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
from tripleoclient.workflows import plan_management
class ListPlans(lister.Lister):
class ListPlans(command.Lister):
"""List overcloud deployment plans."""
log = logging.getLogger(__name__ + ".ListPlans")

View File

@ -14,9 +14,8 @@
import logging
from cliff import command
from cliff import lister
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
from tripleoclient import exceptions
from tripleoclient import utils
@ -86,7 +85,7 @@ class MatchProfiles(command.Command):
POSTFIX = '_profile'
class ListProfiles(lister.Lister):
class ListProfiles(command.Lister):
"""List overcloud node profiles"""
log = logging.getLogger(__name__ + ".ListProfiles")

View File

@ -16,10 +16,10 @@
import logging
import yaml
from cliff import command
from openstackclient.common import exceptions as oscexc
from openstackclient.common import utils
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib import exceptions as oscexc
from osc_lib.i18n import _
from osc_lib import utils
from tripleo_common import update
from tripleoclient import constants

View File

@ -16,9 +16,9 @@
import logging
import yaml
from cliff import command
from openstackclient.common import utils
from openstackclient.i18n import _
from osc_lib.command import command
from osc_lib.i18n import _
from osc_lib import utils
from tripleo_common import upgrade
from tripleoclient import constants

View File

@ -18,7 +18,7 @@
import logging
import subprocess
from cliff import command
from osc_lib.command import command
from tripleoclient import utils