Ejemplo n.º 1
0
        print "ERROR locking of invalid instance returned OK"
    except:
        print "Ok: the locking of a invalid instance has been rejected"
    # There should be no lock files in the folder now
    if printListOfLockFiles(prefix, suffix) != 0:
        print "ERROR: the folder should not contain any lock file at this stage!"
    print "----- Test 3 done -----"

    # Check locking/unlocking of the actual ACS_INSTANCE
    print "----- Test 4: lock ACS_INSTANCE -----"
    if instance == None:
        expectedInstance = 0
    else:
        expectedInstance = int(instance)
    print "Locking ACS_INSTANCE", instance
    lockedInstance = instanceLocker.checkAndLock()
    if lockedInstance == -1:
        print "ERROR locking ACS_INSTANCE"
    else:
        print "Instance locked", lockedInstance
        if expectedInstance != lockedInstance:
            print "ERROR: instance locked", lockedInstance, "expected", expectedInstance
    if printListOfLockFiles(prefix, suffix) != 1:
        print "ERROR: the folder should contain one and only one lock file at this stage!"
    # Free the instance
    if instanceLocker.freeInstance() != 0:
        print "Error freeing ACS_INSTANCE"
    if printListOfLockFiles(prefix, suffix) != 0:
        print "ERROR: the folder should not contain any lock file at this stage!"
    print "----- Test 4 done -----"
Ejemplo n.º 2
0
        selectedActions=selectedActions+1
    if options.unlock:
        selectedActions=selectedActions+1
    if options.clean:
        selectedActions=selectedActions+1   
    
    if selectedActions!=1:
        print "\nERROR: one and only one action must be present in the command line\n"
        parser.print_help()
        os.exit(-1)
    
    lockHelper = AcsInstanceLockHelper()
    if options.clean:
        ret=lockHelper.cleanAll()
        exit(ret)
        
    if options.baseport != None:
        # Use ACS_INSTANCE
        if options.lock:
            ret=lockHelper.lock(options.baseport)
        else:
            ret=lockHelper.unlock(options.baseport)
    else:
        if options.lock:
            ret=lockHelper.checkAndLock()
        else:
            ret=lockHelper.freeInstance()
    
    exit(ret)
# ___oOo___
     print "ERROR locking of invalid instance returned OK"
 except:
     print "Ok: the locking of a invalid instance has been rejected"
 # There should be no lock files in the folder now
 if printListOfLockFiles(prefix,suffix)!=0:
     print "ERROR: the folder should not contain any lock file at this stage!"
 print "----- Test 3 done -----"
 
 # Check locking/unlocking of the actual ACS_INSTANCE
 print "----- Test 4: lock ACS_INSTANCE -----"
 if instance==None:
     expectedInstance=0
 else:
     expectedInstance=int(instance)
 print "Locking ACS_INSTANCE",instance
 lockedInstance=instanceLocker.checkAndLock()
 if lockedInstance==-1:
     print "ERROR locking ACS_INSTANCE"
 else:
     print "Instance locked",lockedInstance
     if expectedInstance!=lockedInstance:
         print "ERROR: instance locked",lockedInstance,"expected",expectedInstance
 if printListOfLockFiles(prefix,suffix)!=1:
     print "ERROR: the folder should contain one and only one lock file at this stage!"
 # Free the instance
 if instanceLocker.freeInstance()!=0:
     print "Error freeing ACS_INSTANCE"
 if printListOfLockFiles(prefix,suffix)!=0:
     print "ERROR: the folder should not contain any lock file at this stage!"
 print "----- Test 4 done -----"
 
Ejemplo n.º 4
0
        selectedActions = selectedActions + 1
    if options.unlock:
        selectedActions = selectedActions + 1
    if options.clean:
        selectedActions = selectedActions + 1

    if selectedActions != 1:
        print "\nERROR: one and only one action must be present in the command line\n"
        parser.print_help()
        os.exit(-1)

    lockHelper = AcsInstanceLockHelper()
    if options.clean:
        ret = lockHelper.cleanAll()
        exit(ret)

    if options.baseport != None:
        # Use ACS_INSTANCE
        if options.lock:
            ret = lockHelper.lock(options.baseport)
        else:
            ret = lockHelper.unlock(options.baseport)
    else:
        if options.lock:
            ret = lockHelper.checkAndLock()
        else:
            ret = lockHelper.freeInstance()

    exit(ret)
# ___oOo___