minor fixes
authorBarthaM@N3SIM1218.D03.arc.local
Thu, 05 Jun 2014 15:51:26 +0100
changeset 1826e9b8f105de1
parent 181 3875d43bacd2
child 183 a4ea59670b6b
minor fixes
OpenSecurity/bin/opensecurity_client_restful_server.py
OpenSecurity/bin/vmmanager.pyw
     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                    
     2.1 --- a/OpenSecurity/bin/vmmanager.pyw	Thu Jun 05 15:04:13 2014 +0100
     2.2 +++ b/OpenSecurity/bin/vmmanager.pyw	Thu Jun 05 15:51:26 2014 +0100
     2.3 @@ -805,9 +805,10 @@
     2.4                  time.sleep(3)
     2.5                  continue
     2.6              
     2.7 -            logger.info("Something's changed")     
     2.8 -            for vm_name in self.attachedRSDs.keys():
     2.9 -                if self.attachedRSDs[vm_name] not in tmp_rsds.values():
    2.10 +            logger.info("Something's changed")
    2.11 +            tmp_attached = self.attachedRSDs     
    2.12 +            for vm_name in tmp_attached.keys():
    2.13 +                if tmp_attached[vm_name] not in tmp_rsds.values():
    2.14                      ip = self.vmm.getHostOnlyIP(vm_name)
    2.15                      if ip == None:
    2.16                          logger.error("Failed getting hostonly IP for " + vm_name)