Beispiel #1
0
    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')
Beispiel #2
0
    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)
Beispiel #4
0
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)
Beispiel #5
0
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)
Beispiel #6
0
 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 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 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()
Beispiel #9
0
    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)
Beispiel #10
0
    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)
Beispiel #11
0
    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)
Beispiel #12
0
    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)
Beispiel #13
0
def commonTearDown():
    stopAgentGlobals()

    if removeAgentRoot() and not os.path.exists(pylons.config['agent_root']):
        os.mkdir(pylons.config['agent_root'])
Beispiel #14
0
 def setUp(self):
     stopAgentGlobals()
     self.threadMgr = ThreadMgr(
         garbageFreq=pylons.config['threadMgr_garbage_freq'],
         maxThreadAge=pylons.config['threadMgr_thread_age'])
Beispiel #15
0
 def tearDown(self):
     stopAgentGlobals()
Beispiel #16
0
 def setUp(self):
     stopAgentGlobals()
     startAgentGlobals()
Beispiel #17
0
 def tearDown(self):
     stopAgentGlobals()
Beispiel #18
0
def commonTearDown():
    stopAgentGlobals()

    if removeAgentRoot() and not os.path.exists(pylons.config['agent_root']):
        os.mkdir(pylons.config['agent_root'])
Beispiel #19
0
 def setUp(self):
     stopAgentGlobals()
     self.threadMgr = ThreadMgr(garbageFreq = pylons.config['threadMgr_garbage_freq'],
                                maxThreadAge = pylons.config['threadMgr_thread_age'])