system('acsKillProc -C ' + process) print "...done." print "" #Now everything should have been killed...let's try to cleanup $ACSDATA/tmp dir = getAcsTmpDirectoryPath() print "==> Cleaning up " + dir + " - removing ACS_INSTANCE temporary directories..." try: com = 'rm -rf ' + dir + '/ACS_INSTANCE*' system(com) print "...done." except: print "==> Failed to remove the ACS_INSTANCE directories from " + dir + "!" print " Please clean up this directory on your own!" if killJava==1: print "Killing all Java processes..." system('acsKillProc -C java') print "...done." print "Removing lock files" lockHelper=AcsInstanceLockHelper() lockHelper.cleanAll() print "...done." #release the lock so future invocations can be run if lock_file!=None: lock_file.close() remove(lock_file_name)
stdout.flush() ret = call(["acsInstanceLock", "-u", "-b", "4"]) if printListOfLockFiles(prefix, suffix) != 0: print "ERROR: the folder should not contain any lock file at this stage!" print "----- Test 7 done -----" # Test if the script clean all the locks when -c is in the command line print "----- Test 8: test cleanAll -----" instanceLocker.lock(0) instanceLocker.lock(3) instanceLocker.lock(5) instanceLocker.lock(8) instances = getLockedInstances(prefix, suffix) if len(instances) != 4: print "ERROR locking instances" instanceLocker.cleanAll() instances = getLockedInstances(prefix, suffix) if len(instances) > 0: print "ERROR: not all the instances have been unlocked" print "----- Test 8 done -----" # Test the cleanAll method print "----- Test 9: test acsInstanceLock to clean all -----" instanceLocker.lock(2) instanceLocker.lock(4) instanceLocker.lock(8) instanceLocker.lock(9) instances = getLockedInstances(prefix, suffix) if len(instances) != 4: print "ERROR locking instances" stdout.flush()
selectedActions=0 if options.lock: 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)
stdout.flush() ret=call(["acsInstanceLock","-u","-b","4"]) if printListOfLockFiles(prefix,suffix)!=0: print "ERROR: the folder should not contain any lock file at this stage!" print "----- Test 7 done -----" # Test if the script clean all the locks when -c is in the command line print "----- Test 8: test cleanAll -----" instanceLocker.lock(0) instanceLocker.lock(3) instanceLocker.lock(5) instanceLocker.lock(8) instances=getLockedInstances(prefix,suffix) if len(instances)!=4: print "ERROR locking instances" instanceLocker.cleanAll() instances=getLockedInstances(prefix,suffix) if len(instances)>0: print "ERROR: not all the instances have been unlocked" print "----- Test 8 done -----" # Test the cleanAll method print "----- Test 9: test acsInstanceLock to clean all -----" instanceLocker.lock(2) instanceLocker.lock(4) instanceLocker.lock(8) instanceLocker.lock(9) instances=getLockedInstances(prefix,suffix) if len(instances)!=4: print "ERROR locking instances" stdout.flush()
selectedActions = 0 if options.lock: 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)