def setUp(self): stopAgentGlobals() startAgentGlobals() self.threadMgr = pylons.config['pylons.app_globals'].threadMgr path = os.path.realpath(__file__) self.scriptDir = os.path.join(os.path.dirname(path), 'scripts')
def _shutdown(self): """ shutdown agent """ stopAgentGlobals() pid = os.getpid() if (hasattr(signal, 'SIGKILL')): os.kill(pid, signal.SIGKILL) else: os.kill(pid, signal.SIGTERM)
def commonSetup(): stopAgentGlobals() if removeAgentRoot() and not os.path.exists(pylons.config['agent_root']): os.mkdir(pylons.config['agent_root']) assert os.path.exists(pylons.config['agent_root']) startAgentGlobals(startAgentMonitor = False, startPackageMgr = False)
def commonSetup(): stopAgentGlobals() if removeAgentRoot() and not os.path.exists(pylons.config['agent_root']): os.mkdir(pylons.config['agent_root']) assert os.path.exists(pylons.config['agent_root']) startAgentGlobals(startAgentMonitor=False, startPackageMgr=False)
def test_init(self): # test the init routine # make sure that the initial path is cleared out of IN Progress nodes tmpFile = os.path.join(PackageMgr.packagePath(), 'foo.inprogress') open(tmpFile, 'w').close() tmpFile2 = os.path.join(PackageMgr.packagePath(), 'foo2.inprogress') open(tmpFile2, 'w').close() stopAgentGlobals() startAgentGlobals()
def shutdown(self): """ This controller shutdown the agent. This should not be exposed to external usage. This should only be used for testing and also for self update. """ LOG.info('[AGENT_SUICIDE] shutdown called. exiting the agent. This is an expected behavior when rest api shutdown is called. ') stopAgentGlobals() pid = os.getpid() if (hasattr(signal, 'SIGKILL')): os.kill(pid, signal.SIGKILL) else: os.kill(pid, signal.SIGTERM)
def test_cleanupPackages(self): stopAgentGlobals() # ok now let's create the directory structure of a bad service and packages packagePath = PackageMgr.packagePath() inProgPackage2 = os.path.join(packagePath, 'bar.inprogress') inProgPackage1 = os.path.join(packagePath, 'foo.inprogress') goodPackage1 = os.path.join(packagePath, 'baz') goodPackage2 = os.path.join(packagePath, 'baz') open(inProgPackage1, 'w').close() open(inProgPackage2, 'w').close() open(goodPackage1, 'w').close() open(goodPackage2, 'w').close() startAgentGlobals() # we remove logic of inprogress file cleanup from packagemgr # assert not os.path.exists(inProgPackage1) # assert not os.path.exists(inProgPackage2) assert os.path.exists(goodPackage1) assert os.path.exists(goodPackage2)
def commonTearDown(): stopAgentGlobals() if removeAgentRoot() and not os.path.exists(pylons.config['agent_root']): os.mkdir(pylons.config['agent_root'])
def setUp(self): stopAgentGlobals() self.threadMgr = ThreadMgr( garbageFreq=pylons.config['threadMgr_garbage_freq'], maxThreadAge=pylons.config['threadMgr_thread_age'])
def tearDown(self): stopAgentGlobals()
def setUp(self): stopAgentGlobals() startAgentGlobals()
def setUp(self): stopAgentGlobals() self.threadMgr = ThreadMgr(garbageFreq = pylons.config['threadMgr_garbage_freq'], maxThreadAge = pylons.config['threadMgr_thread_age'])