From 65293358a0d3cd7055987b18e16b9be5e8a0261b Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Wed, 4 Oct 2017 12:39:43 -0500 Subject: [PATCH] Move shade and os-client-config python content Make shade be openstack.cloud and os-client-config be openstack.config. Change-Id: I1d28be82a72cc1a30d6be306257fc1f0736ed604 --- examples/connect.py | 13 +- {shade/shade => openstack/cloud}/__init__.py | 21 +- {shade/shade => openstack/cloud}/_adapter.py | 10 +- .../cloud/_heat}/__init__.py | 0 .../cloud}/_heat/environment_format.py | 2 +- .../cloud}/_heat/event_utils.py | 2 +- .../cloud}/_heat/template_format.py | 0 .../cloud}/_heat/template_utils.py | 8 +- .../shade => openstack/cloud}/_heat/utils.py | 2 +- .../cloud}/_log.py | 0 .../shade => openstack/cloud}/_normalize.py | 4 + {shade/shade => openstack/cloud}/_tasks.py | 2 +- {shade/shade => openstack/cloud}/_utils.py | 16 +- .../_heat => openstack/cloud/cmd}/__init__.py | 0 .../cloud}/cmd/inventory.py | 10 +- {shade/shade => openstack/cloud}/exc.py | 8 +- {shade/shade => openstack/cloud}/inventory.py | 14 +- {shade/shade => openstack/cloud}/meta.py | 6 +- .../cloud}/openstackcloud.py | 81 +++--- .../cloud}/operatorcloud.py | 8 +- .../shade => openstack/cloud}/task_manager.py | 8 +- .../cmd => openstack/cloud/tests}/__init__.py | 0 .../cloud}/tests/ansible/README.txt | 0 .../tests/ansible/hooks/post_test_hook.sh | 0 .../tests/ansible/roles/auth/tasks/main.yml | 0 .../roles/client_config/tasks/main.yml | 0 .../tests/ansible/roles/group/tasks/main.yml | 0 .../tests/ansible/roles/group/vars/main.yml | 0 .../tests/ansible/roles/image/tasks/main.yml | 0 .../tests/ansible/roles/image/vars/main.yml | 0 .../ansible/roles/keypair/tasks/main.yml | 0 .../tests/ansible/roles/keypair/vars/main.yml | 0 .../roles/keystone_domain/tasks/main.yml | 0 .../roles/keystone_domain/vars/main.yml | 0 .../roles/keystone_role/tasks/main.yml | 0 .../ansible/roles/keystone_role/vars/main.yml | 0 .../ansible/roles/network/tasks/main.yml | 0 .../tests/ansible/roles/network/vars/main.yml | 0 .../ansible/roles/nova_flavor/tasks/main.yml | 0 .../tests/ansible/roles/object/tasks/main.yml | 0 .../tests/ansible/roles/port/tasks/main.yml | 0 .../tests/ansible/roles/port/vars/main.yml | 0 .../tests/ansible/roles/router/tasks/main.yml | 0 .../tests/ansible/roles/router/vars/main.yml | 0 .../roles/security_group/tasks/main.yml | 0 .../roles/security_group/vars/main.yml | 0 .../tests/ansible/roles/server/tasks/main.yml | 0 .../tests/ansible/roles/server/vars/main.yaml | 0 .../tests/ansible/roles/subnet/tasks/main.yml | 0 .../tests/ansible/roles/subnet/vars/main.yml | 0 .../tests/ansible/roles/user/tasks/main.yml | 0 .../ansible/roles/user_group/tasks/main.yml | 0 .../tests/ansible/roles/volume/tasks/main.yml | 0 .../cloud}/tests/ansible/run.yml | 0 .../shade => openstack/cloud}/tests/base.py | 0 .../shade => openstack/cloud}/tests/fakes.py | 10 +- .../cloud/tests/functional}/__init__.py | 0 .../cloud}/tests/functional/base.py | 10 +- .../tests/functional/hooks/post_test_hook.sh | 0 .../cloud}/tests/functional/test_aggregate.py | 2 +- .../functional/test_cluster_templates.py | 6 +- .../cloud}/tests/functional/test_compute.py | 8 +- .../cloud}/tests/functional/test_devstack.py | 2 +- .../cloud}/tests/functional/test_domain.py | 7 +- .../cloud}/tests/functional/test_endpoints.py | 6 +- .../cloud}/tests/functional/test_flavor.py | 4 +- .../tests/functional/test_floating_ip.py | 10 +- .../tests/functional/test_floating_ip_pool.py | 2 +- .../cloud}/tests/functional/test_groups.py | 7 +- .../cloud}/tests/functional/test_identity.py | 4 +- .../cloud}/tests/functional/test_image.py | 2 +- .../cloud}/tests/functional/test_inventory.py | 6 +- .../cloud}/tests/functional/test_keypairs.py | 4 +- .../cloud}/tests/functional/test_limits.py | 2 +- .../tests/functional/test_magnum_services.py | 2 +- .../cloud}/tests/functional/test_network.py | 4 +- .../cloud}/tests/functional/test_object.py | 4 +- .../cloud}/tests/functional/test_port.py | 4 +- .../cloud}/tests/functional/test_project.py | 4 +- .../test_qos_bandwidth_limit_rule.py | 4 +- .../functional/test_qos_dscp_marking_rule.py | 4 +- .../test_qos_minimum_bandwidth_rule.py | 4 +- .../tests/functional/test_qos_policy.py | 4 +- .../cloud}/tests/functional/test_quotas.py | 2 +- .../tests/functional/test_range_search.py | 4 +- .../cloud}/tests/functional/test_recordset.py | 2 +- .../cloud}/tests/functional/test_router.py | 4 +- .../tests/functional/test_security_groups.py | 2 +- .../tests/functional/test_server_group.py | 2 +- .../cloud}/tests/functional/test_services.py | 6 +- .../cloud}/tests/functional/test_stack.py | 6 +- .../cloud}/tests/functional/test_usage.py | 2 +- .../cloud}/tests/functional/test_users.py | 6 +- .../cloud}/tests/functional/test_volume.py | 6 +- .../tests/functional/test_volume_backup.py | 2 +- .../tests/functional/test_volume_type.py | 4 +- .../cloud}/tests/functional/test_zone.py | 2 +- .../cloud}/tests/functional/util.py | 0 .../cloud/tests/unit}/__init__.py | 0 .../cloud}/tests/unit/base.py | 19 +- .../cloud}/tests/unit/fixtures/baremetal.json | 0 .../tests/unit/fixtures/catalog-v2.json | 0 .../tests/unit/fixtures/catalog-v3.json | 0 .../tests/unit/fixtures/clouds/clouds.yaml | 0 .../unit/fixtures/clouds/clouds_cache.yaml | 0 .../cloud}/tests/unit/fixtures/discovery.json | 0 .../cloud}/tests/unit/fixtures/dns.json | 0 .../unit/fixtures/image-version-broken.json | 0 .../tests/unit/fixtures/image-version-v1.json | 0 .../tests/unit/fixtures/image-version-v2.json | 0 .../tests/unit/fixtures/image-version.json | 0 .../cloud}/tests/unit/test__adapter.py | 4 +- .../cloud}/tests/unit/test__utils.py | 6 +- .../cloud}/tests/unit/test_aggregate.py | 4 +- .../tests/unit/test_availability_zones.py | 4 +- .../cloud}/tests/unit/test_baremetal_node.py | 6 +- .../cloud}/tests/unit/test_caching.py | 20 +- .../tests/unit/test_cluster_templates.py | 7 +- .../cloud}/tests/unit/test_create_server.py | 20 +- .../tests/unit/test_create_volume_snapshot.py | 8 +- .../cloud}/tests/unit/test_delete_server.py | 6 +- .../tests/unit/test_delete_volume_snapshot.py | 8 +- .../cloud}/tests/unit/test_domain_params.py | 22 +- .../cloud}/tests/unit/test_domains.py | 10 +- .../cloud}/tests/unit/test_endpoints.py | 6 +- .../cloud}/tests/unit/test_flavors.py | 10 +- .../tests/unit/test_floating_ip_common.py | 8 +- .../tests/unit/test_floating_ip_neutron.py | 6 +- .../tests/unit/test_floating_ip_nova.py | 4 +- .../tests/unit/test_floating_ip_pool.py | 6 +- .../cloud}/tests/unit/test_groups.py | 2 +- .../cloud}/tests/unit/test_identity_roles.py | 10 +- .../cloud}/tests/unit/test_image.py | 137 +++++----- .../cloud}/tests/unit/test_image_snapshot.py | 6 +- .../cloud}/tests/unit/test_inventory.py | 24 +- .../cloud}/tests/unit/test_keypair.py | 6 +- .../cloud}/tests/unit/test_limits.py | 2 +- .../cloud}/tests/unit/test_magnum_services.py | 2 +- .../cloud}/tests/unit/test_meta.py | 60 ++--- .../cloud}/tests/unit/test_network.py | 8 +- .../cloud}/tests/unit/test_normalize.py | 2 +- .../cloud}/tests/unit/test_object.py | 33 +-- .../cloud}/tests/unit/test_operator_noauth.py | 8 +- .../cloud}/tests/unit/test_port.py | 4 +- .../cloud}/tests/unit/test_project.py | 10 +- .../unit/test_qos_bandwidth_limit_rule.py | 4 +- .../tests/unit/test_qos_dscp_marking_rule.py | 4 +- .../unit/test_qos_minimum_bandwidth_rule.py | 4 +- .../cloud}/tests/unit/test_qos_policy.py | 4 +- .../cloud}/tests/unit/test_qos_rule_type.py | 4 +- .../cloud}/tests/unit/test_quotas.py | 4 +- .../cloud}/tests/unit/test_rebuild_server.py | 6 +- .../cloud}/tests/unit/test_recordset.py | 6 +- .../cloud}/tests/unit/test_role_assignment.py | 4 +- .../cloud}/tests/unit/test_router.py | 4 +- .../cloud}/tests/unit/test_security_groups.py | 18 +- .../cloud}/tests/unit/test_server_console.py | 4 +- .../tests/unit/test_server_delete_metadata.py | 6 +- .../cloud}/tests/unit/test_server_group.py | 4 +- .../tests/unit/test_server_set_metadata.py | 6 +- .../cloud}/tests/unit/test_services.py | 6 +- .../cloud}/tests/unit/test_shade.py | 16 +- .../cloud}/tests/unit/test_shade_operator.py | 54 ++-- .../cloud}/tests/unit/test_stack.py | 20 +- .../cloud}/tests/unit/test_subnet.py | 4 +- .../cloud}/tests/unit/test_task_manager.py | 4 +- .../cloud}/tests/unit/test_update_server.py | 6 +- .../cloud}/tests/unit/test_usage.py | 2 +- .../cloud}/tests/unit/test_users.py | 6 +- .../cloud}/tests/unit/test_volume.py | 20 +- .../cloud}/tests/unit/test_volume_access.py | 9 +- .../cloud}/tests/unit/test_volume_backups.py | 4 +- .../cloud}/tests/unit/test_zone.py | 6 +- .../config}/__init__.py | 6 +- {shade/shade => openstack/config}/_log.py | 0 .../config}/cloud_config.py | 2 +- .../config}/config.py | 0 .../config}/constructors.json | 0 .../config}/constructors.py | 0 .../config}/defaults.json | 0 .../config}/defaults.py | 0 .../config}/exceptions.py | 0 .../config}/schema.json | 0 .../config/tests}/__init__.py | 0 .../config}/tests/base.py | 2 +- .../config}/tests/test_cloud_config.py | 0 .../config}/tests/test_config.py | 0 .../config}/tests/test_environ.py | 0 .../config}/tests/test_init.py | 2 +- .../config}/tests/test_json.py | 0 .../config}/vendor-schema.json | 0 .../config}/vendors/__init__.py | 0 .../config}/vendors/auro.json | 0 .../config}/vendors/bluebox.json | 0 .../config}/vendors/catalyst.json | 0 .../config}/vendors/citycloud.json | 0 .../config}/vendors/conoha.json | 0 .../config}/vendors/datacentred.json | 0 .../config}/vendors/dreamcompute.json | 0 .../config}/vendors/dreamhost.json | 0 .../config}/vendors/elastx.json | 0 .../config}/vendors/entercloudsuite.json | 0 .../config}/vendors/fuga.json | 0 .../config}/vendors/ibmcloud.json | 0 .../config}/vendors/internap.json | 0 .../config}/vendors/otc.json | 0 .../config}/vendors/ovh.json | 0 .../config}/vendors/rackspace.json | 0 .../config}/vendors/switchengines.json | 0 .../config}/vendors/ultimum.json | 0 .../config}/vendors/unitedstack.json | 0 .../config}/vendors/vexxhost.json | 0 .../config}/vendors/zetta.json | 0 openstack/connection.py | 2 +- openstack/tests/functional/base.py | 2 +- openstack/tests/unit/test_connection.py | 2 +- os-client-config/doc/source/user/using.rst | 26 +- os-client-config/tools/keystone_version.py | 2 +- os-client-config/tools/nova_version.py | 2 +- .../log-request-ids-37507cb6eed9a7da.yaml | 2 +- .../remove-novaclient-3f8d4db20d5f9582.yaml | 2 +- setup.cfg | 5 + shade/.gitreview | 2 +- shade/HACKING.rst | 2 +- shade/README.rst | 6 +- shade/doc/source/contributor/coding.rst | 4 +- .../source/user/examples/cleanup-servers.py | 6 +- .../user/examples/create-server-dict.py | 6 +- .../user/examples/create-server-name-or-id.py | 6 +- .../doc/source/user/examples/debug-logging.py | 6 +- .../doc/source/user/examples/find-an-image.py | 6 +- .../user/examples/http-debug-logging.py | 6 +- .../source/user/examples/munch-dict-object.py | 6 +- .../doc/source/user/examples/normalization.py | 6 +- .../user/examples/server-information.py | 6 +- .../examples/service-conditional-overrides.py | 6 +- .../user/examples/service-conditionals.py | 6 +- shade/doc/source/user/examples/strict-mode.py | 6 +- .../user/examples/upload-large-object.py | 6 +- .../doc/source/user/examples/upload-object.py | 6 +- shade/doc/source/user/examples/user-agent.py | 6 +- shade/doc/source/user/logging.rst | 36 +-- shade/doc/source/user/microversions.rst | 2 +- shade/doc/source/user/multi-cloud-demo.rst | 114 ++++---- shade/doc/source/user/usage.rst | 6 +- shade/setup.cfg | 4 - shade/shade/_legacy_clients.py | 252 ------------------ tox.ini | 11 +- 248 files changed, 750 insertions(+), 964 deletions(-) rename {shade/shade => openstack/cloud}/__init__.py (88%) rename {shade/shade => openstack/cloud}/_adapter.py (95%) rename {os-client-config/os_client_config/tests => openstack/cloud/_heat}/__init__.py (100%) rename {shade/shade => openstack/cloud}/_heat/environment_format.py (97%) rename {shade/shade => openstack/cloud}/_heat/event_utils.py (99%) rename {shade/shade => openstack/cloud}/_heat/template_format.py (100%) rename {shade/shade => openstack/cloud}/_heat/template_utils.py (98%) rename {shade/shade => openstack/cloud}/_heat/utils.py (98%) rename {os-client-config/os_client_config => openstack/cloud}/_log.py (100%) rename {shade/shade => openstack/cloud}/_normalize.py (99%) rename {shade/shade => openstack/cloud}/_tasks.py (98%) rename {shade/shade => openstack/cloud}/_utils.py (98%) rename {shade/shade/_heat => openstack/cloud/cmd}/__init__.py (100%) rename {shade/shade => openstack/cloud}/cmd/inventory.py (90%) rename {shade/shade => openstack/cloud}/exc.py (96%) rename {shade/shade => openstack/cloud}/inventory.py (88%) rename {shade/shade => openstack/cloud}/meta.py (99%) rename {shade/shade => openstack/cloud}/openstackcloud.py (99%) rename {shade/shade => openstack/cloud}/operatorcloud.py (99%) rename {shade/shade => openstack/cloud}/task_manager.py (98%) rename {shade/shade/cmd => openstack/cloud/tests}/__init__.py (100%) rename {shade/shade => openstack/cloud}/tests/ansible/README.txt (100%) rename {shade/shade => openstack/cloud}/tests/ansible/hooks/post_test_hook.sh (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/auth/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/client_config/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/group/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/group/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/image/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/image/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keypair/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keypair/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keystone_domain/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keystone_domain/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keystone_role/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/keystone_role/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/network/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/network/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/nova_flavor/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/object/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/port/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/port/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/router/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/router/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/security_group/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/security_group/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/server/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/server/vars/main.yaml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/subnet/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/subnet/vars/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/user/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/user_group/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/roles/volume/tasks/main.yml (100%) rename {shade/shade => openstack/cloud}/tests/ansible/run.yml (100%) rename {shade/shade => openstack/cloud}/tests/base.py (100%) rename {shade/shade => openstack/cloud}/tests/fakes.py (98%) rename {shade/shade/tests => openstack/cloud/tests/functional}/__init__.py (100%) rename {shade/shade => openstack/cloud}/tests/functional/base.py (93%) rename {shade/shade => openstack/cloud}/tests/functional/hooks/post_test_hook.sh (100%) rename {shade/shade => openstack/cloud}/tests/functional/test_aggregate.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_cluster_templates.py (95%) rename {shade/shade => openstack/cloud}/tests/functional/test_compute.py (99%) rename {shade/shade => openstack/cloud}/tests/functional/test_devstack.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_domain.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_endpoints.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_flavor.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_floating_ip.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_floating_ip_pool.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_groups.py (95%) rename {shade/shade => openstack/cloud}/tests/functional/test_identity.py (99%) rename {shade/shade => openstack/cloud}/tests/functional/test_image.py (99%) rename {shade/shade => openstack/cloud}/tests/functional/test_inventory.py (95%) rename {shade/shade => openstack/cloud}/tests/functional/test_keypairs.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_limits.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_magnum_services.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_network.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_object.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_port.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_project.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_qos_bandwidth_limit_rule.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_qos_dscp_marking_rule.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_qos_minimum_bandwidth_rule.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_qos_policy.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_quotas.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_range_search.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_recordset.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_router.py (99%) rename {shade/shade => openstack/cloud}/tests/functional/test_security_groups.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_server_group.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_services.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_stack.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_usage.py (96%) rename {shade/shade => openstack/cloud}/tests/functional/test_users.py (97%) rename {shade/shade => openstack/cloud}/tests/functional/test_volume.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_volume_backup.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_volume_type.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/test_zone.py (98%) rename {shade/shade => openstack/cloud}/tests/functional/util.py (100%) rename {shade/shade/tests/functional => openstack/cloud/tests/unit}/__init__.py (100%) rename {shade/shade => openstack/cloud}/tests/unit/base.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/baremetal.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/catalog-v2.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/catalog-v3.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/clouds/clouds.yaml (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/clouds/clouds_cache.yaml (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/discovery.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/dns.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/image-version-broken.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/image-version-v1.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/image-version-v2.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/fixtures/image-version.json (100%) rename {shade/shade => openstack/cloud}/tests/unit/test__adapter.py (94%) rename {shade/shade => openstack/cloud}/tests/unit/test__utils.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_aggregate.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_availability_zones.py (96%) rename {shade/shade => openstack/cloud}/tests/unit/test_baremetal_node.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_caching.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_cluster_templates.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_create_server.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_create_volume_snapshot.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_delete_server.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_delete_volume_snapshot.py (96%) rename {shade/shade => openstack/cloud}/tests/unit/test_domain_params.py (78%) rename {shade/shade => openstack/cloud}/tests/unit/test_domains.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_endpoints.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_flavors.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_floating_ip_common.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_floating_ip_neutron.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_floating_ip_nova.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_floating_ip_pool.py (95%) rename {shade/shade => openstack/cloud}/tests/unit/test_groups.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_identity_roles.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_image.py (87%) rename {shade/shade => openstack/cloud}/tests/unit/test_image_snapshot.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_inventory.py (90%) rename {shade/shade => openstack/cloud}/tests/unit/test_keypair.py (96%) rename {shade/shade => openstack/cloud}/tests/unit/test_limits.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_magnum_services.py (96%) rename {shade/shade => openstack/cloud}/tests/unit/test_meta.py (95%) rename {shade/shade => openstack/cloud}/tests/unit/test_network.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_normalize.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_object.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_operator_noauth.py (93%) rename {shade/shade => openstack/cloud}/tests/unit/test_port.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_project.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_qos_bandwidth_limit_rule.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_qos_dscp_marking_rule.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_qos_minimum_bandwidth_rule.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_qos_policy.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_qos_rule_type.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_quotas.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_rebuild_server.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_recordset.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_role_assignment.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_router.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_security_groups.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_server_console.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_server_delete_metadata.py (94%) rename {shade/shade => openstack/cloud}/tests/unit/test_server_group.py (96%) rename {shade/shade => openstack/cloud}/tests/unit/test_server_set_metadata.py (94%) rename {shade/shade => openstack/cloud}/tests/unit/test_services.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_shade.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_shade_operator.py (90%) rename {shade/shade => openstack/cloud}/tests/unit/test_stack.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_subnet.py (99%) rename {shade/shade => openstack/cloud}/tests/unit/test_task_manager.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_update_server.py (95%) rename {shade/shade => openstack/cloud}/tests/unit/test_usage.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_users.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_volume.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_volume_access.py (97%) rename {shade/shade => openstack/cloud}/tests/unit/test_volume_backups.py (98%) rename {shade/shade => openstack/cloud}/tests/unit/test_zone.py (97%) rename {os-client-config/os_client_config => openstack/config}/__init__.py (96%) rename {shade/shade => openstack/config}/_log.py (100%) rename {os-client-config/os_client_config => openstack/config}/cloud_config.py (99%) rename {os-client-config/os_client_config => openstack/config}/config.py (100%) rename {os-client-config/os_client_config => openstack/config}/constructors.json (100%) rename {os-client-config/os_client_config => openstack/config}/constructors.py (100%) rename {os-client-config/os_client_config => openstack/config}/defaults.json (100%) rename {os-client-config/os_client_config => openstack/config}/defaults.py (100%) rename {os-client-config/os_client_config => openstack/config}/exceptions.py (100%) rename {os-client-config/os_client_config => openstack/config}/schema.json (100%) rename {shade/shade/tests/unit => openstack/config/tests}/__init__.py (100%) rename {os-client-config/os_client_config => openstack/config}/tests/base.py (99%) rename {os-client-config/os_client_config => openstack/config}/tests/test_cloud_config.py (100%) rename {os-client-config/os_client_config => openstack/config}/tests/test_config.py (100%) rename {os-client-config/os_client_config => openstack/config}/tests/test_environ.py (100%) rename {os-client-config/os_client_config => openstack/config}/tests/test_init.py (96%) rename {os-client-config/os_client_config => openstack/config}/tests/test_json.py (100%) rename {os-client-config/os_client_config => openstack/config}/vendor-schema.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/__init__.py (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/auro.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/bluebox.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/catalyst.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/citycloud.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/conoha.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/datacentred.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/dreamcompute.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/dreamhost.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/elastx.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/entercloudsuite.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/fuga.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/ibmcloud.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/internap.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/otc.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/ovh.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/rackspace.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/switchengines.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/ultimum.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/unitedstack.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/vexxhost.json (100%) rename {os-client-config/os_client_config => openstack/config}/vendors/zetta.json (100%) delete mode 100644 shade/shade/_legacy_clients.py diff --git a/examples/connect.py b/examples/connect.py index 07216ae16..7db375ca5 100644 --- a/examples/connect.py +++ b/examples/connect.py @@ -19,8 +19,7 @@ For a full guide see TODO(etoews):link to docs on developer.openstack.org import argparse import os -import os_client_config - +from openstack import config as occ from openstack import connection from openstack import profile from openstack import utils @@ -49,8 +48,8 @@ def _get_resource_value(resource_key, default): except KeyError: return default -occ = os_client_config.OpenStackConfig() -cloud = occ.get_one_cloud(TEST_CLOUD) +config = occ.OpenStackConfig() +cloud = config.get_one_cloud(TEST_CLOUD) SERVER_NAME = 'openstacksdk-example' IMAGE_NAME = _get_resource_value('image_name', 'cirros-0.3.5-x86_64-disk') @@ -68,14 +67,14 @@ EXAMPLE_IMAGE_NAME = 'openstacksdk-example-public-image' def create_connection_from_config(): opts = Opts(cloud_name=TEST_CLOUD) - occ = os_client_config.OpenStackConfig() - cloud = occ.get_one_cloud(opts.cloud) + config = occ.OpenStackConfig() + cloud = config.get_one_cloud(opts.cloud) return connection.from_config(cloud_config=cloud, options=opts) def create_connection_from_args(): parser = argparse.ArgumentParser() - config = os_client_config.OpenStackConfig() + config = occ.OpenStackConfig() config.register_argparse_arguments(parser, sys.argv[1:]) args = parser.parse_args() return connection.from_config(options=args) diff --git a/shade/shade/__init__.py b/openstack/cloud/__init__.py similarity index 88% rename from shade/shade/__init__.py rename to openstack/cloud/__init__.py index 35e7ee98e..d727aa4c9 100644 --- a/shade/shade/__init__.py +++ b/openstack/cloud/__init__.py @@ -16,16 +16,16 @@ import logging import warnings import keystoneauth1.exceptions -import os_client_config import pbr.version import requestsexceptions -from shade.exc import * # noqa -from shade.openstackcloud import OpenStackCloud -from shade.operatorcloud import OperatorCloud -from shade import _log +import openstack.config as os_client_config +from openstack.cloud.exc import * # noqa +from openstack.cloud.openstackcloud import OpenStackCloud +from openstack.cloud.operatorcloud import OperatorCloud +from openstack.cloud import _log -__version__ = pbr.version.VersionInfo('shade').version_string() +__version__ = pbr.version.VersionInfo('openstack').version_string() if requestsexceptions.SubjectAltNameWarning: warnings.filterwarnings( @@ -54,16 +54,13 @@ def simple_logging(debug=False, http_debug=False): log.addHandler(logging.StreamHandler()) log.setLevel(log_level) # We only want extra shade HTTP tracing in http debug mode - log = _log.setup_logging('shade.http') + log = _log.setup_logging('openstack.cloud.http') log.setLevel(log_level) else: # We only want extra shade HTTP tracing in http debug mode - log = _log.setup_logging('shade.http') + log = _log.setup_logging('openstack.cloud.http') log.setLevel(logging.WARNING) - # Simple case - we only care about request id log during debug - log = _log.setup_logging('shade.request_ids') - log.setLevel(log_level) - log = _log.setup_logging('shade') + log = _log.setup_logging('openstack.cloud') log.addHandler(logging.StreamHandler()) log.setLevel(log_level) # Suppress warning about keystoneauth loggers diff --git a/shade/shade/_adapter.py b/openstack/cloud/_adapter.py similarity index 95% rename from shade/shade/_adapter.py rename to openstack/cloud/_adapter.py index bd88d6fd6..354389c92 100644 --- a/shade/shade/_adapter.py +++ b/openstack/cloud/_adapter.py @@ -18,9 +18,9 @@ import functools from keystoneauth1 import adapter from six.moves import urllib -from shade import _log -from shade import exc -from shade import task_manager +from openstack.cloud import _log +from openstack.cloud import exc +from openstack.cloud import task_manager def extract_name(url): @@ -81,13 +81,15 @@ def extract_name(url): return [part for part in name_parts if part] +# TODO(shade) This adapter should go away in favor of the work merging +# adapter with openstack.proxy. class ShadeAdapter(adapter.Adapter): def __init__(self, shade_logger, manager, *args, **kwargs): super(ShadeAdapter, self).__init__(*args, **kwargs) self.shade_logger = shade_logger self.manager = manager - self.request_log = _log.setup_logging('shade.request_ids') + self.request_log = _log.setup_logging('openstack.cloud.request_ids') def _log_request_id(self, response, obj=None): # Log the request id and object id in a specific logger. This way diff --git a/os-client-config/os_client_config/tests/__init__.py b/openstack/cloud/_heat/__init__.py similarity index 100% rename from os-client-config/os_client_config/tests/__init__.py rename to openstack/cloud/_heat/__init__.py diff --git a/shade/shade/_heat/environment_format.py b/openstack/cloud/_heat/environment_format.py similarity index 97% rename from shade/shade/_heat/environment_format.py rename to openstack/cloud/_heat/environment_format.py index 56bc2c1c0..ac60715ae 100644 --- a/shade/shade/_heat/environment_format.py +++ b/openstack/cloud/_heat/environment_format.py @@ -12,7 +12,7 @@ import yaml -from shade._heat import template_format +from openstack.cloud._heat import template_format SECTIONS = ( diff --git a/shade/shade/_heat/event_utils.py b/openstack/cloud/_heat/event_utils.py similarity index 99% rename from shade/shade/_heat/event_utils.py rename to openstack/cloud/_heat/event_utils.py index 69c286220..bceec38af 100644 --- a/shade/shade/_heat/event_utils.py +++ b/openstack/cloud/_heat/event_utils.py @@ -15,7 +15,7 @@ import collections import time -from shade import meta +from openstack.cloud import meta def get_events(cloud, stack_id, event_args, marker=None, limit=None): diff --git a/shade/shade/_heat/template_format.py b/openstack/cloud/_heat/template_format.py similarity index 100% rename from shade/shade/_heat/template_format.py rename to openstack/cloud/_heat/template_format.py diff --git a/shade/shade/_heat/template_utils.py b/openstack/cloud/_heat/template_utils.py similarity index 98% rename from shade/shade/_heat/template_utils.py rename to openstack/cloud/_heat/template_utils.py index 3653daaf6..c56b76ea5 100644 --- a/shade/shade/_heat/template_utils.py +++ b/openstack/cloud/_heat/template_utils.py @@ -18,10 +18,10 @@ import six from six.moves.urllib import parse from six.moves.urllib import request -from shade._heat import environment_format -from shade._heat import template_format -from shade._heat import utils -from shade import exc +from openstack.cloud._heat import environment_format +from openstack.cloud._heat import template_format +from openstack.cloud._heat import utils +from openstack.cloud import exc def get_template_contents(template_file=None, template_url=None, diff --git a/shade/shade/_heat/utils.py b/openstack/cloud/_heat/utils.py similarity index 98% rename from shade/shade/_heat/utils.py rename to openstack/cloud/_heat/utils.py index 24cb0b071..c916c8b63 100644 --- a/shade/shade/_heat/utils.py +++ b/openstack/cloud/_heat/utils.py @@ -20,7 +20,7 @@ from six.moves.urllib import error from six.moves.urllib import parse from six.moves.urllib import request -from shade import exc +from openstack.cloud import exc def base_url_for_url(url): diff --git a/os-client-config/os_client_config/_log.py b/openstack/cloud/_log.py similarity index 100% rename from os-client-config/os_client_config/_log.py rename to openstack/cloud/_log.py diff --git a/shade/shade/_normalize.py b/openstack/cloud/_normalize.py similarity index 99% rename from shade/shade/_normalize.py rename to openstack/cloud/_normalize.py index b8e242b56..cf80627bc 100644 --- a/shade/shade/_normalize.py +++ b/openstack/cloud/_normalize.py @@ -12,6 +12,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +# TODO(shade) The normalize functions here should get merged in to +# the sdk resource objects. + import datetime import munch import six diff --git a/shade/shade/_tasks.py b/openstack/cloud/_tasks.py similarity index 98% rename from shade/shade/_tasks.py rename to openstack/cloud/_tasks.py index a60d27139..294fae3ba 100644 --- a/shade/shade/_tasks.py +++ b/openstack/cloud/_tasks.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from shade import task_manager +from openstack.cloud import task_manager class MachineCreate(task_manager.Task): diff --git a/shade/shade/_utils.py b/openstack/cloud/_utils.py similarity index 98% rename from shade/shade/_utils.py rename to openstack/cloud/_utils.py index 37939e5b2..f38034213 100644 --- a/shade/shade/_utils.py +++ b/openstack/cloud/_utils.py @@ -27,9 +27,9 @@ import uuid from decorator import decorator -from shade import _log -from shade import exc -from shade import meta +from openstack.cloud import _log +from openstack.cloud import exc +from openstack.cloud import meta _decorated_methods = [] @@ -48,7 +48,7 @@ def _iterate_timeout(timeout, message, wait=2): with . """ - log = _log.setup_logging('shade.iterate_timeout') + log = _log.setup_logging('openstack.cloud.iterate_timeout') try: # None as a wait winds up flowing well in the per-resource cache @@ -128,10 +128,10 @@ def _filter_list(data, name_or_id, filters): OR A string containing a jmespath expression for further filtering. """ - # The logger is shade.fmmatch to allow a user/operator to configure logging - # not to communicate about fnmatch misses (they shouldn't be too spammy, - # but one never knows) - log = _log.setup_logging('shade.fnmatch') + # The logger is openstack.cloud.fmmatch to allow a user/operator to + # configure logging not to communicate about fnmatch misses + # (they shouldn't be too spammy, but one never knows) + log = _log.setup_logging('openstack.cloud.fnmatch') if name_or_id: # name_or_id might already be unicode name_or_id = _make_unicode(name_or_id) diff --git a/shade/shade/_heat/__init__.py b/openstack/cloud/cmd/__init__.py similarity index 100% rename from shade/shade/_heat/__init__.py rename to openstack/cloud/cmd/__init__.py diff --git a/shade/shade/cmd/inventory.py b/openstack/cloud/cmd/inventory.py similarity index 90% rename from shade/shade/cmd/inventory.py rename to openstack/cloud/cmd/inventory.py index 26d615299..c5bc8cf26 100755 --- a/shade/shade/cmd/inventory.py +++ b/openstack/cloud/cmd/inventory.py @@ -18,8 +18,8 @@ import json import sys import yaml -import shade -import shade.inventory +import openstack.cloud +import openstack.cloud.inventory def output_format_dict(data, use_yaml): @@ -51,8 +51,8 @@ def parse_args(): def main(): args = parse_args() try: - shade.simple_logging(debug=args.debug) - inventory = shade.inventory.OpenStackInventory( + openstack.cloud.simple_logging(debug=args.debug) + inventory = openstack.cloud.inventory.OpenStackInventory( refresh=args.refresh, private=args.private, cloud=args.cloud) if args.list: @@ -60,7 +60,7 @@ def main(): elif args.host: output = inventory.get_host(args.host) print(output_format_dict(output, args.yaml)) - except shade.OpenStackCloudException as e: + except openstack.cloud.OpenStackCloudException as e: sys.stderr.write(e.message + '\n') sys.exit(1) sys.exit(0) diff --git a/shade/shade/exc.py b/openstack/cloud/exc.py similarity index 96% rename from shade/shade/exc.py rename to openstack/cloud/exc.py index cda469f9c..9262a500f 100644 --- a/shade/shade/exc.py +++ b/openstack/cloud/exc.py @@ -17,7 +17,7 @@ import sys import munch from requests import exceptions as _rex -from shade import _log +from openstack.cloud import _log class OpenStackCloudException(Exception): @@ -37,7 +37,7 @@ class OpenStackCloudException(Exception): def log_error(self, logger=None): if not logger: - logger = _log.setup_logging('shade.exc') + logger = _log.setup_logging('openstack.cloud.exc') if self.inner_exception and self.inner_exception[1]: logger.error(self.orig_message, exc_info=self.inner_exception) @@ -102,7 +102,7 @@ def _log_response_extras(response): # Sometimes we get weird HTML errors. This is usually from load balancers # or other things. Log them to a special logger so that they can be # toggled indepdently - and at debug level so that a person logging - # shade.* only gets them at debug. + # openstack.cloud.* only gets them at debug. if response.headers.get('content-type') != 'text/html': return try: @@ -110,7 +110,7 @@ def _log_response_extras(response): return except Exception: return - logger = _log.setup_logging('shade.http') + logger = _log.setup_logging('openstack.cloud.http') if response.reason: logger.debug( "Non-standard error '{reason}' returned from {url}:".format( diff --git a/shade/shade/inventory.py b/openstack/cloud/inventory.py similarity index 88% rename from shade/shade/inventory.py rename to openstack/cloud/inventory.py index 2490e93bf..d8b6a9f93 100644 --- a/shade/shade/inventory.py +++ b/openstack/cloud/inventory.py @@ -14,10 +14,10 @@ import functools -import os_client_config +import openstack.config as os_client_config -import shade -from shade import _utils +import openstack.cloud +from openstack.cloud import _utils class OpenStackInventory(object): @@ -38,17 +38,17 @@ class OpenStackInventory(object): if cloud is None: self.clouds = [ - shade.OpenStackCloud(cloud_config=cloud_config) + openstack.cloud.OpenStackCloud(cloud_config=cloud_config) for cloud_config in config.get_all_clouds() ] else: try: self.clouds = [ - shade.OpenStackCloud( + openstack.cloud.OpenStackCloud( cloud_config=config.get_one_cloud(cloud)) ] except os_client_config.exceptions.OpenStackConfigException as e: - raise shade.OpenStackCloudException(e) + raise openstack.cloud.OpenStackCloudException(e) if private: for cloud in self.clouds: @@ -67,7 +67,7 @@ class OpenStackInventory(object): # Cycle on servers for server in cloud.list_servers(detailed=expand): hostvars.append(server) - except shade.OpenStackCloudException: + except openstack.cloud.OpenStackCloudException: # Don't fail on one particular cloud as others may work if fail_on_cloud_config: raise diff --git a/shade/shade/meta.py b/openstack/cloud/meta.py similarity index 99% rename from shade/shade/meta.py rename to openstack/cloud/meta.py index 85c0f4310..089fb3229 100644 --- a/shade/shade/meta.py +++ b/openstack/cloud/meta.py @@ -18,8 +18,8 @@ import ipaddress import six import socket -from shade import _log -from shade import exc +from openstack.cloud import _log +from openstack.cloud import exc NON_CALLABLES = (six.string_types, bool, dict, int, float, list, type(None)) @@ -490,7 +490,7 @@ def _log_request_id(obj, request_id): if request_id: # Log the request id and object id in a specific logger. This way # someone can turn it on if they're interested in this kind of tracing. - log = _log.setup_logging('shade.request_ids') + log = _log.setup_logging('openstack.cloud.request_ids') obj_id = None if isinstance(obj, dict): obj_id = obj.get('id', obj.get('uuid')) diff --git a/shade/shade/openstackcloud.py b/openstack/cloud/openstackcloud.py similarity index 99% rename from shade/shade/openstackcloud.py rename to openstack/cloud/openstackcloud.py index 781a06efd..7244b791c 100644 --- a/shade/shade/openstackcloud.py +++ b/openstack/cloud/openstackcloud.py @@ -20,8 +20,8 @@ import jsonpatch import keystoneauth1.session import operator import os -import os_client_config -import os_client_config.defaults +import openstack.config +import openstack.config.defaults import six import threading import time @@ -34,23 +34,28 @@ from six.moves import urllib import keystoneauth1.exceptions -import shade -from shade.exc import * # noqa -from shade import _adapter -from shade._heat import event_utils -from shade._heat import template_utils -from shade import _log -from shade import _legacy_clients -from shade import _normalize -from shade import meta -from shade import task_manager -from shade import _utils +import openstack.cloud +from openstack.cloud.exc import * # noqa +from openstack.cloud import _adapter +from openstack.cloud._heat import event_utils +from openstack.cloud._heat import template_utils +from openstack.cloud import _log +from openstack.cloud import _normalize +from openstack.cloud import meta +from openstack.cloud import task_manager +from openstack.cloud import _utils -OBJECT_MD5_KEY = 'x-object-meta-x-shade-md5' -OBJECT_SHA256_KEY = 'x-object-meta-x-shade-sha256' -IMAGE_MD5_KEY = 'owner_specified.shade.md5' -IMAGE_SHA256_KEY = 'owner_specified.shade.sha256' -IMAGE_OBJECT_KEY = 'owner_specified.shade.object' +# TODO(shade) shade keys were x-object-meta-x-shade-md5 - we need to add those +# to freshness checks so that a shade->sdk transition doens't +# result in a re-upload +OBJECT_MD5_KEY = 'x-object-meta-x-openstack-md5' +OBJECT_SHA256_KEY = 'x-object-meta-x-openstack-sha256' +# TODO(shade) shade keys were owner_specified.shade.md5 - we need to add those +# to freshness checks so that a shade->sdk transition doens't +# result in a re-upload +IMAGE_MD5_KEY = 'owner_specified.openstack.md5' +IMAGE_SHA256_KEY = 'owner_specified.openstack.sha256' +IMAGE_OBJECT_KEY = 'owner_specified.openstack.object' # Rackspace returns this for intermittent import errors IMAGE_ERROR_396 = "Image cannot be imported. Error code: '396'" DEFAULT_OBJECT_SEGMENT_SIZE = 1073741824 # 1GB @@ -93,9 +98,7 @@ def _no_pending_stacks(stacks): return True -class OpenStackCloud( - _normalize.Normalizer, - _legacy_clients.LegacyClientFactoryMixin): +class OpenStackCloud(_normalize.Normalizer): """Represent a connection to an OpenStack Cloud. OpenStackCloud is the entry point for all cloud operations, regardless @@ -119,7 +122,7 @@ class OpenStackCloud( emitted to the error log. This flag will enable that behavior. :param bool strict: Only return documented attributes for each resource - as per the shade Data Model contract. (Default False) + as per the Data Model contract. (Default False) :param app_name: Name of the application to be appended to the user-agent string. Optional, defaults to None. :param app_version: Version of the application to be appended to the @@ -143,10 +146,10 @@ class OpenStackCloud( if log_inner_exceptions: OpenStackCloudException.log_inner_exceptions = True - self.log = _log.setup_logging('shade') + self.log = _log.setup_logging('openstack.cloud') if not cloud_config: - config = os_client_config.OpenStackConfig( + config = openstack.config.OpenStackConfig( app_name=app_name, app_version=app_version) cloud_config = config.get_one_cloud(**kwargs) @@ -161,8 +164,8 @@ class OpenStackCloud( self.secgroup_source = cloud_config.config['secgroup_source'] self.force_ipv4 = cloud_config.force_ipv4 self.strict_mode = strict - # TODO(mordred) When os-client-config adds a "get_client_settings()" - # method to CloudConfig - remove this. + # TODO(shade) The openstack.cloud default for get_flavor_extra_specs + # should be changed and this should be removed completely self._extra_config = cloud_config._openstack_config.get_extra_config( 'shade', { 'get_flavor_extra_specs': True, @@ -296,7 +299,6 @@ class OpenStackCloud( self._keystone_session = None - self._legacy_clients = {} self._raw_clients = {} self._local_ipv6 = ( @@ -368,11 +370,17 @@ class OpenStackCloud( config_major = self._get_major_version_id(config_version) max_major = self._get_major_version_id(max_version) min_major = self._get_major_version_id(min_version) - # NOTE(mordred) The shade logic for versions is slightly different - # than the ksa Adapter constructor logic. shade knows the versions - # it knows, and uses them when it detects them. However, if a user - # requests a version, and it's not found, and a different one shade - # does know about it found, that's a warning in shade. + # TODO(shade) This should be replaced with use of Connection. However, + # we need to find a sane way to deal with this additional + # logic - or we need to give up on it. If we give up on it, + # we need to make sure we can still support it in the shade + # compat layer. + # NOTE(mordred) This logic for versions is slightly different + # than the ksa Adapter constructor logic. openstack.cloud knows the + # versions it knows, and uses them when it detects them. However, if + # a user requests a version, and it's not found, and a different one + # openstack.cloud does know about is found, that's a warning in + # openstack.cloud. if config_version: if min_major and config_major < min_major: raise OpenStackCloudException( @@ -384,7 +392,8 @@ class OpenStackCloud( elif max_major and config_major > max_major: raise OpenStackCloudException( "Version {config_version} requested for {service_type}" - " but shade understands a maximum of {max_version}".format( + " but openstack.cloud understands a maximum of" + " {max_version}".format( config_version=config_version, service_type=service_type, max_version=max_version)) @@ -441,6 +450,8 @@ class OpenStackCloud( warnings.warn(warning_msg) return adapter + # TODO(shade) This should be replaced with using openstack Connection + # object. def _get_raw_client( self, service_type, api_version=None, endpoint_override=None): return _adapter.ShadeAdapter( @@ -588,7 +599,7 @@ class OpenStackCloud( self._keystone_session = self.cloud_config.get_session() if hasattr(self._keystone_session, 'additional_user_agent'): self._keystone_session.additional_user_agent.append( - ('shade', shade.__version__)) + ('shade', openstack.cloud.__version__)) except Exception as e: raise OpenStackCloudException( "Error authenticating to keystone: %s " % str(e)) @@ -1825,7 +1836,7 @@ class OpenStackCloud( :param get_extra: Whether or not to fetch extra specs for each flavor. Defaults to True. Default behavior value can be overridden in clouds.yaml by setting - shade.get_extra_specs to False. + openstack.cloud.get_extra_specs to False. :returns: A list of flavor ``munch.Munch``. """ diff --git a/shade/shade/operatorcloud.py b/openstack/cloud/operatorcloud.py similarity index 99% rename from shade/shade/operatorcloud.py rename to openstack/cloud/operatorcloud.py index da6d07411..d2f2a9464 100644 --- a/shade/shade/operatorcloud.py +++ b/openstack/cloud/operatorcloud.py @@ -17,10 +17,10 @@ import munch from ironicclient import exceptions as ironic_exceptions -from shade.exc import * # noqa -from shade import openstackcloud -from shade import _tasks -from shade import _utils +from openstack.cloud.exc import * # noqa +from openstack.cloud import openstackcloud +from openstack.cloud import _tasks +from openstack.cloud import _utils class OperatorCloud(openstackcloud.OpenStackCloud): diff --git a/shade/shade/task_manager.py b/openstack/cloud/task_manager.py similarity index 98% rename from shade/shade/task_manager.py rename to openstack/cloud/task_manager.py index 885df8be5..39db58575 100644 --- a/shade/shade/task_manager.py +++ b/openstack/cloud/task_manager.py @@ -25,9 +25,9 @@ import keystoneauth1.exceptions import simplejson import six -from shade import _log -from shade import exc -from shade import meta +from openstack.cloud import _log +from openstack.cloud import exc +from openstack.cloud import meta def _is_listlike(obj): @@ -226,7 +226,7 @@ def generate_task_class(method, name, result_filter_cb): class TaskManager(object): - log = _log.setup_logging('shade.task_manager') + log = _log.setup_logging('openstack.cloud.task_manager') def __init__( self, client, name, result_filter_cb=None, workers=5, **kwargs): diff --git a/shade/shade/cmd/__init__.py b/openstack/cloud/tests/__init__.py similarity index 100% rename from shade/shade/cmd/__init__.py rename to openstack/cloud/tests/__init__.py diff --git a/shade/shade/tests/ansible/README.txt b/openstack/cloud/tests/ansible/README.txt similarity index 100% rename from shade/shade/tests/ansible/README.txt rename to openstack/cloud/tests/ansible/README.txt diff --git a/shade/shade/tests/ansible/hooks/post_test_hook.sh b/openstack/cloud/tests/ansible/hooks/post_test_hook.sh similarity index 100% rename from shade/shade/tests/ansible/hooks/post_test_hook.sh rename to openstack/cloud/tests/ansible/hooks/post_test_hook.sh diff --git a/shade/shade/tests/ansible/roles/auth/tasks/main.yml b/openstack/cloud/tests/ansible/roles/auth/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/auth/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/auth/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/client_config/tasks/main.yml b/openstack/cloud/tests/ansible/roles/client_config/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/client_config/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/client_config/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/group/tasks/main.yml b/openstack/cloud/tests/ansible/roles/group/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/group/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/group/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/group/vars/main.yml b/openstack/cloud/tests/ansible/roles/group/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/group/vars/main.yml rename to openstack/cloud/tests/ansible/roles/group/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/image/tasks/main.yml b/openstack/cloud/tests/ansible/roles/image/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/image/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/image/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/image/vars/main.yml b/openstack/cloud/tests/ansible/roles/image/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/image/vars/main.yml rename to openstack/cloud/tests/ansible/roles/image/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/keypair/tasks/main.yml b/openstack/cloud/tests/ansible/roles/keypair/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keypair/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/keypair/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/keypair/vars/main.yml b/openstack/cloud/tests/ansible/roles/keypair/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keypair/vars/main.yml rename to openstack/cloud/tests/ansible/roles/keypair/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/keystone_domain/tasks/main.yml b/openstack/cloud/tests/ansible/roles/keystone_domain/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keystone_domain/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/keystone_domain/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/keystone_domain/vars/main.yml b/openstack/cloud/tests/ansible/roles/keystone_domain/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keystone_domain/vars/main.yml rename to openstack/cloud/tests/ansible/roles/keystone_domain/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/keystone_role/tasks/main.yml b/openstack/cloud/tests/ansible/roles/keystone_role/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keystone_role/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/keystone_role/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/keystone_role/vars/main.yml b/openstack/cloud/tests/ansible/roles/keystone_role/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/keystone_role/vars/main.yml rename to openstack/cloud/tests/ansible/roles/keystone_role/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/network/tasks/main.yml b/openstack/cloud/tests/ansible/roles/network/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/network/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/network/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/network/vars/main.yml b/openstack/cloud/tests/ansible/roles/network/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/network/vars/main.yml rename to openstack/cloud/tests/ansible/roles/network/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/nova_flavor/tasks/main.yml b/openstack/cloud/tests/ansible/roles/nova_flavor/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/nova_flavor/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/nova_flavor/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/object/tasks/main.yml b/openstack/cloud/tests/ansible/roles/object/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/object/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/object/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/port/tasks/main.yml b/openstack/cloud/tests/ansible/roles/port/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/port/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/port/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/port/vars/main.yml b/openstack/cloud/tests/ansible/roles/port/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/port/vars/main.yml rename to openstack/cloud/tests/ansible/roles/port/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/router/tasks/main.yml b/openstack/cloud/tests/ansible/roles/router/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/router/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/router/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/router/vars/main.yml b/openstack/cloud/tests/ansible/roles/router/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/router/vars/main.yml rename to openstack/cloud/tests/ansible/roles/router/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/security_group/tasks/main.yml b/openstack/cloud/tests/ansible/roles/security_group/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/security_group/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/security_group/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/security_group/vars/main.yml b/openstack/cloud/tests/ansible/roles/security_group/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/security_group/vars/main.yml rename to openstack/cloud/tests/ansible/roles/security_group/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/server/tasks/main.yml b/openstack/cloud/tests/ansible/roles/server/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/server/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/server/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/server/vars/main.yaml b/openstack/cloud/tests/ansible/roles/server/vars/main.yaml similarity index 100% rename from shade/shade/tests/ansible/roles/server/vars/main.yaml rename to openstack/cloud/tests/ansible/roles/server/vars/main.yaml diff --git a/shade/shade/tests/ansible/roles/subnet/tasks/main.yml b/openstack/cloud/tests/ansible/roles/subnet/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/subnet/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/subnet/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/subnet/vars/main.yml b/openstack/cloud/tests/ansible/roles/subnet/vars/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/subnet/vars/main.yml rename to openstack/cloud/tests/ansible/roles/subnet/vars/main.yml diff --git a/shade/shade/tests/ansible/roles/user/tasks/main.yml b/openstack/cloud/tests/ansible/roles/user/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/user/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/user/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/user_group/tasks/main.yml b/openstack/cloud/tests/ansible/roles/user_group/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/user_group/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/user_group/tasks/main.yml diff --git a/shade/shade/tests/ansible/roles/volume/tasks/main.yml b/openstack/cloud/tests/ansible/roles/volume/tasks/main.yml similarity index 100% rename from shade/shade/tests/ansible/roles/volume/tasks/main.yml rename to openstack/cloud/tests/ansible/roles/volume/tasks/main.yml diff --git a/shade/shade/tests/ansible/run.yml b/openstack/cloud/tests/ansible/run.yml similarity index 100% rename from shade/shade/tests/ansible/run.yml rename to openstack/cloud/tests/ansible/run.yml diff --git a/shade/shade/tests/base.py b/openstack/cloud/tests/base.py similarity index 100% rename from shade/shade/tests/base.py rename to openstack/cloud/tests/base.py diff --git a/shade/shade/tests/fakes.py b/openstack/cloud/tests/fakes.py similarity index 98% rename from shade/shade/tests/fakes.py rename to openstack/cloud/tests/fakes.py index 9ff4c8457..e3ff72934 100644 --- a/shade/shade/tests/fakes.py +++ b/openstack/cloud/tests/fakes.py @@ -21,8 +21,8 @@ import datetime import json import uuid -from shade._heat import template_format -from shade import meta +from openstack.cloud._heat import template_format +from openstack.cloud import meta PROJECT_ID = '1c36b64c840a42cd9e9b931a369337f0' FLAVOR_ID = u'0c1d9008-f546-4608-9e8f-f8bdaec8dddd' @@ -235,9 +235,9 @@ def make_fake_image( u'name': u'fake_image', u'checksum': u'ee36e35a297980dee1b514de9803ec6d', u'created_at': u'2016-02-10T05:03:11Z', - u'owner_specified.shade.md5': NO_MD5, - u'owner_specified.shade.sha256': NO_SHA256, - u'owner_specified.shade.object': 'images/fake_image', + u'owner_specified.openstack.cloud.md5': NO_MD5, + u'owner_specified.openstack.cloud.sha256': NO_SHA256, + u'owner_specified.openstack.cloud.object': 'images/fake_image', u'protected': False} diff --git a/shade/shade/tests/__init__.py b/openstack/cloud/tests/functional/__init__.py similarity index 100% rename from shade/shade/tests/__init__.py rename to openstack/cloud/tests/functional/__init__.py diff --git a/shade/shade/tests/functional/base.py b/openstack/cloud/tests/functional/base.py similarity index 93% rename from shade/shade/tests/functional/base.py rename to openstack/cloud/tests/functional/base.py index f2fc32525..32c07d7da 100644 --- a/shade/shade/tests/functional/base.py +++ b/openstack/cloud/tests/functional/base.py @@ -12,10 +12,10 @@ import os -import os_client_config as occ +import openstack.config as occ -import shade -from shade.tests import base +import openstack.cloud +from openstack.cloud.tests import base class BaseFunctionalTestCase(base.TestCase): @@ -36,14 +36,14 @@ class BaseFunctionalTestCase(base.TestCase): def _set_user_cloud(self, **kwargs): user_config = self.config.get_one_cloud( cloud=self._demo_name, **kwargs) - self.user_cloud = shade.OpenStackCloud( + self.user_cloud = openstack.cloud.OpenStackCloud( cloud_config=user_config, log_inner_exceptions=True) def _set_operator_cloud(self, **kwargs): operator_config = self.config.get_one_cloud( cloud=self._op_name, **kwargs) - self.operator_cloud = shade.OperatorCloud( + self.operator_cloud = openstack.cloud.OperatorCloud( cloud_config=operator_config, log_inner_exceptions=True) diff --git a/shade/shade/tests/functional/hooks/post_test_hook.sh b/openstack/cloud/tests/functional/hooks/post_test_hook.sh similarity index 100% rename from shade/shade/tests/functional/hooks/post_test_hook.sh rename to openstack/cloud/tests/functional/hooks/post_test_hook.sh diff --git a/shade/shade/tests/functional/test_aggregate.py b/openstack/cloud/tests/functional/test_aggregate.py similarity index 97% rename from shade/shade/tests/functional/test_aggregate.py rename to openstack/cloud/tests/functional/test_aggregate.py index db41afd5a..83fe24de6 100644 --- a/shade/shade/tests/functional/test_aggregate.py +++ b/openstack/cloud/tests/functional/test_aggregate.py @@ -17,7 +17,7 @@ test_aggregate Functional tests for `shade` aggregate resource. """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestAggregate(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_cluster_templates.py b/openstack/cloud/tests/functional/test_cluster_templates.py similarity index 95% rename from shade/shade/tests/functional/test_cluster_templates.py rename to openstack/cloud/tests/functional/test_cluster_templates.py index b19178c88..cb2ff2634 100644 --- a/shade/shade/tests/functional/test_cluster_templates.py +++ b/openstack/cloud/tests/functional/test_cluster_templates.py @@ -19,7 +19,7 @@ Funself.ctional tests for `shade` cluster_template methods. from testtools import content -from shade.tests.functional import base +from openstack.cloud.tests.functional import base import os import subprocess @@ -56,7 +56,7 @@ class TestClusterTemplate(base.BaseFunctionalTestCase): '%s/id_rsa_shade' % ssh_directory]) # add keypair to nova - with open('%s/id_rsa_shade.pub' % ssh_directory) as f: + with open('%s/id_rsa_openstack.cloud.pub' % ssh_directory) as f: key_content = f.read() self.user_cloud.create_keypair('testkey', key_content) @@ -110,4 +110,4 @@ class TestClusterTemplate(base.BaseFunctionalTestCase): # delete keypair self.user_cloud.delete_keypair('testkey') os.unlink('/tmp/.ssh/id_rsa_shade') - os.unlink('/tmp/.ssh/id_rsa_shade.pub') + os.unlink('/tmp/.ssh/id_rsa_openstack.cloud.pub') diff --git a/shade/shade/tests/functional/test_compute.py b/openstack/cloud/tests/functional/test_compute.py similarity index 99% rename from shade/shade/tests/functional/test_compute.py rename to openstack/cloud/tests/functional/test_compute.py index da6c315cb..3c4525410 100644 --- a/shade/shade/tests/functional/test_compute.py +++ b/openstack/cloud/tests/functional/test_compute.py @@ -20,10 +20,10 @@ Functional tests for `shade` compute methods. from fixtures import TimeoutException import six -from shade import exc -from shade.tests.functional import base -from shade.tests.functional.util import pick_flavor -from shade import _utils +from openstack.cloud import exc +from openstack.cloud.tests.functional import base +from openstack.cloud.tests.functional.util import pick_flavor +from openstack.cloud import _utils class TestCompute(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_devstack.py b/openstack/cloud/tests/functional/test_devstack.py similarity index 97% rename from shade/shade/tests/functional/test_devstack.py rename to openstack/cloud/tests/functional/test_devstack.py index d14392007..b48ba5d8c 100644 --- a/shade/shade/tests/functional/test_devstack.py +++ b/openstack/cloud/tests/functional/test_devstack.py @@ -24,7 +24,7 @@ import os from testscenarios import load_tests_apply_scenarios as load_tests # noqa -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestDevstack(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_domain.py b/openstack/cloud/tests/functional/test_domain.py similarity index 96% rename from shade/shade/tests/functional/test_domain.py rename to openstack/cloud/tests/functional/test_domain.py index 4d5ca94e5..42ba09aa7 100644 --- a/shade/shade/tests/functional/test_domain.py +++ b/openstack/cloud/tests/functional/test_domain.py @@ -19,8 +19,8 @@ test_domain Functional tests for `shade` keystone domain resource. """ -import shade -from shade.tests.functional import base +import openstack.cloud +from openstack.cloud.tests.functional import base class TestDomain(base.BaseFunctionalTestCase): @@ -46,7 +46,8 @@ class TestDomain(base.BaseFunctionalTestCase): if exception_list: # Raise an error: we must make users aware that something went # wrong - raise shade.OpenStackCloudException('\n'.join(exception_list)) + raise openstack.cloud.OpenStackCloudException( + '\n'.join(exception_list)) def test_search_domains(self): domain_name = self.domain_prefix + '_search' diff --git a/shade/shade/tests/functional/test_endpoints.py b/openstack/cloud/tests/functional/test_endpoints.py similarity index 97% rename from shade/shade/tests/functional/test_endpoints.py rename to openstack/cloud/tests/functional/test_endpoints.py index da39cb33b..7f32312fe 100644 --- a/shade/shade/tests/functional/test_endpoints.py +++ b/openstack/cloud/tests/functional/test_endpoints.py @@ -24,9 +24,9 @@ Functional tests for `shade` endpoint resource. import string import random -from shade.exc import OpenStackCloudException -from shade.exc import OpenStackCloudUnavailableFeature -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.exc import OpenStackCloudUnavailableFeature +from openstack.cloud.tests.functional import base class TestEndpoints(base.KeystoneBaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_flavor.py b/openstack/cloud/tests/functional/test_flavor.py similarity index 98% rename from shade/shade/tests/functional/test_flavor.py rename to openstack/cloud/tests/functional/test_flavor.py index 71d176f72..3aae4b43b 100644 --- a/shade/shade/tests/functional/test_flavor.py +++ b/openstack/cloud/tests/functional/test_flavor.py @@ -21,8 +21,8 @@ test_flavor Functional tests for `shade` flavor resource. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestFlavor(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_floating_ip.py b/openstack/cloud/tests/functional/test_floating_ip.py similarity index 97% rename from shade/shade/tests/functional/test_floating_ip.py rename to openstack/cloud/tests/functional/test_floating_ip.py index e74a23f5a..917b8bda9 100644 --- a/shade/shade/tests/functional/test_floating_ip.py +++ b/openstack/cloud/tests/functional/test_floating_ip.py @@ -23,11 +23,11 @@ import pprint from testtools import content -from shade import _utils -from shade import meta -from shade.exc import OpenStackCloudException -from shade.tests.functional import base -from shade.tests.functional.util import pick_flavor +from openstack.cloud import _utils +from openstack.cloud import meta +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base +from openstack.cloud.tests.functional.util import pick_flavor class TestFloatingIP(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_floating_ip_pool.py b/openstack/cloud/tests/functional/test_floating_ip_pool.py similarity index 97% rename from shade/shade/tests/functional/test_floating_ip_pool.py rename to openstack/cloud/tests/functional/test_floating_ip_pool.py index c4ee5a0f6..987e83ba4 100644 --- a/shade/shade/tests/functional/test_floating_ip_pool.py +++ b/openstack/cloud/tests/functional/test_floating_ip_pool.py @@ -19,7 +19,7 @@ test_floating_ip_pool Functional tests for floating IP pool resource (managed by nova) """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base # When using nova-network, floating IP pools are created with nova-manage diff --git a/shade/shade/tests/functional/test_groups.py b/openstack/cloud/tests/functional/test_groups.py similarity index 95% rename from shade/shade/tests/functional/test_groups.py rename to openstack/cloud/tests/functional/test_groups.py index cabfeb52a..e48e8b851 100644 --- a/shade/shade/tests/functional/test_groups.py +++ b/openstack/cloud/tests/functional/test_groups.py @@ -19,8 +19,8 @@ test_groups Functional tests for `shade` keystone group resource. """ -import shade -from shade.tests.functional import base +import openstack.cloud +from openstack.cloud.tests.functional import base class TestGroup(base.BaseFunctionalTestCase): @@ -46,7 +46,8 @@ class TestGroup(base.BaseFunctionalTestCase): if exception_list: # Raise an error: we must make users aware that something went # wrong - raise shade.OpenStackCloudException('\n'.join(exception_list)) + raise openstack.cloud.OpenStackCloudException( + '\n'.join(exception_list)) def test_create_group(self): group_name = self.group_prefix + '_create' diff --git a/shade/shade/tests/functional/test_identity.py b/openstack/cloud/tests/functional/test_identity.py similarity index 99% rename from shade/shade/tests/functional/test_identity.py rename to openstack/cloud/tests/functional/test_identity.py index 56413f7db..2636f1dbe 100644 --- a/shade/shade/tests/functional/test_identity.py +++ b/openstack/cloud/tests/functional/test_identity.py @@ -20,8 +20,8 @@ Functional tests for `shade` identity methods. import random import string -from shade import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestIdentity(base.KeystoneBaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_image.py b/openstack/cloud/tests/functional/test_image.py similarity index 99% rename from shade/shade/tests/functional/test_image.py rename to openstack/cloud/tests/functional/test_image.py index 960214ba1..26a48ea3c 100644 --- a/shade/shade/tests/functional/test_image.py +++ b/openstack/cloud/tests/functional/test_image.py @@ -21,7 +21,7 @@ import filecmp import os import tempfile -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestImage(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_inventory.py b/openstack/cloud/tests/functional/test_inventory.py similarity index 95% rename from shade/shade/tests/functional/test_inventory.py rename to openstack/cloud/tests/functional/test_inventory.py index ce98625cf..9e5143cab 100644 --- a/shade/shade/tests/functional/test_inventory.py +++ b/openstack/cloud/tests/functional/test_inventory.py @@ -19,10 +19,10 @@ test_inventory Functional tests for `shade` inventory methods. """ -from shade import inventory +from openstack.cloud import inventory -from shade.tests.functional import base -from shade.tests.functional.util import pick_flavor +from openstack.cloud.tests.functional import base +from openstack.cloud.tests.functional.util import pick_flavor class TestInventory(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_keypairs.py b/openstack/cloud/tests/functional/test_keypairs.py similarity index 96% rename from shade/shade/tests/functional/test_keypairs.py rename to openstack/cloud/tests/functional/test_keypairs.py index 35a159e1c..f990f6367 100644 --- a/shade/shade/tests/functional/test_keypairs.py +++ b/openstack/cloud/tests/functional/test_keypairs.py @@ -16,8 +16,8 @@ test_keypairs Functional tests for `shade` keypairs methods """ -from shade.tests import fakes -from shade.tests.functional import base +from openstack.cloud.tests import fakes +from openstack.cloud.tests.functional import base class TestKeypairs(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_limits.py b/openstack/cloud/tests/functional/test_limits.py similarity index 96% rename from shade/shade/tests/functional/test_limits.py rename to openstack/cloud/tests/functional/test_limits.py index 015dafec0..2aae80434 100644 --- a/shade/shade/tests/functional/test_limits.py +++ b/openstack/cloud/tests/functional/test_limits.py @@ -16,7 +16,7 @@ test_limits Functional tests for `shade` limits method """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestUsage(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_magnum_services.py b/openstack/cloud/tests/functional/test_magnum_services.py similarity index 96% rename from shade/shade/tests/functional/test_magnum_services.py rename to openstack/cloud/tests/functional/test_magnum_services.py index d77468618..2690b910f 100644 --- a/shade/shade/tests/functional/test_magnum_services.py +++ b/openstack/cloud/tests/functional/test_magnum_services.py @@ -17,7 +17,7 @@ test_magnum_services Functional tests for `shade` services method. """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestMagnumServices(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_network.py b/openstack/cloud/tests/functional/test_network.py similarity index 97% rename from shade/shade/tests/functional/test_network.py rename to openstack/cloud/tests/functional/test_network.py index 14e5776d5..8a4b5ee1a 100644 --- a/shade/shade/tests/functional/test_network.py +++ b/openstack/cloud/tests/functional/test_network.py @@ -17,8 +17,8 @@ test_network Functional tests for `shade` network methods. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestNetwork(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_object.py b/openstack/cloud/tests/functional/test_object.py similarity index 98% rename from shade/shade/tests/functional/test_object.py rename to openstack/cloud/tests/functional/test_object.py index a13b27ac3..17d914b8f 100644 --- a/shade/shade/tests/functional/test_object.py +++ b/openstack/cloud/tests/functional/test_object.py @@ -23,8 +23,8 @@ import tempfile from testtools import content -from shade import exc -from shade.tests.functional import base +from openstack.cloud import exc +from openstack.cloud.tests.functional import base class TestObject(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_port.py b/openstack/cloud/tests/functional/test_port.py similarity index 98% rename from shade/shade/tests/functional/test_port.py rename to openstack/cloud/tests/functional/test_port.py index a824a2fe3..1cea9e2cb 100644 --- a/shade/shade/tests/functional/test_port.py +++ b/openstack/cloud/tests/functional/test_port.py @@ -24,8 +24,8 @@ Functional tests for `shade` port resource. import string import random -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestPort(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_project.py b/openstack/cloud/tests/functional/test_project.py similarity index 97% rename from shade/shade/tests/functional/test_project.py rename to openstack/cloud/tests/functional/test_project.py index 25d59e6db..1ba501d72 100644 --- a/shade/shade/tests/functional/test_project.py +++ b/openstack/cloud/tests/functional/test_project.py @@ -21,8 +21,8 @@ test_project Functional tests for `shade` project resource. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestProject(base.KeystoneBaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_qos_bandwidth_limit_rule.py b/openstack/cloud/tests/functional/test_qos_bandwidth_limit_rule.py similarity index 97% rename from shade/shade/tests/functional/test_qos_bandwidth_limit_rule.py rename to openstack/cloud/tests/functional/test_qos_bandwidth_limit_rule.py index 3bec8ced2..f1b449b22 100644 --- a/shade/shade/tests/functional/test_qos_bandwidth_limit_rule.py +++ b/openstack/cloud/tests/functional/test_qos_bandwidth_limit_rule.py @@ -18,8 +18,8 @@ test_qos_bandwidth_limit_rule Functional tests for `shade`QoS bandwidth limit methods. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestQosBandwidthLimitRule(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_qos_dscp_marking_rule.py b/openstack/cloud/tests/functional/test_qos_dscp_marking_rule.py similarity index 96% rename from shade/shade/tests/functional/test_qos_dscp_marking_rule.py rename to openstack/cloud/tests/functional/test_qos_dscp_marking_rule.py index 3640fe4e9..b326f126f 100644 --- a/shade/shade/tests/functional/test_qos_dscp_marking_rule.py +++ b/openstack/cloud/tests/functional/test_qos_dscp_marking_rule.py @@ -18,8 +18,8 @@ test_qos_dscp_marking_rule Functional tests for `shade`QoS DSCP marking rule methods. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestQosDscpMarkingRule(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_qos_minimum_bandwidth_rule.py b/openstack/cloud/tests/functional/test_qos_minimum_bandwidth_rule.py similarity index 96% rename from shade/shade/tests/functional/test_qos_minimum_bandwidth_rule.py rename to openstack/cloud/tests/functional/test_qos_minimum_bandwidth_rule.py index ad5291f10..a0492b262 100644 --- a/shade/shade/tests/functional/test_qos_minimum_bandwidth_rule.py +++ b/openstack/cloud/tests/functional/test_qos_minimum_bandwidth_rule.py @@ -18,8 +18,8 @@ test_qos_minumum_bandwidth_rule Functional tests for `shade`QoS minimum bandwidth methods. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestQosMinimumBandwidthRule(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_qos_policy.py b/openstack/cloud/tests/functional/test_qos_policy.py similarity index 97% rename from shade/shade/tests/functional/test_qos_policy.py rename to openstack/cloud/tests/functional/test_qos_policy.py index ba418337d..670fe38ad 100644 --- a/shade/shade/tests/functional/test_qos_policy.py +++ b/openstack/cloud/tests/functional/test_qos_policy.py @@ -18,8 +18,8 @@ test_qos_policy Functional tests for `shade`QoS policies methods. """ -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestQosPolicy(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_quotas.py b/openstack/cloud/tests/functional/test_quotas.py similarity index 98% rename from shade/shade/tests/functional/test_quotas.py rename to openstack/cloud/tests/functional/test_quotas.py index dd2816873..3abc2cd0c 100644 --- a/shade/shade/tests/functional/test_quotas.py +++ b/openstack/cloud/tests/functional/test_quotas.py @@ -17,7 +17,7 @@ test_quotas Functional tests for `shade` quotas methods. """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestComputeQuotas(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_range_search.py b/openstack/cloud/tests/functional/test_range_search.py similarity index 98% rename from shade/shade/tests/functional/test_range_search.py rename to openstack/cloud/tests/functional/test_range_search.py index 15bf277df..d7089269d 100644 --- a/shade/shade/tests/functional/test_range_search.py +++ b/openstack/cloud/tests/functional/test_range_search.py @@ -15,8 +15,8 @@ # limitations under the License. -from shade import exc -from shade.tests.functional import base +from openstack.cloud import exc +from openstack.cloud.tests.functional import base class TestRangeSearch(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_recordset.py b/openstack/cloud/tests/functional/test_recordset.py similarity index 98% rename from shade/shade/tests/functional/test_recordset.py rename to openstack/cloud/tests/functional/test_recordset.py index 98e209f83..53f98eef7 100644 --- a/shade/shade/tests/functional/test_recordset.py +++ b/openstack/cloud/tests/functional/test_recordset.py @@ -19,7 +19,7 @@ Functional tests for `shade` recordset methods. from testtools import content -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestRecordset(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_router.py b/openstack/cloud/tests/functional/test_router.py similarity index 99% rename from shade/shade/tests/functional/test_router.py rename to openstack/cloud/tests/functional/test_router.py index 5c4ccde46..0259347cb 100644 --- a/shade/shade/tests/functional/test_router.py +++ b/openstack/cloud/tests/functional/test_router.py @@ -19,8 +19,8 @@ Functional tests for `shade` router methods. import ipaddress -from shade.exc import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.functional import base EXPECTED_TOPLEVEL_FIELDS = ( diff --git a/shade/shade/tests/functional/test_security_groups.py b/openstack/cloud/tests/functional/test_security_groups.py similarity index 98% rename from shade/shade/tests/functional/test_security_groups.py rename to openstack/cloud/tests/functional/test_security_groups.py index de9c05f99..23cc006dd 100644 --- a/shade/shade/tests/functional/test_security_groups.py +++ b/openstack/cloud/tests/functional/test_security_groups.py @@ -17,7 +17,7 @@ test_security_groups Functional tests for `shade` security_groups resource. """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestSecurityGroups(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_server_group.py b/openstack/cloud/tests/functional/test_server_group.py similarity index 96% rename from shade/shade/tests/functional/test_server_group.py rename to openstack/cloud/tests/functional/test_server_group.py index e4e7f8ecf..4dc32a4cd 100644 --- a/shade/shade/tests/functional/test_server_group.py +++ b/openstack/cloud/tests/functional/test_server_group.py @@ -17,7 +17,7 @@ test_server_group Functional tests for `shade` server_group resource. """ -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestServerGroup(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_services.py b/openstack/cloud/tests/functional/test_services.py similarity index 96% rename from shade/shade/tests/functional/test_services.py rename to openstack/cloud/tests/functional/test_services.py index 92920d53f..8c5191490 100644 --- a/shade/shade/tests/functional/test_services.py +++ b/openstack/cloud/tests/functional/test_services.py @@ -24,9 +24,9 @@ Functional tests for `shade` service resource. import string import random -from shade.exc import OpenStackCloudException -from shade.exc import OpenStackCloudUnavailableFeature -from shade.tests.functional import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.exc import OpenStackCloudUnavailableFeature +from openstack.cloud.tests.functional import base class TestServices(base.KeystoneBaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_stack.py b/openstack/cloud/tests/functional/test_stack.py similarity index 97% rename from shade/shade/tests/functional/test_stack.py rename to openstack/cloud/tests/functional/test_stack.py index cd6d1fc20..eb3164561 100644 --- a/shade/shade/tests/functional/test_stack.py +++ b/openstack/cloud/tests/functional/test_stack.py @@ -19,9 +19,9 @@ Functional tests for `shade` stack methods. import tempfile -from shade import exc -from shade.tests import fakes -from shade.tests.functional import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.functional import base simple_template = '''heat_template_version: 2014-10-16 parameters: diff --git a/shade/shade/tests/functional/test_usage.py b/openstack/cloud/tests/functional/test_usage.py similarity index 96% rename from shade/shade/tests/functional/test_usage.py rename to openstack/cloud/tests/functional/test_usage.py index ae36ab11d..0f5a3bcdc 100644 --- a/shade/shade/tests/functional/test_usage.py +++ b/openstack/cloud/tests/functional/test_usage.py @@ -20,7 +20,7 @@ Functional tests for `shade` usage method """ import datetime -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestUsage(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_users.py b/openstack/cloud/tests/functional/test_users.py similarity index 97% rename from shade/shade/tests/functional/test_users.py rename to openstack/cloud/tests/functional/test_users.py index 985853854..2a147fb33 100644 --- a/shade/shade/tests/functional/test_users.py +++ b/openstack/cloud/tests/functional/test_users.py @@ -17,9 +17,9 @@ test_users Functional tests for `shade` user methods. """ -from shade import operator_cloud -from shade import OpenStackCloudException -from shade.tests.functional import base +from openstack.cloud import operator_cloud +from openstack.cloud import OpenStackCloudException +from openstack.cloud.tests.functional import base class TestUsers(base.KeystoneBaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_volume.py b/openstack/cloud/tests/functional/test_volume.py similarity index 98% rename from shade/shade/tests/functional/test_volume.py rename to openstack/cloud/tests/functional/test_volume.py index fe4dd6c6f..3cc3898c9 100644 --- a/shade/shade/tests/functional/test_volume.py +++ b/openstack/cloud/tests/functional/test_volume.py @@ -20,9 +20,9 @@ Functional tests for `shade` block storage methods. from fixtures import TimeoutException from testtools import content -from shade import _utils -from shade import exc -from shade.tests.functional import base +from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud.tests.functional import base class TestVolume(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_volume_backup.py b/openstack/cloud/tests/functional/test_volume_backup.py similarity index 98% rename from shade/shade/tests/functional/test_volume_backup.py rename to openstack/cloud/tests/functional/test_volume_backup.py index 3a7d4bff9..dcbc76fb3 100644 --- a/shade/shade/tests/functional/test_volume_backup.py +++ b/openstack/cloud/tests/functional/test_volume_backup.py @@ -9,7 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestVolume(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_volume_type.py b/openstack/cloud/tests/functional/test_volume_type.py similarity index 98% rename from shade/shade/tests/functional/test_volume_type.py rename to openstack/cloud/tests/functional/test_volume_type.py index 03567837f..bc09a7413 100644 --- a/shade/shade/tests/functional/test_volume_type.py +++ b/openstack/cloud/tests/functional/test_volume_type.py @@ -19,8 +19,8 @@ test_volume Functional tests for `shade` block storage methods. """ import testtools -from shade import exc -from shade.tests.functional import base +from openstack.cloud import exc +from openstack.cloud.tests.functional import base class TestVolumeType(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/test_zone.py b/openstack/cloud/tests/functional/test_zone.py similarity index 98% rename from shade/shade/tests/functional/test_zone.py rename to openstack/cloud/tests/functional/test_zone.py index 3a90d9b78..e8ade0aeb 100644 --- a/shade/shade/tests/functional/test_zone.py +++ b/openstack/cloud/tests/functional/test_zone.py @@ -19,7 +19,7 @@ Functional tests for `shade` zone methods. from testtools import content -from shade.tests.functional import base +from openstack.cloud.tests.functional import base class TestZone(base.BaseFunctionalTestCase): diff --git a/shade/shade/tests/functional/util.py b/openstack/cloud/tests/functional/util.py similarity index 100% rename from shade/shade/tests/functional/util.py rename to openstack/cloud/tests/functional/util.py diff --git a/shade/shade/tests/functional/__init__.py b/openstack/cloud/tests/unit/__init__.py similarity index 100% rename from shade/shade/tests/functional/__init__.py rename to openstack/cloud/tests/unit/__init__.py diff --git a/shade/shade/tests/unit/base.py b/openstack/cloud/tests/unit/base.py similarity index 98% rename from shade/shade/tests/unit/base.py rename to openstack/cloud/tests/unit/base.py index 95f731e36..ffeefe019 100644 --- a/shade/shade/tests/unit/base.py +++ b/openstack/cloud/tests/unit/base.py @@ -20,14 +20,14 @@ import uuid import fixtures import mock import os -import os_client_config as occ +import openstack.config as occ from requests import structures from requests_mock.contrib import fixture as rm_fixture from six.moves import urllib import tempfile -import shade.openstackcloud -from shade.tests import base +import openstack.cloud.openstackcloud +from openstack.cloud.tests import base _ProjectData = collections.namedtuple( @@ -125,14 +125,14 @@ class BaseTestCase(base.TestCase): secure_files=['non-existant']) self.cloud_config = self.config.get_one_cloud( cloud=test_cloud, validate=False) - self.cloud = shade.OpenStackCloud( + self.cloud = openstack.cloud.OpenStackCloud( cloud_config=self.cloud_config, log_inner_exceptions=True) - self.strict_cloud = shade.OpenStackCloud( + self.strict_cloud = openstack.cloud.OpenStackCloud( cloud_config=self.cloud_config, log_inner_exceptions=True, strict=True) - self.op_cloud = shade.OperatorCloud( + self.op_cloud = openstack.cloud.OperatorCloud( cloud_config=self.cloud_config, log_inner_exceptions=True) @@ -161,7 +161,8 @@ class RequestsMockTestCase(BaseTestCase): # assert_calls (and calling assert_calls every test case that uses # it on cleanup). Subclassing here could be 100% eliminated in the # future allowing any class to simply - # self.useFixture(shade.RequestsMockFixture) and get all the benefits. + # self.useFixture(openstack.cloud.RequestsMockFixture) and get all + # the benefits. # NOTE(notmorgan): use an ordered dict here to ensure we preserve the # order in which items are added to the uri_registry. This makes @@ -446,10 +447,10 @@ class RequestsMockTestCase(BaseTestCase): test_cloud = os.environ.get('SHADE_OS_CLOUD', cloud_name) self.cloud_config = self.config.get_one_cloud( cloud=test_cloud, validate=True, **kwargs) - self.cloud = shade.OpenStackCloud( + self.cloud = openstack.cloud.OpenStackCloud( cloud_config=self.cloud_config, log_inner_exceptions=True) - self.op_cloud = shade.OperatorCloud( + self.op_cloud = openstack.cloud.OperatorCloud( cloud_config=self.cloud_config, log_inner_exceptions=True) diff --git a/shade/shade/tests/unit/fixtures/baremetal.json b/openstack/cloud/tests/unit/fixtures/baremetal.json similarity index 100% rename from shade/shade/tests/unit/fixtures/baremetal.json rename to openstack/cloud/tests/unit/fixtures/baremetal.json diff --git a/shade/shade/tests/unit/fixtures/catalog-v2.json b/openstack/cloud/tests/unit/fixtures/catalog-v2.json similarity index 100% rename from shade/shade/tests/unit/fixtures/catalog-v2.json rename to openstack/cloud/tests/unit/fixtures/catalog-v2.json diff --git a/shade/shade/tests/unit/fixtures/catalog-v3.json b/openstack/cloud/tests/unit/fixtures/catalog-v3.json similarity index 100% rename from shade/shade/tests/unit/fixtures/catalog-v3.json rename to openstack/cloud/tests/unit/fixtures/catalog-v3.json diff --git a/shade/shade/tests/unit/fixtures/clouds/clouds.yaml b/openstack/cloud/tests/unit/fixtures/clouds/clouds.yaml similarity index 100% rename from shade/shade/tests/unit/fixtures/clouds/clouds.yaml rename to openstack/cloud/tests/unit/fixtures/clouds/clouds.yaml diff --git a/shade/shade/tests/unit/fixtures/clouds/clouds_cache.yaml b/openstack/cloud/tests/unit/fixtures/clouds/clouds_cache.yaml similarity index 100% rename from shade/shade/tests/unit/fixtures/clouds/clouds_cache.yaml rename to openstack/cloud/tests/unit/fixtures/clouds/clouds_cache.yaml diff --git a/shade/shade/tests/unit/fixtures/discovery.json b/openstack/cloud/tests/unit/fixtures/discovery.json similarity index 100% rename from shade/shade/tests/unit/fixtures/discovery.json rename to openstack/cloud/tests/unit/fixtures/discovery.json diff --git a/shade/shade/tests/unit/fixtures/dns.json b/openstack/cloud/tests/unit/fixtures/dns.json similarity index 100% rename from shade/shade/tests/unit/fixtures/dns.json rename to openstack/cloud/tests/unit/fixtures/dns.json diff --git a/shade/shade/tests/unit/fixtures/image-version-broken.json b/openstack/cloud/tests/unit/fixtures/image-version-broken.json similarity index 100% rename from shade/shade/tests/unit/fixtures/image-version-broken.json rename to openstack/cloud/tests/unit/fixtures/image-version-broken.json diff --git a/shade/shade/tests/unit/fixtures/image-version-v1.json b/openstack/cloud/tests/unit/fixtures/image-version-v1.json similarity index 100% rename from shade/shade/tests/unit/fixtures/image-version-v1.json rename to openstack/cloud/tests/unit/fixtures/image-version-v1.json diff --git a/shade/shade/tests/unit/fixtures/image-version-v2.json b/openstack/cloud/tests/unit/fixtures/image-version-v2.json similarity index 100% rename from shade/shade/tests/unit/fixtures/image-version-v2.json rename to openstack/cloud/tests/unit/fixtures/image-version-v2.json diff --git a/shade/shade/tests/unit/fixtures/image-version.json b/openstack/cloud/tests/unit/fixtures/image-version.json similarity index 100% rename from shade/shade/tests/unit/fixtures/image-version.json rename to openstack/cloud/tests/unit/fixtures/image-version.json diff --git a/shade/shade/tests/unit/test__adapter.py b/openstack/cloud/tests/unit/test__adapter.py similarity index 94% rename from shade/shade/tests/unit/test__adapter.py rename to openstack/cloud/tests/unit/test__adapter.py index 68063d65f..57d87a762 100644 --- a/shade/shade/tests/unit/test__adapter.py +++ b/openstack/cloud/tests/unit/test__adapter.py @@ -12,8 +12,8 @@ from testscenarios import load_tests_apply_scenarios as load_tests # noqa -from shade import _adapter -from shade.tests.unit import base +from openstack.cloud import _adapter +from openstack.cloud.tests.unit import base class TestExtractName(base.TestCase): diff --git a/shade/shade/tests/unit/test__utils.py b/openstack/cloud/tests/unit/test__utils.py similarity index 99% rename from shade/shade/tests/unit/test__utils.py rename to openstack/cloud/tests/unit/test__utils.py index 1c453f426..d2e243060 100644 --- a/shade/shade/tests/unit/test__utils.py +++ b/openstack/cloud/tests/unit/test__utils.py @@ -20,9 +20,9 @@ from uuid import uuid4 import mock import testtools -from shade import _utils -from shade import exc -from shade.tests.unit import base +from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud.tests.unit import base RANGE_DATA = [ diff --git a/shade/shade/tests/unit/test_aggregate.py b/openstack/cloud/tests/unit/test_aggregate.py similarity index 98% rename from shade/shade/tests/unit/test_aggregate.py rename to openstack/cloud/tests/unit/test_aggregate.py index 1d832dc4c..9878ad64a 100644 --- a/shade/shade/tests/unit/test_aggregate.py +++ b/openstack/cloud/tests/unit/test_aggregate.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from shade.tests.unit import base -from shade.tests import fakes +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes class TestAggregate(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_availability_zones.py b/openstack/cloud/tests/unit/test_availability_zones.py similarity index 96% rename from shade/shade/tests/unit/test_availability_zones.py rename to openstack/cloud/tests/unit/test_availability_zones.py index fbbd8cc99..7a6e0a1ab 100644 --- a/shade/shade/tests/unit/test_availability_zones.py +++ b/openstack/cloud/tests/unit/test_availability_zones.py @@ -12,8 +12,8 @@ # under the License. -from shade.tests.unit import base -from shade.tests import fakes +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes _fake_zone_list = { diff --git a/shade/shade/tests/unit/test_baremetal_node.py b/openstack/cloud/tests/unit/test_baremetal_node.py similarity index 99% rename from shade/shade/tests/unit/test_baremetal_node.py rename to openstack/cloud/tests/unit/test_baremetal_node.py index d76b37597..a906013d5 100644 --- a/shade/shade/tests/unit/test_baremetal_node.py +++ b/openstack/cloud/tests/unit/test_baremetal_node.py @@ -21,9 +21,9 @@ import uuid from testscenarios import load_tests_apply_scenarios as load_tests # noqa -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestBaremetalNode(base.IronicTestCase): diff --git a/shade/shade/tests/unit/test_caching.py b/openstack/cloud/tests/unit/test_caching.py similarity index 97% rename from shade/shade/tests/unit/test_caching.py rename to openstack/cloud/tests/unit/test_caching.py index 97fe4bb10..4264202a8 100644 --- a/shade/shade/tests/unit/test_caching.py +++ b/openstack/cloud/tests/unit/test_caching.py @@ -16,11 +16,11 @@ import mock import munch import testtools -import shade.openstackcloud -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud.openstackcloud +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base # Mock out the gettext function so that the task schema can be copypasta @@ -104,7 +104,7 @@ class TestMemoryCache(base.RequestsMockTestCase): return self.cloud._normalize_images([fake_image]) def test_openstack_cloud(self): - self.assertIsInstance(self.cloud, shade.OpenStackCloud) + self.assertIsInstance(self.cloud, openstack.cloud.OpenStackCloud) def test_list_projects_v3(self): project_one = self._get_project_data() @@ -480,7 +480,7 @@ class TestMemoryCache(base.RequestsMockTestCase): self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_list_images_ignores_unsteady_status(self, mock_image_client): steady_image = munch.Munch(id='68', name='Jagr', status='active') for status in ('queued', 'saving', 'pending_delete'): @@ -500,7 +500,7 @@ class TestMemoryCache(base.RequestsMockTestCase): self._image_dict(steady_image)], self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_list_images_caches_steady_status(self, mock_image_client): steady_image = munch.Munch(id='91', name='Federov', status='active') first_image = None @@ -523,7 +523,7 @@ class TestMemoryCache(base.RequestsMockTestCase): self._munch_images(first_image), self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_cache_no_cloud_name(self, mock_image_client): self.cloud.name = None @@ -557,5 +557,5 @@ class TestBogusAuth(base.TestCase): def test_get_auth_bogus(self): with testtools.ExpectedException(exc.OpenStackCloudException): - shade.openstack_cloud( + openstack.cloud.openstack_cloud( cloud='_bogus_test_', config=self.config) diff --git a/shade/shade/tests/unit/test_cluster_templates.py b/openstack/cloud/tests/unit/test_cluster_templates.py similarity index 97% rename from shade/shade/tests/unit/test_cluster_templates.py rename to openstack/cloud/tests/unit/test_cluster_templates.py index dbab19bdb..88915927d 100644 --- a/shade/shade/tests/unit/test_cluster_templates.py +++ b/openstack/cloud/tests/unit/test_cluster_templates.py @@ -13,9 +13,9 @@ import munch -import shade +import openstack.cloud import testtools -from shade.tests.unit import base +from openstack.cloud.tests.unit import base cluster_template_obj = munch.Munch( @@ -151,7 +151,8 @@ class TestClusterTemplates(base.RequestsMockTestCase): # OpenStackCloudException - but for some reason testtools will not # match the more specific HTTPError, even though it's a subclass # of OpenStackCloudException. - with testtools.ExpectedException(shade.OpenStackCloudHTTPError): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudHTTPError): self.cloud.create_cluster_template('fake-cluster-template') self.assert_calls() diff --git a/shade/shade/tests/unit/test_create_server.py b/openstack/cloud/tests/unit/test_create_server.py similarity index 98% rename from shade/shade/tests/unit/test_create_server.py rename to openstack/cloud/tests/unit/test_create_server.py index 0e2855e7c..f85b9727e 100644 --- a/shade/shade/tests/unit/test_create_server.py +++ b/openstack/cloud/tests/unit/test_create_server.py @@ -21,11 +21,11 @@ import uuid import mock -import shade -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestCreateServer(base.RequestsMockTestCase): @@ -325,7 +325,7 @@ class TestCreateServer(base.RequestsMockTestCase): self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, "wait_for_server") + @mock.patch.object(openstack.cloud.OpenStackCloud, "wait_for_server") def test_create_server_with_admin_pass_wait(self, mock_wait): """ Test that a server with an admin_pass passed returns the password @@ -410,8 +410,8 @@ class TestCreateServer(base.RequestsMockTestCase): self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, "get_active_server") - @mock.patch.object(shade.OpenStackCloud, "get_server") + @mock.patch.object(openstack.cloud.OpenStackCloud, "get_active_server") + @mock.patch.object(openstack.cloud.OpenStackCloud, "get_server") def test_wait_for_server(self, mock_get_server, mock_get_active_server): """ Test that waiting for a server returns the server instance when @@ -445,7 +445,7 @@ class TestCreateServer(base.RequestsMockTestCase): self.assertEqual('ACTIVE', server['status']) - @mock.patch.object(shade.OpenStackCloud, 'wait_for_server') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'wait_for_server') def test_create_server_wait(self, mock_wait): """ Test that create_server with a wait actually does the wait. @@ -482,7 +482,7 @@ class TestCreateServer(base.RequestsMockTestCase): ) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'add_ips_to_server') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'add_ips_to_server') @mock.patch('time.sleep') def test_create_server_no_addresses( self, mock_sleep, mock_add_ips_to_server): diff --git a/shade/shade/tests/unit/test_create_volume_snapshot.py b/openstack/cloud/tests/unit/test_create_volume_snapshot.py similarity index 97% rename from shade/shade/tests/unit/test_create_volume_snapshot.py rename to openstack/cloud/tests/unit/test_create_volume_snapshot.py index 2d1636f2f..0f85b81f0 100644 --- a/shade/shade/tests/unit/test_create_volume_snapshot.py +++ b/openstack/cloud/tests/unit/test_create_volume_snapshot.py @@ -17,10 +17,10 @@ test_create_volume_snapshot Tests for the `create_volume_snapshot` command. """ -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestCreateVolumeSnapshot(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_delete_server.py b/openstack/cloud/tests/unit/test_delete_server.py similarity index 98% rename from shade/shade/tests/unit/test_delete_server.py rename to openstack/cloud/tests/unit/test_delete_server.py index 0e558e509..8f8cc9d5d 100644 --- a/shade/shade/tests/unit/test_delete_server.py +++ b/openstack/cloud/tests/unit/test_delete_server.py @@ -18,9 +18,9 @@ Tests for the `delete_server` command. """ import uuid -from shade import exc as shade_exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc as shade_exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestDeleteServer(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_delete_volume_snapshot.py b/openstack/cloud/tests/unit/test_delete_volume_snapshot.py similarity index 96% rename from shade/shade/tests/unit/test_delete_volume_snapshot.py rename to openstack/cloud/tests/unit/test_delete_volume_snapshot.py index 3d7920b6a..c267c1d80 100644 --- a/shade/shade/tests/unit/test_delete_volume_snapshot.py +++ b/openstack/cloud/tests/unit/test_delete_volume_snapshot.py @@ -17,10 +17,10 @@ test_delete_volume_snapshot Tests for the `delete_volume_snapshot` command. """ -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestDeleteVolumeSnapshot(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_domain_params.py b/openstack/cloud/tests/unit/test_domain_params.py similarity index 78% rename from shade/shade/tests/unit/test_domain_params.py rename to openstack/cloud/tests/unit/test_domain_params.py index 62bfcc51f..a687704a0 100644 --- a/shade/shade/tests/unit/test_domain_params.py +++ b/openstack/cloud/tests/unit/test_domain_params.py @@ -14,15 +14,15 @@ import mock import munch -import shade -from shade import exc -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestDomainParams(base.TestCase): - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, 'get_project') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_project') def test_identity_params_v3(self, mock_get_project, mock_is_client_version): mock_get_project.return_value = munch.Munch(id=1234) @@ -34,8 +34,8 @@ class TestDomainParams(base.TestCase): self.assertIn('domain_id', ret) self.assertEqual(ret['domain_id'], '5678') - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, 'get_project') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_project') def test_identity_params_v3_no_domain( self, mock_get_project, mock_is_client_version): mock_get_project.return_value = munch.Munch(id=1234) @@ -46,8 +46,8 @@ class TestDomainParams(base.TestCase): self.cloud._get_identity_params, domain_id=None, project='bar') - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, 'get_project') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_project') def test_identity_params_v2(self, mock_get_project, mock_is_client_version): mock_get_project.return_value = munch.Munch(id=1234) @@ -58,8 +58,8 @@ class TestDomainParams(base.TestCase): self.assertEqual(ret['tenant_id'], 1234) self.assertNotIn('domain', ret) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, 'get_project') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_project') def test_identity_params_v2_no_domain(self, mock_get_project, mock_is_client_version): mock_get_project.return_value = munch.Munch(id=1234) diff --git a/shade/shade/tests/unit/test_domains.py b/openstack/cloud/tests/unit/test_domains.py similarity index 97% rename from shade/shade/tests/unit/test_domains.py rename to openstack/cloud/tests/unit/test_domains.py index b1996c1c5..e15e132e4 100644 --- a/shade/shade/tests/unit/test_domains.py +++ b/openstack/cloud/tests/unit/test_domains.py @@ -18,8 +18,8 @@ import uuid import testtools from testtools import matchers -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base class TestDomains(base.RequestsMockTestCase): @@ -94,7 +94,7 @@ class TestDomains(base.RequestsMockTestCase): domain_data = self._get_domain_data(domain_name='domain_name', enabled=True) with testtools.ExpectedException( - shade.OpenStackCloudBadRequest, + openstack.cloud.OpenStackCloudBadRequest, "Failed to create domain domain_name" ): self.register_uris([ @@ -149,7 +149,7 @@ class TestDomains(base.RequestsMockTestCase): validate=dict(json={'domain': {'enabled': False}})), dict(method='DELETE', uri=domain_resource_uri, status_code=404)]) with testtools.ExpectedException( - shade.OpenStackCloudURINotFound, + openstack.cloud.OpenStackCloudURINotFound, "Failed to delete domain %s" % domain_data.domain_id ): self.op_cloud.delete_domain(domain_data.domain_id) @@ -203,7 +203,7 @@ class TestDomains(base.RequestsMockTestCase): json=domain_data.json_response, validate=dict(json={'domain': {'enabled': False}}))]) with testtools.ExpectedException( - shade.OpenStackCloudHTTPError, + openstack.cloud.OpenStackCloudHTTPError, "Error in updating domain %s" % domain_data.domain_id ): self.op_cloud.delete_domain(domain_data.domain_id) diff --git a/shade/shade/tests/unit/test_endpoints.py b/openstack/cloud/tests/unit/test_endpoints.py similarity index 98% rename from shade/shade/tests/unit/test_endpoints.py rename to openstack/cloud/tests/unit/test_endpoints.py index 3884cad8d..3bd3196f0 100644 --- a/shade/shade/tests/unit/test_endpoints.py +++ b/openstack/cloud/tests/unit/test_endpoints.py @@ -21,9 +21,9 @@ Tests Keystone endpoints commands. import uuid -from shade.exc import OpenStackCloudException -from shade.exc import OpenStackCloudUnavailableFeature -from shade.tests.unit import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.exc import OpenStackCloudUnavailableFeature +from openstack.cloud.tests.unit import base from testtools import matchers diff --git a/shade/shade/tests/unit/test_flavors.py b/openstack/cloud/tests/unit/test_flavors.py similarity index 97% rename from shade/shade/tests/unit/test_flavors.py rename to openstack/cloud/tests/unit/test_flavors.py index 5fe7b7abf..7342e65c6 100644 --- a/shade/shade/tests/unit/test_flavors.py +++ b/openstack/cloud/tests/unit/test_flavors.py @@ -11,9 +11,9 @@ # under the License. -import shade -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestFlavors(base.RequestsMockTestCase): @@ -78,7 +78,7 @@ class TestFlavors(base.RequestsMockTestCase): endpoint=fakes.FAKE_FLAVOR_LIST, id=fakes.FLAVOR_ID), status_code=503)]) - self.assertRaises(shade.OpenStackCloudException, + self.assertRaises(openstack.cloud.OpenStackCloudException, self.op_cloud.delete_flavor, 'vanilla') def test_list_flavors(self): @@ -153,7 +153,7 @@ class TestFlavors(base.RequestsMockTestCase): endpoint=fakes.COMPUTE_ENDPOINT), json={'flavors': []})]) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.cloud.get_flavor_by_ram, ram=100) diff --git a/shade/shade/tests/unit/test_floating_ip_common.py b/openstack/cloud/tests/unit/test_floating_ip_common.py similarity index 98% rename from shade/shade/tests/unit/test_floating_ip_common.py rename to openstack/cloud/tests/unit/test_floating_ip_common.py index 638294aef..cf2b55c86 100644 --- a/shade/shade/tests/unit/test_floating_ip_common.py +++ b/openstack/cloud/tests/unit/test_floating_ip_common.py @@ -21,10 +21,10 @@ Tests floating IP resource methods for Neutron and Nova-network. from mock import patch -from shade import meta -from shade import OpenStackCloud -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import meta +from openstack.cloud import OpenStackCloud +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestFloatingIP(base.TestCase): diff --git a/shade/shade/tests/unit/test_floating_ip_neutron.py b/openstack/cloud/tests/unit/test_floating_ip_neutron.py similarity index 99% rename from shade/shade/tests/unit/test_floating_ip_neutron.py rename to openstack/cloud/tests/unit/test_floating_ip_neutron.py index 9ab437fda..000f0d10a 100644 --- a/shade/shade/tests/unit/test_floating_ip_neutron.py +++ b/openstack/cloud/tests/unit/test_floating_ip_neutron.py @@ -23,9 +23,9 @@ import copy import datetime import munch -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestFloatingIP(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_floating_ip_nova.py b/openstack/cloud/tests/unit/test_floating_ip_nova.py similarity index 99% rename from shade/shade/tests/unit/test_floating_ip_nova.py rename to openstack/cloud/tests/unit/test_floating_ip_nova.py index 492d142ce..29a93f2a6 100644 --- a/shade/shade/tests/unit/test_floating_ip_nova.py +++ b/openstack/cloud/tests/unit/test_floating_ip_nova.py @@ -19,8 +19,8 @@ test_floating_ip_nova Tests Floating IP resource methods for nova-network """ -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base def get_fake_has_service(has_service): diff --git a/shade/shade/tests/unit/test_floating_ip_pool.py b/openstack/cloud/tests/unit/test_floating_ip_pool.py similarity index 95% rename from shade/shade/tests/unit/test_floating_ip_pool.py rename to openstack/cloud/tests/unit/test_floating_ip_pool.py index 6ebdd9597..01e757d1a 100644 --- a/shade/shade/tests/unit/test_floating_ip_pool.py +++ b/openstack/cloud/tests/unit/test_floating_ip_pool.py @@ -19,9 +19,9 @@ test_floating_ip_pool Test floating IP pool resource (managed by nova) """ -from shade import OpenStackCloudException -from shade.tests.unit import base -from shade.tests import fakes +from openstack.cloud import OpenStackCloudException +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes class TestFloatingIPPool(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_groups.py b/openstack/cloud/tests/unit/test_groups.py similarity index 98% rename from shade/shade/tests/unit/test_groups.py rename to openstack/cloud/tests/unit/test_groups.py index 63db99723..1e96cd088 100644 --- a/shade/shade/tests/unit/test_groups.py +++ b/openstack/cloud/tests/unit/test_groups.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from shade.tests.unit import base +from openstack.cloud.tests.unit import base class TestGroups(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_identity_roles.py b/openstack/cloud/tests/unit/test_identity_roles.py similarity index 97% rename from shade/shade/tests/unit/test_identity_roles.py rename to openstack/cloud/tests/unit/test_identity_roles.py index 3ef75ce53..7660982cb 100644 --- a/shade/shade/tests/unit/test_identity_roles.py +++ b/openstack/cloud/tests/unit/test_identity_roles.py @@ -13,8 +13,8 @@ import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base from testtools import matchers @@ -202,7 +202,7 @@ class TestIdentityRoles(base.RequestsMockTestCase): status_code=403) ]) with testtools.ExpectedException( - shade.exc.OpenStackCloudHTTPError, + openstack.cloud.exc.OpenStackCloudHTTPError, "Failed to list role assignments" ): self.op_cloud.list_role_assignments() @@ -268,7 +268,7 @@ class TestIdentityRoles(base.RequestsMockTestCase): def test_list_role_assignments_exception_v2(self): self.use_keystone_v2() with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Must provide project and user for keystone v2" ): self.op_cloud.list_role_assignments() @@ -277,7 +277,7 @@ class TestIdentityRoles(base.RequestsMockTestCase): def test_list_role_assignments_exception_v2_no_project(self): self.use_keystone_v2() with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Must provide project and user for keystone v2" ): self.op_cloud.list_role_assignments(filters={'user': '12345'}) diff --git a/shade/shade/tests/unit/test_image.py b/openstack/cloud/tests/unit/test_image.py similarity index 87% rename from shade/shade/tests/unit/test_image.py rename to openstack/cloud/tests/unit/test_image.py index 515ca22e5..39a610167 100644 --- a/shade/shade/tests/unit/test_image.py +++ b/openstack/cloud/tests/unit/test_image.py @@ -23,11 +23,11 @@ import mock import munch import six -import shade -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base CINDER_URL = 'https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0' @@ -233,13 +233,15 @@ class TestImage(BaseTestImage): dict(method='POST', uri='https://image.example.com/v2/images', json=self.fake_image_dict, validate=dict( - json={u'container_format': u'bare', - u'disk_format': u'qcow2', - u'name': u'fake_image', - u'owner_specified.shade.md5': fakes.NO_MD5, - u'owner_specified.shade.object': u'images/fake_image', # noqa - u'owner_specified.shade.sha256': fakes.NO_SHA256, - u'visibility': u'private'}) + json={ + u'container_format': u'bare', + u'disk_format': u'qcow2', + u'name': u'fake_image', + u'owner_specified.openstack.md5': fakes.NO_MD5, + u'owner_specified.openstack.object': + u'images/fake_image', + u'owner_specified.openstack.sha256': fakes.NO_SHA256, + u'visibility': u'private'}) ), dict(method='PUT', uri='https://image.example.com/v2/images/{id}/file'.format( @@ -273,9 +275,9 @@ class TestImage(BaseTestImage): ) image_no_checksums = self.fake_image_dict.copy() - del(image_no_checksums['owner_specified.shade.md5']) - del(image_no_checksums['owner_specified.shade.sha256']) - del(image_no_checksums['owner_specified.shade.object']) + del(image_no_checksums['owner_specified.openstack.md5']) + del(image_no_checksums['owner_specified.openstack.sha256']) + del(image_no_checksums['owner_specified.openstack.object']) self.register_uris([ dict(method='GET', uri='https://image.example.com/v2/images', @@ -346,15 +348,16 @@ class TestImage(BaseTestImage): uri='https://image.example.com/v2/images/{id}'.format( id=self.image_id), validate=dict( - json=sorted([{u'op': u'add', - u'value': '{container}/{object}'.format( - container=container_name, - object=image_name), - u'path': u'/owner_specified.shade.object'}, - {u'op': u'add', u'value': fakes.NO_MD5, - u'path': u'/owner_specified.shade.md5'}, - {u'op': u'add', u'value': fakes.NO_SHA256, - u'path': u'/owner_specified.shade.sha256'}], + json=sorted([ + {u'op': u'add', + u'value': '{container}/{object}'.format( + container=container_name, + object=image_name), + u'path': u'/owner_specified.openstack.object'}, + {u'op': u'add', u'value': fakes.NO_MD5, + u'path': u'/owner_specified.openstack.md5'}, + {u'op': u'add', u'value': fakes.NO_SHA256, + u'path': u'/owner_specified.openstack.sha256'}], key=operator.itemgetter('value')), headers={ 'Content-Type': @@ -384,8 +387,8 @@ class TestImage(BaseTestImage): name, imagefile.name, wait=True, timeout=1, is_public=False, **kwargs) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_v1( self, mock_image_client, mock_is_client_version): # TODO(mordred) Fix this to use requests_mock @@ -396,9 +399,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': 'qcow2', 'properties': { - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'is_public': False}} ret = munch.Munch(args.copy()) ret['id'] = '42' @@ -422,8 +425,8 @@ class TestImage(BaseTestImage): self.assertEqual( self._munch_images(ret), self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_v1_bad_delete( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = False @@ -433,9 +436,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': 'qcow2', 'properties': { - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'is_public': False}} ret = munch.Munch(args.copy()) ret['id'] = '42' @@ -460,8 +463,8 @@ class TestImage(BaseTestImage): }) mock_image_client.delete.assert_called_with('/images/42') - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_update_image_no_patch( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -472,9 +475,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': 'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'visibility': 'private', 'min_disk': 0, 'min_ram': 0} ret = munch.Munch(args.copy()) @@ -487,12 +490,12 @@ class TestImage(BaseTestImage): ] self.cloud.update_image_properties( image=self._image_dict(ret), - **{'owner_specified.shade.object': 'images/42 name'}) + **{'owner_specified.openstack.object': 'images/42 name'}) mock_image_client.get.assert_called_with('/images', params={}) mock_image_client.patch.assert_not_called() - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_v2_bad_delete( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -503,9 +506,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': 'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'visibility': 'private', 'min_disk': 0, 'min_ram': 0} ret = munch.Munch(args.copy()) @@ -530,8 +533,8 @@ class TestImage(BaseTestImage): data=mock.ANY) mock_image_client.delete.assert_called_with('/images/42') - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_bad_int( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -542,8 +545,8 @@ class TestImage(BaseTestImage): self._call_create_image, '42 name', min_disk='fish', min_ram=0) mock_image_client.post.assert_not_called() - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_user_int( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -551,9 +554,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': u'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'int_v': '12345', 'visibility': 'private', 'min_disk': 0, 'min_ram': 0} @@ -577,8 +580,8 @@ class TestImage(BaseTestImage): self.assertEqual( self._munch_images(ret), self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_meta_int( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -591,9 +594,9 @@ class TestImage(BaseTestImage): '42 name', min_disk='0', min_ram=0, meta={'int_v': 12345}) args = {'name': '42 name', 'container_format': 'bare', 'disk_format': u'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'int_v': 12345, 'visibility': 'private', 'min_disk': 0, 'min_ram': 0} @@ -606,8 +609,8 @@ class TestImage(BaseTestImage): self.assertEqual( self._munch_images(ret), self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_protected( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -618,9 +621,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': u'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'protected': False, 'int_v': '12345', 'visibility': 'private', @@ -644,8 +647,8 @@ class TestImage(BaseTestImage): headers={'Content-Type': 'application/octet-stream'}) self.assertEqual(self._munch_images(ret), self.cloud.list_images()) - @mock.patch.object(shade.OpenStackCloud, '_is_client_version') - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_is_client_version') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_create_image_put_user_prop( self, mock_image_client, mock_is_client_version): mock_is_client_version.return_value = True @@ -656,9 +659,9 @@ class TestImage(BaseTestImage): args = {'name': '42 name', 'container_format': 'bare', 'disk_format': u'qcow2', - 'owner_specified.shade.md5': mock.ANY, - 'owner_specified.shade.sha256': mock.ANY, - 'owner_specified.shade.object': 'images/42 name', + 'owner_specified.openstack.md5': mock.ANY, + 'owner_specified.openstack.sha256': mock.ANY, + 'owner_specified.openstack.object': 'images/42 name', 'int_v': '12345', 'xenapi_use_agent': 'False', 'visibility': 'private', diff --git a/shade/shade/tests/unit/test_image_snapshot.py b/openstack/cloud/tests/unit/test_image_snapshot.py similarity index 97% rename from shade/shade/tests/unit/test_image_snapshot.py rename to openstack/cloud/tests/unit/test_image_snapshot.py index 1e3a854fa..87da1281f 100644 --- a/shade/shade/tests/unit/test_image_snapshot.py +++ b/openstack/cloud/tests/unit/test_image_snapshot.py @@ -14,9 +14,9 @@ import uuid -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestImageSnapshot(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_inventory.py b/openstack/cloud/tests/unit/test_inventory.py similarity index 90% rename from shade/shade/tests/unit/test_inventory.py rename to openstack/cloud/tests/unit/test_inventory.py index 84846b231..aaac355d2 100644 --- a/shade/shade/tests/unit/test_inventory.py +++ b/openstack/cloud/tests/unit/test_inventory.py @@ -12,14 +12,14 @@ import mock -import os_client_config +import openstack.config as os_client_config from os_client_config import exceptions as occ_exc -from shade import exc -from shade import inventory -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud import inventory +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestInventory(base.TestCase): @@ -28,7 +28,7 @@ class TestInventory(base.TestCase): super(TestInventory, self).setUp() @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test__init(self, mock_cloud, mock_config): mock_config.return_value.get_all_clouds.return_value = [{}] @@ -42,7 +42,7 @@ class TestInventory(base.TestCase): self.assertTrue(mock_config.return_value.get_all_clouds.called) @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test__init_one_cloud(self, mock_cloud, mock_config): mock_config.return_value.get_one_cloud.return_value = [{}] @@ -58,7 +58,7 @@ class TestInventory(base.TestCase): 'supercloud') @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test__raise_exception_on_no_cloud(self, mock_cloud, mock_config): """ Test that when os-client-config can't find a named cloud, a @@ -74,7 +74,7 @@ class TestInventory(base.TestCase): 'supercloud') @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test_list_hosts(self, mock_cloud, mock_config): mock_config.return_value.get_all_clouds.return_value = [{}] @@ -93,7 +93,7 @@ class TestInventory(base.TestCase): self.assertEqual([server], ret) @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test_list_hosts_no_detail(self, mock_cloud, mock_config): mock_config.return_value.get_all_clouds.return_value = [{}] @@ -112,7 +112,7 @@ class TestInventory(base.TestCase): self.assertFalse(inv.clouds[0].get_openstack_vars.called) @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test_search_hosts(self, mock_cloud, mock_config): mock_config.return_value.get_all_clouds.return_value = [{}] @@ -128,7 +128,7 @@ class TestInventory(base.TestCase): self.assertEqual([server], ret) @mock.patch("os_client_config.config.OpenStackConfig") - @mock.patch("shade.OpenStackCloud") + @mock.patch("openstack.cloud.OpenStackCloud") def test_get_host(self, mock_cloud, mock_config): mock_config.return_value.get_all_clouds.return_value = [{}] diff --git a/shade/shade/tests/unit/test_keypair.py b/openstack/cloud/tests/unit/test_keypair.py similarity index 96% rename from shade/shade/tests/unit/test_keypair.py rename to openstack/cloud/tests/unit/test_keypair.py index 2fa3e3ae1..f1c288938 100644 --- a/shade/shade/tests/unit/test_keypair.py +++ b/openstack/cloud/tests/unit/test_keypair.py @@ -12,9 +12,9 @@ # limitations under the License. -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestKeypair(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_limits.py b/openstack/cloud/tests/unit/test_limits.py similarity index 98% rename from shade/shade/tests/unit/test_limits.py rename to openstack/cloud/tests/unit/test_limits.py index 3eeb9fc0f..0db11e58c 100644 --- a/shade/shade/tests/unit/test_limits.py +++ b/openstack/cloud/tests/unit/test_limits.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from shade.tests.unit import base +from openstack.cloud.tests.unit import base class TestLimits(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_magnum_services.py b/openstack/cloud/tests/unit/test_magnum_services.py similarity index 96% rename from shade/shade/tests/unit/test_magnum_services.py rename to openstack/cloud/tests/unit/test_magnum_services.py index 24499f1fb..83153f365 100644 --- a/shade/shade/tests/unit/test_magnum_services.py +++ b/openstack/cloud/tests/unit/test_magnum_services.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from shade.tests.unit import base +from openstack.cloud.tests.unit import base magnum_service_obj = dict( diff --git a/shade/shade/tests/unit/test_meta.py b/openstack/cloud/tests/unit/test_meta.py similarity index 95% rename from shade/shade/tests/unit/test_meta.py rename to openstack/cloud/tests/unit/test_meta.py index ae76ce877..b32d3518f 100644 --- a/shade/shade/tests/unit/test_meta.py +++ b/openstack/cloud/tests/unit/test_meta.py @@ -14,10 +14,10 @@ import mock -import shade -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base PRIVATE_V4 = '198.51.100.3' PUBLIC_V4 = '192.0.2.99' @@ -333,10 +333,10 @@ class TestMeta(base.RequestsMockTestCase): '10.0.0.101', meta.get_server_private_ip(srv, self.cloud)) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'has_service') - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'has_service') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_private_ip_devstack( self, mock_get_flavor_name, mock_get_image_name, @@ -398,9 +398,9 @@ class TestMeta(base.RequestsMockTestCase): self.assertEqual(PRIVATE_V4, srv['private_v4']) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_private_ip_no_fip( self, mock_get_flavor_name, mock_get_image_name, @@ -448,9 +448,9 @@ class TestMeta(base.RequestsMockTestCase): self.assertEqual(PRIVATE_V4, srv['private_v4']) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_cloud_no_fips( self, mock_get_flavor_name, mock_get_image_name, @@ -496,10 +496,10 @@ class TestMeta(base.RequestsMockTestCase): self.assertEqual(PRIVATE_V4, srv['private_v4']) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'has_service') - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'has_service') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_cloud_missing_fips( self, mock_get_flavor_name, mock_get_image_name, @@ -565,9 +565,9 @@ class TestMeta(base.RequestsMockTestCase): self.assertEqual(PUBLIC_V4, srv['public_v4']) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_cloud_rackspace_v6( self, mock_get_flavor_name, mock_get_image_name, mock_get_volumes): @@ -615,9 +615,9 @@ class TestMeta(base.RequestsMockTestCase): "2001:4800:7819:103:be76:4eff:fe05:8525", srv['interface_ip']) self.assert_calls() - @mock.patch.object(shade.OpenStackCloud, 'get_volumes') - @mock.patch.object(shade.OpenStackCloud, 'get_image_name') - @mock.patch.object(shade.OpenStackCloud, 'get_flavor_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_volumes') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_image_name') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'get_flavor_name') def test_get_server_cloud_osic_split( self, mock_get_flavor_name, mock_get_image_name, mock_get_volumes): @@ -899,8 +899,8 @@ class TestMeta(base.RequestsMockTestCase): self.assertEqual('testgroup', hostvars['security_groups'][0]['name']) - @mock.patch.object(shade.meta, 'get_server_external_ipv6') - @mock.patch.object(shade.meta, 'get_server_external_ipv4') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv6') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv4') def test_basic_hostvars( self, mock_get_server_external_ipv4, mock_get_server_external_ipv6): @@ -933,8 +933,8 @@ class TestMeta(base.RequestsMockTestCase): # test volume exception self.assertEqual([], hostvars['volumes']) - @mock.patch.object(shade.meta, 'get_server_external_ipv6') - @mock.patch.object(shade.meta, 'get_server_external_ipv4') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv6') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv4') def test_ipv4_hostvars( self, mock_get_server_external_ipv4, mock_get_server_external_ipv6): @@ -947,7 +947,7 @@ class TestMeta(base.RequestsMockTestCase): fake_cloud, meta.obj_to_munch(standard_fake_server)) self.assertEqual(PUBLIC_V4, hostvars['interface_ip']) - @mock.patch.object(shade.meta, 'get_server_external_ipv4') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv4') def test_private_interface_ip(self, mock_get_server_external_ipv4): mock_get_server_external_ipv4.return_value = PUBLIC_V4 @@ -957,7 +957,7 @@ class TestMeta(base.RequestsMockTestCase): cloud, meta.obj_to_munch(standard_fake_server)) self.assertEqual(PRIVATE_V4, hostvars['interface_ip']) - @mock.patch.object(shade.meta, 'get_server_external_ipv4') + @mock.patch.object(openstack.cloud.meta, 'get_server_external_ipv4') def test_image_string(self, mock_get_server_external_ipv4): mock_get_server_external_ipv4.return_value = PUBLIC_V4 diff --git a/shade/shade/tests/unit/test_network.py b/openstack/cloud/tests/unit/test_network.py similarity index 98% rename from shade/shade/tests/unit/test_network.py rename to openstack/cloud/tests/unit/test_network.py index 96af721bf..922a2c9b4 100644 --- a/shade/shade/tests/unit/test_network.py +++ b/openstack/cloud/tests/unit/test_network.py @@ -13,8 +13,8 @@ import copy import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base class TestNetwork(base.RequestsMockTestCase): @@ -183,7 +183,7 @@ class TestNetwork(base.RequestsMockTestCase): def test_create_network_provider_wrong_type(self): provider_opts = "invalid" with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Parameter 'provider' must be a dict" ): self.cloud.create_network("netname", provider=provider_opts) @@ -231,7 +231,7 @@ class TestNetwork(base.RequestsMockTestCase): append=['v2.0', 'networks', "%s.json" % network_id]), status_code=503) ]) - self.assertRaises(shade.OpenStackCloudException, + self.assertRaises(openstack.cloud.OpenStackCloudException, self.cloud.delete_network, network_name) self.assert_calls() diff --git a/shade/shade/tests/unit/test_normalize.py b/openstack/cloud/tests/unit/test_normalize.py similarity index 99% rename from shade/shade/tests/unit/test_normalize.py rename to openstack/cloud/tests/unit/test_normalize.py index 0be594022..f0e37f8e3 100644 --- a/shade/shade/tests/unit/test_normalize.py +++ b/openstack/cloud/tests/unit/test_normalize.py @@ -12,7 +12,7 @@ import mock -from shade.tests.unit import base +from openstack.cloud.tests.unit import base RAW_SERVER_DICT = { 'HUMAN_ID': True, diff --git a/shade/shade/tests/unit/test_object.py b/openstack/cloud/tests/unit/test_object.py similarity index 97% rename from shade/shade/tests/unit/test_object.py rename to openstack/cloud/tests/unit/test_object.py index 54fb65b6e..d627c2dbb 100644 --- a/shade/shade/tests/unit/test_object.py +++ b/openstack/cloud/tests/unit/test_object.py @@ -16,10 +16,10 @@ import tempfile import testtools -import shade -import shade.openstackcloud -from shade import exc -from shade.tests.unit import base +import openstack.cloud +import openstack.cloud.openstackcloud as oc_oc +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class BaseTestObject(base.RequestsMockTestCase): @@ -82,7 +82,7 @@ class TestObject(BaseTestObject): validate=dict( headers={ 'x-container-read': - shade.openstackcloud.OBJECT_CONTAINER_ACLS[ + oc_oc.OBJECT_CONTAINER_ACLS[ 'public']})), dict(method='HEAD', uri=self.container_endpoint, headers={ @@ -144,14 +144,14 @@ class TestObject(BaseTestObject): dict(method='DELETE', uri=self.container_endpoint, status_code=409)]) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.cloud.delete_container, self.container) self.assert_calls() def test_update_container(self): headers = { 'x-container-read': - shade.openstackcloud.OBJECT_CONTAINER_ACLS['public']} + oc_oc.OBJECT_CONTAINER_ACLS['public']} self.register_uris([ dict(method='POST', uri=self.container_endpoint, status_code=204, @@ -171,7 +171,7 @@ class TestObject(BaseTestObject): dict(method='POST', uri=self.container_endpoint, status_code=409)]) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.cloud.update_container, self.container, dict(foo='bar')) self.assert_calls() @@ -182,7 +182,7 @@ class TestObject(BaseTestObject): validate=dict( headers={ 'x-container-read': - shade.openstackcloud.OBJECT_CONTAINER_ACLS[ + oc_oc.OBJECT_CONTAINER_ACLS[ 'public']}))]) self.cloud.set_container_access(self.container, 'public') @@ -196,7 +196,7 @@ class TestObject(BaseTestObject): validate=dict( headers={ 'x-container-read': - shade.openstackcloud.OBJECT_CONTAINER_ACLS[ + oc_oc.OBJECT_CONTAINER_ACLS[ 'private']}))]) self.cloud.set_container_access(self.container, 'private') @@ -205,7 +205,7 @@ class TestObject(BaseTestObject): def test_set_container_access_invalid(self): self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.cloud.set_container_access, self.container, 'invalid') def test_get_container_access(self): @@ -213,7 +213,7 @@ class TestObject(BaseTestObject): dict(method='HEAD', uri=self.container_endpoint, headers={ 'x-container-read': - str(shade.openstackcloud.OBJECT_CONTAINER_ACLS[ + str(oc_oc.OBJECT_CONTAINER_ACLS[ 'public'])})]) access = self.cloud.get_container_access(self.container) self.assertEqual('public', access) @@ -360,7 +360,7 @@ class TestObject(BaseTestObject): status_code=416)]) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.cloud.get_object, self.container, self.object) @@ -385,7 +385,7 @@ class TestObject(BaseTestObject): self.register_uris([ dict(method='GET', uri='https://object-store.example.com/info', status_code=404, reason='Not Found')]) - self.assertEqual(shade.openstackcloud.DEFAULT_OBJECT_SEGMENT_SIZE, + self.assertEqual(oc_oc.DEFAULT_OBJECT_SEGMENT_SIZE, self.cloud.get_object_segment_size(None)) self.assert_calls() @@ -393,8 +393,9 @@ class TestObject(BaseTestObject): self.register_uris([ dict(method='GET', uri='https://object-store.example.com/info', status_code=412, reason='Precondition failed')]) - self.assertEqual(shade.openstackcloud.DEFAULT_OBJECT_SEGMENT_SIZE, - self.cloud.get_object_segment_size(None)) + self.assertEqual( + oc_oc.DEFAULT_OBJECT_SEGMENT_SIZE, + self.cloud.get_object_segment_size(None)) self.assert_calls() diff --git a/shade/shade/tests/unit/test_operator_noauth.py b/openstack/cloud/tests/unit/test_operator_noauth.py similarity index 93% rename from shade/shade/tests/unit/test_operator_noauth.py rename to openstack/cloud/tests/unit/test_operator_noauth.py index e489d2e84..fcc4bd0c2 100644 --- a/shade/shade/tests/unit/test_operator_noauth.py +++ b/openstack/cloud/tests/unit/test_operator_noauth.py @@ -14,8 +14,8 @@ from keystoneauth1 import plugin -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base class TestShadeOperatorNoAuth(base.RequestsMockTestCase): @@ -50,7 +50,7 @@ class TestShadeOperatorNoAuth(base.RequestsMockTestCase): The new way of doing this is with the keystoneauth none plugin. """ - self.cloud_noauth = shade.operator_cloud( + self.cloud_noauth = openstack.cloud.operator_cloud( auth_type='none', baremetal_endpoint_override="https://bare-metal.example.com") @@ -63,7 +63,7 @@ class TestShadeOperatorNoAuth(base.RequestsMockTestCase): The old way of doing this was to abuse admin_token. """ - self.cloud_noauth = shade.operator_cloud( + self.cloud_noauth = openstack.cloud.operator_cloud( auth_type='admin_token', auth=dict( endpoint='https://bare-metal.example.com', diff --git a/shade/shade/tests/unit/test_port.py b/openstack/cloud/tests/unit/test_port.py similarity index 99% rename from shade/shade/tests/unit/test_port.py rename to openstack/cloud/tests/unit/test_port.py index 4ef52a2e3..b98571b83 100644 --- a/shade/shade/tests/unit/test_port.py +++ b/openstack/cloud/tests/unit/test_port.py @@ -19,8 +19,8 @@ test_port Test port resource (managed by neutron) """ -from shade.exc import OpenStackCloudException -from shade.tests.unit import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests.unit import base class TestPort(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_project.py b/openstack/cloud/tests/unit/test_project.py similarity index 98% rename from shade/shade/tests/unit/test_project.py rename to openstack/cloud/tests/unit/test_project.py index f836bc0d2..fc9ec19b3 100644 --- a/shade/shade/tests/unit/test_project.py +++ b/openstack/cloud/tests/unit/test_project.py @@ -13,9 +13,9 @@ import testtools from testtools import matchers -import shade -import shade._utils -from shade.tests.unit import base +import openstack.cloud +import openstack.cloud._utils +from openstack.cloud.tests.unit import base class TestProject(base.RequestsMockTestCase): @@ -76,7 +76,7 @@ class TestProject(base.RequestsMockTestCase): def test_create_project_v3_no_domain(self): with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "User or project creation requires an explicit" " domain_id argument." ): @@ -126,7 +126,7 @@ class TestProject(base.RequestsMockTestCase): # shade will raise an attribute error instead of the proper # project not found exception. with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Project %s not found." % project_data.project_id ): self.op_cloud.update_project(project_data.project_id) diff --git a/shade/shade/tests/unit/test_qos_bandwidth_limit_rule.py b/openstack/cloud/tests/unit/test_qos_bandwidth_limit_rule.py similarity index 99% rename from shade/shade/tests/unit/test_qos_bandwidth_limit_rule.py rename to openstack/cloud/tests/unit/test_qos_bandwidth_limit_rule.py index 53858496e..a09a618cb 100644 --- a/shade/shade/tests/unit/test_qos_bandwidth_limit_rule.py +++ b/openstack/cloud/tests/unit/test_qos_bandwidth_limit_rule.py @@ -15,8 +15,8 @@ import copy -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestQosBandwidthLimitRule(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_qos_dscp_marking_rule.py b/openstack/cloud/tests/unit/test_qos_dscp_marking_rule.py similarity index 99% rename from shade/shade/tests/unit/test_qos_dscp_marking_rule.py rename to openstack/cloud/tests/unit/test_qos_dscp_marking_rule.py index ccb60e15f..56234cdc6 100644 --- a/shade/shade/tests/unit/test_qos_dscp_marking_rule.py +++ b/openstack/cloud/tests/unit/test_qos_dscp_marking_rule.py @@ -15,8 +15,8 @@ import copy -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestQosDscpMarkingRule(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_qos_minimum_bandwidth_rule.py b/openstack/cloud/tests/unit/test_qos_minimum_bandwidth_rule.py similarity index 99% rename from shade/shade/tests/unit/test_qos_minimum_bandwidth_rule.py rename to openstack/cloud/tests/unit/test_qos_minimum_bandwidth_rule.py index 6afdc44bb..0b1c220fb 100644 --- a/shade/shade/tests/unit/test_qos_minimum_bandwidth_rule.py +++ b/openstack/cloud/tests/unit/test_qos_minimum_bandwidth_rule.py @@ -15,8 +15,8 @@ import copy -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestQosMinimumBandwidthRule(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_qos_policy.py b/openstack/cloud/tests/unit/test_qos_policy.py similarity index 99% rename from shade/shade/tests/unit/test_qos_policy.py rename to openstack/cloud/tests/unit/test_qos_policy.py index a0b327626..3998f7c6b 100644 --- a/shade/shade/tests/unit/test_qos_policy.py +++ b/openstack/cloud/tests/unit/test_qos_policy.py @@ -15,8 +15,8 @@ import copy -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestQosPolicy(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_qos_rule_type.py b/openstack/cloud/tests/unit/test_qos_rule_type.py similarity index 98% rename from shade/shade/tests/unit/test_qos_rule_type.py rename to openstack/cloud/tests/unit/test_qos_rule_type.py index fd23e411c..6590788c8 100644 --- a/shade/shade/tests/unit/test_qos_rule_type.py +++ b/openstack/cloud/tests/unit/test_qos_rule_type.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestQosRuleType(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_quotas.py b/openstack/cloud/tests/unit/test_quotas.py similarity index 99% rename from shade/shade/tests/unit/test_quotas.py rename to openstack/cloud/tests/unit/test_quotas.py index 12efecbd3..a6c29ea6c 100644 --- a/shade/shade/tests/unit/test_quotas.py +++ b/openstack/cloud/tests/unit/test_quotas.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base fake_quota_set = { "cores": 20, diff --git a/shade/shade/tests/unit/test_rebuild_server.py b/openstack/cloud/tests/unit/test_rebuild_server.py similarity index 98% rename from shade/shade/tests/unit/test_rebuild_server.py rename to openstack/cloud/tests/unit/test_rebuild_server.py index aae725245..c54701d77 100644 --- a/shade/shade/tests/unit/test_rebuild_server.py +++ b/openstack/cloud/tests/unit/test_rebuild_server.py @@ -21,9 +21,9 @@ Tests for the `rebuild_server` command. import uuid -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestRebuildServer(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_recordset.py b/openstack/cloud/tests/unit/test_recordset.py similarity index 98% rename from shade/shade/tests/unit/test_recordset.py rename to openstack/cloud/tests/unit/test_recordset.py index 044499aa5..055f0de3d 100644 --- a/shade/shade/tests/unit/test_recordset.py +++ b/openstack/cloud/tests/unit/test_recordset.py @@ -14,8 +14,8 @@ import copy import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base zone = { @@ -95,7 +95,7 @@ class TestRecordset(base.RequestsMockTestCase): 'type': 'A'})), ]) with testtools.ExpectedException( - shade.exc.OpenStackCloudHTTPError, + openstack.cloud.exc.OpenStackCloudHTTPError, "Error creating recordset www2.example.net." ): self.cloud.create_recordset('1', 'www2.example.net.', diff --git a/shade/shade/tests/unit/test_role_assignment.py b/openstack/cloud/tests/unit/test_role_assignment.py similarity index 99% rename from shade/shade/tests/unit/test_role_assignment.py rename to openstack/cloud/tests/unit/test_role_assignment.py index 3aedd0fd9..257f4b288 100644 --- a/shade/shade/tests/unit/test_role_assignment.py +++ b/openstack/cloud/tests/unit/test_role_assignment.py @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base import testtools from testtools import matchers diff --git a/shade/shade/tests/unit/test_router.py b/openstack/cloud/tests/unit/test_router.py similarity index 99% rename from shade/shade/tests/unit/test_router.py rename to openstack/cloud/tests/unit/test_router.py index 778d0dadc..bbc266235 100644 --- a/shade/shade/tests/unit/test_router.py +++ b/openstack/cloud/tests/unit/test_router.py @@ -15,8 +15,8 @@ import copy -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestRouter(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_security_groups.py b/openstack/cloud/tests/unit/test_security_groups.py similarity index 98% rename from shade/shade/tests/unit/test_security_groups.py rename to openstack/cloud/tests/unit/test_security_groups.py index e3485c8fa..64357575b 100644 --- a/shade/shade/tests/unit/test_security_groups.py +++ b/openstack/cloud/tests/unit/test_security_groups.py @@ -13,9 +13,9 @@ import copy -import shade -from shade.tests.unit import base -from shade.tests import fakes +import openstack.cloud +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes # TODO(mordred): Move id and name to using a getUniqueString() value @@ -83,7 +83,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): self.cloud.secgroup_source = None self.has_neutron = False - self.assertRaises(shade.OpenStackCloudUnavailableFeature, + self.assertRaises(openstack.cloud.OpenStackCloudUnavailableFeature, self.cloud.list_security_groups) def test_delete_security_group_neutron(self): @@ -146,7 +146,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): def test_delete_security_group_none(self): self.cloud.secgroup_source = None - self.assertRaises(shade.OpenStackCloudUnavailableFeature, + self.assertRaises(openstack.cloud.OpenStackCloudUnavailableFeature, self.cloud.delete_security_group, 'doesNotExist') @@ -246,7 +246,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): def test_create_security_group_none(self): self.cloud.secgroup_source = None self.has_neutron = False - self.assertRaises(shade.OpenStackCloudUnavailableFeature, + self.assertRaises(openstack.cloud.OpenStackCloudUnavailableFeature, self.cloud.create_security_group, '', '') @@ -465,7 +465,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): def test_create_security_group_rule_none(self): self.has_neutron = False self.cloud.secgroup_source = None - self.assertRaises(shade.OpenStackCloudUnavailableFeature, + self.assertRaises(openstack.cloud.OpenStackCloudUnavailableFeature, self.cloud.create_security_group_rule, '') @@ -498,7 +498,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): def test_delete_security_group_rule_none(self): self.has_neutron = False self.cloud.secgroup_source = None - self.assertRaises(shade.OpenStackCloudUnavailableFeature, + self.assertRaises(openstack.cloud.OpenStackCloudUnavailableFeature, self.cloud.delete_security_group_rule, '') @@ -538,7 +538,7 @@ class TestSecurityGroups(base.RequestsMockTestCase): endpoint=fakes.COMPUTE_ENDPOINT), json={'security_groups': [nova_grp_dict]}), ]) - self.assertRaises(shade.OpenStackCloudException, + self.assertRaises(openstack.cloud.OpenStackCloudException, self.cloud.create_security_group_rule, secgroup_name_or_id='nova-sec-group', direction='egress') diff --git a/shade/shade/tests/unit/test_server_console.py b/openstack/cloud/tests/unit/test_server_console.py similarity index 97% rename from shade/shade/tests/unit/test_server_console.py rename to openstack/cloud/tests/unit/test_server_console.py index bf534aa2c..5b8e78a11 100644 --- a/shade/shade/tests/unit/test_server_console.py +++ b/openstack/cloud/tests/unit/test_server_console.py @@ -13,8 +13,8 @@ import uuid -from shade.tests.unit import base -from shade.tests import fakes +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes class TestServerConsole(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_server_delete_metadata.py b/openstack/cloud/tests/unit/test_server_delete_metadata.py similarity index 94% rename from shade/shade/tests/unit/test_server_delete_metadata.py rename to openstack/cloud/tests/unit/test_server_delete_metadata.py index 29fea9a8a..e9264432a 100644 --- a/shade/shade/tests/unit/test_server_delete_metadata.py +++ b/openstack/cloud/tests/unit/test_server_delete_metadata.py @@ -19,9 +19,9 @@ Tests for the `delete_server_metadata` command. import uuid -from shade.exc import OpenStackCloudURINotFound -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud.exc import OpenStackCloudURINotFound +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestServerDeleteMetadata(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_server_group.py b/openstack/cloud/tests/unit/test_server_group.py similarity index 96% rename from shade/shade/tests/unit/test_server_group.py rename to openstack/cloud/tests/unit/test_server_group.py index 7e2ee2b1f..943739ffd 100644 --- a/shade/shade/tests/unit/test_server_group.py +++ b/openstack/cloud/tests/unit/test_server_group.py @@ -13,8 +13,8 @@ import uuid -from shade.tests.unit import base -from shade.tests import fakes +from openstack.cloud.tests.unit import base +from openstack.cloud.tests import fakes class TestServerGroup(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_server_set_metadata.py b/openstack/cloud/tests/unit/test_server_set_metadata.py similarity index 94% rename from shade/shade/tests/unit/test_server_set_metadata.py rename to openstack/cloud/tests/unit/test_server_set_metadata.py index 0b32ae6e8..c3a507821 100644 --- a/shade/shade/tests/unit/test_server_set_metadata.py +++ b/openstack/cloud/tests/unit/test_server_set_metadata.py @@ -19,9 +19,9 @@ Tests for the `set_server_metadata` command. import uuid -from shade.exc import OpenStackCloudBadRequest -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud.exc import OpenStackCloudBadRequest +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestServerSetMetadata(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_services.py b/openstack/cloud/tests/unit/test_services.py similarity index 98% rename from shade/shade/tests/unit/test_services.py rename to openstack/cloud/tests/unit/test_services.py index 6ff05a40c..df261d444 100644 --- a/shade/shade/tests/unit/test_services.py +++ b/openstack/cloud/tests/unit/test_services.py @@ -19,9 +19,9 @@ test_cloud_services Tests Keystone services commands. """ -from shade import OpenStackCloudException -from shade.exc import OpenStackCloudUnavailableFeature -from shade.tests.unit import base +from openstack.cloud import OpenStackCloudException +from openstack.cloud.exc import OpenStackCloudUnavailableFeature +from openstack.cloud.tests.unit import base from testtools import matchers diff --git a/shade/shade/tests/unit/test_shade.py b/openstack/cloud/tests/unit/test_shade.py similarity index 97% rename from shade/shade/tests/unit/test_shade.py rename to openstack/cloud/tests/unit/test_shade.py index 65e398de4..3a6988e6a 100644 --- a/shade/shade/tests/unit/test_shade.py +++ b/openstack/cloud/tests/unit/test_shade.py @@ -15,11 +15,11 @@ import uuid import testtools -import shade -from shade import _utils -from shade import exc -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import _utils +from openstack.cloud import exc +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base RANGE_DATA = [ @@ -52,9 +52,9 @@ class TestShade(base.RequestsMockTestCase): self.cloud.has_service = fake_has_service def test_openstack_cloud(self): - self.assertIsInstance(self.cloud, shade.OpenStackCloud) + self.assertIsInstance(self.cloud, openstack.cloud.OpenStackCloud) - @mock.patch.object(shade.OpenStackCloud, 'search_images') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'search_images') def test_get_images(self, mock_search): image1 = dict(id='123', name='mickey') mock_search.return_value = [image1] @@ -62,7 +62,7 @@ class TestShade(base.RequestsMockTestCase): self.assertIsNotNone(r) self.assertDictEqual(image1, r) - @mock.patch.object(shade.OpenStackCloud, 'search_images') + @mock.patch.object(openstack.cloud.OpenStackCloud, 'search_images') def test_get_image_not_found(self, mock_search): mock_search.return_value = [] r = self.cloud.get_image('doesNotExist') diff --git a/shade/shade/tests/unit/test_shade_operator.py b/openstack/cloud/tests/unit/test_shade_operator.py similarity index 90% rename from shade/shade/tests/unit/test_shade_operator.py rename to openstack/cloud/tests/unit/test_shade_operator.py index 7528178db..5396e705f 100644 --- a/shade/shade/tests/unit/test_shade_operator.py +++ b/openstack/cloud/tests/unit/test_shade_operator.py @@ -18,13 +18,13 @@ import munch import testtools import uuid -import os_client_config as occ +import openstack.config as occ from os_client_config import cloud_config -import shade -from shade import exc -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import exc +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestShadeOperator(base.RequestsMockTestCase): @@ -38,9 +38,9 @@ class TestShadeOperator(base.RequestsMockTestCase): machine_name=self.machine_name) def test_operator_cloud(self): - self.assertIsInstance(self.op_cloud, shade.OperatorCloud) + self.assertIsInstance(self.op_cloud, openstack.cloud.OperatorCloud) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_list_nics(self, mock_client): port1 = fakes.FakeMachinePort(1, "aa:bb:cc:dd", "node1") port2 = fakes.FakeMachinePort(2, "dd:cc:bb:aa", "node2") @@ -53,25 +53,25 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertTrue(mock_client.port.list.called) self.assertEqual(port_dict_list, nics) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_list_nics_failure(self, mock_client): mock_client.port.list.side_effect = Exception() self.assertRaises(exc.OpenStackCloudException, self.op_cloud.list_nics) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_list_nics_for_machine(self, mock_client): mock_client.node.list_ports.return_value = [] self.op_cloud.list_nics_for_machine("123") mock_client.node.list_ports.assert_called_with(node_id="123") - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_list_nics_for_machine_failure(self, mock_client): mock_client.node.list_ports.side_effect = Exception() self.assertRaises(exc.OpenStackCloudException, self.op_cloud.list_nics_for_machine, None) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_register_machine(self, mock_client): class fake_node(object): uuid = "00000000-0000-0000-0000-000000000000" @@ -94,8 +94,9 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertTrue(mock_client.port.create.called) self.assertFalse(mock_client.node.get.called) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') - @mock.patch.object(shade.OperatorCloud, 'node_set_provision_state') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, + 'node_set_provision_state') def test_register_machine_enroll( self, mock_set_state, @@ -168,17 +169,18 @@ class TestShadeOperator(base.RequestsMockTestCase): fake_node_post_manage, fake_node_post_enroll_failure]) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.op_cloud.register_machine, nics) self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.op_cloud.register_machine, nics, wait=True) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') - @mock.patch.object(shade.OperatorCloud, 'node_set_provision_state') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, + 'node_set_provision_state') def test_register_machine_enroll_timeout( self, mock_set_state, @@ -195,7 +197,7 @@ class TestShadeOperator(base.RequestsMockTestCase): mock_client.node.create.return_value = fake_node_init_state nics = [{'mac': '00:00:00:00:00:00'}] self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.op_cloud.register_machine, nics, lock_timeout=0.001) @@ -205,7 +207,7 @@ class TestShadeOperator(base.RequestsMockTestCase): mock_client.node.get.reset_mock() mock_client.node.create.reset_mock() self.assertRaises( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, self.op_cloud.register_machine, nics, wait=True, @@ -214,7 +216,7 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertTrue(mock_client.port.create.called) self.assertTrue(mock_client.node.get.called) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_register_machine_port_create_failed(self, mock_client): class fake_node(object): uuid = "00000000-0000-0000-0000-000000000000" @@ -233,7 +235,7 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertTrue(mock_client.port.create.called) self.assertTrue(mock_client.node.delete.called) - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_unregister_machine(self, mock_client): class fake_node(object): provision_state = 'available' @@ -255,7 +257,7 @@ class TestShadeOperator(base.RequestsMockTestCase): mock_client.port.delete.assert_called_with( port_id='00000000-0000-0000-0000-000000000001') - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_unregister_machine_unavailable(self, mock_client): invalid_states = ['active', 'cleaning', 'clean wait', 'clean failed'] nics = [{'mac': '00:00:00:00:00:00'}] @@ -277,7 +279,7 @@ class TestShadeOperator(base.RequestsMockTestCase): mock_client.node.reset_mock() mock_client.node.reset_mock() - @mock.patch.object(shade.OperatorCloud, 'ironic_client') + @mock.patch.object(openstack.cloud.OperatorCloud, 'ironic_client') def test_unregister_machine_timeout(self, mock_client): class fake_node(object): provision_state = 'available' @@ -297,7 +299,7 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertTrue(mock_client.port.get_by_address.called) self.assertTrue(mock_client.node.get.called) - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_get_image_name(self, mock_client): fake_image = munch.Munch( @@ -308,7 +310,7 @@ class TestShadeOperator(base.RequestsMockTestCase): self.assertEqual('22 name', self.op_cloud.get_image_name('22')) self.assertEqual('22 name', self.op_cloud.get_image_name('22 name')) - @mock.patch.object(shade.OpenStackCloud, '_image_client') + @mock.patch.object(openstack.cloud.OpenStackCloud, '_image_client') def test_get_image_id(self, mock_client): fake_image = munch.Munch( diff --git a/shade/shade/tests/unit/test_stack.py b/openstack/cloud/tests/unit/test_stack.py similarity index 97% rename from shade/shade/tests/unit/test_stack.py rename to openstack/cloud/tests/unit/test_stack.py index cc83eb2ec..6915d6479 100644 --- a/shade/shade/tests/unit/test_stack.py +++ b/openstack/cloud/tests/unit/test_stack.py @@ -14,10 +14,10 @@ import tempfile import testtools -import shade -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestStack(base.RequestsMockTestCase): @@ -55,7 +55,8 @@ class TestStack(base.RequestsMockTestCase): endpoint=fakes.ORCHESTRATION_ENDPOINT), status_code=404) ]) - with testtools.ExpectedException(shade.OpenStackCloudURINotFound): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudURINotFound): self.cloud.list_stacks() self.assert_calls() @@ -107,7 +108,8 @@ class TestStack(base.RequestsMockTestCase): endpoint=fakes.ORCHESTRATION_ENDPOINT), status_code=404) ]) - with testtools.ExpectedException(shade.OpenStackCloudURINotFound): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudURINotFound): self.cloud.search_stacks() def test_delete_stack(self): @@ -167,7 +169,8 @@ class TestStack(base.RequestsMockTestCase): status_code=400, reason="ouch"), ]) - with testtools.ExpectedException(shade.OpenStackCloudBadRequest): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudBadRequest): self.cloud.delete_stack(self.stack_id) self.assert_calls() @@ -283,7 +286,8 @@ class TestStack(base.RequestsMockTestCase): json={"stack": failed_stack}), ]) - with testtools.ExpectedException(shade.OpenStackCloudException): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudException): self.cloud.delete_stack(self.stack_id, wait=True) self.assert_calls() diff --git a/shade/shade/tests/unit/test_subnet.py b/openstack/cloud/tests/unit/test_subnet.py similarity index 99% rename from shade/shade/tests/unit/test_subnet.py rename to openstack/cloud/tests/unit/test_subnet.py index d52c7dee0..5e875055f 100644 --- a/shade/shade/tests/unit/test_subnet.py +++ b/openstack/cloud/tests/unit/test_subnet.py @@ -16,8 +16,8 @@ import copy import testtools -from shade import exc -from shade.tests.unit import base +from openstack.cloud import exc +from openstack.cloud.tests.unit import base class TestSubnet(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_task_manager.py b/openstack/cloud/tests/unit/test_task_manager.py similarity index 97% rename from shade/shade/tests/unit/test_task_manager.py rename to openstack/cloud/tests/unit/test_task_manager.py index 1a416ee44..8d6583e49 100644 --- a/shade/shade/tests/unit/test_task_manager.py +++ b/openstack/cloud/tests/unit/test_task_manager.py @@ -16,8 +16,8 @@ import concurrent.futures import mock -from shade import task_manager -from shade.tests.unit import base +from openstack.cloud import task_manager +from openstack.cloud.tests.unit import base class TestException(Exception): diff --git a/shade/shade/tests/unit/test_update_server.py b/openstack/cloud/tests/unit/test_update_server.py similarity index 95% rename from shade/shade/tests/unit/test_update_server.py rename to openstack/cloud/tests/unit/test_update_server.py index 2a94c13c1..4fef35566 100644 --- a/shade/shade/tests/unit/test_update_server.py +++ b/openstack/cloud/tests/unit/test_update_server.py @@ -19,9 +19,9 @@ Tests for the `update_server` command. import uuid -from shade.exc import OpenStackCloudException -from shade.tests import fakes -from shade.tests.unit import base +from openstack.cloud.exc import OpenStackCloudException +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestUpdateServer(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_usage.py b/openstack/cloud/tests/unit/test_usage.py similarity index 98% rename from shade/shade/tests/unit/test_usage.py rename to openstack/cloud/tests/unit/test_usage.py index 9643f9ba2..d51530ab6 100644 --- a/shade/shade/tests/unit/test_usage.py +++ b/openstack/cloud/tests/unit/test_usage.py @@ -14,7 +14,7 @@ import datetime import uuid -from shade.tests.unit import base +from openstack.cloud.tests.unit import base class TestUsage(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_users.py b/openstack/cloud/tests/unit/test_users.py similarity index 98% rename from shade/shade/tests/unit/test_users.py rename to openstack/cloud/tests/unit/test_users.py index 8f15c864a..b3ab63d23 100644 --- a/shade/shade/tests/unit/test_users.py +++ b/openstack/cloud/tests/unit/test_users.py @@ -14,8 +14,8 @@ import uuid import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base class TestUsers(base.RequestsMockTestCase): @@ -124,7 +124,7 @@ class TestUsers(base.RequestsMockTestCase): user_data = self._get_user_data(domain_id=uuid.uuid4().hex, email='test@example.com') with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "User or project creation requires an explicit" " domain_id argument." ): diff --git a/shade/shade/tests/unit/test_volume.py b/openstack/cloud/tests/unit/test_volume.py similarity index 97% rename from shade/shade/tests/unit/test_volume.py rename to openstack/cloud/tests/unit/test_volume.py index 5983c6af8..fc495b97d 100644 --- a/shade/shade/tests/unit/test_volume.py +++ b/openstack/cloud/tests/unit/test_volume.py @@ -13,10 +13,10 @@ import testtools -import shade -from shade import meta -from shade.tests import fakes -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud import meta +from openstack.cloud.tests import fakes +from openstack.cloud.tests.unit import base class TestVolume(base.RequestsMockTestCase): @@ -60,7 +60,7 @@ class TestVolume(base.RequestsMockTestCase): 'volumeId': vol['id']}}) )]) with testtools.ExpectedException( - shade.OpenStackCloudURINotFound, + openstack.cloud.OpenStackCloudURINotFound, "Error attaching volume %s to server %s" % ( volume['id'], server['id']) ): @@ -126,7 +126,7 @@ class TestVolume(base.RequestsMockTestCase): json={'volumes': [errored_volume]})]) with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Error in attaching volume %s" % errored_volume['id'] ): self.cloud.attach_volume(server, volume) @@ -137,7 +137,7 @@ class TestVolume(base.RequestsMockTestCase): volume = dict(id='volume001', status='error', attachments=[]) with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Volume %s is not available. Status is '%s'" % ( volume['id'], volume['status']) ): @@ -153,7 +153,7 @@ class TestVolume(base.RequestsMockTestCase): ]) with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Volume %s already attached to server %s on device %s" % ( volume['id'], server['id'], device_id) ): @@ -189,7 +189,7 @@ class TestVolume(base.RequestsMockTestCase): 'os-volume_attachments', volume['id']]), status_code=404)]) with testtools.ExpectedException( - shade.OpenStackCloudURINotFound, + openstack.cloud.OpenStackCloudURINotFound, "Error detaching volume %s from server %s" % ( volume['id'], server['id']) ): @@ -238,7 +238,7 @@ class TestVolume(base.RequestsMockTestCase): 'volumev2', 'public', append=['volumes', 'detail']), json={'volumes': [errored_volume]})]) with testtools.ExpectedException( - shade.OpenStackCloudException, + openstack.cloud.OpenStackCloudException, "Error in detaching volume %s" % errored_volume['id'] ): self.cloud.detach_volume(server, volume) diff --git a/shade/shade/tests/unit/test_volume_access.py b/openstack/cloud/tests/unit/test_volume_access.py similarity index 97% rename from shade/shade/tests/unit/test_volume_access.py rename to openstack/cloud/tests/unit/test_volume_access.py index 39ee64ead..785e5695e 100644 --- a/shade/shade/tests/unit/test_volume_access.py +++ b/openstack/cloud/tests/unit/test_volume_access.py @@ -15,8 +15,8 @@ import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base class TestVolumeAccess(base.RequestsMockTestCase): @@ -186,8 +186,9 @@ class TestVolumeAccess(base.RequestsMockTestCase): append=['types'], qs_elements=['is_public=None']), json={'volume_types': [volume_type]})]) - with testtools.ExpectedException(shade.OpenStackCloudException, - "VolumeType not found: MISSING"): + with testtools.ExpectedException( + openstack.cloud.OpenStackCloudException, + "VolumeType not found: MISSING"): self.op_cloud.add_volume_type_access( "MISSING", project_001['project_id']) self.assert_calls() diff --git a/shade/shade/tests/unit/test_volume_backups.py b/openstack/cloud/tests/unit/test_volume_backups.py similarity index 98% rename from shade/shade/tests/unit/test_volume_backups.py rename to openstack/cloud/tests/unit/test_volume_backups.py index ca04c1d8c..f32beef6e 100644 --- a/shade/shade/tests/unit/test_volume_backups.py +++ b/openstack/cloud/tests/unit/test_volume_backups.py @@ -9,8 +9,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from shade import meta -from shade.tests.unit import base +from openstack.cloud import meta +from openstack.cloud.tests.unit import base class TestVolumeBackups(base.RequestsMockTestCase): diff --git a/shade/shade/tests/unit/test_zone.py b/openstack/cloud/tests/unit/test_zone.py similarity index 97% rename from shade/shade/tests/unit/test_zone.py rename to openstack/cloud/tests/unit/test_zone.py index 960a81534..1d317880c 100644 --- a/shade/shade/tests/unit/test_zone.py +++ b/openstack/cloud/tests/unit/test_zone.py @@ -13,8 +13,8 @@ import copy import testtools -import shade -from shade.tests.unit import base +import openstack.cloud +from openstack.cloud.tests.unit import base zone_dict = { @@ -62,7 +62,7 @@ class TestZone(base.RequestsMockTestCase): status_code=500) ]) with testtools.ExpectedException( - shade.exc.OpenStackCloudHTTPError, + openstack.cloud.exc.OpenStackCloudHTTPError, "Unable to create zone example.net." ): self.cloud.create_zone('example.net.') diff --git a/os-client-config/os_client_config/__init__.py b/openstack/config/__init__.py similarity index 96% rename from os-client-config/os_client_config/__init__.py rename to openstack/config/__init__.py index 424652541..8cf0c9427 100644 --- a/os-client-config/os_client_config/__init__.py +++ b/openstack/config/__init__.py @@ -104,8 +104,8 @@ def make_shade(options=None, **kwargs): A mechanism that matches make_sdk, make_client and make_rest_client. - :rtype: :class:`~shade.OpenStackCloud` + :rtype: :class:`~openstack.cloud.OpenStackCloud` """ - import shade + import openstack.cloud cloud = get_config(options=options, **kwargs) - return shade.OpenStackCloud(cloud_config=cloud, **kwargs) + return openstack.cloud.OpenStackCloud(cloud_config=cloud, **kwargs) diff --git a/shade/shade/_log.py b/openstack/config/_log.py similarity index 100% rename from shade/shade/_log.py rename to openstack/config/_log.py diff --git a/os-client-config/os_client_config/cloud_config.py b/openstack/config/cloud_config.py similarity index 99% rename from os-client-config/os_client_config/cloud_config.py rename to openstack/config/cloud_config.py index d8b1e262c..29acc5499 100644 --- a/os-client-config/os_client_config/cloud_config.py +++ b/openstack/config/cloud_config.py @@ -21,7 +21,7 @@ import keystoneauth1.exceptions.catalog from keystoneauth1 import session import requestsexceptions -import os_client_config +import openstack.config as os_client_config from os_client_config import _log from os_client_config import constructors from os_client_config import exceptions diff --git a/os-client-config/os_client_config/config.py b/openstack/config/config.py similarity index 100% rename from os-client-config/os_client_config/config.py rename to openstack/config/config.py diff --git a/os-client-config/os_client_config/constructors.json b/openstack/config/constructors.json similarity index 100% rename from os-client-config/os_client_config/constructors.json rename to openstack/config/constructors.json diff --git a/os-client-config/os_client_config/constructors.py b/openstack/config/constructors.py similarity index 100% rename from os-client-config/os_client_config/constructors.py rename to openstack/config/constructors.py diff --git a/os-client-config/os_client_config/defaults.json b/openstack/config/defaults.json similarity index 100% rename from os-client-config/os_client_config/defaults.json rename to openstack/config/defaults.json diff --git a/os-client-config/os_client_config/defaults.py b/openstack/config/defaults.py similarity index 100% rename from os-client-config/os_client_config/defaults.py rename to openstack/config/defaults.py diff --git a/os-client-config/os_client_config/exceptions.py b/openstack/config/exceptions.py similarity index 100% rename from os-client-config/os_client_config/exceptions.py rename to openstack/config/exceptions.py diff --git a/os-client-config/os_client_config/schema.json b/openstack/config/schema.json similarity index 100% rename from os-client-config/os_client_config/schema.json rename to openstack/config/schema.json diff --git a/shade/shade/tests/unit/__init__.py b/openstack/config/tests/__init__.py similarity index 100% rename from shade/shade/tests/unit/__init__.py rename to openstack/config/tests/__init__.py diff --git a/os-client-config/os_client_config/tests/base.py b/openstack/config/tests/base.py similarity index 99% rename from os-client-config/os_client_config/tests/base.py rename to openstack/config/tests/base.py index 9710782d4..e66dea14d 100644 --- a/os-client-config/os_client_config/tests/base.py +++ b/openstack/config/tests/base.py @@ -121,7 +121,7 @@ USER_CONF = { 'name': 'split-no-default', 'routes_ipv6_externally': False, 'routes_ipv4_externally': True, - }], + }], 'region_name': 'test-region', }, '_test_cloud_regions': { diff --git a/os-client-config/os_client_config/tests/test_cloud_config.py b/openstack/config/tests/test_cloud_config.py similarity index 100% rename from os-client-config/os_client_config/tests/test_cloud_config.py rename to openstack/config/tests/test_cloud_config.py diff --git a/os-client-config/os_client_config/tests/test_config.py b/openstack/config/tests/test_config.py similarity index 100% rename from os-client-config/os_client_config/tests/test_config.py rename to openstack/config/tests/test_config.py diff --git a/os-client-config/os_client_config/tests/test_environ.py b/openstack/config/tests/test_environ.py similarity index 100% rename from os-client-config/os_client_config/tests/test_environ.py rename to openstack/config/tests/test_environ.py diff --git a/os-client-config/os_client_config/tests/test_init.py b/openstack/config/tests/test_init.py similarity index 96% rename from os-client-config/os_client_config/tests/test_init.py rename to openstack/config/tests/test_init.py index 5b4fab998..6c766a2ef 100644 --- a/os-client-config/os_client_config/tests/test_init.py +++ b/openstack/config/tests/test_init.py @@ -12,7 +12,7 @@ import argparse -import os_client_config +import openstack.config as os_client_config from os_client_config.tests import base diff --git a/os-client-config/os_client_config/tests/test_json.py b/openstack/config/tests/test_json.py similarity index 100% rename from os-client-config/os_client_config/tests/test_json.py rename to openstack/config/tests/test_json.py diff --git a/os-client-config/os_client_config/vendor-schema.json b/openstack/config/vendor-schema.json similarity index 100% rename from os-client-config/os_client_config/vendor-schema.json rename to openstack/config/vendor-schema.json diff --git a/os-client-config/os_client_config/vendors/__init__.py b/openstack/config/vendors/__init__.py similarity index 100% rename from os-client-config/os_client_config/vendors/__init__.py rename to openstack/config/vendors/__init__.py diff --git a/os-client-config/os_client_config/vendors/auro.json b/openstack/config/vendors/auro.json similarity index 100% rename from os-client-config/os_client_config/vendors/auro.json rename to openstack/config/vendors/auro.json diff --git a/os-client-config/os_client_config/vendors/bluebox.json b/openstack/config/vendors/bluebox.json similarity index 100% rename from os-client-config/os_client_config/vendors/bluebox.json rename to openstack/config/vendors/bluebox.json diff --git a/os-client-config/os_client_config/vendors/catalyst.json b/openstack/config/vendors/catalyst.json similarity index 100% rename from os-client-config/os_client_config/vendors/catalyst.json rename to openstack/config/vendors/catalyst.json diff --git a/os-client-config/os_client_config/vendors/citycloud.json b/openstack/config/vendors/citycloud.json similarity index 100% rename from os-client-config/os_client_config/vendors/citycloud.json rename to openstack/config/vendors/citycloud.json diff --git a/os-client-config/os_client_config/vendors/conoha.json b/openstack/config/vendors/conoha.json similarity index 100% rename from os-client-config/os_client_config/vendors/conoha.json rename to openstack/config/vendors/conoha.json diff --git a/os-client-config/os_client_config/vendors/datacentred.json b/openstack/config/vendors/datacentred.json similarity index 100% rename from os-client-config/os_client_config/vendors/datacentred.json rename to openstack/config/vendors/datacentred.json diff --git a/os-client-config/os_client_config/vendors/dreamcompute.json b/openstack/config/vendors/dreamcompute.json similarity index 100% rename from os-client-config/os_client_config/vendors/dreamcompute.json rename to openstack/config/vendors/dreamcompute.json diff --git a/os-client-config/os_client_config/vendors/dreamhost.json b/openstack/config/vendors/dreamhost.json similarity index 100% rename from os-client-config/os_client_config/vendors/dreamhost.json rename to openstack/config/vendors/dreamhost.json diff --git a/os-client-config/os_client_config/vendors/elastx.json b/openstack/config/vendors/elastx.json similarity index 100% rename from os-client-config/os_client_config/vendors/elastx.json rename to openstack/config/vendors/elastx.json diff --git a/os-client-config/os_client_config/vendors/entercloudsuite.json b/openstack/config/vendors/entercloudsuite.json similarity index 100% rename from os-client-config/os_client_config/vendors/entercloudsuite.json rename to openstack/config/vendors/entercloudsuite.json diff --git a/os-client-config/os_client_config/vendors/fuga.json b/openstack/config/vendors/fuga.json similarity index 100% rename from os-client-config/os_client_config/vendors/fuga.json rename to openstack/config/vendors/fuga.json diff --git a/os-client-config/os_client_config/vendors/ibmcloud.json b/openstack/config/vendors/ibmcloud.json similarity index 100% rename from os-client-config/os_client_config/vendors/ibmcloud.json rename to openstack/config/vendors/ibmcloud.json diff --git a/os-client-config/os_client_config/vendors/internap.json b/openstack/config/vendors/internap.json similarity index 100% rename from os-client-config/os_client_config/vendors/internap.json rename to openstack/config/vendors/internap.json diff --git a/os-client-config/os_client_config/vendors/otc.json b/openstack/config/vendors/otc.json similarity index 100% rename from os-client-config/os_client_config/vendors/otc.json rename to openstack/config/vendors/otc.json diff --git a/os-client-config/os_client_config/vendors/ovh.json b/openstack/config/vendors/ovh.json similarity index 100% rename from os-client-config/os_client_config/vendors/ovh.json rename to openstack/config/vendors/ovh.json diff --git a/os-client-config/os_client_config/vendors/rackspace.json b/openstack/config/vendors/rackspace.json similarity index 100% rename from os-client-config/os_client_config/vendors/rackspace.json rename to openstack/config/vendors/rackspace.json diff --git a/os-client-config/os_client_config/vendors/switchengines.json b/openstack/config/vendors/switchengines.json similarity index 100% rename from os-client-config/os_client_config/vendors/switchengines.json rename to openstack/config/vendors/switchengines.json diff --git a/os-client-config/os_client_config/vendors/ultimum.json b/openstack/config/vendors/ultimum.json similarity index 100% rename from os-client-config/os_client_config/vendors/ultimum.json rename to openstack/config/vendors/ultimum.json diff --git a/os-client-config/os_client_config/vendors/unitedstack.json b/openstack/config/vendors/unitedstack.json similarity index 100% rename from os-client-config/os_client_config/vendors/unitedstack.json rename to openstack/config/vendors/unitedstack.json diff --git a/os-client-config/os_client_config/vendors/vexxhost.json b/openstack/config/vendors/vexxhost.json similarity index 100% rename from os-client-config/os_client_config/vendors/vexxhost.json rename to openstack/config/vendors/vexxhost.json diff --git a/os-client-config/os_client_config/vendors/zetta.json b/openstack/config/vendors/zetta.json similarity index 100% rename from os-client-config/os_client_config/vendors/zetta.json rename to openstack/config/vendors/zetta.json diff --git a/openstack/connection.py b/openstack/connection.py index 6f42d35d4..9743f6f84 100644 --- a/openstack/connection.py +++ b/openstack/connection.py @@ -61,7 +61,7 @@ import logging import sys from keystoneauth1.loading import base as ksa_loader -import os_client_config +import openstack.config as os_client_config from openstack import exceptions from openstack import profile as _profile diff --git a/openstack/tests/functional/base.py b/openstack/tests/functional/base.py index 9eb4eba4d..27bb895d3 100644 --- a/openstack/tests/functional/base.py +++ b/openstack/tests/functional/base.py @@ -11,7 +11,7 @@ # under the License. import os -import os_client_config +import openstack.config as os_client_config import time import unittest diff --git a/openstack/tests/unit/test_connection.py b/openstack/tests/unit/test_connection.py index 229dbb728..eb5b03da5 100644 --- a/openstack/tests/unit/test_connection.py +++ b/openstack/tests/unit/test_connection.py @@ -15,7 +15,7 @@ import os import fixtures from keystoneauth1 import session as ksa_session import mock -import os_client_config +import openstack.config as os_client_config from openstack import connection from openstack import exceptions diff --git a/os-client-config/doc/source/user/using.rst b/os-client-config/doc/source/user/using.rst index 7d1d34eae..827bb4af2 100644 --- a/os-client-config/doc/source/user/using.rst +++ b/os-client-config/doc/source/user/using.rst @@ -18,7 +18,7 @@ Get a named cloud. .. code-block:: python - import os_client_config + import openstack.config as os_client_config cloud_config = os_client_config.OpenStackConfig().get_one_cloud( 'internap', region_name='ams01') @@ -28,7 +28,7 @@ Or, get all of the clouds. .. code-block:: python - import os_client_config + import openstack.config as os_client_config cloud_config = os_client_config.OpenStackConfig().get_all_clouds() for cloud in cloud_config: @@ -47,7 +47,7 @@ with - as well as a consumption argument. import argparse import sys - import os_client_config + import openstack.config as os_client_config cloud_config = os_client_config.OpenStackConfig() parser = argparse.ArgumentParser() @@ -67,7 +67,7 @@ a helper function is provided. The following will get you a fully configured .. code-block:: python - import os_client_config + import openstack.config as os_client_config sdk = os_client_config.make_sdk() @@ -75,7 +75,7 @@ If you want to do the same thing but on a named cloud. .. code-block:: python - import os_client_config + import openstack.config as os_client_config sdk = os_client_config.make_sdk(cloud='mtvexx') @@ -85,7 +85,7 @@ If you want to do the same thing but also support command line parsing. import argparse - import os_client_config + import openstack.config as os_client_config sdk = os_client_config.make_sdk(options=argparse.ArgumentParser()) @@ -105,7 +105,7 @@ instance. .. code-block:: python - import os_client_config + import openstack.config as os_client_config cloud = os_client_config.make_shade() @@ -113,7 +113,7 @@ If you want to do the same thing but on a named cloud. .. code-block:: python - import os_client_config + import openstack.config as os_client_config cloud = os_client_config.make_shade(cloud='mtvexx') @@ -123,7 +123,7 @@ If you want to do the same thing but also support command line parsing. import argparse - import os_client_config + import openstack.config as os_client_config cloud = os_client_config.make_shade(options=argparse.ArgumentParser()) @@ -138,7 +138,7 @@ that is mounted on the endpoint for the service you're looking for. .. code-block:: python - import os_client_config + import openstack.config as os_client_config session = os_client_config.make_rest_client('compute', cloud='vexxhost') @@ -155,7 +155,7 @@ will get you a fully configured `novaclient` instance. .. code-block:: python - import os_client_config + import openstack.config as os_client_config nova = os_client_config.make_client('compute') @@ -163,7 +163,7 @@ If you want to do the same thing but on a named cloud. .. code-block:: python - import os_client_config + import openstack.config as os_client_config nova = os_client_config.make_client('compute', cloud='mtvexx') @@ -173,7 +173,7 @@ If you want to do the same thing but also support command line parsing. import argparse - import os_client_config + import openstack.config as os_client_config nova = os_client_config.make_client( 'compute', options=argparse.ArgumentParser()) diff --git a/os-client-config/tools/keystone_version.py b/os-client-config/tools/keystone_version.py index a81bdabf2..a4a00d27f 100644 --- a/os-client-config/tools/keystone_version.py +++ b/os-client-config/tools/keystone_version.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os_client_config +import openstack.config as os_client_config import pprint import sys import urlparse diff --git a/os-client-config/tools/nova_version.py b/os-client-config/tools/nova_version.py index 20603db41..e173ef6d1 100644 --- a/os-client-config/tools/nova_version.py +++ b/os-client-config/tools/nova_version.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os_client_config +import openstack.config as os_client_config ran = [] for cloud in os_client_config.OpenStackConfig().get_all_clouds(): diff --git a/releasenotes/notes/log-request-ids-37507cb6eed9a7da.yaml b/releasenotes/notes/log-request-ids-37507cb6eed9a7da.yaml index 8dbb75491..6c81b7756 100644 --- a/releasenotes/notes/log-request-ids-37507cb6eed9a7da.yaml +++ b/releasenotes/notes/log-request-ids-37507cb6eed9a7da.yaml @@ -2,4 +2,4 @@ other: - The contents of x-openstack-request-id are no longer added to object returned. Instead, they are logged to - a logger named 'shade.request_ids'. + a logger named 'openstack.cloud.request_ids'. diff --git a/releasenotes/notes/remove-novaclient-3f8d4db20d5f9582.yaml b/releasenotes/notes/remove-novaclient-3f8d4db20d5f9582.yaml index bd0ffbf4a..27db18cb9 100644 --- a/releasenotes/notes/remove-novaclient-3f8d4db20d5f9582.yaml +++ b/releasenotes/notes/remove-novaclient-3f8d4db20d5f9582.yaml @@ -2,4 +2,4 @@ upgrade: - All Nova interactions are done via direct REST calls. python-novaclient is no longer a direct dependency of - shade. + openstack.cloud. diff --git a/setup.cfg b/setup.cfg index d006218f5..11118defb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,11 @@ classifier = packages = openstack +# TODO(mordred) Move this to an OSC command before 1.0 +[entry_points] +console_scripts = + openstack-inventory = openstack.cloud.cmd.inventory:main + [build_sphinx] source-dir = doc/source build-dir = doc/build diff --git a/shade/.gitreview b/shade/.gitreview index 35d93597c..650bebe84 100644 --- a/shade/.gitreview +++ b/shade/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack-infra/shade.git +project=openstack-infra/openstack.cloud.git diff --git a/shade/HACKING.rst b/shade/HACKING.rst index 82e34ce37..9c8af4d35 100644 --- a/shade/HACKING.rst +++ b/shade/HACKING.rst @@ -44,6 +44,6 @@ Unit Tests Unit tests should be virtually instant. If a unit test takes more than 1 second to run, it is a bad unit test. Honestly, 1 second is too slow. -All unit test classes should subclass `shade.tests.unit.base.BaseTestCase`. The +All unit test classes should subclass `openstack.cloud.tests.unit.base.BaseTestCase`. The base TestCase class takes care of properly creating `OpenStackCloud` objects in a way that protects against local environment. diff --git a/shade/README.rst b/shade/README.rst index e4c4e8a66..c43a16699 100644 --- a/shade/README.rst +++ b/shade/README.rst @@ -47,14 +47,14 @@ Sometimes an example is nice. #. Create a server with *shade*, configured with the ``clouds.yml`` file:: - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) # Initialize cloud # Cloud configs are read with os-client-config - cloud = shade.openstack_cloud(cloud='mordred') + cloud = openstack.cloud.openstack_cloud(cloud='mordred') # Upload an image to the cloud image = cloud.create_image( diff --git a/shade/doc/source/contributor/coding.rst b/shade/doc/source/contributor/coding.rst index 739b319fa..851c18b1e 100644 --- a/shade/doc/source/contributor/coding.rst +++ b/shade/doc/source/contributor/coding.rst @@ -67,7 +67,7 @@ Returned Resources ================== Complex objects returned to the caller must be a `munch.Munch` type. The -`shade._adapter.Adapter` class makes resources into `munch.Munch`. +`openstack.cloud._adapter.Adapter` class makes resources into `munch.Munch`. All objects should be normalized. It is shade's purpose in life to make OpenStack consistent for end users, and this means not trusting the clouds @@ -79,7 +79,7 @@ Fields should not be in the normalization contract if we cannot commit to providing them to all users. Fields should be renamed in normalization to be consistent with -the rest of shade. For instance, nothing in shade exposes the legacy OpenStack +the rest of openstack.cloud. For instance, nothing in shade exposes the legacy OpenStack concept of "tenant" to a user, but instead uses "project" even if the cloud uses tenant. diff --git a/shade/doc/source/user/examples/cleanup-servers.py b/shade/doc/source/user/examples/cleanup-servers.py index 0e18ce228..832dfbc45 100644 --- a/shade/doc/source/user/examples/cleanup-servers.py +++ b/shade/doc/source/user/examples/cleanup-servers.py @@ -1,13 +1,13 @@ -import shade +import openstack.cloud # Initialize and turn on debug logging -shade.simple_logging(debug=True) +openstack.cloud.simple_logging(debug=True) for cloud_name, region_name in [ ('my-vexxhost', 'ca-ymq-1'), ('my-citycloud', 'Buf1'), ('my-internap', 'ams01')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) for server in cloud.search_servers('my-server'): cloud.delete_server(server, wait=True, delete_ips=True) diff --git a/shade/doc/source/user/examples/create-server-dict.py b/shade/doc/source/user/examples/create-server-dict.py index 5fa9400ce..6c3b969a8 100644 --- a/shade/doc/source/user/examples/create-server-dict.py +++ b/shade/doc/source/user/examples/create-server-dict.py @@ -1,7 +1,7 @@ -import shade +import openstack.cloud # Initialize and turn on debug logging -shade.simple_logging(debug=True) +openstack.cloud.simple_logging(debug=True) for cloud_name, region_name, image, flavor_id in [ ('my-vexxhost', 'ca-ymq-1', 'Ubuntu 16.04.1 LTS [2017-03-03]', @@ -11,7 +11,7 @@ for cloud_name, region_name, image, flavor_id in [ ('my-internap', 'ams01', 'Ubuntu 16.04 LTS (Xenial Xerus)', 'A1.4')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) # Boot a server, wait for it to boot, and then do whatever is needed # to get a public ip for it. diff --git a/shade/doc/source/user/examples/create-server-name-or-id.py b/shade/doc/source/user/examples/create-server-name-or-id.py index 66ab20e8d..10c151eb6 100644 --- a/shade/doc/source/user/examples/create-server-name-or-id.py +++ b/shade/doc/source/user/examples/create-server-name-or-id.py @@ -1,7 +1,7 @@ -import shade +import openstack.cloud # Initialize and turn on debug logging -shade.simple_logging(debug=True) +openstack.cloud.simple_logging(debug=True) for cloud_name, region_name, image, flavor in [ ('my-vexxhost', 'ca-ymq-1', @@ -11,7 +11,7 @@ for cloud_name, region_name, image, flavor in [ ('my-internap', 'ams01', 'Ubuntu 16.04 LTS (Xenial Xerus)', 'A1.4')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) cloud.delete_server('my-server', wait=True, delete_ips=True) # Boot a server, wait for it to boot, and then do whatever is needed diff --git a/shade/doc/source/user/examples/debug-logging.py b/shade/doc/source/user/examples/debug-logging.py index bf177f320..14806e4ef 100644 --- a/shade/doc/source/user/examples/debug-logging.py +++ b/shade/doc/source/user/examples/debug-logging.py @@ -1,6 +1,6 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud( +cloud = openstack.cloud.openstack_cloud( cloud='my-vexxhost', region_name='ca-ymq-1') cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]') diff --git a/shade/doc/source/user/examples/find-an-image.py b/shade/doc/source/user/examples/find-an-image.py index b7bfdb483..3b92b0356 100644 --- a/shade/doc/source/user/examples/find-an-image.py +++ b/shade/doc/source/user/examples/find-an-image.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging() +import openstack.cloud +openstack.cloud.simple_logging() -cloud = shade.openstack_cloud(cloud='fuga', region_name='cystack') +cloud = openstack.cloud.openstack_cloud(cloud='fuga', region_name='cystack') cloud.pprint([ image for image in cloud.list_images() if 'ubuntu' in image.name.lower()]) diff --git a/shade/doc/source/user/examples/http-debug-logging.py b/shade/doc/source/user/examples/http-debug-logging.py index 1a5b57f56..22a2b746c 100644 --- a/shade/doc/source/user/examples/http-debug-logging.py +++ b/shade/doc/source/user/examples/http-debug-logging.py @@ -1,6 +1,6 @@ -import shade -shade.simple_logging(http_debug=True) +import openstack.cloud +openstack.cloud.simple_logging(http_debug=True) -cloud = shade.openstack_cloud( +cloud = openstack.cloud.openstack_cloud( cloud='my-vexxhost', region_name='ca-ymq-1') cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]') diff --git a/shade/doc/source/user/examples/munch-dict-object.py b/shade/doc/source/user/examples/munch-dict-object.py index b5430dd2c..212cb0956 100644 --- a/shade/doc/source/user/examples/munch-dict-object.py +++ b/shade/doc/source/user/examples/munch-dict-object.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='ovh', region_name='SBG1') +cloud = openstack.cloud.openstack_cloud(cloud='ovh', region_name='SBG1') image = cloud.get_image('Ubuntu 16.10') print(image.name) print(image['name']) diff --git a/shade/doc/source/user/examples/normalization.py b/shade/doc/source/user/examples/normalization.py index 220214f2f..374b88577 100644 --- a/shade/doc/source/user/examples/normalization.py +++ b/shade/doc/source/user/examples/normalization.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging() +import openstack.cloud +openstack.cloud.simple_logging() -cloud = shade.openstack_cloud(cloud='fuga', region_name='cystack') +cloud = openstack.cloud.openstack_cloud(cloud='fuga', region_name='cystack') image = cloud.get_image( 'Ubuntu 16.04 LTS - Xenial Xerus - 64-bit - Fuga Cloud Based Image') cloud.pprint(image) diff --git a/shade/doc/source/user/examples/server-information.py b/shade/doc/source/user/examples/server-information.py index 79f45ea53..f896d287d 100644 --- a/shade/doc/source/user/examples/server-information.py +++ b/shade/doc/source/user/examples/server-information.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='my-citycloud', region_name='Buf1') +cloud = openstack.cloud.openstack_cloud(cloud='my-citycloud', region_name='Buf1') try: server = cloud.create_server( 'my-server', image='Ubuntu 16.04 Xenial Xerus', diff --git a/shade/doc/source/user/examples/service-conditional-overrides.py b/shade/doc/source/user/examples/service-conditional-overrides.py index 1b88f2033..62800630f 100644 --- a/shade/doc/source/user/examples/service-conditional-overrides.py +++ b/shade/doc/source/user/examples/service-conditional-overrides.py @@ -1,5 +1,5 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='rax', region_name='DFW') +cloud = openstack.cloud.openstack_cloud(cloud='rax', region_name='DFW') print(cloud.has_service('network')) diff --git a/shade/doc/source/user/examples/service-conditionals.py b/shade/doc/source/user/examples/service-conditionals.py index 2fa404c64..90953c7c8 100644 --- a/shade/doc/source/user/examples/service-conditionals.py +++ b/shade/doc/source/user/examples/service-conditionals.py @@ -1,6 +1,6 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='kiss', region_name='region1') +cloud = openstack.cloud.openstack_cloud(cloud='kiss', region_name='region1') print(cloud.has_service('network')) print(cloud.has_service('container-orchestration')) diff --git a/shade/doc/source/user/examples/strict-mode.py b/shade/doc/source/user/examples/strict-mode.py index e67bfc8cd..4ecbf0f2a 100644 --- a/shade/doc/source/user/examples/strict-mode.py +++ b/shade/doc/source/user/examples/strict-mode.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging() +import openstack.cloud +openstack.cloud.simple_logging() -cloud = shade.openstack_cloud( +cloud = openstack.cloud.openstack_cloud( cloud='fuga', region_name='cystack', strict=True) image = cloud.get_image( 'Ubuntu 16.04 LTS - Xenial Xerus - 64-bit - Fuga Cloud Based Image') diff --git a/shade/doc/source/user/examples/upload-large-object.py b/shade/doc/source/user/examples/upload-large-object.py index 4a83728e5..10aa13cd0 100644 --- a/shade/doc/source/user/examples/upload-large-object.py +++ b/shade/doc/source/user/examples/upload-large-object.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='ovh', region_name='SBG1') +cloud = openstack.cloud.openstack_cloud(cloud='ovh', region_name='SBG1') cloud.create_object( container='my-container', name='my-object', filename='/home/mordred/briarcliff.sh3d', diff --git a/shade/doc/source/user/examples/upload-object.py b/shade/doc/source/user/examples/upload-object.py index 4a83728e5..10aa13cd0 100644 --- a/shade/doc/source/user/examples/upload-object.py +++ b/shade/doc/source/user/examples/upload-object.py @@ -1,7 +1,7 @@ -import shade -shade.simple_logging(debug=True) +import openstack.cloud +openstack.cloud.simple_logging(debug=True) -cloud = shade.openstack_cloud(cloud='ovh', region_name='SBG1') +cloud = openstack.cloud.openstack_cloud(cloud='ovh', region_name='SBG1') cloud.create_object( container='my-container', name='my-object', filename='/home/mordred/briarcliff.sh3d', diff --git a/shade/doc/source/user/examples/user-agent.py b/shade/doc/source/user/examples/user-agent.py index 01aba7706..f65052854 100644 --- a/shade/doc/source/user/examples/user-agent.py +++ b/shade/doc/source/user/examples/user-agent.py @@ -1,6 +1,6 @@ -import shade -shade.simple_logging(http_debug=True) +import openstack.cloud +openstack.cloud.simple_logging(http_debug=True) -cloud = shade.openstack_cloud( +cloud = openstack.cloud.openstack_cloud( cloud='datacentred', app_name='AmazingApp', app_version='1.0') cloud.list_networks() diff --git a/shade/doc/source/user/logging.rst b/shade/doc/source/user/logging.rst index 5915de9ec..12f606a03 100644 --- a/shade/doc/source/user/logging.rst +++ b/shade/doc/source/user/logging.rst @@ -15,10 +15,10 @@ before any other `shade` functionality. .. code-block:: python - import shade - shade.simple_logging() + import openstack.cloud + openstack.cloud.simple_logging() -`shade.simple_logging` takes two optional boolean arguments: +`openstack.cloud.simple_logging` takes two optional boolean arguments: debug Turns on debug logging. @@ -26,7 +26,7 @@ debug http_debug Turns on debug logging as well as debug logging of the underlying HTTP calls. -`shade.simple_logging` also sets up a few other loggers and squelches some +`openstack.cloud.simple_logging` also sets up a few other loggers and squelches some warnings or log messages that are otherwise uninteresting or unactionable by a `shade` user. @@ -39,39 +39,39 @@ Most of the logging is set up to log to the root `shade` logger. There are additional sub-loggers that are used at times, primarily so that a user can decide to turn on or off a specific type of logging. They are listed below. -shade.task_manager - `shade` uses a Task Manager to perform remote calls. The `shade.task_manager` +openstack.cloud.task_manager + `shade` uses a Task Manager to perform remote calls. The `openstack.cloud.task_manager` logger emits messages at the start and end of each Task announging what it is going to run and then what it ran and how long it took. Logging - `shade.task_manager` is a good way to get a trace of external actions shade + `openstack.cloud.task_manager` is a good way to get a trace of external actions shade is taking without full `HTTP Tracing`_. -shade.request_ids - The `shade.request_ids` logger emits a log line at the end of each HTTP +openstack.cloud.request_ids + The `openstack.cloud.request_ids` logger emits a log line at the end of each HTTP interaction with the OpenStack Request ID associated with the interaction. This can be be useful for tracking action taken on the server-side if one does not want `HTTP Tracing`_. -shade.exc +openstack.cloud.exc If `log_inner_exceptions` is set to True, `shade` will emit any wrapped - exception to the `shade.exc` logger. Wrapped exceptions are usually + exception to the `openstack.cloud.exc` logger. Wrapped exceptions are usually considered implementation details, but can be useful for debugging problems. -shade.iterate_timeout +openstack.cloud.iterate_timeout When `shade` needs to poll a resource, it does so in a loop that waits - between iterations and ultimately timesout. The `shade.iterate_timeout` + between iterations and ultimately timesout. The `openstack.cloud.iterate_timeout` logger emits messages for each iteration indicating it is waiting and for how long. These can be useful to see for long running tasks so that one can know things are not stuck, but can also be noisy. -shade.http +openstack.cloud.http `shade` will sometimes log additional information about HTTP interactions - to the `shade.http` logger. This can be verbose, as it sometimes logs + to the `openstack.cloud.http` logger. This can be verbose, as it sometimes logs entire response bodies. -shade.fnmatch +openstack.cloud.fnmatch `shade` will try to use `fnmatch`_ on given `name_or_id` arguments. It's a - best effort attempt, so pattern misses are logged to `shade.fnmatch`. A user + best effort attempt, so pattern misses are logged to `openstack.cloud.fnmatch`. A user may not be intending to use an fnmatch pattern - such as if they are trying to find an image named ``Fedora 24 [official]``, so these messages are logged separately. @@ -82,7 +82,7 @@ HTTP Tracing ------------ HTTP Interactions are handled by `keystoneauth`. If you want to enable HTTP -tracing while using `shade` and are not using `shade.simple_logging`, +tracing while using `shade` and are not using `openstack.cloud.simple_logging`, set the log level of the `keystoneauth` logger to `DEBUG`. Python Logging diff --git a/shade/doc/source/user/microversions.rst b/shade/doc/source/user/microversions.rst index 8e4142a90..ce821dace 100644 --- a/shade/doc/source/user/microversions.rst +++ b/shade/doc/source/user/microversions.rst @@ -8,7 +8,7 @@ logic to handle each microversion for a given REST call it makes, with the following rules in mind: * If an activity shade performs can be done differently or more efficiently - with a new microversion, the support should be added to shade. + with a new microversion, the support should be added to openstack.cloud. * shade should always attempt to use the latest microversion it is aware of for a given call, unless a microversion removes important data. diff --git a/shade/doc/source/user/multi-cloud-demo.rst b/shade/doc/source/user/multi-cloud-demo.rst index fdd9dcb1b..449f16650 100644 --- a/shade/doc/source/user/multi-cloud-demo.rst +++ b/shade/doc/source/user/multi-cloud-demo.rst @@ -62,17 +62,17 @@ Complete Example .. code:: python - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) for cloud_name, region_name in [ ('my-vexxhost', 'ca-ymq-1'), ('my-citycloud', 'Buf1'), ('my-internap', 'ams01')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) # Upload an image to the cloud image = cloud.create_image( @@ -314,17 +314,17 @@ Complete Example Again .. code:: python - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) for cloud_name, region_name in [ ('my-vexxhost', 'ca-ymq-1'), ('my-citycloud', 'Buf1'), ('my-internap', 'ams01')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) # Upload an image to the cloud image = cloud.create_image( @@ -346,27 +346,27 @@ Import the library .. code:: python - import shade + import openstack.cloud Logging ======= * `shade` uses standard python logging -* Special `shade.request_ids` logger for API request IDs +* Special `openstack.cloud.request_ids` logger for API request IDs * `simple_logging` does easy defaults * Squelches some meaningless warnings * `debug` * Logs shade loggers at debug level - * Includes `shade.request_ids` debug logging + * Includes `openstack.cloud.request_ids` debug logging * `http_debug` Implies `debug`, turns on HTTP tracing .. code:: python # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) Example with Debug Logging ========================== @@ -375,10 +375,10 @@ Example with Debug Logging .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud( + cloud = openstack.cloud.openstack_cloud( cloud='my-vexxhost', region_name='ca-ymq-1') cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]') @@ -389,10 +389,10 @@ Example with HTTP Debug Logging .. code:: python - import shade - shade.simple_logging(http_debug=True) + import openstack.cloud + openstack.cloud.simple_logging(http_debug=True) - cloud = shade.openstack_cloud( + cloud = openstack.cloud.openstack_cloud( cloud='my-vexxhost', region_name='ca-ymq-1') cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]') @@ -400,7 +400,7 @@ Cloud Regions ============= * `cloud` constructor needs `cloud` and `region_name` -* `shade.openstack_cloud` is a helper factory function +* `openstack.cloud.openstack_cloud` is a helper factory function .. code:: python @@ -409,7 +409,7 @@ Cloud Regions ('my-citycloud', 'Buf1'), ('my-internap', 'ams01')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) Upload an Image =============== @@ -486,10 +486,10 @@ Image and Flavor by Name or ID .. code:: python - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) for cloud_name, region_name, image, flavor in [ ('my-vexxhost', 'ca-ymq-1', @@ -499,7 +499,7 @@ Image and Flavor by Name or ID ('my-internap', 'ams01', 'Ubuntu 16.04 LTS (Xenial Xerus)', 'A1.4')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) # Boot a server, wait for it to boot, and then do whatever is needed # to get a public ip for it. @@ -533,10 +533,10 @@ Image and Flavor by Dict .. code:: python - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) for cloud_name, region_name, image, flavor_id in [ ('my-vexxhost', 'ca-ymq-1', 'Ubuntu 16.04.1 LTS [2017-03-03]', @@ -546,7 +546,7 @@ Image and Flavor by Dict ('my-internap', 'ams01', 'Ubuntu 16.04 LTS (Xenial Xerus)', 'A1.4')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) # Boot a server, wait for it to boot, and then do whatever is needed # to get a public ip for it. @@ -564,10 +564,10 @@ Munch Objects .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='zetta', region_name='no-osl1') + cloud = openstack.cloud.openstack_cloud(cloud='zetta', region_name='no-osl1') image = cloud.get_image('Ubuntu 14.04 (AMD64) [Local Storage]') print(image.name) print(image['name']) @@ -596,17 +596,17 @@ Cleanup Script .. code:: python - import shade + import openstack.cloud # Initialize and turn on debug logging - shade.simple_logging(debug=True) + openstack.cloud.simple_logging(debug=True) for cloud_name, region_name in [ ('my-vexxhost', 'ca-ymq-1'), ('my-citycloud', 'Buf1'), ('my-internap', 'ams01')]: # Initialize cloud - cloud = shade.openstack_cloud(cloud=cloud_name, region_name=region_name) + cloud = openstack.cloud.openstack_cloud(cloud=cloud_name, region_name=region_name) for server in cloud.search_servers('my-server'): cloud.delete_server(server, wait=True, delete_ips=True) @@ -618,10 +618,10 @@ Normalization .. code:: python - import shade - shade.simple_logging() + import openstack.cloud + openstack.cloud.simple_logging() - cloud = shade.openstack_cloud(cloud='fuga', region_name='cystack') + cloud = openstack.cloud.openstack_cloud(cloud='fuga', region_name='cystack') image = cloud.get_image( 'Ubuntu 16.04 LTS - Xenial Xerus - 64-bit - Fuga Cloud Based Image') cloud.pprint(image) @@ -634,10 +634,10 @@ Strict Normalized Results .. code:: python - import shade - shade.simple_logging() + import openstack.cloud + openstack.cloud.simple_logging() - cloud = shade.openstack_cloud( + cloud = openstack.cloud.openstack_cloud( cloud='fuga', region_name='cystack', strict=True) image = cloud.get_image( 'Ubuntu 16.04 LTS - Xenial Xerus - 64-bit - Fuga Cloud Based Image') @@ -651,10 +651,10 @@ How Did I Find the Image Name for the Last Example? .. code:: python - import shade - shade.simple_logging() + import openstack.cloud + openstack.cloud.simple_logging() - cloud = shade.openstack_cloud(cloud='fuga', region_name='cystack') + cloud = openstack.cloud.openstack_cloud(cloud='fuga', region_name='cystack') cloud.pprint([ image for image in cloud.list_images() if 'ubuntu' in image.name.lower()]) @@ -672,10 +672,10 @@ Added / Modified Information .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='my-citycloud', region_name='Buf1') + cloud = openstack.cloud.openstack_cloud(cloud='my-citycloud', region_name='Buf1') try: server = cloud.create_server( 'my-server', image='Ubuntu 16.04 Xenial Xerus', @@ -714,10 +714,10 @@ User Agent Info .. code:: python - import shade - shade.simple_logging(http_debug=True) + import openstack.cloud + openstack.cloud.simple_logging(http_debug=True) - cloud = shade.openstack_cloud( + cloud = openstack.cloud.openstack_cloud( cloud='datacentred', app_name='AmazingApp', app_version='1.0') cloud.list_networks() @@ -732,10 +732,10 @@ Uploading Large Objects .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='ovh', region_name='SBG1') + cloud = openstack.cloud.openstack_cloud(cloud='ovh', region_name='SBG1') cloud.create_object( container='my-container', name='my-object', filename='/home/mordred/briarcliff.sh3d') @@ -753,10 +753,10 @@ Uploading Large Objects .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='ovh', region_name='SBG1') + cloud = openstack.cloud.openstack_cloud(cloud='ovh', region_name='SBG1') cloud.create_object( container='my-container', name='my-object', filename='/home/mordred/briarcliff.sh3d', @@ -769,10 +769,10 @@ Service Conditionals .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='kiss', region_name='region1') + cloud = openstack.cloud.openstack_cloud(cloud='kiss', region_name='region1') print(cloud.has_service('network')) print(cloud.has_service('container-orchestration')) @@ -783,10 +783,10 @@ Service Conditional Overrides .. code:: python - import shade - shade.simple_logging(debug=True) + import openstack.cloud + openstack.cloud.simple_logging(debug=True) - cloud = shade.openstack_cloud(cloud='rax', region_name='DFW') + cloud = openstack.cloud.openstack_cloud(cloud='rax', region_name='DFW') print(cloud.has_service('network')) .. code:: yaml diff --git a/shade/doc/source/user/usage.rst b/shade/doc/source/user/usage.rst index fe37d74cb..e66c89a04 100644 --- a/shade/doc/source/user/usage.rst +++ b/shade/doc/source/user/usage.rst @@ -4,7 +4,7 @@ Usage To use shade in a project:: - import shade + import openstack.cloud For a simple example, see :ref:`example`. @@ -15,8 +15,8 @@ For a simple example, see :ref:`example`. objects can be accessed using either dictionary or object notation (e.g., ``server.id``, ``image.name`` and ``server['id']``, ``image['name']``) -.. autoclass:: shade.OpenStackCloud +.. autoclass:: openstack.cloud.OpenStackCloud :members: -.. autoclass:: shade.OperatorCloud +.. autoclass:: openstack.cloud.OperatorCloud :members: diff --git a/shade/setup.cfg b/shade/setup.cfg index 3f3300b3d..0ad4c36c8 100644 --- a/shade/setup.cfg +++ b/shade/setup.cfg @@ -18,10 +18,6 @@ classifier = Programming Language :: Python :: 3 Programming Language :: Python :: 3.4 -[entry_points] -console_scripts = - shade-inventory = shade.cmd.inventory:main - [build_sphinx] source-dir = doc/source build-dir = doc/build diff --git a/shade/shade/_legacy_clients.py b/shade/shade/_legacy_clients.py deleted file mode 100644 index fa6f51776..000000000 --- a/shade/shade/_legacy_clients.py +++ /dev/null @@ -1,252 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import importlib -import warnings - -from keystoneauth1 import plugin -from os_client_config import constructors - -from shade import _utils -from shade import exc - - -class LegacyClientFactoryMixin(object): - """Mixin Class containing factory functions for legacy client objects. - - Methods in this class exist for backwards compatibility so will not go - away any time - but they are all things whose use is discouraged. They're - in a mixin to unclutter the main class file. - """ - - def _create_legacy_client( - self, client, service, deprecated=True, - module_name=None, **kwargs): - if client not in self._legacy_clients: - if deprecated: - self._deprecated_import_check(client) - if module_name: - constructors.get_constructor_mapping()[service] = module_name - self._legacy_clients[client] = self._get_client(service, **kwargs) - return self._legacy_clients[client] - - def _deprecated_import_check(self, client): - module_name = '{client}client'.format(client=client) - warnings.warn( - 'Using shade to get a {module_name} object is deprecated. If you' - ' need a {module_name} object, please use make_legacy_client in' - ' os-client-config instead'.format(module_name=module_name)) - try: - importlib.import_module(module_name) - except ImportError: - self.log.error( - '{module_name} is no longer a dependency of shade. You need to' - ' install python-{module_name} directly.'.format( - module_name=module_name)) - raise - - @property - def trove_client(self): - return self._create_legacy_client('trove', 'database') - - @property - def magnum_client(self): - return self._create_legacy_client('magnum', 'container-infra') - - @property - def neutron_client(self): - return self._create_legacy_client('neutron', 'network') - - @property - def nova_client(self): - return self._create_legacy_client('nova', 'compute', version='2.0') - - @property - def glance_client(self): - return self._create_legacy_client('glance', 'image') - - @property - def heat_client(self): - return self._create_legacy_client('heat', 'orchestration') - - @property - def swift_client(self): - return self._create_legacy_client('swift', 'object-store') - - @property - def cinder_client(self): - return self._create_legacy_client('cinder', 'volume') - - @property - def designate_client(self): - return self._create_legacy_client('designate', 'dns') - - @property - def keystone_client(self): - # Trigger discovery from ksa - self._identity_client - - # Skip broken discovery in ksc. We're good thanks. - from keystoneclient.v2_0 import client as v2_client - from keystoneclient.v3 import client as v3_client - if self.cloud_config.config['identity_api_version'] == '3': - client_class = v3_client - else: - client_class = v2_client - - return self._create_legacy_client( - 'keystone', 'identity', - client_class=client_class.Client, - deprecated=True, - endpoint=self._identity_client.get_endpoint(), - endpoint_override=self._identity_client.get_endpoint()) - - # Set the ironic API microversion to a known-good - # supported/tested with the contents of shade. - # - # NOTE(TheJulia): Defaulted to version 1.6 as the ironic - # state machine changes which will increment the version - # and break an automatic transition of an enrolled node - # to an available state. Locking the version is intended - # to utilize the original transition until shade supports - # calling for node inspection to allow the transition to - # take place automatically. - # NOTE(mordred): shade will handle microversions more - # directly in the REST layer. This microversion property - # will never change. When we implement REST, we should - # start at 1.6 since that's what we've been requesting - # via ironic_client - @property - def ironic_api_microversion(self): - # NOTE(mordred) Abuse _legacy_clients to only show - # this warning once - if 'ironic-microversion' not in self._legacy_clients: - warnings.warn( - 'shade is transitioning to direct REST calls which' - ' will handle microversions with no action needed' - ' on the part of the user. The ironic_api_microversion' - ' property is only used by the legacy ironic_client' - ' constructor and will never change. If you are using' - ' it for any reason, either switch to just using' - ' shade ironic-related API calls, or use os-client-config' - ' make_legacy_client directly and pass os_ironic_api_version' - ' to it as an argument. It is highly recommended to' - ' stop using this property.') - self._legacy_clients['ironic-microversion'] = True - return self._get_legacy_ironic_microversion() - - def _get_legacy_ironic_microversion(self): - return '1.6' - - def _join_ksa_version(self, version): - return ".".join([str(x) for x in version]) - - @property - def ironic_client(self): - # Trigger discovery from ksa. This will make ironicclient and - # keystoneauth1.adapter.Adapter code paths both go through discovery. - # ironicclient does its own magic with discovery, so we won't - # pass an endpoint_override here like we do for keystoneclient. - # Just so it's not wasted though, make sure we can handle the - # min microversion we need. - needed = self._get_legacy_ironic_microversion() - - # TODO(mordred) Bug in ksa - don't do microversion matching for - # auth_type = admin_token. Remove this if when the fix lands. - if (hasattr(plugin.BaseAuthPlugin, 'get_endpoint_data') or - self.cloud_config.config['auth_type'] not in ( - 'admin_token', 'none')): - # TODO(mordred) once we're on REST properly, we need a better - # method for matching requested and available microversion - endpoint_data = self._baremetal_client.get_endpoint_data() - if not endpoint_data.min_microversion: - raise exc.OpenStackCloudException( - "shade needs an ironic that supports microversions") - if endpoint_data.min_microversion[1] > int(needed[-1]): - raise exc.OpenStackCloudException( - "shade needs an ironic that supports microversion {needed}" - " but the ironic found has a minimum microversion" - " of {found}".format( - needed=needed, - found=self._join_ksa_version( - endpoint_data.min_microversion))) - if endpoint_data.max_microversion[1] < int(needed[-1]): - raise exc.OpenStackCloudException( - "shade needs an ironic that supports microversion {needed}" - " but the ironic found has a maximum microversion" - " of {found}".format( - needed=needed, - found=self._join_ksa_version( - endpoint_data.max_microversion))) - - return self._create_legacy_client( - 'ironic', 'baremetal', deprecated=False, - module_name='ironicclient.client.Client', - os_ironic_api_version=self._get_legacy_ironic_microversion()) - - def _get_swift_kwargs(self): - auth_version = self.cloud_config.get_api_version('identity') - auth_args = self.cloud_config.config.get('auth', {}) - os_options = {'auth_version': auth_version} - if auth_version == '2.0': - os_options['os_tenant_name'] = auth_args.get('project_name') - os_options['os_tenant_id'] = auth_args.get('project_id') - else: - os_options['os_project_name'] = auth_args.get('project_name') - os_options['os_project_id'] = auth_args.get('project_id') - - for key in ( - 'username', - 'password', - 'auth_url', - 'user_id', - 'project_domain_id', - 'project_domain_name', - 'user_domain_id', - 'user_domain_name'): - os_options['os_{key}'.format(key=key)] = auth_args.get(key) - return os_options - - @property - def swift_service(self): - suppress_warning = 'swift-service' not in self._legacy_clients - return self.make_swift_service_object(suppress_warning) - - def make_swift_service(self, suppress_warning=False): - # NOTE(mordred): Not using helper functions because the - # error message needs to be different - if not suppress_warning: - warnings.warn( - 'Using shade to get a SwiftService object is deprecated. shade' - ' will automatically do the things SwiftServices does as part' - ' of the normal object resource calls. If you are having' - ' trouble using those such that you still need to use' - ' SwiftService, please file a bug with shade.' - ' If you understand the issues and want to make this warning' - ' go away, use cloud.make_swift_service(True) instead of' - ' cloud.swift_service') - # Abuse self._legacy_clients so that we only give the warning - # once. We don't cache SwiftService objects. - self._legacy_clients['swift-service'] = True - try: - import swiftclient.service - except ImportError: - self.log.error( - 'swiftclient is no longer a dependency of shade. You need to' - ' install python-swiftclient directly.') - with _utils.shade_exceptions("Error constructing SwiftService"): - endpoint = self.get_session_endpoint( - service_key='object-store') - options = dict(os_auth_token=self.auth_token, - os_storage_url=endpoint, - os_region_name=self.region_name) - options.update(self._get_swift_kwargs()) - return swiftclient.service.SwiftService(options=options) diff --git a/tox.ini b/tox.ini index 789758b43..b6ab412d3 100644 --- a/tox.ini +++ b/tox.ini @@ -44,6 +44,15 @@ commands = python setup.py test --coverage --coverage-package-name=openstack --t commands = python setup.py build_sphinx [flake8] -ignore=D100,D101,D102,D103,D104,D105,D200,D202,D204,D205,D211,D301,D400,D401 +# The following are ignored on purpose. It's not super worth it to fix them. +# However, if you feel strongly about it, patches will be accepted to fix them +# if they fix ALL of the occurances of one and only one of them. +# H103 Is about the Apache license. It's strangely strict about the use of +# single vs double quotes in the license text. If someone decides to fix +# this, please be sure to preseve all copyright lines. +# H306 Is about alphabetical imports - there's a lot to fix. +# H4 Are about docstrings and there's just a huge pile of pre-existing issues. +# D* Came from sdk, unknown why they're skipped. +ignore = H103,H306,H4,D100,D101,D102,D103,D104,D105,D200,D202,D204,D205,D211,D301,D400,D401 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build