From 918a02d5cc3c845bcd58e00fcdf2728e78dafa26 Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Thu, 13 Sep 2012 15:08:45 +0300 Subject: Fixes import issue on Windows Fixes Bug #1034043 The crypt module is not available on Windows. Since this is a blocking issue on Hyper-V and since the only function using it is _set_passwd (not implemented on Windows), the import can be safely conditionally avoided. Change-Id: Iefe97edcfcff3b70593e07628b6a6f85e680cbc7 --- nova/virt/disk/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nova') diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index 008445a4a..16bd9fe04 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -25,11 +25,13 @@ Includes injection of SSH PGP keys into authorized_keys file. """ -import crypt import os import random import tempfile +if os.name != 'nt': + import crypt + from nova import exception from nova import flags from nova.openstack.common import cfg @@ -511,6 +513,9 @@ def _set_passwd(username, admin_passwd, passwd_file, shadow_file): :raises: exception.NovaException(), IOError() """ + if os.name == 'nt': + raise exception.NovaException(_('Not implemented on Windows')) + salt_set = ('abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' '0123456789./') -- cgit