Esempio n. 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')
Esempio n. 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')
Esempio n. 3
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 7
0
    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()
Esempio n. 8
0
    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()
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 13
0
def commonTearDown():
    stopAgentGlobals()

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

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