From 09464391c18647ce94f1285b667e8c0e7c913083 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Fri, 28 Nov 2008 00:05:17 -0500 Subject: Make pyOpenSSL optional --- puppethost.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/puppethost.py b/puppethost.py index 312eb38..ef09c3c 100644 --- a/puppethost.py +++ b/puppethost.py @@ -20,10 +20,8 @@ version = '.'.join(map(str, version_info)) import os import sys -import time import shutil import socket -import OpenSSL import tarfile import commands import tempfile @@ -242,11 +240,13 @@ class PuppetHost(object): cert = self.files['cert'] try: - x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, - open(cert).read()) + import OpenSSL.crypto as crypto + x509 = crypto.load_certificate(crypto.FILETYPE_PEM, + open(cert).read()) self._version = x509.get_notBefore()[:8] except: # pyOpenSSL < 0.7 lacks load_certificate()... do it the hard way + import time format = '%Y%m%d' cmd = 'openssl x509 -in %s -text -noout' % cert status, output = commands.getstatusoutput(cmd) -- cgit