From 15e78f5d569a048b333f197ef1c766d2bc452cb3 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 12 Jan 2018 17:45:52 -0600 Subject: [PATCH] Rename resource2 and proxy2 to resource and proxy This caps off a bunch of work to get to the new and improved Resouce2/Proxy2 interfaces. All of the services have been migrated and the old classes have been removed. Rename openstack.resource2 to openstack.resource and openstack.proxy2 to openstack.proxy. Change-Id: I0b7e1c679358e1f60b5316a255aad3a59fbbc8a9 --- SHADE-MERGE-TODO.rst | 2 +- .../create/examples/resource/fake.py | 2 +- doc/source/user/index.rst | 2 +- .../user/{resource2.rst => resource.rst} | 10 +- openstack/baremetal/v1/_proxy.py | 4 +- openstack/baremetal/v1/chassis.py | 2 +- openstack/baremetal/v1/driver.py | 2 +- openstack/baremetal/v1/node.py | 2 +- openstack/baremetal/v1/port.py | 2 +- openstack/baremetal/v1/port_group.py | 2 +- openstack/baremetal/version.py | 10 +- openstack/block_storage/v2/_proxy.py | 4 +- openstack/block_storage/v2/snapshot.py | 30 +- openstack/block_storage/v2/stats.py | 9 +- openstack/block_storage/v2/type.py | 10 +- openstack/block_storage/v2/volume.py | 58 ++-- openstack/clustering/v1/_proxy.py | 29 +- openstack/clustering/v1/action.py | 2 +- openstack/clustering/v1/build_info.py | 2 +- openstack/clustering/v1/cluster.py | 2 +- openstack/clustering/v1/cluster_attr.py | 2 +- openstack/clustering/v1/cluster_policy.py | 2 +- openstack/clustering/v1/event.py | 2 +- openstack/clustering/v1/node.py | 2 +- openstack/clustering/v1/policy.py | 2 +- openstack/clustering/v1/policy_type.py | 2 +- openstack/clustering/v1/profile.py | 2 +- openstack/clustering/v1/profile_type.py | 2 +- openstack/clustering/v1/receiver.py | 2 +- openstack/clustering/v1/service.py | 2 +- openstack/clustering/version.py | 2 +- openstack/compute/v2/_proxy.py | 36 +- openstack/compute/v2/availability_zone.py | 10 +- openstack/compute/v2/extension.py | 16 +- openstack/compute/v2/flavor.py | 31 +- openstack/compute/v2/hypervisor.py | 42 +-- openstack/compute/v2/image.py | 34 +- openstack/compute/v2/keypair.py | 14 +- openstack/compute/v2/limits.py | 56 ++-- openstack/compute/v2/server.py | 101 +++--- openstack/compute/v2/server_group.py | 14 +- openstack/compute/v2/server_interface.py | 16 +- openstack/compute/v2/server_ip.py | 12 +- openstack/compute/v2/service.py | 18 +- openstack/compute/v2/volume_attachment.py | 16 +- openstack/compute/version.py | 2 +- openstack/connection.py | 4 +- openstack/database/v1/_proxy.py | 4 +- openstack/database/v1/database.py | 2 +- openstack/database/v1/flavor.py | 2 +- openstack/database/v1/instance.py | 2 +- openstack/database/v1/user.py | 2 +- openstack/identity/v2/_proxy.py | 2 +- openstack/identity/v2/extension.py | 2 +- openstack/identity/v2/role.py | 2 +- openstack/identity/v2/tenant.py | 2 +- openstack/identity/v2/user.py | 2 +- openstack/identity/v3/_proxy.py | 2 +- openstack/identity/v3/credential.py | 2 +- openstack/identity/v3/domain.py | 2 +- openstack/identity/v3/endpoint.py | 2 +- openstack/identity/v3/group.py | 2 +- openstack/identity/v3/policy.py | 2 +- openstack/identity/v3/project.py | 2 +- openstack/identity/v3/region.py | 2 +- openstack/identity/v3/role.py | 2 +- openstack/identity/v3/role_assignment.py | 2 +- .../v3/role_domain_group_assignment.py | 2 +- .../v3/role_domain_user_assignment.py | 2 +- .../v3/role_project_group_assignment.py | 2 +- .../v3/role_project_user_assignment.py | 2 +- openstack/identity/v3/service.py | 2 +- openstack/identity/v3/trust.py | 2 +- openstack/identity/v3/user.py | 2 +- openstack/identity/version.py | 2 +- openstack/image/v1/_proxy.py | 2 +- openstack/image/v1/image.py | 2 +- openstack/image/v2/_proxy.py | 24 +- openstack/image/v2/image.py | 129 ++++---- openstack/image/v2/member.py | 16 +- openstack/key_manager/v1/_proxy.py | 4 +- openstack/key_manager/v1/container.py | 25 +- openstack/key_manager/v1/order.py | 30 +- openstack/key_manager/v1/secret.py | 49 +-- openstack/load_balancer/v2/_proxy.py | 4 +- openstack/load_balancer/v2/health_monitor.py | 2 +- openstack/load_balancer/v2/l7_policy.py | 2 +- openstack/load_balancer/v2/l7_rule.py | 2 +- openstack/load_balancer/v2/listener.py | 2 +- openstack/load_balancer/v2/load_balancer.py | 2 +- openstack/load_balancer/v2/member.py | 2 +- openstack/load_balancer/v2/pool.py | 2 +- openstack/load_balancer/version.py | 2 +- openstack/message/v2/_proxy.py | 8 +- openstack/message/v2/claim.py | 22 +- openstack/message/v2/message.py | 24 +- openstack/message/v2/queue.py | 20 +- openstack/message/v2/subscription.py | 26 +- openstack/message/version.py | 2 +- openstack/network/v2/_proxy.py | 8 +- openstack/network/v2/address_scope.py | 2 +- openstack/network/v2/agent.py | 2 +- .../network/v2/auto_allocated_topology.py | 2 +- openstack/network/v2/availability_zone.py | 2 +- openstack/network/v2/extension.py | 2 +- openstack/network/v2/flavor.py | 2 +- openstack/network/v2/floating_ip.py | 2 +- openstack/network/v2/health_monitor.py | 2 +- openstack/network/v2/listener.py | 2 +- openstack/network/v2/load_balancer.py | 2 +- openstack/network/v2/metering_label.py | 2 +- openstack/network/v2/metering_label_rule.py | 2 +- openstack/network/v2/network.py | 2 +- .../network/v2/network_ip_availability.py | 2 +- openstack/network/v2/pool.py | 2 +- openstack/network/v2/pool_member.py | 2 +- openstack/network/v2/port.py | 2 +- .../network/v2/qos_bandwidth_limit_rule.py | 2 +- openstack/network/v2/qos_dscp_marking_rule.py | 2 +- .../network/v2/qos_minimum_bandwidth_rule.py | 2 +- openstack/network/v2/qos_policy.py | 2 +- openstack/network/v2/qos_rule_type.py | 2 +- openstack/network/v2/quota.py | 2 +- openstack/network/v2/rbac_policy.py | 2 +- openstack/network/v2/router.py | 2 +- openstack/network/v2/security_group.py | 2 +- openstack/network/v2/security_group_rule.py | 2 +- openstack/network/v2/segment.py | 2 +- openstack/network/v2/service_profile.py | 2 +- openstack/network/v2/service_provider.py | 2 +- openstack/network/v2/subnet.py | 2 +- openstack/network/v2/subnet_pool.py | 2 +- openstack/network/v2/vpn_service.py | 2 +- openstack/network/version.py | 2 +- openstack/object_store/v1/_base.py | 2 +- openstack/object_store/v1/_proxy.py | 2 +- openstack/object_store/v1/account.py | 2 +- openstack/object_store/v1/container.py | 2 +- openstack/object_store/v1/obj.py | 2 +- openstack/orchestration/v1/_proxy.py | 4 +- openstack/orchestration/v1/resource.py | 2 +- openstack/orchestration/v1/software_config.py | 2 +- .../orchestration/v1/software_deployment.py | 2 +- openstack/orchestration/v1/stack.py | 2 +- .../orchestration/v1/stack_environment.py | 2 +- openstack/orchestration/v1/stack_files.py | 2 +- openstack/orchestration/v1/stack_template.py | 2 +- openstack/orchestration/v1/template.py | 2 +- openstack/orchestration/version.py | 2 +- openstack/{proxy2.py => proxy.py} | 98 +++--- openstack/{resource2.py => resource.py} | 22 +- openstack/service_description.py | 19 +- .../tests/unit/baremetal/v1/test_proxy.py | 4 +- .../tests/unit/block_storage/v2/test_proxy.py | 4 +- openstack/tests/unit/cluster/v1/test_proxy.py | 22 +- openstack/tests/unit/compute/v2/test_proxy.py | 12 +- .../tests/unit/database/v1/test_proxy.py | 8 +- .../tests/unit/identity/v2/test_proxy.py | 2 +- .../tests/unit/identity/v3/test_proxy.py | 4 +- openstack/tests/unit/image/v1/test_proxy.py | 2 +- openstack/tests/unit/image/v2/test_proxy.py | 18 +- .../tests/unit/key_manager/v1/test_proxy.py | 4 +- .../tests/unit/load_balancer/test_proxy.py | 12 +- openstack/tests/unit/message/v2/test_proxy.py | 20 +- openstack/tests/unit/network/v2/test_proxy.py | 46 +-- openstack/tests/unit/network/v2/test_quota.py | 2 +- .../tests/unit/object_store/v1/test_proxy.py | 4 +- .../tests/unit/orchestration/v1/test_proxy.py | 12 +- .../tests/unit/orchestration/v1/test_stack.py | 2 +- .../unit/orchestration/v1/test_stack_files.py | 2 +- .../unit/orchestration/v1/test_template.py | 2 +- openstack/tests/unit/test_connection.py | 2 +- .../unit/{test_proxy2.py => test_proxy.py} | 70 ++-- openstack/tests/unit/test_proxy_base.py | 15 +- openstack/tests/unit/test_proxy_base2.py | 18 +- .../{test_resource2.py => test_resource.py} | 309 +++++++++--------- openstack/tests/unit/workflow/test_proxy.py | 4 +- openstack/workflow/v2/_proxy.py | 4 +- openstack/workflow/v2/execution.py | 2 +- openstack/workflow/v2/workflow.py | 2 +- openstack/workflow/version.py | 2 +- 181 files changed, 974 insertions(+), 974 deletions(-) rename doc/source/user/{resource2.rst => resource.rst} (65%) rename openstack/{proxy2.py => proxy.py} (79%) rename openstack/{resource2.py => resource.py} (98%) rename openstack/tests/unit/{test_proxy2.py => test_proxy.py} (87%) rename openstack/tests/unit/{test_resource2.py => test_resource.py} (86%) diff --git a/SHADE-MERGE-TODO.rst b/SHADE-MERGE-TODO.rst index 32baa0925..2a12d00f6 100644 --- a/SHADE-MERGE-TODO.rst +++ b/SHADE-MERGE-TODO.rst @@ -23,11 +23,11 @@ already. For reference, those are: * Removed the Session object in favor of using keystoneauth. * Plumbed Proxy use of Adapter through the Adapter subclass from shade that uses the TaskManager to run REST calls. +* Finish migrating to Resource2 and Proxy2, rename them to Resource and Proxy. Next steps ========== -* Finish migrating to Resource2 and Proxy2, rename them to Resource and Proxy. * Maybe rename self.session and session parameter in all usage in proxy and resource to self.adapter. They are Adapters not Sessions, but that may not mean anything to people. diff --git a/doc/source/contributor/create/examples/resource/fake.py b/doc/source/contributor/create/examples/resource/fake.py index 527e5ad11..074a5fb78 100644 --- a/doc/source/contributor/create/examples/resource/fake.py +++ b/doc/source/contributor/create/examples/resource/fake.py @@ -1,7 +1,7 @@ # Apache 2 header omitted for brevity from openstack.fake import fake_service -from openstack import resource2 as resource +from openstack import resource class Fake(resource.Resource): diff --git a/doc/source/user/index.rst b/doc/source/user/index.rst index fb5e2e082..96b6c80a4 100644 --- a/doc/source/user/index.rst +++ b/doc/source/user/index.rst @@ -137,7 +137,7 @@ can be customized. .. toctree:: :maxdepth: 1 - resource2 + resource service_filter utils diff --git a/doc/source/user/resource2.rst b/doc/source/user/resource.rst similarity index 65% rename from doc/source/user/resource2.rst rename to doc/source/user/resource.rst index bc664213d..8453265f5 100644 --- a/doc/source/user/resource2.rst +++ b/doc/source/user/resource.rst @@ -4,23 +4,23 @@ this module will be drop the 2 suffix and be the only resource module.** Resource ======== -.. automodule:: openstack.resource2 +.. automodule:: openstack.resource Components ---------- -.. autoclass:: openstack.resource2.Body +.. autoclass:: openstack.resource.Body :members: -.. autoclass:: openstack.resource2.Header +.. autoclass:: openstack.resource.Header :members: -.. autoclass:: openstack.resource2.URI +.. autoclass:: openstack.resource.URI :members: The Resource class ------------------ -.. autoclass:: openstack.resource2.Resource +.. autoclass:: openstack.resource.Resource :members: :member-order: bysource diff --git a/openstack/baremetal/v1/_proxy.py b/openstack/baremetal/v1/_proxy.py index 0e68cf357..a802f6973 100644 --- a/openstack/baremetal/v1/_proxy.py +++ b/openstack/baremetal/v1/_proxy.py @@ -15,11 +15,11 @@ from openstack.baremetal.v1 import driver as _driver from openstack.baremetal.v1 import node as _node from openstack.baremetal.v1 import port as _port from openstack.baremetal.v1 import port_group as _portgroup -from openstack import proxy2 +from openstack import proxy from openstack import utils -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def chassis(self, details=False, **query): """Retrieve a generator of chassis. diff --git a/openstack/baremetal/v1/chassis.py b/openstack/baremetal/v1/chassis.py index 715acb250..116ea5696 100644 --- a/openstack/baremetal/v1/chassis.py +++ b/openstack/baremetal/v1/chassis.py @@ -11,7 +11,7 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 as resource +from openstack import resource class Chassis(resource.Resource): diff --git a/openstack/baremetal/v1/driver.py b/openstack/baremetal/v1/driver.py index 8421bdb54..c097edbd8 100644 --- a/openstack/baremetal/v1/driver.py +++ b/openstack/baremetal/v1/driver.py @@ -11,7 +11,7 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 as resource +from openstack import resource class Driver(resource.Resource): diff --git a/openstack/baremetal/v1/node.py b/openstack/baremetal/v1/node.py index e99a61487..3ba698cff 100644 --- a/openstack/baremetal/v1/node.py +++ b/openstack/baremetal/v1/node.py @@ -11,7 +11,7 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 as resource +from openstack import resource class Node(resource.Resource): diff --git a/openstack/baremetal/v1/port.py b/openstack/baremetal/v1/port.py index 75f47f68d..cca5d14aa 100644 --- a/openstack/baremetal/v1/port.py +++ b/openstack/baremetal/v1/port.py @@ -11,7 +11,7 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 as resource +from openstack import resource class Port(resource.Resource): diff --git a/openstack/baremetal/v1/port_group.py b/openstack/baremetal/v1/port_group.py index 41fd78396..d1d44e7d4 100644 --- a/openstack/baremetal/v1/port_group.py +++ b/openstack/baremetal/v1/port_group.py @@ -11,7 +11,7 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 as resource +from openstack import resource class PortGroup(resource.Resource): diff --git a/openstack/baremetal/version.py b/openstack/baremetal/version.py index 51d0e85bf..1613fe43a 100644 --- a/openstack/baremetal/version.py +++ b/openstack/baremetal/version.py @@ -11,10 +11,10 @@ # under the License. from openstack.baremetal import baremetal_service -from openstack import resource2 +from openstack import resource -class Version(resource2.Resource): +class Version(resource.Resource): resource_key = 'version' resources_key = 'versions' base_path = '/' @@ -26,6 +26,6 @@ class Version(resource2.Resource): allow_list = True # Attributes - links = resource2.Body('links') - status = resource2.Body('status') - updated = resource2.Body('updated') + links = resource.Body('links') + status = resource.Body('status') + updated = resource.Body('updated') diff --git a/openstack/block_storage/v2/_proxy.py b/openstack/block_storage/v2/_proxy.py index 90bb623b3..4b7afd90c 100644 --- a/openstack/block_storage/v2/_proxy.py +++ b/openstack/block_storage/v2/_proxy.py @@ -14,10 +14,10 @@ from openstack.block_storage.v2 import snapshot as _snapshot from openstack.block_storage.v2 import stats as _stats from openstack.block_storage.v2 import type as _type from openstack.block_storage.v2 import volume as _volume -from openstack import proxy2 +from openstack import proxy -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def get_snapshot(self, snapshot): """Get a single snapshot diff --git a/openstack/block_storage/v2/snapshot.py b/openstack/block_storage/v2/snapshot.py index 9d5b3dae6..d1080fd3f 100644 --- a/openstack/block_storage/v2/snapshot.py +++ b/openstack/block_storage/v2/snapshot.py @@ -12,17 +12,17 @@ from openstack.block_storage import block_storage_service from openstack import format -from openstack import resource2 +from openstack import resource -class Snapshot(resource2.Resource): +class Snapshot(resource.Resource): resource_key = "snapshot" resources_key = "snapshots" base_path = "/snapshots" service = block_storage_service.BlockStorageService() - _query_mapping = resource2.QueryParameters('all_tenants', 'name', 'status', - 'volume_id') + _query_mapping = resource.QueryParameters( + 'all_tenants', 'name', 'status', 'volume_id') # capabilities allow_get = True @@ -33,26 +33,26 @@ class Snapshot(resource2.Resource): # Properties #: A ID representing this snapshot. - id = resource2.Body("id") + id = resource.Body("id") #: Name of the snapshot. Default is None. - name = resource2.Body("name") + name = resource.Body("name") #: The current status of this snapshot. Potential values are creating, #: available, deleting, error, and error_deleting. - status = resource2.Body("status") + status = resource.Body("status") #: Description of snapshot. Default is None. - description = resource2.Body("description") + description = resource.Body("description") #: The timestamp of this snapshot creation. - created_at = resource2.Body("created_at") + created_at = resource.Body("created_at") #: Metadata associated with this snapshot. - metadata = resource2.Body("metadata", type=dict) + metadata = resource.Body("metadata", type=dict) #: The ID of the volume this snapshot was taken of. - volume_id = resource2.Body("volume_id") + volume_id = resource.Body("volume_id") #: The size of the volume, in GBs. - size = resource2.Body("size", type=int) + size = resource.Body("size", type=int) #: Indicate whether to create snapshot, even if the volume is attached. #: Default is ``False``. *Type: bool* - is_forced = resource2.Body("force", type=format.BoolStr) + is_forced = resource.Body("force", type=format.BoolStr) class SnapshotDetail(Snapshot): @@ -60,6 +60,6 @@ class SnapshotDetail(Snapshot): base_path = "/snapshots/detail" #: The percentage of completeness the snapshot is currently at. - progress = resource2.Body("os-extended-snapshot-attributes:progress") + progress = resource.Body("os-extended-snapshot-attributes:progress") #: The project ID this snapshot is associated with. - project_id = resource2.Body("os-extended-snapshot-attributes:project_id") + project_id = resource.Body("os-extended-snapshot-attributes:project_id") diff --git a/openstack/block_storage/v2/stats.py b/openstack/block_storage/v2/stats.py index 80a9c0b60..914ba9436 100644 --- a/openstack/block_storage/v2/stats.py +++ b/openstack/block_storage/v2/stats.py @@ -11,10 +11,10 @@ # under the License. from openstack.block_storage import block_storage_service -from openstack import resource2 +from openstack import resource -class Pools(resource2.Resource): +class Pools(resource.Resource): resource_key = "pool" resources_key = "pools" base_path = "/scheduler-stats/get_pools?detail=True" @@ -28,7 +28,6 @@ class Pools(resource2.Resource): # Properties #: The Cinder name for the pool - name = resource2.Body("name") + name = resource.Body("name") #: returns a dict with information about the pool - capabilities = resource2.Body("capabilities", - type=dict) + capabilities = resource.Body("capabilities", type=dict) diff --git a/openstack/block_storage/v2/type.py b/openstack/block_storage/v2/type.py index 7b477aee4..2ca9a51b0 100644 --- a/openstack/block_storage/v2/type.py +++ b/openstack/block_storage/v2/type.py @@ -11,10 +11,10 @@ # under the License. from openstack.block_storage import block_storage_service -from openstack import resource2 +from openstack import resource -class Type(resource2.Resource): +class Type(resource.Resource): resource_key = "volume_type" resources_key = "volume_types" base_path = "/types" @@ -28,8 +28,8 @@ class Type(resource2.Resource): # Properties #: A ID representing this type. - id = resource2.Body("id") + id = resource.Body("id") #: Name of the type. - name = resource2.Body("name") + name = resource.Body("name") #: A dict of extra specifications. "capabilities" is a usual key. - extra_specs = resource2.Body("extra_specs", type=dict) + extra_specs = resource.Body("extra_specs", type=dict) diff --git a/openstack/block_storage/v2/volume.py b/openstack/block_storage/v2/volume.py index ee8c60d62..25e77509f 100644 --- a/openstack/block_storage/v2/volume.py +++ b/openstack/block_storage/v2/volume.py @@ -12,17 +12,17 @@ from openstack.block_storage import block_storage_service from openstack import format -from openstack import resource2 +from openstack import resource -class Volume(resource2.Resource): +class Volume(resource.Resource): resource_key = "volume" resources_key = "volumes" base_path = "/volumes" service = block_storage_service.BlockStorageService() - _query_mapping = resource2.QueryParameters('all_tenants', 'name', - 'status', 'project_id') + _query_mapping = resource.QueryParameters( + 'all_tenants', 'name', 'status', 'project_id') # capabilities allow_get = True @@ -33,48 +33,48 @@ class Volume(resource2.Resource): # Properties #: A ID representing this volume. - id = resource2.Body("id") + id = resource.Body("id") #: The name of this volume. - name = resource2.Body("name") + name = resource.Body("name") #: A list of links associated with this volume. *Type: list* - links = resource2.Body("links", type=list) + links = resource.Body("links", type=list) #: The availability zone. - availability_zone = resource2.Body("availability_zone") + availability_zone = resource.Body("availability_zone") #: To create a volume from an existing volume, specify the ID of #: the existing volume. If specified, the volume is created with #: same size of the source volume. - source_volume_id = resource2.Body("source_volid") + source_volume_id = resource.Body("source_volid") #: The volume description. - description = resource2.Body("description") + description = resource.Body("description") #: To create a volume from an existing snapshot, specify the ID of #: the existing volume snapshot. If specified, the volume is created #: in same availability zone and with same size of the snapshot. - snapshot_id = resource2.Body("snapshot_id") + snapshot_id = resource.Body("snapshot_id") #: The size of the volume, in GBs. *Type: int* - size = resource2.Body("size", type=int) + size = resource.Body("size", type=int) #: The ID of the image from which you want to create the volume. #: Required to create a bootable volume. - image_id = resource2.Body("imageRef") + image_id = resource.Body("imageRef") #: The name of the associated volume type. - volume_type = resource2.Body("volume_type") + volume_type = resource.Body("volume_type") #: Enables or disables the bootable attribute. You can boot an #: instance from a bootable volume. *Type: bool* - is_bootable = resource2.Body("bootable", type=format.BoolStr) + is_bootable = resource.Body("bootable", type=format.BoolStr) #: One or more metadata key and value pairs to associate with the volume. - metadata = resource2.Body("metadata") + metadata = resource.Body("metadata") #: One or more metadata key and value pairs about image - volume_image_metadata = resource2.Body("volume_image_metadata") + volume_image_metadata = resource.Body("volume_image_metadata") #: One of the following values: creating, available, attaching, in-use #: deleting, error, error_deleting, backing-up, restoring-backup, #: error_restoring. For details on these statuses, see the #: Block Storage API documentation. - status = resource2.Body("status") + status = resource.Body("status") #: TODO(briancurtin): This is currently undocumented in the API. - attachments = resource2.Body("attachments") + attachments = resource.Body("attachments") #: The timestamp of this volume creation. - created_at = resource2.Body("created_at") + created_at = resource.Body("created_at") class VolumeDetail(Volume): @@ -82,24 +82,24 @@ class VolumeDetail(Volume): base_path = "/volumes/detail" #: The volume's current back-end. - host = resource2.Body("os-vol-host-attr:host") + host = resource.Body("os-vol-host-attr:host") #: The project ID associated with current back-end. - project_id = resource2.Body("os-vol-tenant-attr:tenant_id") + project_id = resource.Body("os-vol-tenant-attr:tenant_id") #: The status of this volume's migration (None means that a migration #: is not currently in progress). - migration_status = resource2.Body("os-vol-mig-status-attr:migstat") + migration_status = resource.Body("os-vol-mig-status-attr:migstat") #: The volume ID that this volume's name on the back-end is based on. - migration_id = resource2.Body("os-vol-mig-status-attr:name_id") + migration_id = resource.Body("os-vol-mig-status-attr:name_id") #: Status of replication on this volume. - replication_status = resource2.Body("replication_status") + replication_status = resource.Body("replication_status") #: Extended replication status on this volume. - extended_replication_status = resource2.Body( + extended_replication_status = resource.Body( "os-volume-replication:extended_status") #: ID of the consistency group. - consistency_group_id = resource2.Body("consistencygroup_id") + consistency_group_id = resource.Body("consistencygroup_id") #: Data set by the replication driver - replication_driver_data = resource2.Body( + replication_driver_data = resource.Body( "os-volume-replication:driver_data") #: ``True`` if this volume is encrypted, ``False`` if not. #: *Type: bool* - is_encrypted = resource2.Body("encrypted", type=format.BoolStr) + is_encrypted = resource.Body("encrypted", type=format.BoolStr) diff --git a/openstack/clustering/v1/_proxy.py b/openstack/clustering/v1/_proxy.py index 562f8abde..e17a23504 100644 --- a/openstack/clustering/v1/_proxy.py +++ b/openstack/clustering/v1/_proxy.py @@ -23,12 +23,12 @@ from openstack.clustering.v1 import profile as _profile from openstack.clustering.v1 import profile_type as _profile_type from openstack.clustering.v1 import receiver as _receiver from openstack.clustering.v1 import service as _service -from openstack import proxy2 -from openstack import resource2 +from openstack import proxy +from openstack import resource from openstack import utils -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def get_build_info(self): """Get build info for service engine and API @@ -913,7 +913,7 @@ class Proxy(proxy2.BaseProxy): enabled on the cluster. :returns: A generator of cluster-policy binding instances. """ - cluster_id = resource2.Resource._get_id(cluster) + cluster_id = resource.Resource._get_id(cluster) return self._list(_cluster_policy.ClusterPolicy, paginated=False, cluster_id=cluster_id, **query) @@ -1102,13 +1102,13 @@ class Proxy(proxy2.BaseProxy): """ return self._list(_event.Event, paginated=True, **query) - def wait_for_status(self, resource, status, failures=None, interval=2, + def wait_for_status(self, res, status, failures=None, interval=2, wait=120): """Wait for a resource to be in a particular status. - :param resource: The resource to wait on to reach the specified status. - The resource must have a ``status`` attribute. - :type resource: A :class:`~openstack.resource2.Resource` object. + :param res: The resource to wait on to reach the specified status. + The resource must have a ``status`` attribute. + :type resource: A :class:`~openstack.resource.Resource` object. :param status: Desired status. :param failures: Statuses that would be interpreted as failures. :type failures: :py:class:`list` @@ -1125,14 +1125,14 @@ class Proxy(proxy2.BaseProxy): ``status`` attribute. """ failures = [] if failures is None else failures - return resource2.wait_for_status(self, resource, status, - failures, interval, wait) + return resource.wait_for_status( + self, res, status, failures, interval, wait) - def wait_for_delete(self, resource, interval=2, wait=120): + def wait_for_delete(self, res, interval=2, wait=120): """Wait for a resource to be deleted. - :param resource: The resource to wait on to be deleted. - :type resource: A :class:`~openstack.resource2.Resource` object. + :param res: The resource to wait on to be deleted. + :type resource: A :class:`~openstack.resource.Resource` object. :param interval: Number of seconds to wait before to consecutive checks. Default to 2. :param wait: Maximum number of seconds to wait before the change. @@ -1141,8 +1141,7 @@ class Proxy(proxy2.BaseProxy): :raises: :class:`~openstack.exceptions.ResourceTimeout` if transition to delete failed to occur in the specified seconds. """ - return resource2.wait_for_delete(self, resource, interval, - wait) + return resource.wait_for_delete(self, res, interval, wait) def services(self, **query): """Get a generator of services. diff --git a/openstack/clustering/v1/action.py b/openstack/clustering/v1/action.py index 46609f8a9..76a63c9b2 100644 --- a/openstack/clustering/v1/action.py +++ b/openstack/clustering/v1/action.py @@ -12,7 +12,7 @@ from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Action(resource.Resource): diff --git a/openstack/clustering/v1/build_info.py b/openstack/clustering/v1/build_info.py index e666050eb..901f43b5f 100644 --- a/openstack/clustering/v1/build_info.py +++ b/openstack/clustering/v1/build_info.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class BuildInfo(resource.Resource): diff --git a/openstack/clustering/v1/cluster.py b/openstack/clustering/v1/cluster.py index 8b7f12757..1b3668700 100644 --- a/openstack/clustering/v1/cluster.py +++ b/openstack/clustering/v1/cluster.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/clustering/v1/cluster_attr.py b/openstack/clustering/v1/cluster_attr.py index 353728503..68e1f53f8 100644 --- a/openstack/clustering/v1/cluster_attr.py +++ b/openstack/clustering/v1/cluster_attr.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class ClusterAttr(resource.Resource): diff --git a/openstack/clustering/v1/cluster_policy.py b/openstack/clustering/v1/cluster_policy.py index 6d48ece91..49c9c4c77 100644 --- a/openstack/clustering/v1/cluster_policy.py +++ b/openstack/clustering/v1/cluster_policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class ClusterPolicy(resource.Resource): diff --git a/openstack/clustering/v1/event.py b/openstack/clustering/v1/event.py index c248a5179..6ca6798c3 100644 --- a/openstack/clustering/v1/event.py +++ b/openstack/clustering/v1/event.py @@ -12,7 +12,7 @@ from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Event(resource.Resource): diff --git a/openstack/clustering/v1/node.py b/openstack/clustering/v1/node.py index 4147e442d..abfdbbdb4 100644 --- a/openstack/clustering/v1/node.py +++ b/openstack/clustering/v1/node.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/clustering/v1/policy.py b/openstack/clustering/v1/policy.py index f8613f291..5a1202e4f 100644 --- a/openstack/clustering/v1/policy.py +++ b/openstack/clustering/v1/policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Policy(resource.Resource): diff --git a/openstack/clustering/v1/policy_type.py b/openstack/clustering/v1/policy_type.py index e63edf007..6acb10000 100644 --- a/openstack/clustering/v1/policy_type.py +++ b/openstack/clustering/v1/policy_type.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class PolicyType(resource.Resource): diff --git a/openstack/clustering/v1/profile.py b/openstack/clustering/v1/profile.py index e01ebccb8..b148a6167 100644 --- a/openstack/clustering/v1/profile.py +++ b/openstack/clustering/v1/profile.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Profile(resource.Resource): diff --git a/openstack/clustering/v1/profile_type.py b/openstack/clustering/v1/profile_type.py index be04686ea..3d7e4df23 100644 --- a/openstack/clustering/v1/profile_type.py +++ b/openstack/clustering/v1/profile_type.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class ProfileType(resource.Resource): diff --git a/openstack/clustering/v1/receiver.py b/openstack/clustering/v1/receiver.py index 35265aeef..434244d75 100644 --- a/openstack/clustering/v1/receiver.py +++ b/openstack/clustering/v1/receiver.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Receiver(resource.Resource): diff --git a/openstack/clustering/v1/service.py b/openstack/clustering/v1/service.py index dde009087..d9de49687 100644 --- a/openstack/clustering/v1/service.py +++ b/openstack/clustering/v1/service.py @@ -11,7 +11,7 @@ # under the License. from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Service(resource.Resource): diff --git a/openstack/clustering/version.py b/openstack/clustering/version.py index c08894012..8fc20902b 100644 --- a/openstack/clustering/version.py +++ b/openstack/clustering/version.py @@ -12,7 +12,7 @@ from openstack.clustering import clustering_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index 9ba0ef6e4..889295939 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -23,11 +23,11 @@ from openstack.compute.v2 import server_interface as _server_interface from openstack.compute.v2 import server_ip from openstack.compute.v2 import service as _service from openstack.compute.v2 import volume_attachment as _volume_attachment -from openstack import proxy2 -from openstack import resource2 +from openstack import proxy +from openstack import resource -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def find_extension(self, name_or_id, ignore_missing=True): """Find a single extension @@ -501,7 +501,7 @@ class Proxy(proxy2.BaseProxy): :returns: None """ server = self._get_resource(_server.Server, server) - flavor_id = resource2.Resource._get_id(flavor) + flavor_id = resource.Resource._get_id(flavor) server.resize(self, flavor_id) def confirm_server_resize(self, server): @@ -551,7 +551,7 @@ class Proxy(proxy2.BaseProxy): :returns: None """ server = self._get_resource(_server.Server, server) - security_group_id = resource2.Resource._get_id(security_group) + security_group_id = resource.Resource._get_id(security_group) server.add_security_group(self, security_group_id) def remove_security_group_from_server(self, server, security_group): @@ -566,7 +566,7 @@ class Proxy(proxy2.BaseProxy): :returns: None """ server = self._get_resource(_server.Server, server) - security_group_id = resource2.Resource._get_id(security_group) + security_group_id = resource.Resource._get_id(security_group) server.remove_security_group(self, security_group_id) def add_fixed_ip_to_server(self, server, network_id): @@ -806,8 +806,8 @@ class Proxy(proxy2.BaseProxy): def wait_for_server(self, server, status='ACTIVE', failures=['ERROR'], interval=2, wait=120): - return resource2.wait_for_status(self, server, status, - failures, interval, wait) + return resource.wait_for_status( + self, server, status, failures, interval, wait) def create_server_interface(self, server, **attrs): """Create a new server interface from attributes @@ -822,7 +822,7 @@ class Proxy(proxy2.BaseProxy): :returns: The results of server interface creation :rtype: :class:`~openstack.compute.v2.server_interface.ServerInterface` """ - server_id = resource2.Resource._get_id(server) + server_id = resource.Resource._get_id(server) return self._create(_server_interface.ServerInterface, server_id=server_id, **attrs) @@ -848,7 +848,7 @@ class Proxy(proxy2.BaseProxy): """ server_id = self._get_uri_attribute(server_interface, server, "server_id") - server_interface = resource2.Resource._get_id(server_interface) + server_interface = resource.Resource._get_id(server_interface) self._delete(_server_interface.ServerInterface, port_id=server_interface, @@ -874,7 +874,7 @@ class Proxy(proxy2.BaseProxy): """ server_id = self._get_uri_attribute(server_interface, server, "server_id") - server_interface = resource2.Resource._get_id(server_interface) + server_interface = resource.Resource._get_id(server_interface) return self._get(_server_interface.ServerInterface, server_id=server_id, port_id=server_interface) @@ -888,7 +888,7 @@ class Proxy(proxy2.BaseProxy): :returns: A generator of ServerInterface objects :rtype: :class:`~openstack.compute.v2.server_interface.ServerInterface` """ - server_id = resource2.Resource._get_id(server) + server_id = resource.Resource._get_id(server) return self._list(_server_interface.ServerInterface, paginated=False, server_id=server_id) @@ -903,7 +903,7 @@ class Proxy(proxy2.BaseProxy): :returns: A generator of ServerIP objects :rtype: :class:`~openstack.compute.v2.server_ip.ServerIP` """ - server_id = resource2.Resource._get_id(server) + server_id = resource.Resource._get_id(server) return self._list(server_ip.ServerIP, paginated=False, server_id=server_id, network_label=network_label) @@ -1150,7 +1150,7 @@ class Proxy(proxy2.BaseProxy): :rtype: :class:`~openstack.compute.v2.volume_attachment.VolumeAttachment` """ - server_id = resource2.Resource._get_id(server) + server_id = resource.Resource._get_id(server) return self._create(_volume_attachment.VolumeAttachment, server_id=server_id, **attrs) @@ -1177,7 +1177,7 @@ class Proxy(proxy2.BaseProxy): """ server_id = self._get_uri_attribute(volume_attachment, server, "server_id") - volume_attachment = resource2.Resource._get_id(volume_attachment) + volume_attachment = resource.Resource._get_id(volume_attachment) return self._update(_volume_attachment.VolumeAttachment, attachment_id=volume_attachment, @@ -1206,7 +1206,7 @@ class Proxy(proxy2.BaseProxy): """ server_id = self._get_uri_attribute(volume_attachment, server, "server_id") - volume_attachment = resource2.Resource._get_id(volume_attachment) + volume_attachment = resource.Resource._get_id(volume_attachment) self._delete(_volume_attachment.VolumeAttachment, attachment_id=volume_attachment, @@ -1239,7 +1239,7 @@ class Proxy(proxy2.BaseProxy): """ server_id = self._get_uri_attribute(volume_attachment, server, "server_id") - volume_attachment = resource2.Resource._get_id(volume_attachment) + volume_attachment = resource.Resource._get_id(volume_attachment) return self._get(_volume_attachment.VolumeAttachment, server_id=server_id, @@ -1256,7 +1256,7 @@ class Proxy(proxy2.BaseProxy): :rtype: :class:`~openstack.compute.v2.volume_attachment.VolumeAttachment` """ - server_id = resource2.Resource._get_id(server) + server_id = resource.Resource._get_id(server) return self._list(_volume_attachment.VolumeAttachment, paginated=False, server_id=server_id) diff --git a/openstack/compute/v2/availability_zone.py b/openstack/compute/v2/availability_zone.py index 56f49295c..5727d4825 100644 --- a/openstack/compute/v2/availability_zone.py +++ b/openstack/compute/v2/availability_zone.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class AvailabilityZone(resource2.Resource): +class AvailabilityZone(resource.Resource): resources_key = 'availabilityZoneInfo' base_path = '/os-availability-zone' @@ -25,11 +25,11 @@ class AvailabilityZone(resource2.Resource): # Properties #: name of availability zone - name = resource2.Body('zoneName') + name = resource.Body('zoneName') #: state of availability zone - state = resource2.Body('zoneState') + state = resource.Body('zoneState') #: hosts of availability zone - hosts = resource2.Body('hosts') + hosts = resource.Body('hosts') class AvailabilityZoneDetail(AvailabilityZone): diff --git a/openstack/compute/v2/extension.py b/openstack/compute/v2/extension.py index 6d3681034..c5a938bf5 100644 --- a/openstack/compute/v2/extension.py +++ b/openstack/compute/v2/extension.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class Extension(resource2.Resource): +class Extension(resource.Resource): resource_key = 'extension' resources_key = 'extensions' base_path = '/extensions' @@ -27,15 +27,15 @@ class Extension(resource2.Resource): # Properties #: A short name by which this extension is also known. - alias = resource2.Body('alias', alternate_id=True) + alias = resource.Body('alias', alternate_id=True) #: Text describing this extension's purpose. - description = resource2.Body('description') + description = resource.Body('description') #: Links pertaining to this extension. This is a list of dictionaries, #: each including keys ``href`` and ``rel``. - links = resource2.Body('links') + links = resource.Body('links') #: The name of the extension. - name = resource2.Body('name') + name = resource.Body('name') #: A URL pointing to the namespace for this extension. - namespace = resource2.Body('namespace') + namespace = resource.Body('namespace') #: Timestamp when this extension was last updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') diff --git a/openstack/compute/v2/flavor.py b/openstack/compute/v2/flavor.py index 34df465ce..b21555135 100644 --- a/openstack/compute/v2/flavor.py +++ b/openstack/compute/v2/flavor.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class Flavor(resource2.Resource): +class Flavor(resource.Resource): resource_key = 'flavor' resources_key = 'flavors' base_path = '/flavors' @@ -26,33 +26,34 @@ class Flavor(resource2.Resource): allow_delete = True allow_list = True - _query_mapping = resource2.QueryParameters("sort_key", "sort_dir", - min_disk="minDisk", - min_ram="minRam") + _query_mapping = resource.QueryParameters( + "sort_key", "sort_dir", + min_disk="minDisk", + min_ram="minRam") # Properties #: Links pertaining to this flavor. This is a list of dictionaries, #: each including keys ``href`` and ``rel``. - links = resource2.Body('links') + links = resource.Body('links') #: The name of this flavor. - name = resource2.Body('name') + name = resource.Body('name') #: Size of the disk this flavor offers. *Type: int* - disk = resource2.Body('disk', type=int) + disk = resource.Body('disk', type=int) #: ``True`` if this is a publicly visible flavor. ``False`` if this is #: a private image. *Type: bool* - is_public = resource2.Body('os-flavor-access:is_public', type=bool) + is_public = resource.Body('os-flavor-access:is_public', type=bool) #: The amount of RAM (in MB) this flavor offers. *Type: int* - ram = resource2.Body('ram', type=int) + ram = resource.Body('ram', type=int) #: The number of virtual CPUs this flavor offers. *Type: int* - vcpus = resource2.Body('vcpus', type=int) + vcpus = resource.Body('vcpus', type=int) #: Size of the swap partitions. - swap = resource2.Body('swap') + swap = resource.Body('swap') #: Size of the ephemeral data disk attached to this server. *Type: int* - ephemeral = resource2.Body('OS-FLV-EXT-DATA:ephemeral', type=int) + ephemeral = resource.Body('OS-FLV-EXT-DATA:ephemeral', type=int) #: ``True`` if this flavor is disabled, ``False`` if not. *Type: bool* - is_disabled = resource2.Body('OS-FLV-DISABLED:disabled', type=bool) + is_disabled = resource.Body('OS-FLV-DISABLED:disabled', type=bool) #: The bandwidth scaling factor this flavor receives on the network. - rxtx_factor = resource2.Body('rxtx_factor', type=float) + rxtx_factor = resource.Body('rxtx_factor', type=float) class FlavorDetail(Flavor): diff --git a/openstack/compute/v2/hypervisor.py b/openstack/compute/v2/hypervisor.py index 25293f7e9..1c532b9ad 100644 --- a/openstack/compute/v2/hypervisor.py +++ b/openstack/compute/v2/hypervisor.py @@ -12,10 +12,10 @@ from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class Hypervisor(resource2.Resource): +class Hypervisor(resource.Resource): resource_key = 'hypervisor' resources_key = 'hypervisors' base_path = '/os-hypervisors' @@ -28,40 +28,40 @@ class Hypervisor(resource2.Resource): # Properties #: Status of hypervisor - status = resource2.Body('status') + status = resource.Body('status') #: State of hypervisor - state = resource2.Body('state') + state = resource.Body('state') #: Name of hypervisor - name = resource2.Body('hypervisor_hostname') + name = resource.Body('hypervisor_hostname') #: Service details - service_details = resource2.Body('service') + service_details = resource.Body('service') #: Count of the VCPUs in use - vcpus_used = resource2.Body('vcpus_used') + vcpus_used = resource.Body('vcpus_used') #: Count of all VCPUs - vcpus = resource2.Body('vcpus') + vcpus = resource.Body('vcpus') #: Count of the running virtual machines - running_vms = resource2.Body('running_vms') + running_vms = resource.Body('running_vms') #: The type of hypervisor - hypervisor_type = resource2.Body('hypervisor_type') + hypervisor_type = resource.Body('hypervisor_type') #: Version of the hypervisor - hypervisor_version = resource2.Body('hypervisor_version') + hypervisor_version = resource.Body('hypervisor_version') #: The amount, in gigabytes, of local storage used - local_disk_used = resource2.Body('local_gb_used') + local_disk_used = resource.Body('local_gb_used') #: The amount, in gigabytes, of the local storage device - local_disk_size = resource2.Body('local_gb') + local_disk_size = resource.Body('local_gb') #: The amount, in gigabytes, of free space on the local storage device - local_disk_free = resource2.Body('free_disk_gb') + local_disk_free = resource.Body('free_disk_gb') #: The amount, in megabytes, of memory - memory_used = resource2.Body('memory_mb_used') + memory_used = resource.Body('memory_mb_used') #: The amount, in megabytes, of total memory - memory_size = resource2.Body('memory_mb') + memory_size = resource.Body('memory_mb') #: The amount, in megabytes, of available memory - memory_free = resource2.Body('free_ram_mb') + memory_free = resource.Body('free_ram_mb') #: Measurement of the hypervisor's current workload - current_workload = resource2.Body('current_workload') + current_workload = resource.Body('current_workload') #: Information about the hypervisor's CPU - cpu_info = resource2.Body('cpu_info') + cpu_info = resource.Body('cpu_info') #: IP address of the host - host_ip = resource2.Body('host_ip') + host_ip = resource.Body('host_ip') #: Disk space available to the scheduler - disk_available = resource2.Body("disk_available_least") + disk_available = resource.Body("disk_available_least") diff --git a/openstack/compute/v2/image.py b/openstack/compute/v2/image.py index a0cd539b8..b201ac922 100644 --- a/openstack/compute/v2/image.py +++ b/openstack/compute/v2/image.py @@ -12,10 +12,10 @@ from openstack.compute import compute_service from openstack.compute.v2 import metadata -from openstack import resource2 +from openstack import resource -class Image(resource2.Resource, metadata.MetadataMixin): +class Image(resource.Resource, metadata.MetadataMixin): resource_key = 'image' resources_key = 'images' base_path = '/images' @@ -26,35 +26,35 @@ class Image(resource2.Resource, metadata.MetadataMixin): allow_delete = True allow_list = True - _query_mapping = resource2.QueryParameters("server", "name", - "status", "type", - min_disk="minDisk", - min_ram="minRam", - changes_since="changes-since") + _query_mapping = resource.QueryParameters( + "server", "name", "status", "type", + min_disk="minDisk", + min_ram="minRam", + changes_since="changes-since") # Properties #: Links pertaining to this image. This is a list of dictionaries, #: each including keys ``href`` and ``rel``, and optionally ``type``. - links = resource2.Body('links') + links = resource.Body('links') #: The name of this image. - name = resource2.Body('name') + name = resource.Body('name') #: Timestamp when the image was created. - created_at = resource2.Body('created') + created_at = resource.Body('created') #: Metadata pertaining to this image. *Type: dict* - metadata = resource2.Body('metadata', type=dict) + metadata = resource.Body('metadata', type=dict) #: The mimimum disk size. *Type: int* - min_disk = resource2.Body('minDisk', type=int) + min_disk = resource.Body('minDisk', type=int) #: The minimum RAM size. *Type: int* - min_ram = resource2.Body('minRam', type=int) + min_ram = resource.Body('minRam', type=int) #: If this image is still building, its progress is represented here. #: Once an image is created, progres will be 100. *Type: int* - progress = resource2.Body('progress', type=int) + progress = resource.Body('progress', type=int) #: The status of this image. - status = resource2.Body('status') + status = resource.Body('status') #: Timestamp when the image was updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') #: Size of the image in bytes. *Type: int* - size = resource2.Body('OS-EXT-IMG-SIZE:size', type=int) + size = resource.Body('OS-EXT-IMG-SIZE:size', type=int) class ImageDetail(Image): diff --git a/openstack/compute/v2/keypair.py b/openstack/compute/v2/keypair.py index e11266218..268de02cc 100644 --- a/openstack/compute/v2/keypair.py +++ b/openstack/compute/v2/keypair.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class Keypair(resource2.Resource): +class Keypair(resource.Resource): resource_key = 'keypair' resources_key = 'keypairs' base_path = '/os-keypairs' @@ -29,7 +29,7 @@ class Keypair(resource2.Resource): # Properties #: The short fingerprint associated with the ``public_key`` for #: this keypair. - fingerprint = resource2.Body('fingerprint') + fingerprint = resource.Body('fingerprint') # NOTE: There is in fact an 'id' field. However, it's not useful # because all operations use the 'name' as an identifier. # Additionally, the 'id' field only appears *after* creation, @@ -37,13 +37,13 @@ class Keypair(resource2.Resource): # and it just gets in the way. We need to cover this up by listing # name as alternate_id and listing id as coming from name. #: The id identifying the keypair - id = resource2.Body('name') + id = resource.Body('name') #: A name identifying the keypair - name = resource2.Body('name', alternate_id=True) + name = resource.Body('name', alternate_id=True) #: The private key for the keypair - private_key = resource2.Body('private_key') + private_key = resource.Body('private_key') #: The SSH public key that is paired with the server. - public_key = resource2.Body('public_key') + public_key = resource.Body('public_key') def _consume_attrs(self, mapping, attrs): # TODO(mordred) This should not be required. However, without doing diff --git a/openstack/compute/v2/limits.py b/openstack/compute/v2/limits.py index e66b3e81b..645d6104f 100644 --- a/openstack/compute/v2/limits.py +++ b/openstack/compute/v2/limits.py @@ -11,72 +11,72 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class AbsoluteLimits(resource2.Resource): +class AbsoluteLimits(resource.Resource): #: The number of key-value pairs that can be set as image metadata. - image_meta = resource2.Body("maxImageMeta") + image_meta = resource.Body("maxImageMeta") #: The maximum number of personality contents that can be supplied. - personality = resource2.Body("maxPersonality") + personality = resource.Body("maxPersonality") #: The maximum size, in bytes, of a personality. - personality_size = resource2.Body("maxPersonalitySize") + personality_size = resource.Body("maxPersonalitySize") #: The maximum amount of security group rules allowed. - security_group_rules = resource2.Body("maxSecurityGroupRules") + security_group_rules = resource.Body("maxSecurityGroupRules") #: The maximum amount of security groups allowed. - security_groups = resource2.Body("maxSecurityGroups") + security_groups = resource.Body("maxSecurityGroups") #: The amount of security groups currently in use. - security_groups_used = resource2.Body("totalSecurityGroupsUsed") + security_groups_used = resource.Body("totalSecurityGroupsUsed") #: The number of key-value pairs that can be set as sever metadata. - server_meta = resource2.Body("maxServerMeta") + server_meta = resource.Body("maxServerMeta") #: The maximum amount of cores. - total_cores = resource2.Body("maxTotalCores") + total_cores = resource.Body("maxTotalCores") #: The amount of cores currently in use. - total_cores_used = resource2.Body("totalCoresUsed") + total_cores_used = resource.Body("totalCoresUsed") #: The maximum amount of floating IPs. - floating_ips = resource2.Body("maxTotalFloatingIps") + floating_ips = resource.Body("maxTotalFloatingIps") #: The amount of floating IPs currently in use. - floating_ips_used = resource2.Body("totalFloatingIpsUsed") + floating_ips_used = resource.Body("totalFloatingIpsUsed") #: The maximum amount of instances. - instances = resource2.Body("maxTotalInstances") + instances = resource.Body("maxTotalInstances") #: The amount of instances currently in use. - instances_used = resource2.Body("totalInstancesUsed") + instances_used = resource.Body("totalInstancesUsed") #: The maximum amount of keypairs. - keypairs = resource2.Body("maxTotalKeypairs") + keypairs = resource.Body("maxTotalKeypairs") #: The maximum RAM size in megabytes. - total_ram = resource2.Body("maxTotalRAMSize") + total_ram = resource.Body("maxTotalRAMSize") #: The RAM size in megabytes currently in use. - total_ram_used = resource2.Body("totalRAMUsed") + total_ram_used = resource.Body("totalRAMUsed") #: The maximum amount of server groups. - server_groups = resource2.Body("maxServerGroups") + server_groups = resource.Body("maxServerGroups") #: The amount of server groups currently in use. - server_groups_used = resource2.Body("totalServerGroupsUsed") + server_groups_used = resource.Body("totalServerGroupsUsed") #: The maximum number of members in a server group. - server_group_members = resource2.Body("maxServerGroupMembers") + server_group_members = resource.Body("maxServerGroupMembers") -class RateLimit(resource2.Resource): +class RateLimit(resource.Resource): # TODO(mordred) Make a resource type for the contents of limit and add # it to list_type here. #: A list of the specific limits that apply to the ``regex`` and ``uri``. - limits = resource2.Body("limit", type=list) + limits = resource.Body("limit", type=list) #: A regex representing which routes this rate limit applies to. - regex = resource2.Body("regex") + regex = resource.Body("regex") #: A URI representing which routes this rate limit applies to. - uri = resource2.Body("uri") + uri = resource.Body("uri") -class Limits(resource2.Resource): +class Limits(resource.Resource): base_path = "/limits" resource_key = "limits" service = compute_service.ComputeService() allow_get = True - absolute = resource2.Body("absolute", type=AbsoluteLimits) - rate = resource2.Body("rate", type=list, list_type=RateLimit) + absolute = resource.Body("absolute", type=AbsoluteLimits) + rate = resource.Body("rate", type=list, list_type=RateLimit) def get(self, session, requires_id=False, error_message=None): """Get the Limits resource. diff --git a/openstack/compute/v2/server.py b/openstack/compute/v2/server.py index 01ef2ba65..6cde73b00 100644 --- a/openstack/compute/v2/server.py +++ b/openstack/compute/v2/server.py @@ -12,11 +12,11 @@ from openstack.compute import compute_service from openstack.compute.v2 import metadata -from openstack import resource2 +from openstack import resource from openstack import utils -class Server(resource2.Resource, metadata.MetadataMixin): +class Server(resource.Resource, metadata.MetadataMixin): resource_key = 'server' resources_key = 'servers' base_path = '/servers' @@ -29,115 +29,116 @@ class Server(resource2.Resource, metadata.MetadataMixin): allow_delete = True allow_list = True - _query_mapping = resource2.QueryParameters("image", "flavor", "name", - "status", "host", "all_tenants", - "sort_key", "sort_dir", - "reservation_id", "tags", - "project_id", - tags_any="tags-any", - not_tags="not-tags", - not_tags_any="not-tags-any", - is_deleted="deleted", - ipv4_address="ip", - ipv6_address="ip6", - changes_since="changes-since") + _query_mapping = resource.QueryParameters( + "image", "flavor", "name", + "status", "host", "all_tenants", + "sort_key", "sort_dir", + "reservation_id", "tags", + "project_id", + tags_any="tags-any", + not_tags="not-tags", + not_tags_any="not-tags-any", + is_deleted="deleted", + ipv4_address="ip", + ipv6_address="ip6", + changes_since="changes-since") #: A list of dictionaries holding links relevant to this server. - links = resource2.Body('links') + links = resource.Body('links') - access_ipv4 = resource2.Body('accessIPv4') - access_ipv6 = resource2.Body('accessIPv6') + access_ipv4 = resource.Body('accessIPv4') + access_ipv6 = resource.Body('accessIPv6') #: A dictionary of addresses this server can be accessed through. #: The dictionary contains keys such as ``private`` and ``public``, #: each containing a list of dictionaries for addresses of that type. #: The addresses are contained in a dictionary with keys ``addr`` #: and ``version``, which is either 4 or 6 depending on the protocol #: of the IP address. *Type: dict* - addresses = resource2.Body('addresses', type=dict) + addresses = resource.Body('addresses', type=dict) #: Timestamp of when the server was created. - created_at = resource2.Body('created') + created_at = resource.Body('created') #: The flavor reference, as a ID or full URL, for the flavor to use for #: this server. - flavor_id = resource2.Body('flavorRef') + flavor_id = resource.Body('flavorRef') #: The flavor property as returned from server. - flavor = resource2.Body('flavor', type=dict) + flavor = resource.Body('flavor', type=dict) #: An ID representing the host of this server. - host_id = resource2.Body('hostId') + host_id = resource.Body('hostId') #: The image reference, as a ID or full URL, for the image to use for #: this server. - image_id = resource2.Body('imageRef') + image_id = resource.Body('imageRef') #: The image property as returned from server. - image = resource2.Body('image', type=dict) + image = resource.Body('image', type=dict) #: Metadata stored for this server. *Type: dict* - metadata = resource2.Body('metadata', type=dict) + metadata = resource.Body('metadata', type=dict) #: While the server is building, this value represents the percentage #: of completion. Once it is completed, it will be 100. *Type: int* - progress = resource2.Body('progress', type=int) + progress = resource.Body('progress', type=int) #: The ID of the project this server is associated with. - project_id = resource2.Body('tenant_id') + project_id = resource.Body('tenant_id') #: The state this server is in. Valid values include ``ACTIVE``, #: ``BUILDING``, ``DELETED``, ``ERROR``, ``HARD_REBOOT``, ``PASSWORD``, #: ``PAUSED``, ``REBOOT``, ``REBUILD``, ``RESCUED``, ``RESIZED``, #: ``REVERT_RESIZE``, ``SHUTOFF``, ``SOFT_DELETED``, ``STOPPED``, #: ``SUSPENDED``, ``UNKNOWN``, or ``VERIFY_RESIZE``. - status = resource2.Body('status') + status = resource.Body('status') #: Timestamp of when this server was last updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') #: The ID of the owners of this server. - user_id = resource2.Body('user_id') + user_id = resource.Body('user_id') #: The name of an associated keypair - key_name = resource2.Body('key_name') + key_name = resource.Body('key_name') #: The disk configuration. Either AUTO or MANUAL. - disk_config = resource2.Body('OS-DCF:diskConfig') + disk_config = resource.Body('OS-DCF:diskConfig') #: Indicates whether a configuration drive enables metadata injection. #: Not all cloud providers enable this feature. - has_config_drive = resource2.Body('config_drive') + has_config_drive = resource.Body('config_drive') #: The name of the availability zone this server is a part of. - availability_zone = resource2.Body('OS-EXT-AZ:availability_zone') + availability_zone = resource.Body('OS-EXT-AZ:availability_zone') #: The power state of this server. - power_state = resource2.Body('OS-EXT-STS:power_state') + power_state = resource.Body('OS-EXT-STS:power_state') #: The task state of this server. - task_state = resource2.Body('OS-EXT-STS:task_state') + task_state = resource.Body('OS-EXT-STS:task_state') #: The VM state of this server. - vm_state = resource2.Body('OS-EXT-STS:vm_state') + vm_state = resource.Body('OS-EXT-STS:vm_state') #: A list of an attached volumes. Each item in the list contains at least #: an "id" key to identify the specific volumes. - attached_volumes = resource2.Body( + attached_volumes = resource.Body( 'os-extended-volumes:volumes_attached') #: The timestamp when the server was launched. - launched_at = resource2.Body('OS-SRV-USG:launched_at') + launched_at = resource.Body('OS-SRV-USG:launched_at') #: The timestamp when the server was terminated (if it has been). - terminated_at = resource2.Body('OS-SRV-USG:terminated_at') + terminated_at = resource.Body('OS-SRV-USG:terminated_at') #: A list of applicable security groups. Each group contains keys for #: description, name, id, and rules. - security_groups = resource2.Body('security_groups') + security_groups = resource.Body('security_groups') #: When a server is first created, it provides the administrator password. - admin_password = resource2.Body('adminPass') + admin_password = resource.Body('adminPass') #: The file path and contents, text only, to inject into the server at #: launch. The maximum size of the file path data is 255 bytes. #: The maximum limit is The number of allowed bytes in the decoded, #: rather than encoded, data. - personality = resource2.Body('personality') + personality = resource.Body('personality') #: Configuration information or scripts to use upon launch. #: Must be Base64 encoded. - user_data = resource2.Body('OS-EXT-SRV-ATTR:user_data') + user_data = resource.Body('OS-EXT-SRV-ATTR:user_data') #: Enables fine grained control of the block device mapping for an #: instance. This is typically used for booting servers from volumes. - block_device_mapping = resource2.Body('block_device_mapping_v2') + block_device_mapping = resource.Body('block_device_mapping_v2') #: The dictionary of data to send to the scheduler. - scheduler_hints = resource2.Body('OS-SCH-HNT:scheduler_hints', type=dict) + scheduler_hints = resource.Body('OS-SCH-HNT:scheduler_hints', type=dict) #: A networks object. Required parameter when there are multiple #: networks defined for the tenant. When you do not specify the #: networks parameter, the server attaches to the only network #: created for the current tenant. - networks = resource2.Body('networks') + networks = resource.Body('networks') #: The hypervisor host name. Appears in the response for administrative #: users only. - hypervisor_hostname = resource2.Body('OS-EXT-SRV-ATTR:hypervisor_hostname') + hypervisor_hostname = resource.Body('OS-EXT-SRV-ATTR:hypervisor_hostname') #: The instance name. The Compute API generates the instance name from the #: instance name template. Appears in the response for administrative users #: only. - instance_name = resource2.Body('OS-EXT-SRV-ATTR:instance_name') + instance_name = resource.Body('OS-EXT-SRV-ATTR:instance_name') def _prepare_request(self, requires_id=True, prepend_key=True): request = super(Server, self)._prepare_request(requires_id=requires_id, @@ -206,7 +207,7 @@ class Server(resource2.Resource, metadata.MetadataMixin): 'preserve_ephemeral': preserve_ephemeral } if image is not None: - action['imageRef'] = resource2.Resource._get_id(image) + action['imageRef'] = resource.Resource._get_id(image) if access_ipv4 is not None: action['accessIPv4'] = access_ipv4 if access_ipv6 is not None: diff --git a/openstack/compute/v2/server_group.py b/openstack/compute/v2/server_group.py index f57c8e58a..1807069c5 100644 --- a/openstack/compute/v2/server_group.py +++ b/openstack/compute/v2/server_group.py @@ -11,16 +11,16 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class ServerGroup(resource2.Resource): +class ServerGroup(resource.Resource): resource_key = 'server_group' resources_key = 'server_groups' base_path = '/os-server-groups' service = compute_service.ComputeService() - _query_mapping = resource2.QueryParameters("all_projects") + _query_mapping = resource.QueryParameters("all_projects") # capabilities allow_create = True @@ -30,10 +30,10 @@ class ServerGroup(resource2.Resource): # Properties #: A name identifying the server group - name = resource2.Body('name') + name = resource.Body('name') #: The list of policies supported by the server group - policies = resource2.Body('policies') + policies = resource.Body('policies') #: The list of members in the server group - member_ids = resource2.Body('members') + member_ids = resource.Body('members') #: The metadata associated with the server group - metadata = resource2.Body('metadata') + metadata = resource.Body('metadata') diff --git a/openstack/compute/v2/server_interface.py b/openstack/compute/v2/server_interface.py index 951f6e422..98659d9a1 100644 --- a/openstack/compute/v2/server_interface.py +++ b/openstack/compute/v2/server_interface.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class ServerInterface(resource2.Resource): +class ServerInterface(resource.Resource): resource_key = 'interfaceAttachment' resources_key = 'interfaceAttachments' base_path = '/servers/%(server_id)s/os-interface' @@ -28,14 +28,14 @@ class ServerInterface(resource2.Resource): allow_list = True #: Fixed IP addresses with subnet IDs. - fixed_ips = resource2.Body('fixed_ips') + fixed_ips = resource.Body('fixed_ips') #: The MAC address. - mac_addr = resource2.Body('mac_addr') + mac_addr = resource.Body('mac_addr') #: The network ID. - net_id = resource2.Body('net_id') + net_id = resource.Body('net_id') #: The ID of the port for which you want to create an interface. - port_id = resource2.Body('port_id', alternate_id=True) + port_id = resource.Body('port_id', alternate_id=True) #: The port state. - port_state = resource2.Body('port_state') + port_state = resource.Body('port_state') #: The ID for the server. - server_id = resource2.URI('server_id') + server_id = resource.URI('server_id') diff --git a/openstack/compute/v2/server_ip.py b/openstack/compute/v2/server_ip.py index 2f4ed9542..4c797a68a 100644 --- a/openstack/compute/v2/server_ip.py +++ b/openstack/compute/v2/server_ip.py @@ -11,11 +11,11 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource from openstack import utils -class ServerIP(resource2.Resource): +class ServerIP(resource.Resource): resources_key = 'addresses' base_path = '/servers/%(server_id)s/ips' service = compute_service.ComputeService() @@ -25,13 +25,13 @@ class ServerIP(resource2.Resource): # Properties #: The IP address. The format of the address depends on :attr:`version` - address = resource2.Body('addr') + address = resource.Body('addr') #: The network label, such as public or private. - network_label = resource2.URI('network_label') + network_label = resource.URI('network_label') #: The ID for the server. - server_id = resource2.URI('server_id') + server_id = resource.URI('server_id') # Version of the IP protocol. Currently either 4 or 6. - version = resource2.Body('version') + version = resource.Body('version') @classmethod def list(cls, session, paginated=False, server_id=None, diff --git a/openstack/compute/v2/service.py b/openstack/compute/v2/service.py index ece512703..4e9b0873e 100644 --- a/openstack/compute/v2/service.py +++ b/openstack/compute/v2/service.py @@ -11,11 +11,11 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource from openstack import utils -class Service(resource2.Resource): +class Service(resource.Resource): resource_key = 'service' resources_key = 'services' base_path = '/os-services' @@ -28,19 +28,19 @@ class Service(resource2.Resource): # Properties #: Status of service - status = resource2.Body('status') + status = resource.Body('status') #: State of service - state = resource2.Body('state') + state = resource.Body('state') #: Name of service - binary = resource2.Body('binary') + binary = resource.Body('binary') #: Id of service - id = resource2.Body('id') + id = resource.Body('id') #: Disabled reason of service - disables_reason = resource2.Body('disabled_reason') + disables_reason = resource.Body('disabled_reason') #: Host where service runs - host = resource2.Body('host') + host = resource.Body('host') #: The availability zone of service - zone = resource2.Body("zone") + zone = resource.Body("zone") def _action(self, session, action, body): url = utils.urljoin(Service.base_path, action) diff --git a/openstack/compute/v2/volume_attachment.py b/openstack/compute/v2/volume_attachment.py index 44ae47f61..aa3e20674 100644 --- a/openstack/compute/v2/volume_attachment.py +++ b/openstack/compute/v2/volume_attachment.py @@ -11,10 +11,10 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 +from openstack import resource -class VolumeAttachment(resource2.Resource): +class VolumeAttachment(resource.Resource): resource_key = 'volumeAttachment' resources_key = 'volumeAttachments' base_path = '/servers/%(server_id)s/os-volume_attachments' @@ -27,15 +27,15 @@ class VolumeAttachment(resource2.Resource): allow_delete = True allow_list = True - _query_mapping = resource2.QueryParameters("limit", "offset") + _query_mapping = resource.QueryParameters("limit", "offset") #: Name of the device such as, /dev/vdb. - device = resource2.Body('device') + device = resource.Body('device') #: The ID of the attachment. - id = resource2.Body('id') + id = resource.Body('id') #: The ID for the server. - server_id = resource2.URI('server_id') + server_id = resource.URI('server_id') #: The ID of the attached volume. - volume_id = resource2.Body('volumeId') + volume_id = resource.Body('volumeId') #: The ID of the attachment you want to delete or update. - attachment_id = resource2.Body('attachment_id', alternate_id=True) + attachment_id = resource.Body('attachment_id', alternate_id=True) diff --git a/openstack/compute/version.py b/openstack/compute/version.py index 186f35e18..d1230260a 100644 --- a/openstack/compute/version.py +++ b/openstack/compute/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.compute import compute_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/connection.py b/openstack/connection.py index dd968ae1a..aa5c56863 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -250,10 +250,10 @@ class Connection(object): def add_service(self, service): """Add a service to the Connection. - Attaches an instance of the :class:`~openstack.proxy2.BaseProxy` + Attaches an instance of the :class:`~openstack.proxy.BaseProxy` class contained in :class:`~openstack.service_description.ServiceDescription`. - The :class:`~openstack.proxy2.BaseProxy` will be attached to the + The :class:`~openstack.proxy.BaseProxy` will be attached to the `Connection` by its ``service_type`` and by any ``aliases`` that may be specified. diff --git a/openstack/database/v1/_proxy.py b/openstack/database/v1/_proxy.py index 89a1702cd..211e286f9 100644 --- a/openstack/database/v1/_proxy.py +++ b/openstack/database/v1/_proxy.py @@ -14,10 +14,10 @@ from openstack.database.v1 import database as _database from openstack.database.v1 import flavor as _flavor from openstack.database.v1 import instance as _instance from openstack.database.v1 import user as _user -from openstack import proxy2 +from openstack import proxy -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_database(self, instance, **attrs): """Create a new database from attributes diff --git a/openstack/database/v1/database.py b/openstack/database/v1/database.py index 3270ea98a..be46be803 100644 --- a/openstack/database/v1/database.py +++ b/openstack/database/v1/database.py @@ -11,7 +11,7 @@ # under the License. from openstack.database import database_service -from openstack import resource2 as resource +from openstack import resource class Database(resource.Resource): diff --git a/openstack/database/v1/flavor.py b/openstack/database/v1/flavor.py index 38a06098e..ac4bf7b9d 100644 --- a/openstack/database/v1/flavor.py +++ b/openstack/database/v1/flavor.py @@ -11,7 +11,7 @@ # under the License. from openstack.database import database_service -from openstack import resource2 as resource +from openstack import resource class Flavor(resource.Resource): diff --git a/openstack/database/v1/instance.py b/openstack/database/v1/instance.py index 30d03cc9a..76f67b035 100644 --- a/openstack/database/v1/instance.py +++ b/openstack/database/v1/instance.py @@ -11,7 +11,7 @@ # under the License. from openstack.database import database_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/database/v1/user.py b/openstack/database/v1/user.py index a2f4116cb..2055544b9 100644 --- a/openstack/database/v1/user.py +++ b/openstack/database/v1/user.py @@ -11,7 +11,7 @@ # under the License. from openstack.database import database_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/identity/v2/_proxy.py b/openstack/identity/v2/_proxy.py index e371da5e8..8b6b918e8 100644 --- a/openstack/identity/v2/_proxy.py +++ b/openstack/identity/v2/_proxy.py @@ -14,7 +14,7 @@ from openstack.identity.v2 import extension as _extension from openstack.identity.v2 import role as _role from openstack.identity.v2 import tenant as _tenant from openstack.identity.v2 import user as _user -from openstack import proxy2 as proxy +from openstack import proxy class Proxy(proxy.BaseProxy): diff --git a/openstack/identity/v2/extension.py b/openstack/identity/v2/extension.py index e8ba4fcfd..0012831e6 100644 --- a/openstack/identity/v2/extension.py +++ b/openstack/identity/v2/extension.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Extension(resource.Resource): diff --git a/openstack/identity/v2/role.py b/openstack/identity/v2/role.py index b3b0a0363..be07ff7fb 100644 --- a/openstack/identity/v2/role.py +++ b/openstack/identity/v2/role.py @@ -12,7 +12,7 @@ from openstack import format from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Role(resource.Resource): diff --git a/openstack/identity/v2/tenant.py b/openstack/identity/v2/tenant.py index f6933d5a4..ccac50aee 100644 --- a/openstack/identity/v2/tenant.py +++ b/openstack/identity/v2/tenant.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Tenant(resource.Resource): diff --git a/openstack/identity/v2/user.py b/openstack/identity/v2/user.py index 0e5a5846b..3f905712c 100644 --- a/openstack/identity/v2/user.py +++ b/openstack/identity/v2/user.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class User(resource.Resource): diff --git a/openstack/identity/v3/_proxy.py b/openstack/identity/v3/_proxy.py index 30aad2656..7cb720ee9 100644 --- a/openstack/identity/v3/_proxy.py +++ b/openstack/identity/v3/_proxy.py @@ -31,7 +31,7 @@ from openstack.identity.v3 import role_project_user_assignment \ from openstack.identity.v3 import service as _service from openstack.identity.v3 import trust as _trust from openstack.identity.v3 import user as _user -from openstack import proxy2 as proxy +from openstack import proxy class Proxy(proxy.BaseProxy): diff --git a/openstack/identity/v3/credential.py b/openstack/identity/v3/credential.py index 33bc40c49..781397964 100644 --- a/openstack/identity/v3/credential.py +++ b/openstack/identity/v3/credential.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Credential(resource.Resource): diff --git a/openstack/identity/v3/domain.py b/openstack/identity/v3/domain.py index 45b06fcbc..7ce373499 100644 --- a/openstack/identity/v3/domain.py +++ b/openstack/identity/v3/domain.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/identity/v3/endpoint.py b/openstack/identity/v3/endpoint.py index 59899e25e..e68517a04 100644 --- a/openstack/identity/v3/endpoint.py +++ b/openstack/identity/v3/endpoint.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Endpoint(resource.Resource): diff --git a/openstack/identity/v3/group.py b/openstack/identity/v3/group.py index 2793f94da..d0d132ec0 100644 --- a/openstack/identity/v3/group.py +++ b/openstack/identity/v3/group.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Group(resource.Resource): diff --git a/openstack/identity/v3/policy.py b/openstack/identity/v3/policy.py index 3e5643c70..6d240d8a2 100644 --- a/openstack/identity/v3/policy.py +++ b/openstack/identity/v3/policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Policy(resource.Resource): diff --git a/openstack/identity/v3/project.py b/openstack/identity/v3/project.py index 159192668..7b126b3a0 100644 --- a/openstack/identity/v3/project.py +++ b/openstack/identity/v3/project.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/identity/v3/region.py b/openstack/identity/v3/region.py index 9169d9436..d774aaa17 100644 --- a/openstack/identity/v3/region.py +++ b/openstack/identity/v3/region.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Region(resource.Resource): diff --git a/openstack/identity/v3/role.py b/openstack/identity/v3/role.py index 58c8b0fbc..aad9bdc17 100644 --- a/openstack/identity/v3/role.py +++ b/openstack/identity/v3/role.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Role(resource.Resource): diff --git a/openstack/identity/v3/role_assignment.py b/openstack/identity/v3/role_assignment.py index 459c275b7..412535f00 100644 --- a/openstack/identity/v3/role_assignment.py +++ b/openstack/identity/v3/role_assignment.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class RoleAssignment(resource.Resource): diff --git a/openstack/identity/v3/role_domain_group_assignment.py b/openstack/identity/v3/role_domain_group_assignment.py index d7fadc3cc..27b6963cb 100644 --- a/openstack/identity/v3/role_domain_group_assignment.py +++ b/openstack/identity/v3/role_domain_group_assignment.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class RoleDomainGroupAssignment(resource.Resource): diff --git a/openstack/identity/v3/role_domain_user_assignment.py b/openstack/identity/v3/role_domain_user_assignment.py index b4db0f522..085a77e0f 100644 --- a/openstack/identity/v3/role_domain_user_assignment.py +++ b/openstack/identity/v3/role_domain_user_assignment.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class RoleDomainUserAssignment(resource.Resource): diff --git a/openstack/identity/v3/role_project_group_assignment.py b/openstack/identity/v3/role_project_group_assignment.py index 225410b5d..cb48025c1 100644 --- a/openstack/identity/v3/role_project_group_assignment.py +++ b/openstack/identity/v3/role_project_group_assignment.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class RoleProjectGroupAssignment(resource.Resource): diff --git a/openstack/identity/v3/role_project_user_assignment.py b/openstack/identity/v3/role_project_user_assignment.py index b1989794a..a7e887099 100644 --- a/openstack/identity/v3/role_project_user_assignment.py +++ b/openstack/identity/v3/role_project_user_assignment.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class RoleProjectUserAssignment(resource.Resource): diff --git a/openstack/identity/v3/service.py b/openstack/identity/v3/service.py index 457d2995f..51bb7ced4 100644 --- a/openstack/identity/v3/service.py +++ b/openstack/identity/v3/service.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Service(resource.Resource): diff --git a/openstack/identity/v3/trust.py b/openstack/identity/v3/trust.py index 5141e7514..1b334bb02 100644 --- a/openstack/identity/v3/trust.py +++ b/openstack/identity/v3/trust.py @@ -12,7 +12,7 @@ from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Trust(resource.Resource): diff --git a/openstack/identity/v3/user.py b/openstack/identity/v3/user.py index 055a50ef8..453541763 100644 --- a/openstack/identity/v3/user.py +++ b/openstack/identity/v3/user.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class User(resource.Resource): diff --git a/openstack/identity/version.py b/openstack/identity/version.py index 1f8442a68..30992f109 100644 --- a/openstack/identity/version.py +++ b/openstack/identity/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.identity import identity_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/image/v1/_proxy.py b/openstack/image/v1/_proxy.py index e8d2ff534..aa4ba6fbe 100644 --- a/openstack/image/v1/_proxy.py +++ b/openstack/image/v1/_proxy.py @@ -11,7 +11,7 @@ # under the License. from openstack.image.v1 import image as _image -from openstack import proxy2 as proxy +from openstack import proxy class Proxy(proxy.BaseProxy): diff --git a/openstack/image/v1/image.py b/openstack/image/v1/image.py index 882f61334..b5b10fa1d 100644 --- a/openstack/image/v1/image.py +++ b/openstack/image/v1/image.py @@ -11,7 +11,7 @@ # under the License. from openstack.image import image_service -from openstack import resource2 as resource +from openstack import resource class Image(resource.Resource): diff --git a/openstack/image/v2/_proxy.py b/openstack/image/v2/_proxy.py index 55d7db916..b943bc9a7 100644 --- a/openstack/image/v2/_proxy.py +++ b/openstack/image/v2/_proxy.py @@ -13,11 +13,11 @@ from openstack import exceptions from openstack.image.v2 import image as _image from openstack.image.v2 import member as _member -from openstack import proxy2 -from openstack import resource2 +from openstack import proxy +from openstack import resource -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def upload_image(self, container_format=None, disk_format=None, data=None, **attrs): @@ -221,7 +221,7 @@ class Proxy(proxy2.BaseProxy): :returns: The results of member creation :rtype: :class:`~openstack.image.v2.member.Member` """ - image_id = resource2.Resource._get_id(image) + image_id = resource.Resource._get_id(image) return self._create(_member.Member, image_id=image_id, **attrs) def remove_member(self, member, image, ignore_missing=True): @@ -237,8 +237,8 @@ class Proxy(proxy2.BaseProxy): :returns: ``None`` """ - image_id = resource2.Resource._get_id(image) - member_id = resource2.Resource._get_id(member) + image_id = resource.Resource._get_id(image) + member_id = resource.Resource._get_id(member) self._delete(_member.Member, member_id=member_id, image_id=image_id, ignore_missing=ignore_missing) @@ -256,7 +256,7 @@ class Proxy(proxy2.BaseProxy): attempting to find a nonexistent resource. :returns: One :class:`~openstack.image.v2.member.Member` or None """ - image_id = resource2.Resource._get_id(image) + image_id = resource.Resource._get_id(image) return self._find(_member.Member, name_or_id, image_id=image_id, ignore_missing=ignore_missing) @@ -272,8 +272,8 @@ class Proxy(proxy2.BaseProxy): :raises: :class:`~openstack.exceptions.ResourceNotFound` when no resource can be found. """ - member_id = resource2.Resource._get_id(member) - image_id = resource2.Resource._get_id(image) + member_id = resource.Resource._get_id(member) + image_id = resource.Resource._get_id(image) return self._get(_member.Member, member_id=member_id, image_id=image_id) @@ -287,7 +287,7 @@ class Proxy(proxy2.BaseProxy): :returns: A generator of member objects :rtype: :class:`~openstack.image.v2.member.Member` """ - image_id = resource2.Resource._get_id(image) + image_id = resource.Resource._get_id(image) return self._list(_member.Member, paginated=False, image_id=image_id) @@ -305,7 +305,7 @@ class Proxy(proxy2.BaseProxy): :returns: The updated member :rtype: :class:`~openstack.image.v2.member.Member` """ - member_id = resource2.Resource._get_id(member) - image_id = resource2.Resource._get_id(image) + member_id = resource.Resource._get_id(member) + image_id = resource.Resource._get_id(image) return self._update(_member.Member, member_id=member_id, image_id=image_id, **attrs) diff --git a/openstack/image/v2/image.py b/openstack/image/v2/image.py index 4b397a443..91f83b3a3 100644 --- a/openstack/image/v2/image.py +++ b/openstack/image/v2/image.py @@ -17,13 +17,13 @@ import jsonpatch from openstack import _log from openstack import exceptions from openstack.image import image_service -from openstack import resource2 +from openstack import resource from openstack import utils _logger = _log.setup_logging('openstack') -class Image(resource2.Resource): +class Image(resource.Resource): resources_key = 'images' base_path = '/images' service = image_service.ImageService() @@ -36,12 +36,13 @@ class Image(resource2.Resource): allow_list = True update_method = 'PATCH' - _query_mapping = resource2.QueryParameters("name", "visibility", - "member_status", "owner", - "status", "size_min", - "size_max", "sort_key", - "sort_dir", "sort", "tag", - "created_at", "updated_at") + _query_mapping = resource.QueryParameters( + "name", "visibility", + "member_status", "owner", + "status", "size_min", + "size_max", "sort_key", + "sort_dir", "sort", "tag", + "created_at", "updated_at") # NOTE: Do not add "self" support here. If you've used Python before, # you know that self, while not being a reserved word, has special @@ -57,159 +58,159 @@ class Image(resource2.Resource): # Properties #: Hash of the image data used. The Image service uses this value #: for verification. - checksum = resource2.Body('checksum') + checksum = resource.Body('checksum') #: The container format refers to whether the VM image is in a file #: format that also contains metadata about the actual VM. #: Container formats include OVF and Amazon AMI. In addition, #: a VM image might not have a container format - instead, #: the image is just a blob of unstructured data. - container_format = resource2.Body('container_format') + container_format = resource.Body('container_format') #: The date and time when the image was created. - created_at = resource2.Body('created_at') + created_at = resource.Body('created_at') #: Valid values are: aki, ari, ami, raw, iso, vhd, vdi, qcow2, or vmdk. #: The disk format of a VM image is the format of the underlying #: disk image. Virtual appliance vendors have different formats #: for laying out the information contained in a VM disk image. - disk_format = resource2.Body('disk_format') + disk_format = resource.Body('disk_format') #: Defines whether the image can be deleted. #: *Type: bool* - is_protected = resource2.Body('protected', type=bool) + is_protected = resource.Body('protected', type=bool) #: The minimum disk size in GB that is required to boot the image. - min_disk = resource2.Body('min_disk') + min_disk = resource.Body('min_disk') #: The minimum amount of RAM in MB that is required to boot the image. - min_ram = resource2.Body('min_ram') + min_ram = resource.Body('min_ram') #: The name of the image. - name = resource2.Body('name') + name = resource.Body('name') #: The ID of the owner, or project, of the image. - owner_id = resource2.Body('owner') + owner_id = resource.Body('owner') #: Properties, if any, that are associated with the image. - properties = resource2.Body('properties', type=dict) + properties = resource.Body('properties', type=dict) #: The size of the image data, in bytes. - size = resource2.Body('size', type=int) + size = resource.Body('size', type=int) #: When present, Glance will attempt to store the disk image data in the #: backing store indicated by the value of the header. When not present, #: Glance will store the disk image data in the backing store that is #: marked default. Valid values are: file, s3, rbd, swift, cinder, #: gridfs, sheepdog, or vsphere. - store = resource2.Body('store') + store = resource.Body('store') #: The image status. - status = resource2.Body('status') + status = resource.Body('status') #: Tags, if any, that are associated with the image. - tags = resource2.Body('tags') + tags = resource.Body('tags') #: The date and time when the image was updated. - updated_at = resource2.Body('updated_at') + updated_at = resource.Body('updated_at') #: The virtual size of the image. - virtual_size = resource2.Body('virtual_size') + virtual_size = resource.Body('virtual_size') #: The image visibility. - visibility = resource2.Body('visibility') + visibility = resource.Body('visibility') #: The URL for the virtual machine image file. - file = resource2.Body('file') + file = resource.Body('file') #: A list of URLs to access the image file in external store. #: This list appears if the show_multiple_locations option is set #: to true in the Image service's configuration file. - locations = resource2.Body('locations') + locations = resource.Body('locations') #: The URL to access the image file kept in external store. It appears #: when you set the show_image_direct_url option to true in the #: Image service's configuration file. - direct_url = resource2.Body('direct_url') + direct_url = resource.Body('direct_url') #: An image property. - path = resource2.Body('path') + path = resource.Body('path') #: Value of image property used in add or replace operations expressed #: in JSON notation. For example, you must enclose strings in quotation #: marks, and you do not enclose numeric values in quotation marks. - value = resource2.Body('value') + value = resource.Body('value') #: The URL to access the image file kept in external store. - url = resource2.Body('url') + url = resource.Body('url') #: The location metadata. - metadata = resource2.Body('metadata', type=dict) + metadata = resource.Body('metadata', type=dict) # Additional Image Properties # https://docs.openstack.org/glance/latest/user/common-image-properties.html # http://docs.openstack.org/cli-reference/glance-property-keys.html #: The CPU architecture that must be supported by the hypervisor. - architecture = resource2.Body("architecture") + architecture = resource.Body("architecture") #: The hypervisor type. Note that qemu is used for both QEMU and #: KVM hypervisor types. - hypervisor_type = resource2.Body("hypervisor-type") + hypervisor_type = resource.Body("hypervisor-type") #: Optional property allows created servers to have a different bandwidth #: cap than that defined in the network they are attached to. - instance_type_rxtx_factor = resource2.Body("instance_type_rxtx_factor", - type=float) + instance_type_rxtx_factor = resource.Body( + "instance_type_rxtx_factor", type=float) # For snapshot images, this is the UUID of the server used to #: create this image. - instance_uuid = resource2.Body('instance_uuid') + instance_uuid = resource.Body('instance_uuid') #: Specifies whether the image needs a config drive. #: `mandatory` or `optional` (default if property is not used). - needs_config_drive = resource2.Body('img_config_drive') + needs_config_drive = resource.Body('img_config_drive') #: The ID of an image stored in the Image service that should be used #: as the kernel when booting an AMI-style image. - kernel_id = resource2.Body('kernel_id') + kernel_id = resource.Body('kernel_id') #: The common name of the operating system distribution in lowercase - os_distro = resource2.Body('os_distro') + os_distro = resource.Body('os_distro') #: The operating system version as specified by the distributor. - os_version = resource2.Body('os_version') + os_version = resource.Body('os_version') #: Secure Boot is a security standard. When the instance starts, #: Secure Boot first examines software such as firmware and OS by #: their signature and only allows them to run if the signatures are valid. - needs_secure_boot = resource2.Body('os_secure_boot') + needs_secure_boot = resource.Body('os_secure_boot') #: The ID of image stored in the Image service that should be used as #: the ramdisk when booting an AMI-style image. - ramdisk_id = resource2.Body('ramdisk_id') + ramdisk_id = resource.Body('ramdisk_id') #: The virtual machine mode. This represents the host/guest ABI #: (application binary interface) used for the virtual machine. - vm_mode = resource2.Body('vm_mode') + vm_mode = resource.Body('vm_mode') #: The preferred number of sockets to expose to the guest. - hw_cpu_sockets = resource2.Body('hw_cpu_sockets', type=int) + hw_cpu_sockets = resource.Body('hw_cpu_sockets', type=int) #: The preferred number of cores to expose to the guest. - hw_cpu_cores = resource2.Body('hw_cpu_cores', type=int) + hw_cpu_cores = resource.Body('hw_cpu_cores', type=int) #: The preferred number of threads to expose to the guest. - hw_cpu_threads = resource2.Body('hw_cpu_threads', type=int) + hw_cpu_threads = resource.Body('hw_cpu_threads', type=int) #: Specifies the type of disk controller to attach disk devices to. #: One of scsi, virtio, uml, xen, ide, or usb. - hw_disk_bus = resource2.Body('hw_disk_bus') + hw_disk_bus = resource.Body('hw_disk_bus') #: Adds a random-number generator device to the image's instances. - hw_rng_model = resource2.Body('hw_rng_model') + hw_rng_model = resource.Body('hw_rng_model') #: For libvirt: Enables booting an ARM system using the specified #: machine type. #: For Hyper-V: Specifies whether the Hyper-V instance will be a #: generation 1 or generation 2 VM. - hw_machine_type = resource2.Body('hw_machine_type') + hw_machine_type = resource.Body('hw_machine_type') #: Enables the use of VirtIO SCSI (virtio-scsi) to provide block device #: access for compute instances; by default, instances use VirtIO Block #: (virtio-blk). - hw_scsi_model = resource2.Body('hw_scsi_model') + hw_scsi_model = resource.Body('hw_scsi_model') #: Specifies the count of serial ports that should be provided. - hw_serial_port_count = resource2.Body('hw_serial_port_count', type=int) + hw_serial_port_count = resource.Body('hw_serial_port_count', type=int) #: The video image driver used. - hw_video_model = resource2.Body('hw_video_model') + hw_video_model = resource.Body('hw_video_model') #: Maximum RAM for the video image. - hw_video_ram = resource2.Body('hw_video_ram', type=int) + hw_video_ram = resource.Body('hw_video_ram', type=int) #: Enables a virtual hardware watchdog device that carries out the #: specified action if the server hangs. - hw_watchdog_action = resource2.Body('hw_watchdog_action') + hw_watchdog_action = resource.Body('hw_watchdog_action') #: The kernel command line to be used by the libvirt driver, instead #: of the default. - os_command_line = resource2.Body('os_command_line') + os_command_line = resource.Body('os_command_line') #: Specifies the model of virtual network interface device to use. - hw_vif_model = resource2.Body('hw_vif_model') + hw_vif_model = resource.Body('hw_vif_model') #: If true, this enables the virtio-net multiqueue feature. #: In this case, the driver sets the number of queues equal to the #: number of guest vCPUs. This makes the network performance scale #: across a number of vCPUs. - is_hw_vif_multiqueue_enabled = resource2.Body('hw_vif_multiqueue_enabled', - type=bool) + is_hw_vif_multiqueue_enabled = resource.Body( + 'hw_vif_multiqueue_enabled', type=bool) #: If true, enables the BIOS bootmenu. - is_hw_boot_menu_enabled = resource2.Body('hw_boot_menu', type=bool) + is_hw_boot_menu_enabled = resource.Body('hw_boot_menu', type=bool) #: The virtual SCSI or IDE controller used by the hypervisor. - vmware_adaptertype = resource2.Body('vmware_adaptertype') + vmware_adaptertype = resource.Body('vmware_adaptertype') #: A VMware GuestID which describes the operating system installed #: in the image. - vmware_ostype = resource2.Body('vmware_ostype') + vmware_ostype = resource.Body('vmware_ostype') #: If true, the root partition on the disk is automatically resized #: before the instance boots. - has_auto_disk_config = resource2.Body('auto_disk_config', type=bool) + has_auto_disk_config = resource.Body('auto_disk_config', type=bool) #: The operating system installed on the image. - os_type = resource2.Body('os_type') + os_type = resource.Body('os_type') def _action(self, session, action): """Call an action on an image ID.""" diff --git a/openstack/image/v2/member.py b/openstack/image/v2/member.py index 5548efd7c..4157646e0 100644 --- a/openstack/image/v2/member.py +++ b/openstack/image/v2/member.py @@ -11,10 +11,10 @@ # under the License. from openstack.image import image_service -from openstack import resource2 +from openstack import resource -class Member(resource2.Resource): +class Member(resource.Resource): resources_key = 'members' base_path = '/images/%(image_id)s/members' service = image_service.ImageService() @@ -32,14 +32,14 @@ class Member(resource2.Resource): #: The ID of the image member. An image member is a tenant #: with whom the image is shared. - member_id = resource2.Body('member', alternate_id=True) + member_id = resource.Body('member', alternate_id=True) #: The date and time when the member was created. - created_at = resource2.Body('created_at') + created_at = resource.Body('created_at') #: Image ID stored through the image API. Typically a UUID. - image_id = resource2.URI('image_id') + image_id = resource.URI('image_id') #: The status of the image. - status = resource2.Body('status') + status = resource.Body('status') #: The URL for schema of the member. - schema = resource2.Body('schema') + schema = resource.Body('schema') #: The date and time when the member was updated. - updated_at = resource2.Body('updated_at') + updated_at = resource.Body('updated_at') diff --git a/openstack/key_manager/v1/_proxy.py b/openstack/key_manager/v1/_proxy.py index 0c65d2629..21215bad1 100644 --- a/openstack/key_manager/v1/_proxy.py +++ b/openstack/key_manager/v1/_proxy.py @@ -13,10 +13,10 @@ from openstack.key_manager.v1 import container as _container from openstack.key_manager.v1 import order as _order from openstack.key_manager.v1 import secret as _secret -from openstack import proxy2 +from openstack import proxy -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_container(self, **attrs): """Create a new container from attributes diff --git a/openstack/key_manager/v1/container.py b/openstack/key_manager/v1/container.py index dbfcdfa56..5cc4ff1a0 100644 --- a/openstack/key_manager/v1/container.py +++ b/openstack/key_manager/v1/container.py @@ -12,10 +12,10 @@ from openstack.key_manager import key_manager_service from openstack.key_manager.v1 import _format -from openstack import resource2 +from openstack import resource -class Container(resource2.Resource): +class Container(resource.Resource): resources_key = 'containers' base_path = '/containers' service = key_manager_service.KeyManagerService() @@ -29,21 +29,22 @@ class Container(resource2.Resource): # Properties #: A URI for this container - container_ref = resource2.Body('container_ref') + container_ref = resource.Body('container_ref') #: The ID for this container - container_id = resource2.Body('container_ref', alternate_id=True, - type=_format.HREFToUUID) + container_id = resource.Body( + 'container_ref', alternate_id=True, + type=_format.HREFToUUID) #: The timestamp when this container was created. - created_at = resource2.Body('created') + created_at = resource.Body('created') #: The name of this container - name = resource2.Body('name') + name = resource.Body('name') #: A list of references to secrets in this container - secret_refs = resource2.Body('secret_refs', type=list) + secret_refs = resource.Body('secret_refs', type=list) #: The status of this container - status = resource2.Body('status') + status = resource.Body('status') #: The type of this container - type = resource2.Body('type') + type = resource.Body('type') #: The timestamp when this container was updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') #: A party interested in this container. - consumers = resource2.Body('consumers', type=list) + consumers = resource.Body('consumers', type=list) diff --git a/openstack/key_manager/v1/order.py b/openstack/key_manager/v1/order.py index b7bed0654..a701275d5 100644 --- a/openstack/key_manager/v1/order.py +++ b/openstack/key_manager/v1/order.py @@ -12,10 +12,10 @@ from openstack.key_manager import key_manager_service from openstack.key_manager.v1 import _format -from openstack import resource2 +from openstack import resource -class Order(resource2.Resource): +class Order(resource.Resource): resources_key = 'orders' base_path = '/orders' service = key_manager_service.KeyManagerService() @@ -28,28 +28,28 @@ class Order(resource2.Resource): allow_list = True #: Timestamp in ISO8601 format of when the order was created - created_at = resource2.Body('created') + created_at = resource.Body('created') #: Keystone Id of the user who created the order - creator_id = resource2.Body('creator_id') + creator_id = resource.Body('creator_id') #: A dictionary containing key-value parameters which specify the #: details of an order request - meta = resource2.Body('meta', type=dict) + meta = resource.Body('meta', type=dict) #: A URI for this order - order_ref = resource2.Body('order_ref') + order_ref = resource.Body('order_ref') #: The ID of this order - order_id = resource2.Body('order_ref', alternate_id=True, - type=_format.HREFToUUID) + order_id = resource.Body( + 'order_ref', alternate_id=True, type=_format.HREFToUUID) #: Secret href associated with the order - secret_ref = resource2.Body('secret_ref') + secret_ref = resource.Body('secret_ref') #: Secret ID associated with the order - secret_id = resource2.Body('secret_ref', type=_format.HREFToUUID) + secret_id = resource.Body('secret_ref', type=_format.HREFToUUID) # The status of this order - status = resource2.Body('status') + status = resource.Body('status') #: Metadata associated with the order - sub_status = resource2.Body('sub_status') + sub_status = resource.Body('sub_status') #: Metadata associated with the order - sub_status_message = resource2.Body('sub_status_message') + sub_status_message = resource.Body('sub_status_message') # The type of order - type = resource2.Body('type') + type = resource.Body('type') #: Timestamp in ISO8601 format of the last time the order was updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') diff --git a/openstack/key_manager/v1/secret.py b/openstack/key_manager/v1/secret.py index 15b6ebea2..fd04e49e0 100644 --- a/openstack/key_manager/v1/secret.py +++ b/openstack/key_manager/v1/secret.py @@ -12,11 +12,11 @@ from openstack.key_manager import key_manager_service from openstack.key_manager.v1 import _format -from openstack import resource2 +from openstack import resource from openstack import utils -class Secret(resource2.Resource): +class Secret(resource.Resource): resources_key = 'secrets' base_path = '/secrets' service = key_manager_service.KeyManagerService() @@ -28,55 +28,56 @@ class Secret(resource2.Resource): allow_delete = True allow_list = True - _query_mapping = resource2.QueryParameters("name", "mode", "bits", - "secret_type", "acl_only", - "created", "updated", - "expiration", "sort", - algorithm="alg") + _query_mapping = resource.QueryParameters( + "name", "mode", "bits", + "secret_type", "acl_only", + "created", "updated", + "expiration", "sort", + algorithm="alg") # Properties #: Metadata provided by a user or system for informational purposes - algorithm = resource2.Body('algorithm') + algorithm = resource.Body('algorithm') #: Metadata provided by a user or system for informational purposes. #: Value must be greater than zero. - bit_length = resource2.Body('bit_length') + bit_length = resource.Body('bit_length') #: A list of content types - content_types = resource2.Body('content_types', type=dict) + content_types = resource.Body('content_types', type=dict) #: Once this timestamp has past, the secret will no longer be available. - expires_at = resource2.Body('expiration') + expires_at = resource.Body('expiration') #: Timestamp of when the secret was created. - created_at = resource2.Body('created') + created_at = resource.Body('created') #: Timestamp of when the secret was last updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') #: The type/mode of the algorithm associated with the secret information. - mode = resource2.Body('mode') + mode = resource.Body('mode') #: The name of the secret set by the user - name = resource2.Body('name') + name = resource.Body('name') #: A URI to the sercret - secret_ref = resource2.Body('secret_ref') + secret_ref = resource.Body('secret_ref') #: The ID of the secret # NOTE: This is not really how alternate IDs are supposed to work and # ultimately means this has to work differently than all other services # in all of OpenStack because of the departure from using actual IDs # that even this service can't even use itself. - secret_id = resource2.Body('secret_ref', alternate_id=True, - type=_format.HREFToUUID) + secret_id = resource.Body( + 'secret_ref', alternate_id=True, type=_format.HREFToUUID) #: Used to indicate the type of secret being stored. - secret_type = resource2.Body('secret_type') + secret_type = resource.Body('secret_type') #: The status of this secret - status = resource2.Body('status') + status = resource.Body('status') #: A timestamp when this secret was updated. - updated_at = resource2.Body('updated') + updated_at = resource.Body('updated') #: The secret's data to be stored. payload_content_type must also #: be supplied if payload is included. (optional) - payload = resource2.Body('payload') + payload = resource.Body('payload') #: The media type for the content of the payload. #: (required if payload is included) - payload_content_type = resource2.Body('payload_content_type') + payload_content_type = resource.Body('payload_content_type') #: The encoding used for the payload to be able to include it in #: the JSON request. Currently only base64 is supported. #: (required if payload is encoded) - payload_content_encoding = resource2.Body('payload_content_encoding') + payload_content_encoding = resource.Body('payload_content_encoding') def get(self, session, requires_id=True): request = self._prepare_request(requires_id=requires_id) diff --git a/openstack/load_balancer/v2/_proxy.py b/openstack/load_balancer/v2/_proxy.py index 8f02b1cd1..8542e2800 100644 --- a/openstack/load_balancer/v2/_proxy.py +++ b/openstack/load_balancer/v2/_proxy.py @@ -17,10 +17,10 @@ from openstack.load_balancer.v2 import listener as _listener from openstack.load_balancer.v2 import load_balancer as _lb from openstack.load_balancer.v2 import member as _member from openstack.load_balancer.v2 import pool as _pool -from openstack import proxy2 +from openstack import proxy -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_load_balancer(self, **attrs): """Create a new load balancer from attributes diff --git a/openstack/load_balancer/v2/health_monitor.py b/openstack/load_balancer/v2/health_monitor.py index ab47d2a52..d06de09a0 100644 --- a/openstack/load_balancer/v2/health_monitor.py +++ b/openstack/load_balancer/v2/health_monitor.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class HealthMonitor(resource.Resource): diff --git a/openstack/load_balancer/v2/l7_policy.py b/openstack/load_balancer/v2/l7_policy.py index 2c700702a..6d41d595b 100644 --- a/openstack/load_balancer/v2/l7_policy.py +++ b/openstack/load_balancer/v2/l7_policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class L7Policy(resource.Resource): diff --git a/openstack/load_balancer/v2/l7_rule.py b/openstack/load_balancer/v2/l7_rule.py index bc6af906e..398e31d24 100644 --- a/openstack/load_balancer/v2/l7_rule.py +++ b/openstack/load_balancer/v2/l7_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class L7Rule(resource.Resource): diff --git a/openstack/load_balancer/v2/listener.py b/openstack/load_balancer/v2/listener.py index 2612ff7ba..3ef086fc6 100644 --- a/openstack/load_balancer/v2/listener.py +++ b/openstack/load_balancer/v2/listener.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class Listener(resource.Resource): diff --git a/openstack/load_balancer/v2/load_balancer.py b/openstack/load_balancer/v2/load_balancer.py index 1e2afa733..de640aa1f 100644 --- a/openstack/load_balancer/v2/load_balancer.py +++ b/openstack/load_balancer/v2/load_balancer.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class LoadBalancer(resource.Resource): diff --git a/openstack/load_balancer/v2/member.py b/openstack/load_balancer/v2/member.py index f40b4dd83..da8200491 100644 --- a/openstack/load_balancer/v2/member.py +++ b/openstack/load_balancer/v2/member.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class Member(resource.Resource): diff --git a/openstack/load_balancer/v2/pool.py b/openstack/load_balancer/v2/pool.py index 6d72681e6..305299c56 100644 --- a/openstack/load_balancer/v2/pool.py +++ b/openstack/load_balancer/v2/pool.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class Pool(resource.Resource): diff --git a/openstack/load_balancer/version.py b/openstack/load_balancer/version.py index 4a829c2e3..c2266a2b0 100644 --- a/openstack/load_balancer/version.py +++ b/openstack/load_balancer/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.load_balancer import load_balancer_service as lb_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/message/v2/_proxy.py b/openstack/message/v2/_proxy.py index 948277278..f12c2174a 100644 --- a/openstack/message/v2/_proxy.py +++ b/openstack/message/v2/_proxy.py @@ -14,11 +14,11 @@ from openstack.message.v2 import claim as _claim from openstack.message.v2 import message as _message from openstack.message.v2 import queue as _queue from openstack.message.v2 import subscription as _subscription -from openstack import proxy2 -from openstack import resource2 +from openstack import proxy +from openstack import resource -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_queue(self, **attrs): """Create a new queue from attributes @@ -148,7 +148,7 @@ class Proxy(proxy2.BaseProxy): """ message = self._get_resource(_message.Message, value, queue_name=queue_name) - message.claim_id = resource2.Resource._get_id(claim) + message.claim_id = resource.Resource._get_id(claim) return self._delete(_message.Message, message, ignore_missing=ignore_missing) diff --git a/openstack/message/v2/claim.py b/openstack/message/v2/claim.py index c4824c919..9ee98f923 100644 --- a/openstack/message/v2/claim.py +++ b/openstack/message/v2/claim.py @@ -13,14 +13,14 @@ import uuid from openstack.message import message_service -from openstack import resource2 +from openstack import resource -class Claim(resource2.Resource): +class Claim(resource.Resource): # FIXME(anyone): The name string of `location` field of Zaqar API response # is lower case. That is inconsistent with the guide from API-WG. This is # a workaround for this issue. - location = resource2.Header("location") + location = resource.Header("location") resources_key = 'claims' base_path = '/queues/%(queue_name)s/claims' @@ -35,27 +35,27 @@ class Claim(resource2.Resource): # Properties #: The value in seconds indicating how long the claim has existed. - age = resource2.Body("age") + age = resource.Body("age") #: In case worker stops responding for a long time, the server will #: extend the lifetime of claimed messages to be at least as long as #: the lifetime of the claim itself, plus the specified grace period. #: Must between 60 and 43200 seconds(12 hours). - grace = resource2.Body("grace") + grace = resource.Body("grace") #: The number of messages to claim. Default 10, up to 20. - limit = resource2.Body("limit") + limit = resource.Body("limit") #: Messages have been successfully claimed. - messages = resource2.Body("messages") + messages = resource.Body("messages") #: Number of seconds the server wait before releasing the claim. Must #: between 60 and 43200 seconds(12 hours). - ttl = resource2.Body("ttl") + ttl = resource.Body("ttl") #: The name of queue to claim message from. - queue_name = resource2.URI("queue_name") + queue_name = resource.URI("queue_name") #: The ID to identify the client accessing Zaqar API. Must be specified #: in header for each API request. - client_id = resource2.Header("Client-ID") + client_id = resource.Header("Client-ID") #: The ID to identify the project. Must be provided when keystone #: authentication is not enabled in Zaqar service. - project_id = resource2.Header("X-PROJECT-ID") + project_id = resource.Header("X-PROJECT-ID") def _translate_response(self, response, has_body=True): super(Claim, self)._translate_response(response, has_body=has_body) diff --git a/openstack/message/v2/message.py b/openstack/message/v2/message.py index a889f14d2..2b8cccf65 100644 --- a/openstack/message/v2/message.py +++ b/openstack/message/v2/message.py @@ -13,14 +13,14 @@ import uuid from openstack.message import message_service -from openstack import resource2 +from openstack import resource -class Message(resource2.Resource): +class Message(resource.Resource): # FIXME(anyone): The name string of `location` field of Zaqar API response # is lower case. That is inconsistent with the guide from API-WG. This is # a workaround for this issue. - location = resource2.Header("location") + location = resource.Header("location") resources_key = 'messages' base_path = '/queues/%(queue_name)s/messages' @@ -32,28 +32,28 @@ class Message(resource2.Resource): allow_get = True allow_delete = True - _query_mapping = resource2.QueryParameters("echo", "include_claimed") + _query_mapping = resource.QueryParameters("echo", "include_claimed") # Properties #: The value in second to specify how long the message has been #: posted to the queue. - age = resource2.Body("age") + age = resource.Body("age") #: A dictionary specifies an arbitrary document that constitutes the #: body of the message being sent. - body = resource2.Body("body") + body = resource.Body("body") #: An uri string describe the location of the message resource. - href = resource2.Body("href") + href = resource.Body("href") #: The value in seconds to specify how long the server waits before #: marking the message as expired and removing it from the queue. - ttl = resource2.Body("ttl") + ttl = resource.Body("ttl") #: The name of target queue message is post to or got from. - queue_name = resource2.URI("queue_name") + queue_name = resource.URI("queue_name") #: The ID to identify the client accessing Zaqar API. Must be specified #: in header for each API request. - client_id = resource2.Header("Client-ID") + client_id = resource.Header("Client-ID") #: The ID to identify the project accessing Zaqar API. Must be specified #: in case keystone auth is not enabled in Zaqar service. - project_id = resource2.Header("X-PROJECT-ID") + project_id = resource.Header("X-PROJECT-ID") def post(self, session, messages): request = self._prepare_request(requires_id=False, prepend_key=True) @@ -72,7 +72,7 @@ class Message(resource2.Resource): def list(cls, session, paginated=True, **params): """This method is a generator which yields message objects. - This is almost the copy of list method of resource2.Resource class. + This is almost the copy of list method of resource.Resource class. The only difference is the request header now includes `Client-ID` and `X-PROJECT-ID` fields which are required by Zaqar v2 API. """ diff --git a/openstack/message/v2/queue.py b/openstack/message/v2/queue.py index 7be063789..d69b0034c 100644 --- a/openstack/message/v2/queue.py +++ b/openstack/message/v2/queue.py @@ -13,14 +13,14 @@ import uuid from openstack.message import message_service -from openstack import resource2 +from openstack import resource -class Queue(resource2.Resource): +class Queue(resource.Resource): # FIXME(anyone): The name string of `location` field of Zaqar API response # is lower case. That is inconsistent with the guide from API-WG. This is # a workaround for this issue. - location = resource2.Header("location") + location = resource.Header("location") resources_key = "queues" base_path = "/queues" @@ -35,22 +35,22 @@ class Queue(resource2.Resource): # Properties #: The default TTL of messages defined for a queue, which will effect for #: any messages posted to the queue. - default_message_ttl = resource2.Body("_default_message_ttl") + default_message_ttl = resource.Body("_default_message_ttl") #: Description of the queue. - description = resource2.Body("description") + description = resource.Body("description") #: The max post size of messages defined for a queue, which will effect #: for any messages posted to the queue. - max_messages_post_size = resource2.Body("_max_messages_post_size") + max_messages_post_size = resource.Body("_max_messages_post_size") #: Name of the queue. The name is the unique identity of a queue. It #: must not exceed 64 bytes in length, and it is limited to US-ASCII #: letters, digits, underscores, and hyphens. - name = resource2.Body("name", alternate_id=True) + name = resource.Body("name", alternate_id=True) #: The ID to identify the client accessing Zaqar API. Must be specified #: in header for each API request. - client_id = resource2.Header("Client-ID") + client_id = resource.Header("Client-ID") #: The ID to identify the project accessing Zaqar API. Must be specified #: in case keystone auth is not enabled in Zaqar service. - project_id = resource2.Header("X-PROJECT-ID") + project_id = resource.Header("X-PROJECT-ID") def create(self, session, prepend_key=True): request = self._prepare_request(requires_id=True, @@ -70,7 +70,7 @@ class Queue(resource2.Resource): def list(cls, session, paginated=False, **params): """This method is a generator which yields queue objects. - This is almost the copy of list method of resource2.Resource class. + This is almost the copy of list method of resource.Resource class. The only difference is the request header now includes `Client-ID` and `X-PROJECT-ID` fields which are required by Zaqar v2 API. """ diff --git a/openstack/message/v2/subscription.py b/openstack/message/v2/subscription.py index e95329fe2..f9de79b57 100644 --- a/openstack/message/v2/subscription.py +++ b/openstack/message/v2/subscription.py @@ -13,14 +13,14 @@ import uuid from openstack.message import message_service -from openstack import resource2 +from openstack import resource -class Subscription(resource2.Resource): +class Subscription(resource.Resource): # FIXME(anyone): The name string of `location` field of Zaqar API response # is lower case. That is inconsistent with the guide from API-WG. This is # a workaround for this issue. - location = resource2.Header("location") + location = resource.Header("location") resources_key = 'subscriptions' base_path = '/queues/%(queue_name)s/subscriptions' @@ -34,31 +34,31 @@ class Subscription(resource2.Resource): # Properties #: The value in seconds indicating how long the subscription has existed. - age = resource2.Body("age") + age = resource.Body("age") #: Alternate id of the subscription. This key is used in response of #: subscription create API to return id of subscription created. - subscription_id = resource2.Body("subscription_id", alternate_id=True) + subscription_id = resource.Body("subscription_id", alternate_id=True) #: The extra metadata for the subscription. The value must be a dict. #: If the subscriber is `mailto`. The options can contain `from` and #: `subject` to indicate the email's author and title. - options = resource2.Body("options", type=dict) + options = resource.Body("options", type=dict) #: The queue name which the subscription is registered on. - source = resource2.Body("source") + source = resource.Body("source") #: The destination of the message. Two kinds of subscribers are supported: #: http/https and email. The http/https subscriber should start with #: `http/https`. The email subscriber should start with `mailto`. - subscriber = resource2.Body("subscriber") + subscriber = resource.Body("subscriber") #: Number of seconds the subscription remains alive? The ttl value must #: be great than 60 seconds. The default value is 3600 seconds. - ttl = resource2.Body("ttl") + ttl = resource.Body("ttl") #: The queue name which the subscription is registered on. - queue_name = resource2.URI("queue_name") + queue_name = resource.URI("queue_name") #: The ID to identify the client accessing Zaqar API. Must be specified #: in header for each API request. - client_id = resource2.Header("Client-ID") + client_id = resource.Header("Client-ID") #: The ID to identify the project. Must be provided when keystone #: authentication is not enabled in Zaqar service. - project_id = resource2.Header("X-PROJECT-ID") + project_id = resource.Header("X-PROJECT-ID") def create(self, session, prepend_key=True): request = self._prepare_request(requires_id=False, @@ -78,7 +78,7 @@ class Subscription(resource2.Resource): def list(cls, session, paginated=True, **params): """This method is a generator which yields subscription objects. - This is almost the copy of list method of resource2.Resource class. + This is almost the copy of list method of resource.Resource class. The only difference is the request header now includes `Client-ID` and `X-PROJECT-ID` fields which are required by Zaqar v2 API. """ diff --git a/openstack/message/version.py b/openstack/message/version.py index 831effac7..6cb2ee51d 100644 --- a/openstack/message/version.py +++ b/openstack/message/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.message import message_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/network/v2/_proxy.py b/openstack/network/v2/_proxy.py index 09aeb3eac..a503a3723 100644 --- a/openstack/network/v2/_proxy.py +++ b/openstack/network/v2/_proxy.py @@ -48,11 +48,11 @@ from openstack.network.v2 import service_provider as _service_provider from openstack.network.v2 import subnet as _subnet from openstack.network.v2 import subnet_pool as _subnet_pool from openstack.network.v2 import vpn_service as _vpn_service -from openstack import proxy2 +from openstack import proxy from openstack import utils -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_address_scope(self, **attrs): """Create a new address scope from attributes @@ -3036,12 +3036,12 @@ class Proxy(proxy2.BaseProxy): """Replace tags of a specified resource with specified tags :param resource: - :class:`~openstack.resource2.Resource` instance. + :class:`~openstack.resource.Resource` instance. :param tags: New tags to be set. :type tags: "list" :returns: The updated resource - :rtype: :class:`~openstack.resource2.Resource` + :rtype: :class:`~openstack.resource.Resource` """ self._check_tag_support(resource) return resource.set_tags(self, tags) diff --git a/openstack/network/v2/address_scope.py b/openstack/network/v2/address_scope.py index 1364fcfdd..501800cb2 100644 --- a/openstack/network/v2/address_scope.py +++ b/openstack/network/v2/address_scope.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class AddressScope(resource.Resource): diff --git a/openstack/network/v2/agent.py b/openstack/network/v2/agent.py index 0259d2b4e..c657bfc8b 100644 --- a/openstack/network/v2/agent.py +++ b/openstack/network/v2/agent.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/network/v2/auto_allocated_topology.py b/openstack/network/v2/auto_allocated_topology.py index 84cf0bfa3..917de9780 100644 --- a/openstack/network/v2/auto_allocated_topology.py +++ b/openstack/network/v2/auto_allocated_topology.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class AutoAllocatedTopology(resource.Resource): diff --git a/openstack/network/v2/availability_zone.py b/openstack/network/v2/availability_zone.py index dd55f1797..7bc1a8d04 100644 --- a/openstack/network/v2/availability_zone.py +++ b/openstack/network/v2/availability_zone.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as _resource +from openstack import resource as _resource class AvailabilityZone(_resource.Resource): diff --git a/openstack/network/v2/extension.py b/openstack/network/v2/extension.py index 76c79c8e9..50fc4371f 100644 --- a/openstack/network/v2/extension.py +++ b/openstack/network/v2/extension.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Extension(resource.Resource): diff --git a/openstack/network/v2/flavor.py b/openstack/network/v2/flavor.py index 273d132f5..0947f5677 100644 --- a/openstack/network/v2/flavor.py +++ b/openstack/network/v2/flavor.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/network/v2/floating_ip.py b/openstack/network/v2/floating_ip.py index 2536e7f47..5ffbb1f4e 100644 --- a/openstack/network/v2/floating_ip.py +++ b/openstack/network/v2/floating_ip.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class FloatingIP(resource.Resource): diff --git a/openstack/network/v2/health_monitor.py b/openstack/network/v2/health_monitor.py index 74be84183..4430b3009 100644 --- a/openstack/network/v2/health_monitor.py +++ b/openstack/network/v2/health_monitor.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class HealthMonitor(resource.Resource): diff --git a/openstack/network/v2/listener.py b/openstack/network/v2/listener.py index 509367e91..b947cc171 100644 --- a/openstack/network/v2/listener.py +++ b/openstack/network/v2/listener.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Listener(resource.Resource): diff --git a/openstack/network/v2/load_balancer.py b/openstack/network/v2/load_balancer.py index 60f6df747..29cedd299 100644 --- a/openstack/network/v2/load_balancer.py +++ b/openstack/network/v2/load_balancer.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class LoadBalancer(resource.Resource): diff --git a/openstack/network/v2/metering_label.py b/openstack/network/v2/metering_label.py index 31220e445..5d9cccf38 100644 --- a/openstack/network/v2/metering_label.py +++ b/openstack/network/v2/metering_label.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class MeteringLabel(resource.Resource): diff --git a/openstack/network/v2/metering_label_rule.py b/openstack/network/v2/metering_label_rule.py index 568d054bc..e6db81fd5 100644 --- a/openstack/network/v2/metering_label_rule.py +++ b/openstack/network/v2/metering_label_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class MeteringLabelRule(resource.Resource): diff --git a/openstack/network/v2/network.py b/openstack/network/v2/network.py index f2aa0aa8e..0c1ca1d86 100644 --- a/openstack/network/v2/network.py +++ b/openstack/network/v2/network.py @@ -12,7 +12,7 @@ from openstack.network import network_service from openstack.network.v2 import tag -from openstack import resource2 as resource +from openstack import resource class Network(resource.Resource, tag.TagMixin): diff --git a/openstack/network/v2/network_ip_availability.py b/openstack/network/v2/network_ip_availability.py index 132fbc94f..e5ca95fda 100644 --- a/openstack/network/v2/network_ip_availability.py +++ b/openstack/network/v2/network_ip_availability.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class NetworkIPAvailability(resource.Resource): diff --git a/openstack/network/v2/pool.py b/openstack/network/v2/pool.py index 328d51afa..9cec41364 100644 --- a/openstack/network/v2/pool.py +++ b/openstack/network/v2/pool.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Pool(resource.Resource): diff --git a/openstack/network/v2/pool_member.py b/openstack/network/v2/pool_member.py index 2d8dba058..2de93f951 100644 --- a/openstack/network/v2/pool_member.py +++ b/openstack/network/v2/pool_member.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class PoolMember(resource.Resource): diff --git a/openstack/network/v2/port.py b/openstack/network/v2/port.py index 8240443ce..2a5ad4b0c 100644 --- a/openstack/network/v2/port.py +++ b/openstack/network/v2/port.py @@ -12,7 +12,7 @@ from openstack.network import network_service from openstack.network.v2 import tag -from openstack import resource2 as resource +from openstack import resource class Port(resource.Resource, tag.TagMixin): diff --git a/openstack/network/v2/qos_bandwidth_limit_rule.py b/openstack/network/v2/qos_bandwidth_limit_rule.py index ba5c32d8e..f080938ec 100644 --- a/openstack/network/v2/qos_bandwidth_limit_rule.py +++ b/openstack/network/v2/qos_bandwidth_limit_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class QoSBandwidthLimitRule(resource.Resource): diff --git a/openstack/network/v2/qos_dscp_marking_rule.py b/openstack/network/v2/qos_dscp_marking_rule.py index c01a6e548..bf247f1e1 100644 --- a/openstack/network/v2/qos_dscp_marking_rule.py +++ b/openstack/network/v2/qos_dscp_marking_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class QoSDSCPMarkingRule(resource.Resource): diff --git a/openstack/network/v2/qos_minimum_bandwidth_rule.py b/openstack/network/v2/qos_minimum_bandwidth_rule.py index 09577dc97..ad773d5d8 100644 --- a/openstack/network/v2/qos_minimum_bandwidth_rule.py +++ b/openstack/network/v2/qos_minimum_bandwidth_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class QoSMinimumBandwidthRule(resource.Resource): diff --git a/openstack/network/v2/qos_policy.py b/openstack/network/v2/qos_policy.py index f14de70aa..406285785 100644 --- a/openstack/network/v2/qos_policy.py +++ b/openstack/network/v2/qos_policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class QoSPolicy(resource.Resource): diff --git a/openstack/network/v2/qos_rule_type.py b/openstack/network/v2/qos_rule_type.py index ee2812c17..a241615ea 100644 --- a/openstack/network/v2/qos_rule_type.py +++ b/openstack/network/v2/qos_rule_type.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class QoSRuleType(resource.Resource): diff --git a/openstack/network/v2/quota.py b/openstack/network/v2/quota.py index 283242088..fadaff1b0 100644 --- a/openstack/network/v2/quota.py +++ b/openstack/network/v2/quota.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Quota(resource.Resource): diff --git a/openstack/network/v2/rbac_policy.py b/openstack/network/v2/rbac_policy.py index 16c3022ae..e0262ab77 100644 --- a/openstack/network/v2/rbac_policy.py +++ b/openstack/network/v2/rbac_policy.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class RBACPolicy(resource.Resource): diff --git a/openstack/network/v2/router.py b/openstack/network/v2/router.py index fd90f6a7a..4c123777a 100644 --- a/openstack/network/v2/router.py +++ b/openstack/network/v2/router.py @@ -12,7 +12,7 @@ from openstack.network import network_service from openstack.network.v2 import tag -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/network/v2/security_group.py b/openstack/network/v2/security_group.py index 2b7e0ff5f..d4c956263 100644 --- a/openstack/network/v2/security_group.py +++ b/openstack/network/v2/security_group.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class SecurityGroup(resource.Resource): diff --git a/openstack/network/v2/security_group_rule.py b/openstack/network/v2/security_group_rule.py index 6ea5e84a5..6bbf0d672 100644 --- a/openstack/network/v2/security_group_rule.py +++ b/openstack/network/v2/security_group_rule.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class SecurityGroupRule(resource.Resource): diff --git a/openstack/network/v2/segment.py b/openstack/network/v2/segment.py index 8d211ecbf..c81f21049 100644 --- a/openstack/network/v2/segment.py +++ b/openstack/network/v2/segment.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Segment(resource.Resource): diff --git a/openstack/network/v2/service_profile.py b/openstack/network/v2/service_profile.py index 0af0a340f..2707e0ac9 100644 --- a/openstack/network/v2/service_profile.py +++ b/openstack/network/v2/service_profile.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class ServiceProfile(resource.Resource): diff --git a/openstack/network/v2/service_provider.py b/openstack/network/v2/service_provider.py index 0f6680303..d6d93d2fc 100644 --- a/openstack/network/v2/service_provider.py +++ b/openstack/network/v2/service_provider.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class ServiceProvider(resource.Resource): diff --git a/openstack/network/v2/subnet.py b/openstack/network/v2/subnet.py index a79a26f9b..0dbf88001 100644 --- a/openstack/network/v2/subnet.py +++ b/openstack/network/v2/subnet.py @@ -12,7 +12,7 @@ from openstack.network import network_service from openstack.network.v2 import tag -from openstack import resource2 as resource +from openstack import resource class Subnet(resource.Resource, tag.TagMixin): diff --git a/openstack/network/v2/subnet_pool.py b/openstack/network/v2/subnet_pool.py index b4115d4d7..49e51e60b 100644 --- a/openstack/network/v2/subnet_pool.py +++ b/openstack/network/v2/subnet_pool.py @@ -12,7 +12,7 @@ from openstack.network import network_service from openstack.network.v2 import tag -from openstack import resource2 as resource +from openstack import resource class SubnetPool(resource.Resource, tag.TagMixin): diff --git a/openstack/network/v2/vpn_service.py b/openstack/network/v2/vpn_service.py index 55556b425..c65ee121a 100644 --- a/openstack/network/v2/vpn_service.py +++ b/openstack/network/v2/vpn_service.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource # NOTE: The VPN service is unmaintained, need to consider remove it diff --git a/openstack/network/version.py b/openstack/network/version.py index a3b520b72..9de4601ca 100644 --- a/openstack/network/version.py +++ b/openstack/network/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.network import network_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/object_store/v1/_base.py b/openstack/object_store/v1/_base.py index d2f9c13d6..ca297b0bb 100644 --- a/openstack/object_store/v1/_base.py +++ b/openstack/object_store/v1/_base.py @@ -13,7 +13,7 @@ from openstack import exceptions from openstack.object_store import object_store_service -from openstack import resource2 as resource +from openstack import resource class BaseResource(resource.Resource): diff --git a/openstack/object_store/v1/_proxy.py b/openstack/object_store/v1/_proxy.py index 8b8a7b4ec..e220cfd12 100644 --- a/openstack/object_store/v1/_proxy.py +++ b/openstack/object_store/v1/_proxy.py @@ -13,7 +13,7 @@ from openstack.object_store.v1 import account as _account from openstack.object_store.v1 import container as _container from openstack.object_store.v1 import obj as _obj -from openstack import proxy2 as proxy +from openstack import proxy class Proxy(proxy.BaseProxy): diff --git a/openstack/object_store/v1/account.py b/openstack/object_store/v1/account.py index 410d3a339..ede5716d7 100644 --- a/openstack/object_store/v1/account.py +++ b/openstack/object_store/v1/account.py @@ -12,7 +12,7 @@ # under the License. from openstack.object_store.v1 import _base -from openstack import resource2 as resource +from openstack import resource class Account(_base.BaseResource): diff --git a/openstack/object_store/v1/container.py b/openstack/object_store/v1/container.py index f5594a8f6..51452c882 100644 --- a/openstack/object_store/v1/container.py +++ b/openstack/object_store/v1/container.py @@ -12,7 +12,7 @@ # under the License. from openstack.object_store.v1 import _base -from openstack import resource2 as resource +from openstack import resource class Container(_base.BaseResource): diff --git a/openstack/object_store/v1/obj.py b/openstack/object_store/v1/obj.py index daacddcaf..2c305c9ef 100644 --- a/openstack/object_store/v1/obj.py +++ b/openstack/object_store/v1/obj.py @@ -16,7 +16,7 @@ import copy from openstack import exceptions from openstack.object_store import object_store_service from openstack.object_store.v1 import _base -from openstack import resource2 as resource +from openstack import resource class Object(_base.BaseResource): diff --git a/openstack/orchestration/v1/_proxy.py b/openstack/orchestration/v1/_proxy.py index 0ce2f1ec5..d83e469a7 100644 --- a/openstack/orchestration/v1/_proxy.py +++ b/openstack/orchestration/v1/_proxy.py @@ -19,10 +19,10 @@ from openstack.orchestration.v1 import stack_environment as _stack_environment from openstack.orchestration.v1 import stack_files as _stack_files from openstack.orchestration.v1 import stack_template as _stack_template from openstack.orchestration.v1 import template as _template -from openstack import proxy2 +from openstack import proxy -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_stack(self, preview=False, **attrs): """Create a new stack from attributes diff --git a/openstack/orchestration/v1/resource.py b/openstack/orchestration/v1/resource.py index f2a0a5633..710e5dcbf 100644 --- a/openstack/orchestration/v1/resource.py +++ b/openstack/orchestration/v1/resource.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class Resource(resource.Resource): diff --git a/openstack/orchestration/v1/software_config.py b/openstack/orchestration/v1/software_config.py index c0f128852..b8eb8e93d 100644 --- a/openstack/orchestration/v1/software_config.py +++ b/openstack/orchestration/v1/software_config.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class SoftwareConfig(resource.Resource): diff --git a/openstack/orchestration/v1/software_deployment.py b/openstack/orchestration/v1/software_deployment.py index 3fb22eafd..a76cc08ef 100644 --- a/openstack/orchestration/v1/software_deployment.py +++ b/openstack/orchestration/v1/software_deployment.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class SoftwareDeployment(resource.Resource): diff --git a/openstack/orchestration/v1/stack.py b/openstack/orchestration/v1/stack.py index 9172be71e..b42301eef 100644 --- a/openstack/orchestration/v1/stack.py +++ b/openstack/orchestration/v1/stack.py @@ -12,7 +12,7 @@ from openstack import exceptions from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource from openstack import utils diff --git a/openstack/orchestration/v1/stack_environment.py b/openstack/orchestration/v1/stack_environment.py index 7ffc5d5f8..dcf008f6e 100644 --- a/openstack/orchestration/v1/stack_environment.py +++ b/openstack/orchestration/v1/stack_environment.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class StackEnvironment(resource.Resource): diff --git a/openstack/orchestration/v1/stack_files.py b/openstack/orchestration/v1/stack_files.py index cb16dcd6e..e671688f2 100644 --- a/openstack/orchestration/v1/stack_files.py +++ b/openstack/orchestration/v1/stack_files.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class StackFiles(resource.Resource): diff --git a/openstack/orchestration/v1/stack_template.py b/openstack/orchestration/v1/stack_template.py index 7dace49a5..892ee4348 100644 --- a/openstack/orchestration/v1/stack_template.py +++ b/openstack/orchestration/v1/stack_template.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class StackTemplate(resource.Resource): diff --git a/openstack/orchestration/v1/template.py b/openstack/orchestration/v1/template.py index 7e2c5eab2..aa516d591 100644 --- a/openstack/orchestration/v1/template.py +++ b/openstack/orchestration/v1/template.py @@ -13,7 +13,7 @@ from six.moves.urllib import parse from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class Template(resource.Resource): diff --git a/openstack/orchestration/version.py b/openstack/orchestration/version.py index ecfdbc8eb..2dd05c286 100644 --- a/openstack/orchestration/version.py +++ b/openstack/orchestration/version.py @@ -11,7 +11,7 @@ # under the License. from openstack.orchestration import orchestration_service -from openstack import resource2 as resource +from openstack import resource class Version(resource.Resource): diff --git a/openstack/proxy2.py b/openstack/proxy.py similarity index 79% rename from openstack/proxy2.py rename to openstack/proxy.py index 33d3ee6f2..6954c823a 100644 --- a/openstack/proxy2.py +++ b/openstack/proxy.py @@ -12,7 +12,7 @@ from openstack import _adapter from openstack import exceptions -from openstack import resource2 +from openstack import resource from openstack import utils @@ -28,9 +28,9 @@ def _check_resource(strict=False): def wrap(method): def check(self, expected, actual=None, *args, **kwargs): if (strict and actual is not None and not - isinstance(actual, resource2.Resource)): + isinstance(actual, resource.Resource)): raise ValueError("A %s must be passed" % expected.__name__) - elif (isinstance(actual, resource2.Resource) and not + elif (isinstance(actual, resource.Resource) and not isinstance(actual, expected)): raise ValueError("Expected %s but received %s" % ( expected.__name__, actual.__class__.__name__)) @@ -47,7 +47,7 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): :param resource_type: The type of resource to operate on. This should be a subclass of - :class:`~openstack.resource2.Resource` with a + :class:`~openstack.resource.Resource` with a ``from_id`` method. :param value: The ID of a resource or an object of ``resource_type`` class if using an existing instance, or None to create a @@ -80,7 +80,7 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): if parent is None: value = getattr(child, name) else: - value = resource2.Resource._get_id(parent) + value = resource.Resource._get_id(parent) return value def _find(self, resource_type, name_or_id, ignore_missing=True, @@ -92,9 +92,9 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): :class:`~openstack.exceptions.ResourceNotFound` will be raised when the resource does not exist. When set to ``True``, None will be returned when - attempting to find a nonexistent resource2. + attempting to find a nonexistent resource. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.find` + :meth:`~openstack.resource.Resource.find` method, such as query parameters. :returns: An instance of ``resource_type`` or None @@ -108,23 +108,23 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """Delete a resource :param resource_type: The type of resource to delete. This should - be a :class:`~openstack.resource2.Resource` + be a :class:`~openstack.resource.Resource` subclass with a ``from_id`` method. :param value: The value to delete. Can be either the ID of a - resource or a :class:`~openstack.resource2.Resource` + resource or a :class:`~openstack.resource.Resource` subclass. :param bool ignore_missing: When set to ``False`` :class:`~openstack.exceptions.ResourceNotFound` will be raised when the resource does not exist. When set to ``True``, no exception will be set when - attempting to delete a nonexistent resource2. + attempting to delete a nonexistent resource. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.delete` + :meth:`~openstack.resource.Resource.delete` method, such as the ID of a parent resource. :returns: The result of the ``delete`` :raises: ``ValueError`` if ``value`` is a - :class:`~openstack.resource2.Resource` that doesn't match + :class:`~openstack.resource.Resource` that doesn't match the ``resource_type``. :class:`~openstack.exceptions.ResourceNotFound` when ignore_missing if ``False`` and a nonexistent resource @@ -155,19 +155,19 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """Update a resource :param resource_type: The type of resource to update. - :type resource_type: :class:`~openstack.resource2.Resource` + :type resource_type: :class:`~openstack.resource.Resource` :param value: The resource to update. This must either be a - :class:`~openstack.resource2.Resource` or an id - that corresponds to a resource2. + :class:`~openstack.resource.Resource` or an id + that corresponds to a resource. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.update` + :meth:`~openstack.resource.Resource.update` method to be updated. These should correspond - to either :class:`~openstack.resource2.Body` - or :class:`~openstack.resource2.Header` + to either :class:`~openstack.resource.Body` + or :class:`~openstack.resource.Header` values on this resource. :returns: The result of the ``update`` - :rtype: :class:`~openstack.resource2.Resource` + :rtype: :class:`~openstack.resource.Resource` """ res = self._get_resource(resource_type, value, **attrs) return res.update(self) @@ -176,18 +176,18 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """Create a resource from attributes :param resource_type: The type of resource to create. - :type resource_type: :class:`~openstack.resource2.Resource` + :type resource_type: :class:`~openstack.resource.Resource` :param path_args: A dict containing arguments for forming the request URL, if needed. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.create` + :meth:`~openstack.resource.Resource.create` method to be created. These should correspond - to either :class:`~openstack.resource2.Body` - or :class:`~openstack.resource2.Header` + to either :class:`~openstack.resource.Body` + or :class:`~openstack.resource.Header` values on this resource. :returns: The result of the ``create`` - :rtype: :class:`~openstack.resource2.Resource` + :rtype: :class:`~openstack.resource.Resource` """ res = resource_type.new(**attrs) return res.create(self) @@ -197,19 +197,19 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """Get a resource :param resource_type: The type of resource to get. - :type resource_type: :class:`~openstack.resource2.Resource` + :type resource_type: :class:`~openstack.resource.Resource` :param value: The value to get. Can be either the ID of a - resource or a :class:`~openstack.resource2.Resource` + resource or a :class:`~openstack.resource.Resource` subclass. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.get` + :meth:`~openstack.resource.Resource.get` method. These should correspond - to either :class:`~openstack.resource2.Body` - or :class:`~openstack.resource2.Header` + to either :class:`~openstack.resource.Body` + or :class:`~openstack.resource.Header` values on this resource. :returns: The result of the ``get`` - :rtype: :class:`~openstack.resource2.Resource` + :rtype: :class:`~openstack.resource.Resource` """ res = self._get_resource(resource_type, value, **attrs) @@ -222,23 +222,23 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """List a resource :param resource_type: The type of resource to delete. This should - be a :class:`~openstack.resource2.Resource` + be a :class:`~openstack.resource.Resource` subclass with a ``from_id`` method. :param value: The resource to list. It can be the ID of a resource, or - a :class:`~openstack.resource2.Resource` object. When set + a :class:`~openstack.resource.Resource` object. When set to None, a new bare resource is created. :param bool paginated: When set to ``False``, expect all of the data to be returned in one response. When set to ``True``, the resource supports data being returned across multiple pages. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.list` method. These should - correspond to either :class:`~openstack.resource2.URI` values - or appear in :data:`~openstack.resource2.Resource._query_mapping`. + :meth:`~openstack.resource.Resource.list` method. These should + correspond to either :class:`~openstack.resource.URI` values + or appear in :data:`~openstack.resource.Resource._query_mapping`. :returns: A generator of Resource objects. :raises: ``ValueError`` if ``value`` is a - :class:`~openstack.resource2.Resource` that doesn't match + :class:`~openstack.resource.Resource` that doesn't match the ``resource_type``. """ res = self._get_resource(resource_type, value, **attrs) @@ -248,18 +248,18 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): """Retrieve a resource's header :param resource_type: The type of resource to retrieve. - :type resource_type: :class:`~openstack.resource2.Resource` + :type resource_type: :class:`~openstack.resource.Resource` :param value: The value of a specific resource to retreive headers for. Can be either the ID of a resource, - a :class:`~openstack.resource2.Resource` subclass, + a :class:`~openstack.resource.Resource` subclass, or ``None``. :param dict attrs: Attributes to be passed onto the - :meth:`~openstack.resource2.Resource.head` method. + :meth:`~openstack.resource.Resource.head` method. These should correspond to - :class:`~openstack.resource2.URI` values. + :class:`~openstack.resource.URI` values. :returns: The result of the ``head`` call - :rtype: :class:`~openstack.resource2.Resource` + :rtype: :class:`~openstack.resource.Resource` """ res = self._get_resource(resource_type, value, **attrs) return res.head(self) @@ -267,7 +267,7 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): @utils.deprecated(deprecated_in="0.9.14", removed_in="1.0", details=("This is no longer a part of the proxy base, " "service-specific subclasses should expose " - "this as needed. See resource2.wait_for_status " + "this as needed. See resource.wait_for_status " "for this behavior")) def wait_for_status(self, value, status, failures=None, interval=2, wait=120): @@ -275,8 +275,8 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): :param value: The resource to wait on to reach the status. The resource must have a status attribute. - :type value: :class:`~openstack.resource2.Resource` - :param status: Desired status of the resource2. + :type value: :class:`~openstack.resource.Resource` + :param status: Desired status of the resource. :param list failures: Statuses that would indicate the transition failed such as 'ERROR'. :param interval: Number of seconds to wait between checks. @@ -291,19 +291,19 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): status attribute """ failures = [] if failures is None else failures - return resource2.wait_for_status(self, value, status, - failures, interval, wait) + return resource.wait_for_status( + self, value, status, failures, interval, wait) @utils.deprecated(deprecated_in="0.9.14", removed_in="1.0", details=("This is no longer a part of the proxy base, " "service-specific subclasses should expose " - "this as needed. See resource2.wait_for_delete " + "this as needed. See resource.wait_for_delete " "for this behavior")) def wait_for_delete(self, value, interval=2, wait=120): """Wait for the resource to be deleted. :param value: The resource to wait on to be deleted. - :type value: :class:`~openstack.resource2.Resource` + :type value: :class:`~openstack.resource.Resource` :param interval: Number of seconds to wait between checks. :param wait: Maximum number of seconds to wait for the delete. @@ -311,4 +311,4 @@ class BaseProxy(_adapter.OpenStackSDKAdapter): :raises: :class:`~openstack.exceptions.ResourceTimeout` transition to delete failed to occur in wait seconds. """ - return resource2.wait_for_delete(self, value, interval, wait) + return resource.wait_for_delete(self, value, interval, wait) diff --git a/openstack/resource2.py b/openstack/resource.py similarity index 98% rename from openstack/resource2.py rename to openstack/resource.py index 8d45efa4f..2d992b171 100644 --- a/openstack/resource2.py +++ b/openstack/resource.py @@ -15,11 +15,11 @@ The :class:`~openstack.resource.Resource` class is a base class that represent a remote resource. The attributes that comprise a request or response for this resource are specified as class members on the Resource subclass where their values -are of a component type, including :class:`~openstack.resource2.Body`, -:class:`~openstack.resource2.Header`, and :class:`~openstack.resource2.URI`. +are of a component type, including :class:`~openstack.resource.Body`, +:class:`~openstack.resource.Header`, and :class:`~openstack.resource.URI`. -For update management, :class:`~openstack.resource2.Resource` employs -a series of :class:`~openstack.resource2._ComponentManager` instances +For update management, :class:`~openstack.resource.Resource` employs +a series of :class:`~openstack.resource._ComponentManager` instances to look after the attributes of that particular component type. This is particularly useful for Body and Header types, so that only the values necessary are sent in requests to the server. @@ -296,8 +296,8 @@ class Resource(object): """The base resource :param bool _synchronized: This is not intended to be used directly. - See :meth:`~openstack.resource2.Resource.new` and - :meth:`~openstack.resource2.Resource.existing`. + See :meth:`~openstack.resource.Resource.new` and + :meth:`~openstack.resource.Resource.existing`. """ # NOTE: _collect_attrs modifies **attrs in place, removing @@ -532,9 +532,9 @@ class Resource(object): def to_dict(self, body=True, headers=True, ignore_none=False): """Return a dictionary of this resource's contents - :param bool body: Include the :class:`~openstack.resource2.Body` + :param bool body: Include the :class:`~openstack.resource.Body` attributes in the returned dictionary. - :param bool headers: Include the :class:`~openstack.resource2.Header` + :param bool headers: Include the :class:`~openstack.resource.Header` attributes in the returned dictionary. :param bool ignore_none: When True, exclude key/value pairs where the value is None. This will exclude @@ -807,12 +807,12 @@ class Resource(object): page of data will be returned regardless of the API's support of pagination.** :param dict params: These keyword arguments are passed through the - :meth:`~openstack.resource2.QueryParamter._transpose` method + :meth:`~openstack.resource.QueryParamter._transpose` method to find if any of them match expected query parameters to be sent in the *params* argument to :meth:`~keystoneauth1.adapter.Adapter.get`. They are additionally checked against the - :data:`~openstack.resource2.Resource.base_path` format string + :data:`~openstack.resource.Resource.base_path` format string to see if any path fragments need to be filled in by the contents of this argument. @@ -964,7 +964,7 @@ class Resource(object): attempting to find a nonexistent resource. :param dict params: Any additional parameters to be passed into underlying methods, such as to - :meth:`~openstack.resource2.Resource.existing` + :meth:`~openstack.resource.Resource.existing` in order to pass on URI parameters. :return: The :class:`Resource` object matching the given name or id diff --git a/openstack/service_description.py b/openstack/service_description.py index 80e5eeaaf..c141318e9 100644 --- a/openstack/service_description.py +++ b/openstack/service_description.py @@ -22,7 +22,7 @@ import warnings import os_service_types from openstack import _log -from openstack import proxy2 +from openstack import proxy _logger = _log.setup_logging('openstack') _service_type_manager = os_service_types.ServiceTypes() @@ -51,15 +51,11 @@ def _get_all_types(service_type, aliases=None): class ServiceDescription(object): #: Proxy class for this service - proxy_class = proxy2.BaseProxy + proxy_class = proxy.BaseProxy #: main service_type to use to find this service in the catalog service_type = None #: list of aliases this service might be registered as aliases = [] - #: Internal temporary flag to control whether or not a warning is - #: emitted for use of old Proxy class. In-tree things should not - #: emit a warning - but out of tree things should only use Proxy2. - _warn_if_old = True def __init__(self, service_type, proxy_class=None, aliases=None): """Class describing how to interact with a REST service. @@ -80,10 +76,10 @@ class ServiceDescription(object): :param string service_type: service_type to look for in the keystone catalog - :param proxy2.BaseProxy proxy_class: - subclass of :class:`~openstack.proxy2.BaseProxy` implementing + :param proxy.BaseProxy proxy_class: + subclass of :class:`~openstack.proxy.BaseProxy` implementing an interface for this service. Defaults to - :class:`~openstack.proxy2.BaseProxy` which provides REST operations + :class:`~openstack.proxy.BaseProxy` which provides REST operations but no additional features. :param list aliases: Optional list of aliases, if there is more than one name that might @@ -96,7 +92,7 @@ class ServiceDescription(object): self._validate_proxy_class() def _validate_proxy_class(self): - if not issubclass(self.proxy_class, proxy2.BaseProxy): + if not issubclass(self.proxy_class, proxy.BaseProxy): raise TypeError( "{module}.{proxy_class} must inherit from BaseProxy".format( module=self.proxy_class.__module__, @@ -105,9 +101,6 @@ class ServiceDescription(object): class OpenStackServiceDescription(ServiceDescription): - #: Override _warn_if_old so we don't spam people with warnings - _warn_if_old = False - def __init__(self, service, config): """Official OpenStack ServiceDescription. diff --git a/openstack/tests/unit/baremetal/v1/test_proxy.py b/openstack/tests/unit/baremetal/v1/test_proxy.py index d1bb49c16..4d874e89c 100644 --- a/openstack/tests/unit/baremetal/v1/test_proxy.py +++ b/openstack/tests/unit/baremetal/v1/test_proxy.py @@ -18,10 +18,10 @@ from openstack.baremetal.v1 import driver from openstack.baremetal.v1 import node from openstack.baremetal.v1 import port from openstack.baremetal.v1 import port_group -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestBaremetalProxy(test_proxy_base2.TestProxyBase): +class TestBaremetalProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestBaremetalProxy, self).setUp() diff --git a/openstack/tests/unit/block_storage/v2/test_proxy.py b/openstack/tests/unit/block_storage/v2/test_proxy.py index ac616e89d..e7b7fe721 100644 --- a/openstack/tests/unit/block_storage/v2/test_proxy.py +++ b/openstack/tests/unit/block_storage/v2/test_proxy.py @@ -15,10 +15,10 @@ from openstack.block_storage.v2 import snapshot from openstack.block_storage.v2 import stats from openstack.block_storage.v2 import type from openstack.block_storage.v2 import volume -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestVolumeProxy(test_proxy_base2.TestProxyBase): +class TestVolumeProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestVolumeProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) diff --git a/openstack/tests/unit/cluster/v1/test_proxy.py b/openstack/tests/unit/cluster/v1/test_proxy.py index 592509b1f..10b60b747 100644 --- a/openstack/tests/unit/cluster/v1/test_proxy.py +++ b/openstack/tests/unit/cluster/v1/test_proxy.py @@ -27,11 +27,11 @@ from openstack.clustering.v1 import profile from openstack.clustering.v1 import profile_type from openstack.clustering.v1 import receiver from openstack.clustering.v1 import service -from openstack import proxy2 as proxy_base -from openstack.tests.unit import test_proxy_base2 +from openstack import proxy as proxy_base +from openstack.tests.unit import test_proxy_base -class TestClusterProxy(test_proxy_base2.TestProxyBase): +class TestClusterProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestClusterProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -366,7 +366,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): self.verify_get(self.proxy.get_node, node.Node) def test_node_get_with_details(self): - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_node, method_args=['NODE_ID'], method_kwargs={'details': True}, @@ -472,7 +472,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): fake_cluster = cluster.Cluster.new(id='FAKE_CLUSTER') # ClusterPolicy object as input - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_cluster_policy, method_args=[fake_policy, "FAKE_CLUSTER"], expected_args=[cluster_policy.ClusterPolicy, @@ -481,7 +481,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): expected_result=fake_policy) # Policy ID as input - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_cluster_policy, method_args=["FAKE_POLICY", "FAKE_CLUSTER"], expected_args=[cluster_policy.ClusterPolicy, @@ -489,7 +489,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"cluster_id": "FAKE_CLUSTER"}) # Cluster object as input - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_cluster_policy, method_args=["FAKE_POLICY", fake_cluster], expected_args=[cluster_policy.ClusterPolicy, @@ -539,7 +539,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): method_kwargs={'limit': 2}, expected_kwargs={'limit': 2}) - @mock.patch("openstack.resource2.wait_for_status") + @mock.patch("openstack.resource.wait_for_status") def test_wait_for(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource @@ -549,7 +549,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): mock_wait.assert_called_once_with(self.proxy, mock_resource, 'ACTIVE', [], 2, 120) - @mock.patch("openstack.resource2.wait_for_status") + @mock.patch("openstack.resource.wait_for_status") def test_wait_for_params(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource @@ -559,7 +559,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): mock_wait.assert_called_once_with(self.proxy, mock_resource, 'ACTIVE', ['ERROR'], 1, 2) - @mock.patch("openstack.resource2.wait_for_delete") + @mock.patch("openstack.resource.wait_for_delete") def test_wait_for_delete(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource @@ -568,7 +568,7 @@ class TestClusterProxy(test_proxy_base2.TestProxyBase): mock_wait.assert_called_once_with(self.proxy, mock_resource, 2, 120) - @mock.patch("openstack.resource2.wait_for_delete") + @mock.patch("openstack.resource.wait_for_delete") def test_wait_for_delete_params(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource diff --git a/openstack/tests/unit/compute/v2/test_proxy.py b/openstack/tests/unit/compute/v2/test_proxy.py index 39a971e6d..f0c192708 100644 --- a/openstack/tests/unit/compute/v2/test_proxy.py +++ b/openstack/tests/unit/compute/v2/test_proxy.py @@ -23,10 +23,10 @@ from openstack.compute.v2 import server_group from openstack.compute.v2 import server_interface from openstack.compute.v2 import server_ip from openstack.compute.v2 import service -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestComputeProxy(test_proxy_base2.TestProxyBase): +class TestComputeProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestComputeProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -126,7 +126,7 @@ class TestComputeProxy(test_proxy_base2.TestProxyBase): test_interface.server_id = server_id # Case1: ServerInterface instance is provided as value - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_server_interface, method_args=[test_interface], method_kwargs={"server": server_id}, @@ -136,7 +136,7 @@ class TestComputeProxy(test_proxy_base2.TestProxyBase): "ignore_missing": True}) # Case2: ServerInterface ID is provided as value - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_server_interface, method_args=[interface_id], method_kwargs={"server": server_id}, @@ -163,7 +163,7 @@ class TestComputeProxy(test_proxy_base2.TestProxyBase): test_interface.server_id = server_id # Case1: ServerInterface instance is provided as value - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_server_interface, method_args=[test_interface], method_kwargs={"server": server_id}, @@ -172,7 +172,7 @@ class TestComputeProxy(test_proxy_base2.TestProxyBase): "server_id": server_id}) # Case2: ServerInterface ID is provided as value - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_server_interface, method_args=[interface_id], method_kwargs={"server": server_id}, diff --git a/openstack/tests/unit/database/v1/test_proxy.py b/openstack/tests/unit/database/v1/test_proxy.py index ff54e5b20..516340f18 100644 --- a/openstack/tests/unit/database/v1/test_proxy.py +++ b/openstack/tests/unit/database/v1/test_proxy.py @@ -15,10 +15,10 @@ from openstack.database.v1 import database from openstack.database.v1 import flavor from openstack.database.v1 import instance from openstack.database.v1 import user -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestDatabaseProxy(test_proxy_base2.TestProxyBase): +class TestDatabaseProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestDatabaseProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -41,7 +41,7 @@ class TestDatabaseProxy(test_proxy_base2.TestProxyBase): expected_path_args={"instance_id": "test_id"}) def test_database_find(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_database, method_args=["db", "instance"], expected_args=[database.Database, "db"], @@ -106,7 +106,7 @@ class TestDatabaseProxy(test_proxy_base2.TestProxyBase): expected_path_args={"instance_id": "id"}) def test_user_find(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_user, method_args=["user", "instance"], expected_args=[user.User, "user"], diff --git a/openstack/tests/unit/identity/v2/test_proxy.py b/openstack/tests/unit/identity/v2/test_proxy.py index cbca1fd7b..6e8ba830a 100644 --- a/openstack/tests/unit/identity/v2/test_proxy.py +++ b/openstack/tests/unit/identity/v2/test_proxy.py @@ -14,7 +14,7 @@ from openstack.identity.v2 import _proxy from openstack.identity.v2 import role from openstack.identity.v2 import tenant from openstack.identity.v2 import user -from openstack.tests.unit import test_proxy_base2 as test_proxy_base +from openstack.tests.unit import test_proxy_base as test_proxy_base class TestIdentityProxy(test_proxy_base.TestProxyBase): diff --git a/openstack/tests/unit/identity/v3/test_proxy.py b/openstack/tests/unit/identity/v3/test_proxy.py index aff747264..4fd0227b3 100644 --- a/openstack/tests/unit/identity/v3/test_proxy.py +++ b/openstack/tests/unit/identity/v3/test_proxy.py @@ -22,10 +22,10 @@ from openstack.identity.v3 import role from openstack.identity.v3 import service from openstack.identity.v3 import trust from openstack.identity.v3 import user -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestIdentityProxy(test_proxy_base2.TestProxyBase): +class TestIdentityProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestIdentityProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) diff --git a/openstack/tests/unit/image/v1/test_proxy.py b/openstack/tests/unit/image/v1/test_proxy.py index e0dbd679f..741770028 100644 --- a/openstack/tests/unit/image/v1/test_proxy.py +++ b/openstack/tests/unit/image/v1/test_proxy.py @@ -12,7 +12,7 @@ from openstack.image.v1 import _proxy from openstack.image.v1 import image -from openstack.tests.unit import test_proxy_base2 as test_proxy_base +from openstack.tests.unit import test_proxy_base as test_proxy_base class TestImageProxy(test_proxy_base.TestProxyBase): diff --git a/openstack/tests/unit/image/v2/test_proxy.py b/openstack/tests/unit/image/v2/test_proxy.py index 0fafcd927..4b6e66ad2 100644 --- a/openstack/tests/unit/image/v2/test_proxy.py +++ b/openstack/tests/unit/image/v2/test_proxy.py @@ -17,12 +17,12 @@ from openstack.image.v2 import _proxy from openstack.image.v2 import image from openstack.image.v2 import member from openstack.tests.unit.image.v2 import test_image as fake_image -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base EXAMPLE = fake_image.EXAMPLE -class TestImageProxy(test_proxy_base2.TestProxyBase): +class TestImageProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestImageProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -56,8 +56,8 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): def test_image_delete_ignore(self): self.verify_delete(self.proxy.delete_image, image.Image, True) - @mock.patch("openstack.resource2.Resource._translate_response") - @mock.patch("openstack.proxy2.BaseProxy._get") + @mock.patch("openstack.resource.Resource._translate_response") + @mock.patch("openstack.proxy.BaseProxy._get") @mock.patch("openstack.image.v2.image.Image.update") def test_image_update(self, mock_update_image, mock_get_image, mock_transpose): @@ -104,7 +104,7 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"image_id": "test_id"}) def test_member_delete(self): - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.remove_member, method_args=["member_id"], method_kwargs={"image": "image_id", @@ -115,7 +115,7 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): "ignore_missing": False}) def test_member_delete_ignore(self): - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.remove_member, method_args=["member_id"], method_kwargs={"image": "image_id"}, @@ -125,7 +125,7 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): "ignore_missing": True}) def test_member_update(self): - self._verify2("openstack.proxy2.BaseProxy._update", + self._verify2("openstack.proxy.BaseProxy._update", self.proxy.update_member, method_args=['member_id', 'image_id'], expected_args=[member.Member], @@ -133,7 +133,7 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): 'image_id': 'image_id'}) def test_member_get(self): - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_member, method_args=['member_id'], method_kwargs={"image": "image_id"}, @@ -142,7 +142,7 @@ class TestImageProxy(test_proxy_base2.TestProxyBase): 'image_id': 'image_id'}) def test_member_find(self): - self._verify2("openstack.proxy2.BaseProxy._find", + self._verify2("openstack.proxy.BaseProxy._find", self.proxy.find_member, method_args=['member_id'], method_kwargs={"image": "image_id"}, diff --git a/openstack/tests/unit/key_manager/v1/test_proxy.py b/openstack/tests/unit/key_manager/v1/test_proxy.py index e3652fb0e..ed3f9250a 100644 --- a/openstack/tests/unit/key_manager/v1/test_proxy.py +++ b/openstack/tests/unit/key_manager/v1/test_proxy.py @@ -14,10 +14,10 @@ from openstack.key_manager.v1 import _proxy from openstack.key_manager.v1 import container from openstack.key_manager.v1 import order from openstack.key_manager.v1 import secret -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestKeyManagerProxy(test_proxy_base2.TestProxyBase): +class TestKeyManagerProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestKeyManagerProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) diff --git a/openstack/tests/unit/load_balancer/test_proxy.py b/openstack/tests/unit/load_balancer/test_proxy.py index 4db9ad239..efa32031e 100644 --- a/openstack/tests/unit/load_balancer/test_proxy.py +++ b/openstack/tests/unit/load_balancer/test_proxy.py @@ -20,10 +20,10 @@ from openstack.load_balancer.v2 import listener from openstack.load_balancer.v2 import load_balancer as lb from openstack.load_balancer.v2 import member from openstack.load_balancer.v2 import pool -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase): +class TestLoadBalancerProxy(test_proxy_base.TestProxyBase): POOL_ID = uuid.uuid4() L7_POLICY_ID = uuid.uuid4() @@ -134,7 +134,7 @@ class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase): expected_kwargs={'pool_id': self.POOL_ID}) def test_member_find(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_member, method_args=["MEMBER", self.POOL_ID], expected_args=[member.Member, "MEMBER"], @@ -142,7 +142,7 @@ class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase): "ignore_missing": True}) def test_member_update(self): - self._verify2('openstack.proxy2.BaseProxy._update', + self._verify2('openstack.proxy.BaseProxy._update', self.proxy.update_member, method_args=["MEMBER", self.POOL_ID], expected_args=[member.Member, "MEMBER"], @@ -225,7 +225,7 @@ class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase): expected_kwargs={'l7policy_id': self.L7_POLICY_ID}) def test_l7_rule_find(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_l7_rule, method_args=["RULE", self.L7_POLICY_ID], expected_args=[l7_rule.L7Rule, "RULE"], @@ -233,7 +233,7 @@ class TestLoadBalancerProxy(test_proxy_base2.TestProxyBase): "ignore_missing": True}) def test_l7_rule_update(self): - self._verify2('openstack.proxy2.BaseProxy._update', + self._verify2('openstack.proxy.BaseProxy._update', self.proxy.update_l7_rule, method_args=["RULE", self.L7_POLICY_ID], expected_args=[l7_rule.L7Rule, "RULE"], diff --git a/openstack/tests/unit/message/v2/test_proxy.py b/openstack/tests/unit/message/v2/test_proxy.py index 75a602c56..d41165597 100644 --- a/openstack/tests/unit/message/v2/test_proxy.py +++ b/openstack/tests/unit/message/v2/test_proxy.py @@ -17,13 +17,13 @@ from openstack.message.v2 import claim from openstack.message.v2 import message from openstack.message.v2 import queue from openstack.message.v2 import subscription -from openstack import proxy2 as proxy_base -from openstack.tests.unit import test_proxy_base2 +from openstack import proxy as proxy_base +from openstack.tests.unit import test_proxy_base QUEUE_NAME = 'test_queue' -class TestMessageProxy(test_proxy_base2.TestProxyBase): +class TestMessageProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestMessageProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -57,7 +57,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): @mock.patch.object(proxy_base.BaseProxy, '_get_resource') def test_message_get(self, mock_get_resource): mock_get_resource.return_value = "resource_or_id" - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_message, method_args=["test_queue", "resource_or_id"], expected_args=[message.Message, "resource_or_id"]) @@ -75,7 +75,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): fake_message = mock.Mock() fake_message.id = "message_id" mock_get_resource.return_value = fake_message - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_message, method_args=["test_queue", "resource_or_id", None, False], @@ -92,7 +92,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): fake_message = mock.Mock() fake_message.id = "message_id" mock_get_resource.return_value = fake_message - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_message, method_args=["test_queue", "resource_or_id", "claim_id", False], @@ -109,7 +109,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): fake_message = mock.Mock() fake_message.id = "message_id" mock_get_resource.return_value = fake_message - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_message, method_args=["test_queue", "resource_or_id", None, True], @@ -129,7 +129,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): @mock.patch.object(proxy_base.BaseProxy, '_get_resource') def test_subscription_get(self, mock_get_resource): mock_get_resource.return_value = "resource_or_id" - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_subscription, method_args=["test_queue", "resource_or_id"], expected_args=[subscription.Subscription, @@ -169,7 +169,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): method_args=["test_queue"]) def test_claim_get(self): - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_claim, method_args=["test_queue", "resource_or_id"], expected_args=[claim.Claim, @@ -177,7 +177,7 @@ class TestMessageProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"queue_name": "test_queue"}) def test_claim_update(self): - self._verify2("openstack.proxy2.BaseProxy._update", + self._verify2("openstack.proxy.BaseProxy._update", self.proxy.update_claim, method_args=["test_queue", "resource_or_id"], method_kwargs={"k1": "v1"}, diff --git a/openstack/tests/unit/network/v2/test_proxy.py b/openstack/tests/unit/network/v2/test_proxy.py index abfe01a46..f548a80a0 100644 --- a/openstack/tests/unit/network/v2/test_proxy.py +++ b/openstack/tests/unit/network/v2/test_proxy.py @@ -49,8 +49,8 @@ from openstack.network.v2 import service_provider from openstack.network.v2 import subnet from openstack.network.v2 import subnet_pool from openstack.network.v2 import vpn_service -from openstack import proxy2 as proxy_base2 -from openstack.tests.unit import test_proxy_base2 +from openstack import proxy as proxy_base +from openstack.tests.unit import test_proxy_base QOS_POLICY_ID = 'qos-policy-id-' + uuid.uuid4().hex @@ -60,7 +60,7 @@ AGENT_ID = 'agent-id-' + uuid.uuid4().hex ROUTER_ID = 'router-id-' + uuid.uuid4().hex -class TestNetworkProxy(test_proxy_base2.TestProxyBase): +class TestNetworkProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestNetworkProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -316,7 +316,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): self.verify_find(self.proxy.find_network, network.Network) def test_network_find_with_filter(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_network, method_args=["net1"], method_kwargs={"project_id": "1"}, @@ -406,7 +406,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): {"pool": "test_id"}, {"pool_id": "test_id"}) def test_pool_member_find(self): - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_pool_member, method_args=["MEMBER", "POOL"], expected_args=[pool_member.PoolMember, "MEMBER"], @@ -414,7 +414,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): "ignore_missing": True}) def test_pool_member_get(self): - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_pool_member, method_args=["MEMBER", "POOL"], expected_args=[pool_member.PoolMember, "MEMBER"], @@ -426,7 +426,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"pool_id": "test_id"}) def test_pool_member_update(self): - self._verify2("openstack.proxy2.BaseProxy._update", + self._verify2("openstack.proxy.BaseProxy._update", self.proxy.update_pool_member, method_args=["MEMBER", "POOL"], expected_args=[pool_member.PoolMember, "MEMBER"], @@ -497,7 +497,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_bandwidth_limit_rule_find(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_qos_bandwidth_limit_rule, method_args=['rule_id', policy], expected_args=[ @@ -523,7 +523,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_bandwidth_limit_rule_update(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._update', + self._verify2('openstack.proxy.BaseProxy._update', self.proxy.update_qos_bandwidth_limit_rule, method_args=['rule_id', policy], method_kwargs={'foo': 'bar'}, @@ -556,7 +556,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_dscp_marking_rule_find(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_qos_dscp_marking_rule, method_args=['rule_id', policy], expected_args=[qos_dscp_marking_rule.QoSDSCPMarkingRule, @@ -581,7 +581,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_dscp_marking_rule_update(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._update', + self._verify2('openstack.proxy.BaseProxy._update', self.proxy.update_qos_dscp_marking_rule, method_args=['rule_id', policy], method_kwargs={'foo': 'bar'}, @@ -614,7 +614,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_minimum_bandwidth_rule_find(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._find', + self._verify2('openstack.proxy.BaseProxy._find', self.proxy.find_qos_minimum_bandwidth_rule, method_args=['rule_id', policy], expected_args=[ @@ -640,7 +640,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_qos_minimum_bandwidth_rule_update(self): policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID) - self._verify2('openstack.proxy2.BaseProxy._update', + self._verify2('openstack.proxy.BaseProxy._update', self.proxy.update_qos_minimum_bandwidth_rule, method_args=['rule_id', policy], method_kwargs={'foo': 'bar'}, @@ -695,11 +695,11 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_quota_get(self): self.verify_get(self.proxy.get_quota, quota.Quota) - @mock.patch.object(proxy_base2.BaseProxy, "_get_resource") + @mock.patch.object(proxy_base.BaseProxy, "_get_resource") def test_quota_get_details(self, mock_get): fake_quota = mock.Mock(project_id='PROJECT') mock_get.return_value = fake_quota - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_quota, method_args=['QUOTA_ID'], method_kwargs={'details': True}, @@ -708,11 +708,11 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): 'requires_id': False}) mock_get.assert_called_once_with(quota.Quota, 'QUOTA_ID') - @mock.patch.object(proxy_base2.BaseProxy, "_get_resource") + @mock.patch.object(proxy_base.BaseProxy, "_get_resource") def test_quota_default_get(self, mock_get): fake_quota = mock.Mock(project_id='PROJECT') mock_get.return_value = fake_quota - self._verify2("openstack.proxy2.BaseProxy._get", + self._verify2("openstack.proxy.BaseProxy._get", self.proxy.get_quota_default, method_args=['QUOTA_ID'], expected_args=[quota.QuotaDefault], @@ -773,7 +773,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): def test_router_update(self): self.verify_update(self.proxy.update_router, router.Router) - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'add_interface') def test_add_interface_to_router_with_port(self, mock_add_interface, mock_get): @@ -787,7 +787,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"port_id": "PORT"}) mock_get.assert_called_once_with(router.Router, "FAKE_ROUTER") - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'add_interface') def test_add_interface_to_router_with_subnet(self, mock_add_interface, mock_get): @@ -801,7 +801,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"subnet_id": "SUBNET"}) mock_get.assert_called_once_with(router.Router, "FAKE_ROUTER") - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'remove_interface') def test_remove_interface_from_router_with_port(self, mock_remove, mock_get): @@ -815,7 +815,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"port_id": "PORT"}) mock_get.assert_called_once_with(router.Router, "FAKE_ROUTER") - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'remove_interface') def test_remove_interface_from_router_with_subnet(self, mock_remove, mock_get): @@ -829,7 +829,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"subnet_id": "SUBNET"}) mock_get.assert_called_once_with(router.Router, "FAKE_ROUTER") - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'add_gateway') def test_add_gateway_to_router(self, mock_add, mock_get): x_router = router.Router.new(id="ROUTER_ID") @@ -842,7 +842,7 @@ class TestNetworkProxy(test_proxy_base2.TestProxyBase): expected_kwargs={"foo": "bar"}) mock_get.assert_called_once_with(router.Router, "FAKE_ROUTER") - @mock.patch.object(proxy_base2.BaseProxy, '_get_resource') + @mock.patch.object(proxy_base.BaseProxy, '_get_resource') @mock.patch.object(router.Router, 'remove_gateway') def test_remove_gateway_from_router(self, mock_remove, mock_get): x_router = router.Router.new(id="ROUTER_ID") diff --git a/openstack/tests/unit/network/v2/test_quota.py b/openstack/tests/unit/network/v2/test_quota.py index 20f55effa..1f35281e5 100644 --- a/openstack/tests/unit/network/v2/test_quota.py +++ b/openstack/tests/unit/network/v2/test_quota.py @@ -13,7 +13,7 @@ import testtools from openstack.network.v2 import quota -from openstack import resource2 as resource +from openstack import resource IDENTIFIER = 'IDENTIFIER' EXAMPLE = { diff --git a/openstack/tests/unit/object_store/v1/test_proxy.py b/openstack/tests/unit/object_store/v1/test_proxy.py index 537f7b299..1b5266750 100644 --- a/openstack/tests/unit/object_store/v1/test_proxy.py +++ b/openstack/tests/unit/object_store/v1/test_proxy.py @@ -60,7 +60,7 @@ class TestObjectStoreProxy(test_proxy_base2.TestProxyBase): "container": "name", } - self._verify2("openstack.proxy2.BaseProxy._delete", + self._verify2("openstack.proxy.BaseProxy._delete", self.proxy.delete_object, method_args=["resource"], method_kwargs=expected_kwargs, @@ -76,7 +76,7 @@ class TestObjectStoreProxy(test_proxy_base2.TestProxyBase): def test_object_create_attrs(self): kwargs = {"name": "test", "data": "data", "container": "name"} - self._verify2("openstack.proxy2.BaseProxy._create", + self._verify2("openstack.proxy.BaseProxy._create", self.proxy.upload_object, method_kwargs=kwargs, expected_args=[obj.Object], diff --git a/openstack/tests/unit/orchestration/v1/test_proxy.py b/openstack/tests/unit/orchestration/v1/test_proxy.py index 3289f5656..0193781af 100644 --- a/openstack/tests/unit/orchestration/v1/test_proxy.py +++ b/openstack/tests/unit/orchestration/v1/test_proxy.py @@ -23,10 +23,10 @@ from openstack.orchestration.v1 import stack_environment from openstack.orchestration.v1 import stack_files from openstack.orchestration.v1 import stack_template from openstack.orchestration.v1 import template -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base -class TestOrchestrationProxy(test_proxy_base2.TestProxyBase): +class TestOrchestrationProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestOrchestrationProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) @@ -84,7 +84,7 @@ class TestOrchestrationProxy(test_proxy_base2.TestProxyBase): stk = stack.Stack(id=stack_id, name=stack_name) mock_find.return_value = stk - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_stack_environment, method_args=['IDENTITY'], expected_args=[stack_environment.StackEnvironment], @@ -99,7 +99,7 @@ class TestOrchestrationProxy(test_proxy_base2.TestProxyBase): stack_name = 'test_stack' stk = stack.Stack(id=stack_id, name=stack_name) - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_stack_environment, method_args=[stk], expected_args=[stack_environment.StackEnvironment], @@ -142,7 +142,7 @@ class TestOrchestrationProxy(test_proxy_base2.TestProxyBase): stk = stack.Stack(id=stack_id, name=stack_name) mock_find.return_value = stk - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_stack_template, method_args=['IDENTITY'], expected_args=[stack_template.StackTemplate], @@ -157,7 +157,7 @@ class TestOrchestrationProxy(test_proxy_base2.TestProxyBase): stack_name = 'test_stack' stk = stack.Stack(id=stack_id, name=stack_name) - self._verify2('openstack.proxy2.BaseProxy._get', + self._verify2('openstack.proxy.BaseProxy._get', self.proxy.get_stack_template, method_args=[stk], expected_args=[stack_template.StackTemplate], diff --git a/openstack/tests/unit/orchestration/v1/test_stack.py b/openstack/tests/unit/orchestration/v1/test_stack.py index fc91d720d..802b07660 100644 --- a/openstack/tests/unit/orchestration/v1/test_stack.py +++ b/openstack/tests/unit/orchestration/v1/test_stack.py @@ -16,7 +16,7 @@ import testtools from openstack import exceptions from openstack.orchestration.v1 import stack -from openstack import resource2 as resource +from openstack import resource FAKE_ID = 'ce8ae86c-9810-4cb1-8888-7fb53bc523bf' diff --git a/openstack/tests/unit/orchestration/v1/test_stack_files.py b/openstack/tests/unit/orchestration/v1/test_stack_files.py index fe2d47c4e..7e7aa6c80 100644 --- a/openstack/tests/unit/orchestration/v1/test_stack_files.py +++ b/openstack/tests/unit/orchestration/v1/test_stack_files.py @@ -14,7 +14,7 @@ import mock import testtools from openstack.orchestration.v1 import stack_files as sf -from openstack import resource2 as resource +from openstack import resource FAKE = { 'stack_id': 'ID', diff --git a/openstack/tests/unit/orchestration/v1/test_template.py b/openstack/tests/unit/orchestration/v1/test_template.py index 24d7a369d..c127d9cab 100644 --- a/openstack/tests/unit/orchestration/v1/test_template.py +++ b/openstack/tests/unit/orchestration/v1/test_template.py @@ -14,7 +14,7 @@ import mock import testtools from openstack.orchestration.v1 import template -from openstack import resource2 as resource +from openstack import resource FAKE = { diff --git a/openstack/tests/unit/test_connection.py b/openstack/tests/unit/test_connection.py index d43c0d895..8f434965b 100644 --- a/openstack/tests/unit/test_connection.py +++ b/openstack/tests/unit/test_connection.py @@ -83,7 +83,7 @@ class TestConnection(base.RequestsMockTestCase): def test_create_session(self): conn = connection.Connection(cloud='sample') - self.assertEqual('openstack.proxy2', + self.assertEqual('openstack.proxy', conn.alarm.__class__.__module__) self.assertEqual('openstack.clustering.v1._proxy', conn.clustering.__class__.__module__) diff --git a/openstack/tests/unit/test_proxy2.py b/openstack/tests/unit/test_proxy.py similarity index 87% rename from openstack/tests/unit/test_proxy2.py rename to openstack/tests/unit/test_proxy.py index 6c9832d63..dc72a6cd2 100644 --- a/openstack/tests/unit/test_proxy2.py +++ b/openstack/tests/unit/test_proxy.py @@ -14,31 +14,31 @@ import mock import testtools from openstack import exceptions -from openstack import proxy2 -from openstack import resource2 +from openstack import proxy +from openstack import resource -class DeleteableResource(resource2.Resource): +class DeleteableResource(resource.Resource): allow_delete = True -class UpdateableResource(resource2.Resource): +class UpdateableResource(resource.Resource): allow_update = True -class CreateableResource(resource2.Resource): +class CreateableResource(resource.Resource): allow_create = True -class RetrieveableResource(resource2.Resource): +class RetrieveableResource(resource.Resource): allow_retrieve = True -class ListableResource(resource2.Resource): +class ListableResource(resource.Resource): allow_list = True -class HeadableResource(resource2.Resource): +class HeadableResource(resource.Resource): allow_head = True @@ -53,43 +53,43 @@ class TestProxyPrivate(testtools.TestCase): self.sot = mock.Mock() self.sot.method = method - self.fake_proxy = proxy2.BaseProxy("session") + self.fake_proxy = proxy.BaseProxy("session") def _test_correct(self, value): - decorated = proxy2._check_resource(strict=False)(self.sot.method) - rv = decorated(self.sot, resource2.Resource, value) + decorated = proxy._check_resource(strict=False)(self.sot.method) + rv = decorated(self.sot, resource.Resource, value) self.assertEqual(value, rv) def test__check_resource_correct_resource(self): - res = resource2.Resource() + res = resource.Resource() self._test_correct(res) def test__check_resource_notstrict_id(self): self._test_correct("abc123-id") def test__check_resource_strict_id(self): - decorated = proxy2._check_resource(strict=True)(self.sot.method) + decorated = proxy._check_resource(strict=True)(self.sot.method) self.assertRaisesRegex(ValueError, "A Resource must be passed", - decorated, self.sot, resource2.Resource, + decorated, self.sot, resource.Resource, "this-is-not-a-resource") def test__check_resource_incorrect_resource(self): - class OneType(resource2.Resource): + class OneType(resource.Resource): pass - class AnotherType(resource2.Resource): + class AnotherType(resource.Resource): pass value = AnotherType() - decorated = proxy2._check_resource(strict=False)(self.sot.method) + decorated = proxy._check_resource(strict=False)(self.sot.method) self.assertRaisesRegex(ValueError, "Expected OneType but received AnotherType", decorated, self.sot, OneType, value) def test__get_uri_attribute_no_parent(self): - class Child(resource2.Resource): - something = resource2.Body("something") + class Child(resource.Resource): + something = resource.Body("something") attr = "something" value = "nothing" @@ -100,7 +100,7 @@ class TestProxyPrivate(testtools.TestCase): self.assertEqual(value, result) def test__get_uri_attribute_with_parent(self): - class Parent(resource2.Resource): + class Parent(resource.Resource): pass value = "nothing" @@ -112,7 +112,7 @@ class TestProxyPrivate(testtools.TestCase): def test__get_resource_new(self): value = "hello" - fake_type = mock.Mock(spec=resource2.Resource) + fake_type = mock.Mock(spec=resource.Resource) fake_type.new = mock.Mock(return_value=value) attrs = {"first": "Brian", "last": "Curtin"} @@ -146,12 +146,12 @@ class TestProxyPrivate(testtools.TestCase): self.assertEqual(value, result) def test__get_resource_from_resource(self): - res = mock.Mock(spec=resource2.Resource) + res = mock.Mock(spec=resource.Resource) res._update = mock.Mock() attrs = {"first": "Brian", "last": "Curtin"} - result = self.fake_proxy._get_resource(resource2.Resource, + result = self.fake_proxy._get_resource(resource.Resource, res, **attrs) res._update.assert_called_once_with(**attrs) @@ -170,7 +170,7 @@ class TestProxyDelete(testtools.TestCase): self.res.id = self.fake_id self.res.delete = mock.Mock() - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) DeleteableResource.new = mock.Mock(return_value=self.res) def test_delete(self): @@ -227,7 +227,7 @@ class TestProxyUpdate(testtools.TestCase): self.res = mock.Mock(spec=UpdateableResource) self.res.update = mock.Mock(return_value=self.fake_result) - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) self.attrs = {"x": 1, "y": 2, "z": 3} @@ -258,7 +258,7 @@ class TestProxyCreate(testtools.TestCase): self.res = mock.Mock(spec=CreateableResource) self.res.create = mock.Mock(return_value=self.fake_result) - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) def test_create_attributes(self): CreateableResource.new = mock.Mock(return_value=self.res) @@ -285,7 +285,7 @@ class TestProxyGet(testtools.TestCase): self.res.id = self.fake_id self.res.get = mock.Mock(return_value=self.fake_result) - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) RetrieveableResource.new = mock.Mock(return_value=self.res) def test_get_resource(self): @@ -329,9 +329,9 @@ class TestProxyList(testtools.TestCase): self.session = mock.Mock() self.args = {"a": "A", "b": "B", "c": "C"} - self.fake_response = [resource2.Resource()] + self.fake_response = [resource.Resource()] - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) ListableResource.list = mock.Mock() ListableResource.list.return_value = self.fake_response @@ -363,7 +363,7 @@ class TestProxyHead(testtools.TestCase): self.res.id = self.fake_id self.res.head = mock.Mock(return_value=self.fake_result) - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) HeadableResource.new = mock.Mock(return_value=self.res) def test_head_resource(self): @@ -386,9 +386,9 @@ class TestProxyWaits(testtools.TestCase): super(TestProxyWaits, self).setUp() self.session = mock.Mock() - self.sot = proxy2.BaseProxy(self.session) + self.sot = proxy.BaseProxy(self.session) - @mock.patch("openstack.resource2.wait_for_status") + @mock.patch("openstack.resource.wait_for_status") def test_wait_for(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource @@ -396,7 +396,7 @@ class TestProxyWaits(testtools.TestCase): mock_wait.assert_called_once_with( self.sot, mock_resource, 'ACTIVE', [], 2, 120) - @mock.patch("openstack.resource2.wait_for_status") + @mock.patch("openstack.resource.wait_for_status") def test_wait_for_params(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource @@ -404,14 +404,14 @@ class TestProxyWaits(testtools.TestCase): mock_wait.assert_called_once_with( self.sot, mock_resource, 'ACTIVE', ['ERROR'], 1, 2) - @mock.patch("openstack.resource2.wait_for_delete") + @mock.patch("openstack.resource.wait_for_delete") def test_wait_for_delete(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource self.sot.wait_for_delete(mock_resource) mock_wait.assert_called_once_with(self.sot, mock_resource, 2, 120) - @mock.patch("openstack.resource2.wait_for_delete") + @mock.patch("openstack.resource.wait_for_delete") def test_wait_for_delete_params(self, mock_wait): mock_resource = mock.Mock() mock_wait.return_value = mock_resource diff --git a/openstack/tests/unit/test_proxy_base.py b/openstack/tests/unit/test_proxy_base.py index 38cb1dd52..296d7670e 100644 --- a/openstack/tests/unit/test_proxy_base.py +++ b/openstack/tests/unit/test_proxy_base.py @@ -98,21 +98,26 @@ class TestProxyBase(base.TestCase): def verify_delete(self, test_method, resource_type, ignore, input_path_args=None, expected_path_args=None, + method_kwargs=None, expected_args=None, + expected_kwargs=None, mock_method="openstack.proxy.BaseProxy._delete"): method_args = ["resource_or_id"] - method_kwargs = {"ignore_missing": ignore} + method_kwargs = method_kwargs or {} + method_kwargs["ignore_missing"] = ignore if isinstance(input_path_args, dict): for key in input_path_args: method_kwargs[key] = input_path_args[key] elif isinstance(input_path_args, list): method_args = input_path_args - expected_kwargs = {"ignore_missing": ignore} + expected_kwargs = expected_kwargs or {} + expected_kwargs["ignore_missing"] = ignore if expected_path_args: - expected_kwargs["path_args"] = expected_path_args + expected_kwargs.update(expected_path_args) + expected_args = expected_args or [resource_type, "resource_or_id"] self._verify2(mock_method, test_method, method_args=method_args, method_kwargs=method_kwargs, - expected_args=[resource_type, "resource_or_id"], + expected_args=expected_args, expected_kwargs=expected_kwargs) def verify_get(self, test_method, resource_type, value=None, args=None, @@ -179,9 +184,7 @@ class TestProxyBase(base.TestCase): **kwargs): expected_kwargs = kwargs.pop("expected_kwargs", {}) expected_kwargs.update({"paginated": paginated}) - expected_kwargs['limit'] = 2 method_kwargs = kwargs.pop("method_kwargs", {}) - method_kwargs['limit'] = 2 self._verify2(mock_method, test_method, method_kwargs=method_kwargs, expected_args=[resource_type], diff --git a/openstack/tests/unit/test_proxy_base2.py b/openstack/tests/unit/test_proxy_base2.py index 24d300fa2..06d88ca40 100644 --- a/openstack/tests/unit/test_proxy_base2.py +++ b/openstack/tests/unit/test_proxy_base2.py @@ -87,7 +87,7 @@ class TestProxyBase(base.TestCase): mocked.assert_called_with(test_method.__self__) def verify_create(self, test_method, resource_type, - mock_method="openstack.proxy2.BaseProxy._create", + mock_method="openstack.proxy.BaseProxy._create", expected_result="result", **kwargs): the_kwargs = {"x": 1, "y": 2, "z": 3} method_kwargs = kwargs.pop("method_kwargs", the_kwargs) @@ -105,7 +105,7 @@ class TestProxyBase(base.TestCase): input_path_args=None, expected_path_args=None, method_kwargs=None, expected_args=None, expected_kwargs=None, - mock_method="openstack.proxy2.BaseProxy._delete"): + mock_method="openstack.proxy.BaseProxy._delete"): method_args = ["resource_or_id"] method_kwargs = method_kwargs or {} method_kwargs["ignore_missing"] = ignore @@ -126,7 +126,7 @@ class TestProxyBase(base.TestCase): expected_kwargs=expected_kwargs) def verify_get(self, test_method, resource_type, value=None, args=None, - mock_method="openstack.proxy2.BaseProxy._get", + mock_method="openstack.proxy.BaseProxy._get", ignore_value=False, **kwargs): the_value = value if value is None: @@ -147,7 +147,7 @@ class TestProxyBase(base.TestCase): expected_kwargs=expected_kwargs) def verify_head(self, test_method, resource_type, - mock_method="openstack.proxy2.BaseProxy._head", + mock_method="openstack.proxy.BaseProxy._head", value=None, **kwargs): the_value = [value] if value is not None else [] if self.kwargs_to_path_args: @@ -161,7 +161,7 @@ class TestProxyBase(base.TestCase): expected_kwargs=expected_kwargs) def verify_find(self, test_method, resource_type, value=None, - mock_method="openstack.proxy2.BaseProxy._find", + mock_method="openstack.proxy.BaseProxy._find", path_args=None, **kwargs): method_args = value or ["name_or_id"] expected_kwargs = {} @@ -188,7 +188,7 @@ class TestProxyBase(base.TestCase): **kwargs) def verify_list(self, test_method, resource_type, paginated=False, - mock_method="openstack.proxy2.BaseProxy._list", + mock_method="openstack.proxy.BaseProxy._list", **kwargs): expected_kwargs = kwargs.pop("expected_kwargs", {}) expected_kwargs.update({"paginated": paginated}) @@ -202,7 +202,7 @@ class TestProxyBase(base.TestCase): def verify_list_no_kwargs(self, test_method, resource_type, paginated=False, - mock_method="openstack.proxy2.BaseProxy._list"): + mock_method="openstack.proxy.BaseProxy._list"): self._verify2(mock_method, test_method, method_kwargs={}, expected_args=[resource_type], @@ -210,7 +210,7 @@ class TestProxyBase(base.TestCase): expected_result=["result"]) def verify_update(self, test_method, resource_type, value=None, - mock_method="openstack.proxy2.BaseProxy._update", + mock_method="openstack.proxy.BaseProxy._update", expected_result="result", path_args=None, **kwargs): method_args = value or ["resource_or_id"] method_kwargs = {"x": 1, "y": 2, "z": 3} @@ -230,5 +230,5 @@ class TestProxyBase(base.TestCase): def verify_wait_for_status( self, test_method, - mock_method="openstack.resource2.wait_for_status", **kwargs): + mock_method="openstack.resource.wait_for_status", **kwargs): self._verify(mock_method, test_method, **kwargs) diff --git a/openstack/tests/unit/test_resource2.py b/openstack/tests/unit/test_resource.py similarity index 86% rename from openstack/tests/unit/test_resource2.py rename to openstack/tests/unit/test_resource.py index 8ea53d35b..ededc7e39 100644 --- a/openstack/tests/unit/test_resource2.py +++ b/openstack/tests/unit/test_resource.py @@ -19,7 +19,7 @@ import six from openstack import exceptions from openstack import format -from openstack import resource2 +from openstack import resource from openstack.tests.unit import base @@ -36,7 +36,7 @@ class FakeResponse(object): class TestComponent(base.TestCase): - class ExampleComponent(resource2._BaseComponent): + class ExampleComponent(resource._BaseComponent): key = "_example" # Since we're testing ExampleComponent, which is as isolated as we @@ -47,13 +47,13 @@ class TestComponent(base.TestCase): # keys and values to test against. def test_implementations(self): - self.assertEqual("_body", resource2.Body.key) - self.assertEqual("_header", resource2.Header.key) - self.assertEqual("_uri", resource2.URI.key) + self.assertEqual("_body", resource.Body.key) + self.assertEqual("_header", resource.Header.key) + self.assertEqual("_uri", resource.URI.key) def test_creation(self): - sot = resource2._BaseComponent("name", type=int, default=1, - alternate_id=True) + sot = resource._BaseComponent( + "name", type=int, default=1, alternate_id=True) self.assertEqual("name", sot.name) self.assertEqual(int, sot.type) @@ -61,7 +61,7 @@ class TestComponent(base.TestCase): self.assertTrue(sot.alternate_id) def test_get_no_instance(self): - sot = resource2._BaseComponent("test") + sot = resource._BaseComponent("test") # Test that we short-circuit everything when given no instance. result = sot.__get__(None, None) @@ -248,7 +248,7 @@ class TestComponent(base.TestCase): class TestComponentManager(base.TestCase): def test_create_basic(self): - sot = resource2._ComponentManager() + sot = resource._ComponentManager() self.assertEqual(dict(), sot.attributes) self.assertEqual(set(), sot._dirty) @@ -256,7 +256,7 @@ class TestComponentManager(base.TestCase): attrs = {"hey": 1, "hi": 2, "hello": 3} sync = False - sot = resource2._ComponentManager(attributes=attrs, synchronized=sync) + sot = resource._ComponentManager(attributes=attrs, synchronized=sync) self.assertEqual(attrs, sot.attributes) self.assertEqual(set(attrs.keys()), sot._dirty) @@ -264,7 +264,7 @@ class TestComponentManager(base.TestCase): attrs = {"hey": 1, "hi": 2, "hello": 3} sync = True - sot = resource2._ComponentManager(attributes=attrs, synchronized=sync) + sot = resource._ComponentManager(attributes=attrs, synchronized=sync) self.assertEqual(attrs, sot.attributes) self.assertEqual(set(), sot._dirty) @@ -273,14 +273,14 @@ class TestComponentManager(base.TestCase): value = "value" attrs = {key: value} - sot = resource2._ComponentManager(attributes=attrs) + sot = resource._ComponentManager(attributes=attrs) self.assertEqual(value, sot.__getitem__(key)) def test_setitem_new(self): key = "key" value = "value" - sot = resource2._ComponentManager() + sot = resource._ComponentManager() sot.__setitem__(key, value) self.assertIn(key, sot.attributes) @@ -291,7 +291,7 @@ class TestComponentManager(base.TestCase): value = "value" attrs = {key: value} - sot = resource2._ComponentManager(attributes=attrs, synchronized=True) + sot = resource._ComponentManager(attributes=attrs, synchronized=True) # This shouldn't end up in the dirty list since we're just re-setting. sot.__setitem__(key, value) @@ -303,19 +303,19 @@ class TestComponentManager(base.TestCase): value = "value" attrs = {key: value} - sot = resource2._ComponentManager(attributes=attrs, synchronized=True) + sot = resource._ComponentManager(attributes=attrs, synchronized=True) sot.__delitem__(key) self.assertIsNone(sot.dirty[key]) def test_iter(self): attrs = {"key": "value"} - sot = resource2._ComponentManager(attributes=attrs) + sot = resource._ComponentManager(attributes=attrs) self.assertItemsEqual(iter(attrs), sot.__iter__()) def test_len(self): attrs = {"key": "value"} - sot = resource2._ComponentManager(attributes=attrs) + sot = resource._ComponentManager(attributes=attrs) self.assertEqual(len(attrs), sot.__len__()) def test_dirty(self): @@ -323,7 +323,7 @@ class TestComponentManager(base.TestCase): key2 = "key2" value = "value" attrs = {key: value} - sot = resource2._ComponentManager(attributes=attrs, synchronized=False) + sot = resource._ComponentManager(attributes=attrs, synchronized=False) self.assertEqual({key: value}, sot.dirty) sot.__setitem__(key2, value) @@ -333,7 +333,7 @@ class TestComponentManager(base.TestCase): key = "key" value = "value" attrs = {key: value} - sot = resource2._ComponentManager(attributes=attrs, synchronized=False) + sot = resource._ComponentManager(attributes=attrs, synchronized=False) self.assertEqual(attrs, sot.dirty) sot.clean() @@ -348,7 +348,7 @@ class Test_Request(base.TestCase): body = 2 headers = 3 - sot = resource2._Request(uri, body, headers) + sot = resource._Request(uri, body, headers) self.assertEqual(uri, sot.url) self.assertEqual(body, sot.body) @@ -361,7 +361,7 @@ class TestQueryParameters(base.TestCase): location = "location" mapping = {"first_name": "first-name"} - sot = resource2.QueryParameters(location, **mapping) + sot = resource.QueryParameters(location, **mapping) self.assertEqual({"location": "location", "first_name": "first-name", @@ -373,7 +373,7 @@ class TestQueryParameters(base.TestCase): location = "location" mapping = {"first_name": "first-name"} - sot = resource2.QueryParameters(location, **mapping) + sot = resource.QueryParameters(location, **mapping) result = sot._transpose({"location": "Brooklyn", "first_name": "Brian", "last_name": "Curtin"}) @@ -386,7 +386,7 @@ class TestQueryParameters(base.TestCase): location = "location" mapping = {"first_name": "first-name"} - sot = resource2.QueryParameters(location, **mapping) + sot = resource.QueryParameters(location, **mapping) result = sot._transpose({"location": "Brooklyn"}) # first_name not being in the query shouldn't affect results @@ -406,17 +406,17 @@ class TestResource(base.TestCase): mock_collect = mock.Mock() mock_collect.return_value = body, header, uri - with mock.patch.object(resource2.Resource, + with mock.patch.object(resource.Resource, "_collect_attrs", mock_collect): - sot = resource2.Resource(_synchronized=False, **everything) + sot = resource.Resource(_synchronized=False, **everything) mock_collect.assert_called_once_with(everything) self.assertEqual("somewhere", sot.location) - self.assertIsInstance(sot._body, resource2._ComponentManager) + self.assertIsInstance(sot._body, resource._ComponentManager) self.assertEqual(body, sot._body.dirty) - self.assertIsInstance(sot._header, resource2._ComponentManager) + self.assertIsInstance(sot._header, resource._ComponentManager) self.assertEqual(header, sot._header.dirty) - self.assertIsInstance(sot._uri, resource2._ComponentManager) + self.assertIsInstance(sot._uri, resource._ComponentManager) self.assertEqual(uri, sot._uri.dirty) self.assertFalse(sot.allow_create) @@ -433,7 +433,7 @@ class TestResource(base.TestCase): b = {"b": 2} c = {"c": 3} - class Test(resource2.Resource): + class Test(resource.Resource): def __init__(self): self._body = mock.Mock() self._body.attributes.items = mock.Mock( @@ -451,16 +451,16 @@ class TestResource(base.TestCase): # Don't test the arguments all together since the dictionary order # they're rendered in can't be depended on, nor does it matter. - self.assertIn("openstack.tests.unit.test_resource2.Test", the_repr) + self.assertIn("openstack.tests.unit.test_resource.Test", the_repr) self.assertIn("a=1", the_repr) self.assertIn("b=2", the_repr) self.assertIn("c=3", the_repr) def test_equality(self): - class Example(resource2.Resource): - x = resource2.Body("x") - y = resource2.Header("y") - z = resource2.URI("z") + class Example(resource.Resource): + x = resource.Body("x") + y = resource.Header("y") + z = resource.URI("z") e1 = Example(x=1, y=2, z=3) e2 = Example(x=1, y=2, z=3) @@ -470,7 +470,7 @@ class TestResource(base.TestCase): self.assertNotEqual(e1, e3) def test__update(self): - sot = resource2.Resource() + sot = resource.Resource() body = "body" header = "header" @@ -490,7 +490,7 @@ class TestResource(base.TestCase): sot._uri.update.assert_called_once_with(uri) def test__collect_attrs(self): - sot = resource2.Resource() + sot = resource.Resource() expected_attrs = ["body", "header", "uri"] @@ -518,7 +518,7 @@ class TestResource(base.TestCase): serverside_key2: value2, other_key: other_value} - sot = resource2.Resource() + sot = resource.Resource() result = sot._consume_attrs(mapping, attrs) @@ -536,9 +536,9 @@ class TestResource(base.TestCase): # Check that even on an empty class, we get the expected # built-in attributes. - self.assertIn("location", resource2.Resource._header_mapping()) - self.assertIn("name", resource2.Resource._body_mapping()) - self.assertIn("id", resource2.Resource._body_mapping()) + self.assertIn("location", resource.Resource._header_mapping()) + self.assertIn("name", resource.Resource._body_mapping()) + self.assertIn("id", resource.Resource._body_mapping()) def test__mapping_overrides(self): # Iterating through the MRO used to wipe out overrides of mappings @@ -546,9 +546,9 @@ class TestResource(base.TestCase): new_name = "MyName" new_id = "MyID" - class Test(resource2.Resource): - name = resource2.Body(new_name) - id = resource2.Body(new_id) + class Test(resource.Resource): + name = resource.Body(new_name) + id = resource.Body(new_id) mapping = Test._body_mapping() @@ -556,30 +556,30 @@ class TestResource(base.TestCase): self.assertEqual("id", mapping["MyID"]) def test__body_mapping(self): - class Test(resource2.Resource): - x = resource2.Body("x") - y = resource2.Body("y") - z = resource2.Body("z") + class Test(resource.Resource): + x = resource.Body("x") + y = resource.Body("y") + z = resource.Body("z") self.assertIn("x", Test._body_mapping()) self.assertIn("y", Test._body_mapping()) self.assertIn("z", Test._body_mapping()) def test__header_mapping(self): - class Test(resource2.Resource): - x = resource2.Header("x") - y = resource2.Header("y") - z = resource2.Header("z") + class Test(resource.Resource): + x = resource.Header("x") + y = resource.Header("y") + z = resource.Header("z") self.assertIn("x", Test._header_mapping()) self.assertIn("y", Test._header_mapping()) self.assertIn("z", Test._header_mapping()) def test__uri_mapping(self): - class Test(resource2.Resource): - x = resource2.URI("x") - y = resource2.URI("y") - z = resource2.URI("z") + class Test(resource.Resource): + x = resource.URI("x") + y = resource.URI("y") + z = resource.URI("z") self.assertIn("x", Test._uri_mapping()) self.assertIn("y", Test._uri_mapping()) @@ -587,7 +587,7 @@ class TestResource(base.TestCase): def test__getattribute__id_in_body(self): id = "lol" - sot = resource2.Resource(id=id) + sot = resource.Resource(id=id) result = getattr(sot, "id") self.assertEqual(result, id) @@ -595,8 +595,8 @@ class TestResource(base.TestCase): def test__getattribute__id_with_alternate(self): id = "lol" - class Test(resource2.Resource): - blah = resource2.Body("blah", alternate_id=True) + class Test(resource.Resource): + blah = resource.Body("blah", alternate_id=True) sot = Test(blah=id) @@ -604,18 +604,18 @@ class TestResource(base.TestCase): self.assertEqual(result, id) def test__getattribute__id_without_alternate(self): - class Test(resource2.Resource): + class Test(resource.Resource): id = None sot = Test() self.assertIsNone(sot.id) def test__alternate_id_None(self): - self.assertEqual("", resource2.Resource._alternate_id()) + self.assertEqual("", resource.Resource._alternate_id()) def test__alternate_id(self): - class Test(resource2.Resource): - alt = resource2.Body("the_alt", alternate_id=True) + class Test(resource.Resource): + alt = resource.Body("the_alt", alternate_id=True) self.assertTrue("the_alt", Test._alternate_id()) @@ -630,8 +630,8 @@ class TestResource(base.TestCase): self.assertEqual(sot.id, value2) def test__get_id_instance(self): - class Test(resource2.Resource): - id = resource2.Body("id") + class Test(resource.Resource): + id = resource.Body("id") value = "id" sot = Test(id=value) @@ -639,8 +639,8 @@ class TestResource(base.TestCase): self.assertEqual(value, sot._get_id(sot)) def test__get_id_instance_alternate(self): - class Test(resource2.Resource): - attr = resource2.Body("attr", alternate_id=True) + class Test(resource.Resource): + attr = resource.Body("attr", alternate_id=True) value = "id" sot = Test(attr=value) @@ -649,13 +649,13 @@ class TestResource(base.TestCase): def test__get_id_value(self): value = "id" - self.assertEqual(value, resource2.Resource._get_id(value)) + self.assertEqual(value, resource.Resource._get_id(value)) def test_to_dict(self): - class Test(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Test(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') res = Test(id='FAKE_ID') @@ -670,9 +670,9 @@ class TestResource(base.TestCase): def test_to_dict_no_body(self): - class Test(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Test(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') res = Test(id='FAKE_ID') @@ -684,9 +684,9 @@ class TestResource(base.TestCase): def test_to_dict_no_header(self): - class Test(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Test(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') res = Test(id='FAKE_ID') @@ -699,9 +699,9 @@ class TestResource(base.TestCase): def test_to_dict_ignore_none(self): - class Test(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Test(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') res = Test(id='FAKE_ID', bar='BAR') @@ -713,13 +713,13 @@ class TestResource(base.TestCase): def test_to_dict_with_mro(self): - class Parent(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Parent(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') class Child(Parent): - foo_new = resource2.Header('foo_baz_server') - bar_new = resource2.Body('bar_baz_server') + foo_new = resource.Header('foo_baz_server') + bar_new = resource.Body('bar_baz_server') res = Child(id='FAKE_ID') @@ -736,9 +736,9 @@ class TestResource(base.TestCase): def test_to_dict_value_error(self): - class Test(resource2.Resource): - foo = resource2.Header('foo') - bar = resource2.Body('bar') + class Test(resource.Resource): + foo = resource.Header('foo') + bar = resource.Body('bar') res = Test(id='FAKE_ID') @@ -749,15 +749,15 @@ class TestResource(base.TestCase): def test_to_dict_with_mro_no_override(self): - class Parent(resource2.Resource): - header = resource2.Header('HEADER') - body = resource2.Body('BODY') + class Parent(resource.Resource): + header = resource.Header('HEADER') + body = resource.Body('BODY') class Child(Parent): # The following two properties are not supposed to be overridden # by the parent class property values. - header = resource2.Header('ANOTHER_HEADER') - body = resource2.Body('ANOTHER_BODY') + header = resource.Header('ANOTHER_HEADER') + body = resource.Body('ANOTHER_BODY') res = Child(id='FAKE_ID', body='BODY_VALUE', header='HEADER_VALUE') @@ -771,8 +771,8 @@ class TestResource(base.TestCase): self.assertEqual(expected, res.to_dict()) def test_new(self): - class Test(resource2.Resource): - attr = resource2.Body("attr") + class Test(resource.Resource): + attr = resource.Body("attr") value = "value" sot = Test.new(attr=value) @@ -781,8 +781,8 @@ class TestResource(base.TestCase): self.assertEqual(value, sot.attr) def test_existing(self): - class Test(resource2.Resource): - attr = resource2.Body("attr") + class Test(resource.Resource): + attr = resource.Body("attr") value = "value" sot = Test.existing(attr=value) @@ -791,10 +791,10 @@ class TestResource(base.TestCase): self.assertEqual(value, sot.attr) def test__prepare_request_with_id(self): - class Test(resource2.Resource): + class Test(resource.Resource): base_path = "/something" - body_attr = resource2.Body("x") - header_attr = resource2.Header("y") + body_attr = resource.Body("x") + header_attr = resource.Header("y") the_id = "id" body_value = "body" @@ -809,7 +809,7 @@ class TestResource(base.TestCase): self.assertEqual({"y": header_value}, result.headers) def test__prepare_request_missing_id(self): - sot = resource2.Resource(id=None) + sot = resource.Resource(id=None) self.assertRaises(exceptions.InvalidRequest, sot._prepare_request, requires_id=True) @@ -817,11 +817,11 @@ class TestResource(base.TestCase): def test__prepare_request_with_key(self): key = "key" - class Test(resource2.Resource): + class Test(resource.Resource): base_path = "/something" resource_key = key - body_attr = resource2.Body("x") - header_attr = resource2.Header("y") + body_attr = resource.Body("x") + header_attr = resource.Header("y") body_value = "body" header_value = "header" @@ -835,8 +835,8 @@ class TestResource(base.TestCase): self.assertEqual({"y": header_value}, result.headers) def test__translate_response_no_body(self): - class Test(resource2.Resource): - attr = resource2.Header("attr") + class Test(resource.Resource): + attr = resource.Header("attr") response = FakeResponse({}, headers={"attr": "value"}) @@ -848,8 +848,8 @@ class TestResource(base.TestCase): self.assertEqual("value", sot.attr) def test__translate_response_with_body_no_resource_key(self): - class Test(resource2.Resource): - attr = resource2.Body("attr") + class Test(resource.Resource): + attr = resource.Body("attr") body = {"attr": "value"} response = FakeResponse(body) @@ -866,9 +866,9 @@ class TestResource(base.TestCase): def test__translate_response_with_body_with_resource_key(self): key = "key" - class Test(resource2.Resource): + class Test(resource.Resource): resource_key = key - attr = resource2.Body("attr") + attr = resource.Body("attr") body = {"attr": "value"} response = FakeResponse({key: body}) @@ -883,7 +883,7 @@ class TestResource(base.TestCase): self.assertEqual(dict(), sot._header.dirty) def test_cant_do_anything(self): - class Test(resource2.Resource): + class Test(resource.Resource): allow_create = False allow_get = False allow_update = False @@ -920,7 +920,7 @@ class TestResourceActions(base.TestCase): self.service_name = "service" self.base_path = "base_path" - class Test(resource2.Resource): + class Test(resource.Resource): service = self.service_name base_path = self.base_path resources_key = 'resources' @@ -933,7 +933,7 @@ class TestResourceActions(base.TestCase): self.test_class = Test - self.request = mock.Mock(spec=resource2._Request) + self.request = mock.Mock(spec=resource._Request) self.request.url = "uri" self.request.body = "body" self.request.headers = "headers" @@ -976,7 +976,7 @@ class TestResourceActions(base.TestCase): self.assertEqual(result, sot) def test_put_create(self): - class Test(resource2.Resource): + class Test(resource.Resource): service = self.service_name base_path = self.base_path allow_create = True @@ -985,7 +985,7 @@ class TestResourceActions(base.TestCase): self._test_create(Test, requires_id=True, prepend_key=True) def test_post_create(self): - class Test(resource2.Resource): + class Test(resource.Resource): service = self.service_name base_path = self.base_path allow_create = True @@ -1274,9 +1274,9 @@ class TestResourceActions(base.TestCase): self.session.get.side_effect = [mock_response, mock_empty] class Test(self.test_class): - _query_mapping = resource2.QueryParameters(query_param=qp_name) + _query_mapping = resource.QueryParameters(query_param=qp_name) base_path = "/%(something)s/blah" - something = resource2.URI("something") + something = resource.URI("something") results = list(Test.list(self.session, paginated=True, query_param=qp, something=uri_param)) @@ -1523,7 +1523,7 @@ class TestResourceFind(base.TestCase): self.result = 1 - class Base(resource2.Resource): + class Base(resource.Resource): @classmethod def existing(cls, **kwargs): @@ -1554,7 +1554,7 @@ class TestResourceFind(base.TestCase): def test_find_short_circuit(self): value = 1 - class Test(resource2.Resource): + class Test(resource.Resource): @classmethod def existing(cls, **kwargs): @@ -1578,43 +1578,43 @@ class TestResourceFind(base.TestCase): self.assertEqual(self.result, self.one_result.find("session", "name")) def test_match_empty_results(self): - self.assertIsNone(resource2.Resource._get_one_match("name", [])) + self.assertIsNone(resource.Resource._get_one_match("name", [])) def test_no_match_by_name(self): the_name = "Brian" - match = mock.Mock(spec=resource2.Resource) + match = mock.Mock(spec=resource.Resource) match.name = the_name - result = resource2.Resource._get_one_match("Richard", [match]) + result = resource.Resource._get_one_match("Richard", [match]) self.assertIsNone(result, match) def test_single_match_by_name(self): the_name = "Brian" - match = mock.Mock(spec=resource2.Resource) + match = mock.Mock(spec=resource.Resource) match.name = the_name - result = resource2.Resource._get_one_match(the_name, [match]) + result = resource.Resource._get_one_match(the_name, [match]) self.assertIs(result, match) def test_single_match_by_id(self): the_id = "Brian" - match = mock.Mock(spec=resource2.Resource) + match = mock.Mock(spec=resource.Resource) match.id = the_id - result = resource2.Resource._get_one_match(the_id, [match]) + result = resource.Resource._get_one_match(the_id, [match]) self.assertIs(result, match) def test_single_match_by_alternate_id(self): the_id = "Richard" - class Test(resource2.Resource): - other_id = resource2.Body("other_id", alternate_id=True) + class Test(resource.Resource): + other_id = resource.Body("other_id", alternate_id=True) match = Test(other_id=the_id) result = Test._get_one_match(the_id, [match]) @@ -1624,25 +1624,25 @@ class TestResourceFind(base.TestCase): def test_multiple_matches(self): the_id = "Brian" - match = mock.Mock(spec=resource2.Resource) + match = mock.Mock(spec=resource.Resource) match.id = the_id self.assertRaises( exceptions.DuplicateResource, - resource2.Resource._get_one_match, the_id, [match, match]) + resource.Resource._get_one_match, the_id, [match, match]) class TestWaitForStatus(base.TestCase): def test_immediate_status(self): status = "loling" - resource = mock.Mock() - resource.status = status + res = mock.Mock() + res.status = status - result = resource2.wait_for_status("session", resource, status, - "failures", "interval", "wait") + result = resource.wait_for_status( + "session", res, status, "failures", "interval", "wait") - self.assertEqual(result, resource) + self.assertTrue(result, res) def _resources_from_statuses(self, *statuses): resources = [] @@ -1662,7 +1662,7 @@ class TestWaitForStatus(base.TestCase): resources = self._resources_from_statuses( "first", "other", "another", "another", status) - result = resource2.wait_for_status( + result = resource.wait_for_status( mock.Mock(), resources[0], status, None, 1, 5) self.assertEqual(result, resources[-1]) @@ -1674,32 +1674,32 @@ class TestWaitForStatus(base.TestCase): self.assertRaises( exceptions.ResourceFailure, - resource2.wait_for_status, + resource.wait_for_status, mock.Mock(), resources[0], "loling", [failure], 1, 5) def test_timeout(self): status = "loling" - resource = mock.Mock() + res = mock.Mock() # The first "other" gets past the first check, and then three # pairs of "other" statuses run through the sleep counter loop, # after which time should be up. This is because we have a # one second interval and three second waiting period. statuses = ["other"] * 7 - type(resource).status = mock.PropertyMock(side_effect=statuses) + type(res).status = mock.PropertyMock(side_effect=statuses) self.assertRaises(exceptions.ResourceTimeout, - resource2.wait_for_status, - "session", resource, status, None, 1, 3) + resource.wait_for_status, + "session", res, status, None, 1, 3) def test_no_sleep(self): - resource = mock.Mock() + res = mock.Mock() statuses = ["other"] - type(resource).status = mock.PropertyMock(side_effect=statuses) + type(res).status = mock.PropertyMock(side_effect=statuses) self.assertRaises(exceptions.ResourceTimeout, - resource2.wait_for_status, - "session", resource, "status", None, 0, -1) + resource.wait_for_status, + "session", res, "status", None, 0, -1) class TestWaitForDelete(base.TestCase): @@ -1708,20 +1708,21 @@ class TestWaitForDelete(base.TestCase): response = mock.Mock() response.headers = {} response.status_code = 404 - resource = mock.Mock() - resource.get.side_effect = [ + res = mock.Mock() + res.get.side_effect = [ None, None, exceptions.NotFoundException('Not Found', response)] - result = resource2.wait_for_delete("session", resource, 1, 3) + result = resource.wait_for_delete("session", res, 1, 3) - self.assertEqual(result, resource) + self.assertEqual(result, res) def test_timeout(self): - resource = mock.Mock() - resource.status = 'ACTIVE' - resource.get.return_value = resource + res = mock.Mock() + res.status = 'ACTIVE' + res.get.return_value = res - self.assertRaises(exceptions.ResourceTimeout, - resource2.wait_for_delete, - "session", resource, 0.1, 0.3) + self.assertRaises( + exceptions.ResourceTimeout, + resource.wait_for_delete, + "session", res, 0.1, 0.3) diff --git a/openstack/tests/unit/workflow/test_proxy.py b/openstack/tests/unit/workflow/test_proxy.py index 3f01420c6..b17d1d67b 100644 --- a/openstack/tests/unit/workflow/test_proxy.py +++ b/openstack/tests/unit/workflow/test_proxy.py @@ -10,13 +10,13 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack.tests.unit import test_proxy_base2 +from openstack.tests.unit import test_proxy_base from openstack.workflow.v2 import _proxy from openstack.workflow.v2 import execution from openstack.workflow.v2 import workflow -class TestWorkflowProxy(test_proxy_base2.TestProxyBase): +class TestWorkflowProxy(test_proxy_base.TestProxyBase): def setUp(self): super(TestWorkflowProxy, self).setUp() self.proxy = _proxy.Proxy(self.session) diff --git a/openstack/workflow/v2/_proxy.py b/openstack/workflow/v2/_proxy.py index 8a99531e4..ffe7259b7 100644 --- a/openstack/workflow/v2/_proxy.py +++ b/openstack/workflow/v2/_proxy.py @@ -10,12 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import proxy2 +from openstack import proxy from openstack.workflow.v2 import execution as _execution from openstack.workflow.v2 import workflow as _workflow -class Proxy(proxy2.BaseProxy): +class Proxy(proxy.BaseProxy): def create_workflow(self, **attrs): """Create a new workflow from attributes diff --git a/openstack/workflow/v2/execution.py b/openstack/workflow/v2/execution.py index 9877e2bc2..01287eacb 100644 --- a/openstack/workflow/v2/execution.py +++ b/openstack/workflow/v2/execution.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import resource2 as resource +from openstack import resource from openstack.workflow import workflow_service diff --git a/openstack/workflow/v2/workflow.py b/openstack/workflow/v2/workflow.py index 73f04b48e..c98237cc1 100644 --- a/openstack/workflow/v2/workflow.py +++ b/openstack/workflow/v2/workflow.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack import resource2 as resource +from openstack import resource from openstack.workflow import workflow_service diff --git a/openstack/workflow/version.py b/openstack/workflow/version.py index 4834e952a..531938607 100644 --- a/openstack/workflow/version.py +++ b/openstack/workflow/version.py @@ -11,7 +11,7 @@ # under the License. -from openstack import resource2 as resource +from openstack import resource from openstack.workflow import workflow_service