Bug fixes

This commit is contained in:
Alessandro Pilotti 2013-02-04 00:20:59 +02:00
parent 4657ee3468
commit 2a7bc8510a
3 changed files with 14 additions and 17 deletions

View File

@ -68,8 +68,7 @@ class BaseMetadataService(object):
raise NotImplementedError() raise NotImplementedError()
def post_password(self, enc_password_b64, version='latest'): def post_password(self, enc_password_b64, version='latest'):
path = posixpath.normpath(posixpath.join(path, path = posixpath.normpath(posixpath.join('openstack',
'openstack',
version, version,
'password')) 'password'))
return self._post_data(path, enc_password_b64) return self._post_data(path, enc_password_b64)

View File

@ -15,7 +15,6 @@
# under the License. # under the License.
import posixpath import posixpath
import urllib
import urllib2 import urllib2
from cloudbaseinit.metadata.services.base import * from cloudbaseinit.metadata.services.base import *
@ -62,7 +61,7 @@ class HttpService(BaseMetadataService):
def _post_data(self, path, data): def _post_data(self, path, data):
norm_path = posixpath.join(CONF.metadata_base_url, path) norm_path = posixpath.join(CONF.metadata_base_url, path)
LOG.debug('Posting metadata to: %(norm_path)s' % locals()) LOG.debug('Posting metadata to: %(norm_path)s' % locals())
req = urllib2.Request(norm_path, data=urllib.urlencode(data)) req = urllib2.Request(norm_path, data=data)
self._get_response(req) self._get_response(req)
return True return True
@ -78,4 +77,3 @@ class HttpService(BaseMetadataService):
raise ex raise ex

View File

@ -21,11 +21,11 @@ import struct
import sys import sys
if sys.platform == "win32": if sys.platform == "win32":
openssl_lib_name = "libeay32" openssl_lib_path = "libeay32.dll"
else: else:
openssl_lib_name = "ssl" openssl_lib_path = ctypes.util.find_library("ssl")
openssl = ctypes.CDLL(ctypes.util.find_library(openssl_lib_name)) openssl = ctypes.CDLL(openssl_lib_path)
clib = ctypes.CDLL(ctypes.util.find_library("c")) clib = ctypes.CDLL(ctypes.util.find_library("c"))
class RSA(ctypes.Structure): class RSA(ctypes.Structure):
@ -140,8 +140,8 @@ class CryptManager(object):
def load_ssh_rsa_public_key(self, ssh_pub_key): def load_ssh_rsa_public_key(self, ssh_pub_key):
ssh_rsa_prefix = "ssh-rsa " ssh_rsa_prefix = "ssh-rsa "
i = ssh_pub_key.rindex(' ') s = ssh_pub_key[len(ssh_rsa_prefix):]
b64_pub_key = ssh_pub_key[len(ssh_rsa_prefix):i] b64_pub_key = s[:s.index(' ')]
pub_key = base64.b64decode(b64_pub_key) pub_key = base64.b64decode(b64_pub_key)