Renamed SERVER_STATE to NODE_STATE_MAP and moved it to UpcloudDriver for better consistency with other drivers
Signed-off-by: Quentin Pradet <quent...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e7df9487 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e7df9487 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e7df9487 Branch: refs/heads/trunk Commit: e7df94873dc0e2f9c5bfdd358fe99da6eda82c04 Parents: a2dc54a Author: Mika Lackman <mika.lack...@upcloud.com> Authored: Tue Sep 26 15:33:23 2017 +0300 Committer: Quentin Pradet <quent...@apache.org> Committed: Wed Sep 27 07:04:33 2017 +0400 ---------------------------------------------------------------------- libcloud/compute/drivers/upcloud.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e7df9487/libcloud/compute/drivers/upcloud.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/upcloud.py b/libcloud/compute/drivers/upcloud.py index d2e0314..c9c762e 100644 --- a/libcloud/compute/drivers/upcloud.py +++ b/libcloud/compute/drivers/upcloud.py @@ -28,13 +28,6 @@ from libcloud.common.upcloud import UpcloudCreateNodeRequestBody from libcloud.common.upcloud import UpcloudNodeDestroyer from libcloud.common.upcloud import UpcloudNodeOperations -SERVER_STATE = { - 'started': NodeState.RUNNING, - 'stopped': NodeState.STOPPED, - 'maintenance': NodeState.RECONFIGURING, - 'error': NodeState.ERROR -} - class UpcloudResponse(JsonResponse): """ @@ -92,6 +85,13 @@ class UpcloudDriver(NodeDriver): connectionCls = UpcloudConnection features = {'create_node': ['ssh_key', 'generates_password']} + NODE_STATE_MAP = { + 'started': NodeState.RUNNING, + 'stopped': NodeState.STOPPED, + 'maintenance': NodeState.RECONFIGURING, + 'error': NodeState.ERROR + } + def __init__(self, username, password, **kwargs): super(UpcloudDriver, self).__init__(key=username, secret=password, **kwargs) @@ -236,7 +236,7 @@ class UpcloudDriver(NodeDriver): extra['password'] = server['password'] return Node(id=server['uuid'], name=server['title'], - state=state or SERVER_STATE[server['state']], + state=state or self.NODE_STATE_MAP[server['state']], public_ips=public_ips, private_ips=private_ips, driver=self,