1.1 --- a/OpenSecurity/bin/opensecurity_client_restful_server.py Thu Jun 05 15:04:13 2014 +0100
1.2 +++ b/OpenSecurity/bin/opensecurity_client_restful_server.py Thu Jun 05 15:51:26 2014 +0100
1.3 @@ -296,19 +296,18 @@
1.4 return None
1.5
1.6 def mapDrive(drive, networkPath, user, password):
1.7 - print networkPath
1.8 if (os.path.exists(networkPath)):
1.9 - print networkPath, " is found..."
1.10 - print "Trying to map ", networkPath, " on to ", drive, " ....."
1.11 + logger.debug(networkPath + " is found...")
1.12 + logger.debug("Trying to map " + networkPath + " on to " + drive + " .....")
1.13 try:
1.14 win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, drive, networkPath, None, user, password)
1.15 except:
1.16 - print "Unexpected error..."
1.17 + logger.error("Unexpected error...")
1.18 return 1
1.19 - print "Mapping successful"
1.20 + logger.info("Mapping successful")
1.21 return 0
1.22 else:
1.23 - print "Network path unreachable..."
1.24 + logger.error("Network path unreachable...")
1.25 return 1
1.26
1.27 # handles netumount request
1.28 @@ -361,16 +360,16 @@
1.29 return 'Ok'
1.30
1.31 def unmapDrive(drive, force=0):
1.32 - print "drive in use, trying to unmap..."
1.33 + logger.debug("drive in use, trying to unmap...")
1.34 if force == 0:
1.35 - print "Executing un-forced call..."
1.36 + logger.debug("Executing un-forced call...")
1.37
1.38 try:
1.39 win32wnet.WNetCancelConnection2(drive, 1, force)
1.40 - print drive, "successfully unmapped..."
1.41 + logger,info(drive + "successfully unmapped...")
1.42 return 0
1.43 except:
1.44 - print "Unmap failed, try again..."
1.45 + logger.error("Unmap failed, try again...")
1.46 return 1
1.47
1.48 # handles netumount request