pyrax icon indicating copy to clipboard operation
pyrax copied to clipboard

mismatching tables prevent getting cloud networks client using a context

Open saahn opened this issue 11 years ago • 1 comments

Related to #381 , the _client_classes dict in pyrax/__init__.py has no mapping for the "network" service in self.service_mapping in pyrax/base_identity.py. This breaks getting the network client from a context object.

pyrax/init.py line121:

_client_classes = {
        "object_store": _cf.CFClient,
        "compute": _cs_client.Client,
        "database": CloudDatabaseClient,
        "load_balancer": CloudLoadBalancerClient,
        "volume": CloudBlockStorageClient,
        "dns": CloudDNSClient,
        "compute:network": CloudNetworkClient,
        "monitor": CloudMonitorClient,
        "autoscale": AutoScaleClient,
        "image": ImageClient,
        "queues": QueueClient,
        }

pyrax/base_identity line294:

        self.service_mapping = {
                "cloudservers": "compute",
                "nova": "compute",
                "cloudfiles": "object_store",
                "swift": "object_store",
                "cloud_loadbalancers": "load_balancer",
                "cloud_databases": "database",
                "trove": "database",
                "cloud_blockstorage": "volume",
                "cinder": "volume",
                "cloud_dns": "dns",
                "designate": "dns",
                "cloud_networks": "raxnetwork",
                "neutron": "network",
                "cloud_monitoring": "monitor",
                "autoscale": "autoscale",
                "images": "image",
                "glance": "image",
                "queues": "queues",
                "marconi": "queues",
                }

My workaround was to change "compute:network": CloudNetworkClient, to "network": CloudNetworkClient, and add "raxnetwork": CloudNetworkClient, in init.py

saahn avatar May 30 '14 23:05 saahn

That would be fine for Rackspace-only, but would potentially break other OpenStack uses where network means the Neutron API endpoints. compute:network represents nova-network, which is what Rackspace uses. Using the service name cloud_networks works fine with context objects:

import pyrax
ctx = pyrax.create_context()
ctx.keyring_auth()
print ctx.get_client("cloud_networks", "DFW")
<pyrax.cloudnetworks.CloudNetworkClient at 0x105e1cf50>

EdLeafe avatar Jun 02 '14 16:06 EdLeafe