Split out OpenStackCloud and OperatorCloud classes

Change-Id: If8a09f52313c07d12c7fe0da66f6599de3120979
This commit is contained in:
David Shrewsbury 2015-10-31 14:25:50 -04:00
parent 5ce5c003e8
commit 0f6203f303
7 changed files with 5746 additions and 5698 deletions

View File

@ -13,5 +13,8 @@ To use shade in a project::
compatibility, but attribute access is deprecated. New code should
assume a normal dictionary and access values via key.
.. automodule:: shade
.. autoclass:: shade.OpenStackCloud
:members:
.. autoclass:: shade.OperatorCloud
:members:

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,9 @@ from shade import exc
log = _log.setup_logging(__name__)
_decorated_methods = []
def _iterate_timeout(timeout, message, wait=2):
"""Iterate and raise an exception on timeout.
@ -319,3 +322,23 @@ def valid_kwargs(*valid_args):
"'{arg}'".format(f=inspect.stack()[1][3], arg=k))
return func(*args, **kwargs)
return func_wrapper
def cache_on_arguments(*cache_on_args, **cache_on_kwargs):
def _inner_cache_on_arguments(func):
def _cache_decorator(obj, *args, **kwargs):
the_method = obj._cache.cache_on_arguments(
*cache_on_args, **cache_on_kwargs)(
func.__get__(obj, type(obj)))
return the_method(*args, **kwargs)
def invalidate(obj, *args, **kwargs):
return obj._cache.cache_on_arguments()(func).invalidate(
*args, **kwargs)
_cache_decorator.invalidate = invalidate
_cache_decorator.func = func
_decorated_methods.append(func.__name__)
return _cache_decorator
return _inner_cache_on_arguments

4274
shade/openstackcloud.py Normal file

File diff suppressed because it is too large Load Diff

1438
shade/operatorcloud.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@ import testtools
import yaml
import shade
import shade.openstackcloud
from shade import exc
from shade import meta
from shade.tests import fakes
@ -386,8 +387,8 @@ class TestMemoryCache(base.TestCase):
fake_image.update({
'id': '99',
'name': '99 name',
shade.IMAGE_MD5_KEY: fake_md5,
shade.IMAGE_SHA256_KEY: fake_sha256,
shade.openstackcloud.IMAGE_MD5_KEY: fake_md5,
shade.openstackcloud.IMAGE_SHA256_KEY: fake_sha256,
})
glance_mock.images.list.return_value = [fake_image]

View File

@ -20,6 +20,7 @@ from swiftclient import service as swift_service
from swiftclient import exceptions as swift_exc
import shade
import shade.openstackcloud
from shade import exc
from shade import OpenStackCloud
from shade.tests.unit import base
@ -93,5 +94,5 @@ class TestObject(base.TestCase):
def test_get_object_segment_size_http_412(self, swift_mock):
swift_mock.get_capabilities.side_effect = swift_exc.ClientException(
"Precondition failed", http_status=412)
self.assertEqual(shade.DEFAULT_OBJECT_SEGMENT_SIZE,
self.assertEqual(shade.openstackcloud.DEFAULT_OBJECT_SEGMENT_SIZE,
self.cloud.get_object_segment_size(None))