libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [libcloud] Kami commented on a change in pull request #1395: Add LXD driver & tests
Date Tue, 24 Dec 2019 19:08:32 GMT
Kami commented on a change in pull request #1395: Add LXD driver & tests

 File path: libcloud/container/drivers/
 @@ -0,0 +1,1269 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import base64
+import re
+import os
+    import simplejson as json
+except Exception:
+    import json
+from libcloud.utils.py3 import httplib
+from libcloud.utils.py3 import b
+from libcloud.common.base import JsonResponse, ConnectionUserAndKey
+from libcloud.common.base import KeyCertificateConnection
+from libcloud.common.types import InvalidCredsError
+from libcloud.container.base import (Container, ContainerDriver,
+                                     ContainerImage)
+from libcloud.common.exceptions import BaseHTTPError
+from libcloud.compute.base import StorageVolume
+from libcloud.container.providers import Provider
+from libcloud.container.types import ContainerState
+# Acceptable success strings comping from LXD API
+LXD_API_STATE_ACTIONS = ['stop', 'start', 'restart', 'freeze', 'unfreeze']
+LXD_API_IMAGE_SOURCE_TYPE = ["image", "migration", "copy", "none"]
+# the wording used by LXD to indicate that an error
+# occurred for a request
+# helpers
+def strip_http_prefix(host):
+    # strip the prefix
+    prefixes = ['http://', 'https://']
+    for prefix in prefixes:
+        if host.startswith(prefix):
+            host = host.strip(prefix)
+    return host
+def check_certificates(key_file, cert_file, **kwargs):
 Review comment:
   It appears that some of that logic is similar to the one in #1394 so once those PRs are
merged, both of the drivers could perhaps be refactored to use those common utility functions.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message