summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorAlessandro Pilotti <ap@pilotti.it>2012-09-13 15:08:45 +0300
committerAlessandro Pilotti <ap@pilotti.it>2012-09-13 15:08:45 +0300
commit918a02d5cc3c845bcd58e00fcdf2728e78dafa26 (patch)
treef44d303f8ca21d14e3a1e6cf7f545a629c38c17f /nova
parent0296a2d2499a634ef49c2545fd75d41f3219bfa5 (diff)
downloadnova-918a02d5cc3c845bcd58e00fcdf2728e78dafa26.tar.gz
nova-918a02d5cc3c845bcd58e00fcdf2728e78dafa26.tar.xz
nova-918a02d5cc3c845bcd58e00fcdf2728e78dafa26.zip
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
Diffstat (limited to 'nova')
-rw-r--r--nova/virt/disk/api.py7
1 files changed, 6 insertions, 1 deletions
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./')