當前位置: 首頁>>代碼示例>>Python>>正文


Python ServiceController.downloadedPkgPath方法代碼示例

本文整理匯總了Python中agent.controllers.service.ServiceController.downloadedPkgPath方法的典型用法代碼示例。如果您正苦於以下問題:Python ServiceController.downloadedPkgPath方法的具體用法?Python ServiceController.downloadedPkgPath怎麽用?Python ServiceController.downloadedPkgPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在agent.controllers.service.ServiceController的用法示例。


在下文中一共展示了ServiceController.downloadedPkgPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_post_manifest_inprogress_errorout

# 需要導入模塊: from agent.controllers.service import ServiceController [as 別名]
# 或者: from agent.controllers.service.ServiceController import downloadedPkgPath [as 別名]
    def test_post_manifest_inprogress_errorout(self):
        packages = ['http://github.com/yubin154/cronusagent/blob/master/agent/agent/tests/unit/packages/perlserver-1.0.0.unix.cronus']
        manifest = 'bar'
        service = 'foo'

        try:
            path = ServiceController.manifestPath(service)
            os.makedirs(path)
            path = ServiceController.installedPkgPath(service)
            os.makedirs(path)
            path = ServiceController.downloadedPkgPath(service)
            os.makedirs(path)
        except Exception as excep:
            LOG.warning('got an OS Exception - %s' % str(excep))


        body = json.dumps({'package' : packages})
        response = self.app.post(url(controller = 'manifest', action = 'post', service = service, manifest = manifest),
                                 headers = {'Content-Type' : 'application/json'},
                                 params = body)
        assert response.status_int == 200, 'Manifest Post assert'

        try:
            response = self.app.post(url(controller = 'manifest', action = 'post', service = service, manifest = manifest),
                                 headers = {'Content-Type' : 'application/json'},
                                 params = body)
            #should error out!
            raise Exception('Oops! Expected AppError but did not get any')
        except AppError:
            pass
開發者ID:cronuspaas,項目名稱:cronusagent,代碼行數:32,代碼來源:test_manifest.py

示例2: test_post_manifest_inprogress_ok

# 需要導入模塊: from agent.controllers.service import ServiceController [as 別名]
# 或者: from agent.controllers.service.ServiceController import downloadedPkgPath [as 別名]
    def test_post_manifest_inprogress_ok(self):
        service = 'foo'
        manifest = 'blahblah'
        try:
            path = ServiceController.servicePath(service)
            if os.path.exists(path):
                if os.name == 'nt':
                    cmd = 'rm -r %s' % path
                    LOG.debug("running command %s" % cmd)
                    os.system(cmd)
                else:
                    shutil.rmtree(path)
            path = ServiceController.manifestPath(service)
            os.makedirs(path)
            path = ServiceController.installedPkgPath(service)
            os.makedirs(path)
            inProgressPath = ManifestCreate.inProgress(ManifestController.manifestPath(service, manifest))
            os.makedirs(inProgressPath)
            path = ServiceController.downloadedPkgPath(service)
            os.makedirs(path)
        except Exception as excep:
            LOG.warning('got an OS Exception - %s' % str(excep))

        createManifest(self, ["http://github.com/yubin154/cronusagent/blob/master/agent/agent/tests/unit/packages/pkgA-1.2.0.unix.cronus"], manifest = 'blahblah', createDirs = False)
        self.assertTrue(islink(os.path.join(ManifestController.manifestPath('foo', 'blahblah'), 'pkgA')))
開發者ID:anzarafaq,項目名稱:cronusagent,代碼行數:27,代碼來源:test_manifest.py

示例3: test_same_pkg_download_parallel

# 需要導入模塊: from agent.controllers.service import ServiceController [as 別名]
# 或者: from agent.controllers.service.ServiceController import downloadedPkgPath [as 別名]
    def test_same_pkg_download_parallel(self):
        packages = ['http://www.stackscaling.com/agentrepo/pkgA-1.2.0.unix.cronus']
        manifest1 = 'bar'
        manifest2 = 'blah'
        service1 = 'foo'
        service2 = 'lah'
        try:
            for pkg in packages:
                mockDownloadPkg(pkg)
            
            path = ServiceController.manifestPath(service1)
            os.makedirs(path)
            path = ServiceController.installedPkgPath(service1)
            os.makedirs(path)
            path = ServiceController.downloadedPkgPath(service1)
            os.makedirs(path)
            path = ServiceController.manifestPath(service2)
            os.makedirs(path)
            path = ServiceController.installedPkgPath(service2)
            os.makedirs(path)
            path = ServiceController.downloadedPkgPath(service2)
            os.makedirs(path)
        except Exception as excep:
            LOG.warning('got an OS Exception - %s' % str(excep))

        body = json.dumps({'package' : packages})
        response1 = self.app.post(url(controller = 'manifest', action = 'post', service = service1, manifest = manifest1),
                                 headers = {'Content-Type' : 'application/json'},
                                 params = body)
        assert response1.status_int == 200, 'Manifest Post assert'

        response2 = self.app.post(url(controller = 'manifest', action = 'post', service = service2, manifest = manifest2),
                                 headers = {'Content-Type' : 'application/json'},
                                 params = body)
        assert response2.status_int == 200, 'Manifest Post assert'

        checkStatus(self, 'create manifest bar', response1, timeout = 25)
        checkStatus(self, 'create manifest baz', response2, timeout = 25)

        self.assertTrue(os.path.exists(os.path.join(PackageMgr.packagePath(), 'pkgA-1.2.0.unix.cronus')))
        self.assertTrue(islink(os.path.join(manifestutil.manifestPath('foo', 'bar'), 'pkgA')))
        self.assertTrue(islink(os.path.join(manifestutil.manifestPath('lah', 'blah'), 'pkgA')))
開發者ID:cronuspaas,項目名稱:cronusagent,代碼行數:44,代碼來源:test_manifest.py

示例4: test_inprogress_pkg_download

# 需要導入模塊: from agent.controllers.service import ServiceController [as 別名]
# 或者: from agent.controllers.service.ServiceController import downloadedPkgPath [as 別名]
    def test_inprogress_pkg_download(self):
        service = 'foo'
        try:
            path = ServiceController.manifestPath(service)
            os.makedirs(path)
            path = ServiceController.installedPkgPath(service)
            os.makedirs(path)
            path = ServiceController.downloadedPkgPath(service)
            os.makedirs(path)
            inprogressPath = os.path.join(PackageMgr.packagePath(), 'perlserver-1.0.0.unix.cronus.inprogress')
            inprogressFile = open(inprogressPath, 'w')
            inprogressFile.write('somegarbage')
            inprogressFile.close()
        except Exception as excep:
            LOG.warning('got an OS Exception - %s' % str(excep))

        createManifest(self)
        self.assertTrue(os.path.exists(os.path.join(PackageMgr.packagePath(), 'perlserver-1.0.0.unix.cronus')))
        self.assertTrue(islink(os.path.join(manifestutil.manifestPath('foo', 'bar'), 'perlserver')))
開發者ID:cronuspaas,項目名稱:cronusagent,代碼行數:21,代碼來源:test_manifest.py


注:本文中的agent.controllers.service.ServiceController.downloadedPkgPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。