Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong object returned #569

Open
eljrax opened this issue Jul 28, 2015 · 0 comments
Open

Wrong object returned #569

eljrax opened this issue Jul 28, 2015 · 0 comments

Comments

@eljrax
Copy link

eljrax commented Jul 28, 2015

There appears to be a bug in the caching of context objects. Consider the code below. If I add cached=False to the second call for get_client('nova', region), it works as expected.

Admittedly it's rather odd to ask for the same client twice in the same scope, but this behaviour may manifest itself in other ways as well?

import pyrax

token = ''
ddi = 
region = ''


pyrax_ctx = pyrax.create_context("rackspace")
pyrax_ctx.auth_with_token(token, ddi)

nova_lon = pyrax_ctx.get_client('nova', region)
print type(nova_lon)
network_lon = pyrax_ctx.get_client('cloud_networks', region)
print type(network_lon)
nova_lon = pyrax_ctx.get_client('nova', region)
print type(nova_lon)
glance_lon = pyrax_ctx.get_client('glance', region)
print type(glance_lon)



Expected output:

<class 'novaclient.v2.client.Client'>
<class 'pyrax.cloudnetworks.CloudNetworkClient'>
<class 'novaclient.v2.client.Client'>
<class 'pyrax.image.ImageClient'>

Actual output:
<class 'novaclient.v2.client.Client'>
<class 'pyrax.cloudnetworks.CloudNetworkClient'>
<class 'pyrax.cloudnetworks.CloudNetworkClient'>    <--- Why?
<class 'pyrax.image.ImageClient'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant