direct-io.hg

changeset 13744:7c992fd3b19b

[XEND] Make python-pam warning only appear if using XenAPI

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Wed Jan 31 12:58:41 2007 +0000 (2007-01-31)
parents 54678a99e102
children 3cccf8e64296
files tools/python/xen/xend/XendAuthSessions.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAuthSessions.py	Wed Jan 31 12:23:35 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAuthSessions.py	Wed Jan 31 12:58:41 2007 +0000
     1.3 @@ -21,11 +21,6 @@ from xen.xend import uuid
     1.4  from xen.xend.XendError import *
     1.5  from xen.xend.XendLogging import log
     1.6  
     1.7 -try:
     1.8 -    import PAM
     1.9 -except ImportError:
    1.10 -    log.warn("python-pam is required for XenAPI support.")
    1.11 -
    1.12  class XendAuthSessions:
    1.13      """Keeps track of Xen API Login Sessions using PAM.
    1.14  
    1.15 @@ -80,7 +75,11 @@ class XendAuthSessions:
    1.16          """
    1.17          pam_auth = None
    1.18          try:
    1.19 +            import PAM
    1.20              pam_auth = PAM.pam()
    1.21 +        except ImportError:
    1.22 +            log.warn("python-pam is required for XenAPI support.")
    1.23 +            return False
    1.24          except NameError:
    1.25              # if PAM doesn't exist, let's ignore it
    1.26              return False