Ejemplo n.º 1
0
    # Get the actual ACS_INSTANCE
    # None if ACS_INSTANCE not defined in the environment
    try:
        instance = environ['ACS_INSTANCE']
    except:
        instance = None

    # There should be no lock file at the beginning of the test
    if printListOfLockFiles(prefix, suffix) != 0:
        print "ERROR: the folder should not contain any lock file at this stage!"

    # Lock a instance
    print "----- Test 1: lock of a ACS instance -----"
    print "Locking instance 3"
    instanceLocker.lock(3)
    printListOfLockFiles(prefix, suffix)
    print "Unlocking instance 3"
    instanceLocker.unlock(3)
    if printListOfLockFiles(prefix, suffix) != 0:
        print "ERROR: the folder should not contain any lock file at this stage!"
    print "----- Test 1 done -----"

    # Lock ALL possible instances
    print "----- Test 2: locking all possible instances -----"
    print "Locking all possible instances"
    for i in range(10):
        if instanceLocker.lock(i) != 0:
            print "ERROR locking instance", i
    if printListOfLockFiles(prefix, suffix) != 10:
        print "ERROR: some lock file is missing!"
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___
 
 # Get the actual ACS_INSTANCE
 # None if ACS_INSTANCE not defined in the environment
 try:
     instance=environ['ACS_INSTANCE']
 except:
     instance=None
 
 # There should be no lock file at the beginning of the test
 if printListOfLockFiles(prefix,suffix)!=0:
     print "ERROR: the folder should not contain any lock file at this stage!"
 
 # Lock a instance
 print "----- Test 1: lock of a ACS instance -----"
 print "Locking instance 3"
 instanceLocker.lock(3)
 printListOfLockFiles(prefix,suffix)
 print "Unlocking instance 3"
 instanceLocker.unlock(3)
 if printListOfLockFiles(prefix,suffix)!=0:
     print "ERROR: the folder should not contain any lock file at this stage!"
 print "----- Test 1 done -----"
 
 # Lock ALL possible instances
 print "----- Test 2: locking all possible instances -----"
 print "Locking all possible instances"
 for i in range(10):
     if instanceLocker.lock(i)!=0:
         print "ERROR locking instance",i
 if printListOfLockFiles(prefix,suffix)!=10:
     print "ERROR: some lock file is missing!"
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___