libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [45/45] libcloud git commit: made pyopenssl optional Closes #1255
Date Thu, 13 Dec 2018 11:26:54 GMT
made pyopenssl optional
Closes #1255


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/de159ec7
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/de159ec7
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/de159ec7

Branch: refs/heads/trunk
Commit: de159ec7b7693c321f12db8eca15656f387c18bc
Parents: efa8f97
Author: mitch <mitch.raful@itaas.dimensiondata.com>
Authored: Thu Dec 6 14:06:22 2018 -0500
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Thu Dec 13 19:24:18 2018 +0800

----------------------------------------------------------------------
 libcloud/loadbalancer/drivers/nttcis.py | 14 ++++++++++----
 tox.ini                                 |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/de159ec7/libcloud/loadbalancer/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/drivers/nttcis.py b/libcloud/loadbalancer/drivers/nttcis.py
index 316f918..5d56e0c 100644
--- a/libcloud/loadbalancer/drivers/nttcis.py
+++ b/libcloud/loadbalancer/drivers/nttcis.py
@@ -12,7 +12,13 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-import OpenSSL.crypto
+try:
+    import OpenSSL
+    OpenSSL
+except ImportError:
+    raise ImportError('Missing "OpenSSL" dependency. You can install it '
+                      'using pip - pip install pyopenssl')
+from OpenSSL import crypto
 from libcloud.utils.py3 import ET
 from libcloud.common.nttcis import NttCisConnection
 from libcloud.common.nttcis import NttCisPool
@@ -833,10 +839,10 @@ class NttCisLBDriver(Driver):
         :type description: ``str``
         :return: ``bool``
         """
-        c = OpenSSL.crypto.load_certificate(
-            OpenSSL.crypto.FILETYPE_PEM, open(chain_crt_file).read())
+        c = crypto.load_certificate(
+            crypto.FILETYPE_PEM, open(chain_crt_file).read())
         cert = OpenSSL.crypto.dump_certificate(
-            OpenSSL.crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
+            crypto.FILETYPE_PEM, c).decode(encoding='utf-8')
         cert_chain_elem = ET.Element("importSslCertificateChain",
                                      {"xmlns": TYPES_URN})
         ET.SubElement(cert_chain_elem, "networkDomainId") \

http://git-wip-us.apache.org/repos/asf/libcloud/blob/de159ec7/tox.ini
----------------------------------------------------------------------
diff --git a/tox.ini b/tox.ini
index 293ccf9..dbcad71 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,8 +5,8 @@ envlist = py{2.7,pypy,pypy3,3.4,3.5,3.6,3.7},checks,lint,pylint,integration,cove
 passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
 deps =
     -r{toxinidir}/requirements-tests.txt
-    lockfile
     pyopenssl
+    lockfile
     libvirt-python==4.0.0
     py2.7: paramiko
 commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
@@ -30,6 +30,7 @@ commands = cp libcloud/test/secrets.py-dist libcloud/test/secrets.py
 
 [testenv:docs]
 deps = pysphere
+       pyopenssl
        backports.ssl_match_hostname
        lockfile
        rstcheck
@@ -45,6 +46,7 @@ commands = pip install sphinx~=1.6.0
 # Note: We don't build API docs on Travis since it causes build failures because
 # those API docs files are not included anywhere.
 deps = pysphere
+       pyopenssl
        backports.ssl_match_hostname
        lockfile
        rstcheck


Mime
View raw message