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

LIBCLOUD-700 Add support for setting the region #513


Copy link

@tonybaloney tonybaloney commented May 8, 2015

when connecting to a Dimension Data cloud, added all public endpoints.

…Dimension Data cloud, added all public endpoints.
secure=secure, host=host,
region=region, **kwargs) = self.selected_region.get('host')
Copy link

@Kami Kami May 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this won't work correctly when user instantiates multiple drivers with a different region and runs those inside the same process.

You should use _ex_connection_kwargs approach. This way, host argument will be passed to the Connection class constructor when instantiating it instead of modifying a class level variable. Please see EC2 and some other drivers for an example.

Copy link
Contributor Author

tonybaloney commented May 8, 2015

I based it on the joyent driver, which follows a similar pattern (so of note that one may suffer the same issue!).

Running DimensionData and Rackspace side by side does give results for the DimensionData driver, then
NameError: name 'driver' is not defined

Will follow the EC2 pattern instead and resubmit changes

Copy link
Contributor Author

tonybaloney commented May 10, 2015

Updated and tested against multiple regions in the same process by:

DimensionData = get_driver(Provider.DIMENSIONDATA)

drivers = [DimensionData('anthony','****',region='dd-na'),

for driver in drivers:
nodes = driver.list_nodes()

Gives 14 and 154 as expected.

Copy link

Kami commented May 12, 2015

@tonybaloney Thanks, I will have a look.

Also, to clarify it, your example wouldn't uncover the bug. You would need to do something like this:

driver1 = cls(region='region-1')
driver2 = cls(region='region-2')

pprint(driver1.list_nodes())  # If there is a bug, this line would result in region from driver2 also being used here

Copy link
Contributor Author

tonybaloney commented May 14, 2015


gives 5, 154 and 5, so its not giving that bug

@asfgit asfgit closed this in 92c107d May 16, 2015
Copy link

Kami commented May 16, 2015

I made a minor change (use normal dictionary access instead of get - we should throw if dictionary doesn't contain "host" item since this most likely indicates a programmer error) and merged changes into trunk.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants