-
Notifications
You must be signed in to change notification settings - Fork 927
add more location to OVH and avoid exception when location is not in the list #2123
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,6 @@ | |
| from libcloud.compute.types import Provider, StorageVolumeState, VolumeSnapshotState | ||
| from libcloud.compute.drivers.openstack import OpenStackKeyPair, OpenStackNodeDriver | ||
|
|
||
|
|
||
| class OvhNodeDriver(NodeDriver): | ||
| """ | ||
| Libcloud driver for the Ovh API | ||
|
|
@@ -537,7 +536,9 @@ def _to_volumes(self, objs): | |
| return [self._to_volume(obj) for obj in objs] | ||
|
|
||
| def _to_location(self, obj): | ||
| location = self.connectionCls.LOCATIONS[obj] | ||
| location = self.connectionCls.LOCATIONS.get(obj) | ||
| if not location: | ||
| location = {"id": obj, "name": obj, "country": ""} | ||
|
Comment on lines
539
to
541
|
||
|
|
||
| return NodeLocation(driver=self, **location) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 'UK' as a country code is inconsistent with ISO 3166-1 alpha-2 standards, which uses 'GB' for the United Kingdom. However, this appears to be an existing pattern in the codebase (see line 50 with LON1). For consistency with existing entries, this may be acceptable, but consider using 'GB' for proper ISO compliance in future additions.