• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python servicemigration.require函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中servicemigration.require函数的典型用法代码示例。如果您正苦于以下问题:Python require函数的具体用法?Python require怎么用?Python require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了require函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: migrate

    def migrate(self, pack):
        if pack.prevZenPackVersion is None:
            # Do nothing if this is a fresh install of self.version.
            return

        if not CONTROL_CENTER:
            return

        sm.require("1.0.0")

        try:
            ctx = sm.ServiceContext()
        except Exception as e:
            LOG.warn("failed to replace %s service: %s", SERVICE_NAME, e)
            return

        service = get_service_id(ctx)
        if not service:
            return

        client = ControlPlaneClient(**getConnectionSettings())

        # Stop and remove the old service.
        remove_service(client, service)

        # Install the new service.
        pack.installServices()
开发者ID:zenoss,项目名称:ZenPacks.zenoss.Layer2,代码行数:27,代码来源:ReplaceService.py


示例2: test_sdk_versioning_bugfix_big

 def test_sdk_versioning_bugfix_big(self):
     major = int(sm.version.API_VERSION.split('.')[0])
     minor = int(sm.version.API_VERSION.split('.')[1])
     bugfx = int(sm.version.API_VERSION.split('.')[2]) + 1
     try:
         sm.require("%d.%d.%d" % (major, minor, bugfx))
     except ValueError:
         pass
     else:
         raise ValueError("SDK Versioning logic failed.")
开发者ID:malysoun,项目名称:service-migration,代码行数:10,代码来源:test_context.py


示例3: migrate

    def migrate(self, pack):
        # Apply only on ZP upgrade.
        if pack.prevZenPackVersion is None:
            return

        try:
            import servicemigration as sm
        except ImportError:
            # No servicemigrations, which means we are on Zenoss 4.2.x or 5.0.x
            # No need to install service on Zenoss 5.0.x as service install
            # performed on each upgrade.
            return

        sm.require("1.0.0")

        try:
            ctx = sm.ServiceContext()
        except:
            log.warn("Couldn't generate service context, skipping.")
            return

        log.info("Looking for zenmapper services to migrate")
        services = filter(lambda s: s.name == "zenmapper", ctx.services)

        # Add the Redis endpoint import if it does not exist
        if not services:
            log.info("Found no 'zenmapper' services to migrate")
            # short circuit
            return
        for service in services:
            try:
                if not service.ramCommitment:
                    service.ramCommitment = '5G'
            except AttributeError:
                log.warning("Your Zenoss version doesn't support such "
                            "migrations. Please set RAM commitment for "
                            "zenmapper service manualy to 5G using "
                            "Control Center UI.")
                return
        ctx.commit()
开发者ID:zenoss,项目名称:ZenPacks.zenoss.Layer2,代码行数:40,代码来源:AddRAMCommitment.py


示例4: Copyright

# Copyright (C) Zenoss, Inc. 2015, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import itertools
import logging
log = logging.getLogger("zen.migrate")

import Migrate
import servicemigration as sm
from servicemigration.endpoint import Endpoint

sm.require("1.0.0")


class AddEndpointsToZenjobs(Migrate.Step):
    "Add zep + zproxy endpoints to zenjobs services"

    version = Migrate.Version(5,0,70)

    def cutover(self, dmd):
        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
            log.info("Couldn't generate service context, skipping.")
            return

        endpoint_map = {
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:AddEndpointsToZenjobs.py


示例5: Copyright

##############################################################################
#
# Copyright (C) Zenoss, Inc. 2016, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import logging
log = logging.getLogger("zen.migrate")

import Migrate
import servicemigration as sm
sm.require("1.1.5")

from serviceRunLevels import serviceRunLevels


class AddServiceRunLevels(Migrate.Step):
    """
    Add the emergency shutdown and startup levels to service definitions.
    See ZEN-23931, ZEN-27299.
    """

    version = Migrate.Version(109, 0, 0)

    def cutover(self, dmd):
        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:addServiceRunLevels.py


示例6: addMissedRunsThreshold

#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import logging
log = logging.getLogger("zen.migrate")

import Migrate
import servicemigration as sm
import servicemigration.thresholdconfig
import servicemigration.threshold
import servicemigration.eventtags

sm.require("1.1.6")

class addMissedRunsThreshold(Migrate.Step):
    """Adds a threshold for missedRuns for collector services"""

    version = Migrate.Version(200, 0, 0)

    def cutover(self, dmd):
        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
            log.info("Couldn't generate context, skipping.")
            return

        # Get all collector services
        changed = False
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:addMissedRunsThreshold.py


示例7: create_upstream_pattern

__doc__ = """AddAPIZopesSvcDef
Adds the service zenapi that provides Zope instances dedicated to serving non-UI JSON API requests.
"""
import logging
log = logging.getLogger("zen.migrate")

import os
import re
import copy
import Migrate
import servicemigration as sm
import subprocess
import shutil

sm.require("1.1.9")

def create_upstream_pattern(upstream_name, server_decl):
    return re.compile("\\n\s+upstream %s {\\n\s+least_conn;\\n\s+%s;\\n\s+keepalive 64;\\n\s+}(?:(?:\\r)?\\n)" % (upstream_name, server_decl))

incl_mimetypes_pat = re.compile(r'include mime\.types;(?:(?:\\r)?\\n)?')
zope_upstream_pat = create_upstream_pattern('zopes', 'include zope-upstreams\.conf')
zopereports_upstream_pat = create_upstream_pattern('zopereports', 'include zopereports-upstreams\.conf')
debugzope_upstream_pat = create_upstream_pattern('debugzopes', 'server 127\.0\.0\.1:9310')
apizopes_upstream_pat = create_upstream_pattern('apizopes', 'include apizopes-upstreams\.conf')
map_whichzopes_pat = re.compile(r'\\n\s+map \$host \$whichzopes {\\n\s+default zopes;\\n\s+~\*zenapi apizopes;\\n\s+}\\n(?:(?:\\r)?\\n)')

apizopes_upstreams_decl = '\n\n    upstream apizopes {\n        least_conn;\n        include apizopes-upstreams.conf;\n        keepalive 64;\n    }\n'
apizopes_map_clause = '\n        ~*zenapi apizopes;'
apizopes_map_whichzopes_block_decl = '\n    map $host $whichzopes {\n        default zopes;\n        ~*zenapi apizopes;\n    }\n'
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:29,代码来源:addAPIZopesSvcDef.py


示例8: Copyright

#
# Copyright (C) Zenoss, Inc. 2017, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import logging
import Migrate
import os
import servicemigration as sm
from Products.ZenUtils.Utils import zenPath

log = logging.getLogger("zen.migrate")
sm.require("1.1.10")

class AddZookeeperLogFilters(Migrate.Step):
    """
    Add LogFilters for Zookeeper logs issue addressed by ZEN-28089
    """
    version = Migrate.Version(200, 0, 0)

    def cutover(self, dmd):
        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
            log.info("Couldn't generate service context, skipping.")
            return

        service = ctx.getTopService()
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:addZookeeperLogFilters.py


示例9: AddZingConfigToZep

import os
import logging

log = logging.getLogger("zen.migrate")

import Migrate
import servicemigration as sm
from servicemigration.metrics import Metric
from servicemigration.graphrange import GraphRange
from servicemigration.graphconfig import GraphConfig
from servicemigration.metricconfig import MetricConfig
from servicemigration.graphdatapoint import GraphDatapoint


sm.require("1.1.12")


class AddZingConfigToZep(Migrate.Step):
    "Add reasonable defaults to zeneventserver to enable sending events to Zenoss cloud"

    version = Migrate.Version(300, 0, 6)

    CLOUD_CONFIG_BLOCK = """

## Configuration to forward events to Zenoss Cloud
#
zep.zing.enabled=false
zep.zing.project={{getContext . "cse.project"}}
zep.zing.tenant={{getContext . "cse.tenant"}}
zep.zing.source={{getContext . "cse.source"}}
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:30,代码来源:addZingConfigToZep.py


示例10: Copyright

#
# Copyright (C) Zenoss, Inc. 2017, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import logging

log = logging.getLogger("zen.migrate")

import Migrate
import servicemigration as sm

sm.require("1.1.11")


class DeleteRateOptionsForServices(Migrate.Step):
    """
    Update/Add rateOptions for counters.
    Remove reset values.
    """

    version = Migrate.Version(300, 0, 1)

    def cutover(self, dmd):

        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:deleteRateOptionsForServices.py


示例11: Copyright

##############################################################################
#
# Copyright (C) Zenoss, Inc. 2016, all rights reserved.
#
# This content is made available according to terms specified in
# License.zenoss under the directory where your Zenoss product is installed.
#
##############################################################################

import logging
import Migrate
import servicemigration as sm

sm.require("1.1.7")

class AddAuditLogFlag(Migrate.Step):
    """ Add boolean flag to indicate which logs are audit logs."""

    version = Migrate.Version(114, 0, 0)

    def cutover(self, dmd):
        log = logging.getLogger("zen.migrate")
        try:
            ctx = sm.ServiceContext()
        except sm.ServiceMigrationError:
            log.info("Couldn't generate service context, skipping.")
            return

        changed = False

        for service in ctx.services:
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:31,代码来源:addAuditLogFlag.py


示例12: ServiceTest

import unittest
import os

import servicemigration as sm
sm.require(sm.version.API_VERSION)

INFILENAME = os.path.join(os.path.dirname(__file__), "v1.0.0.json")
OUTFILENAME = os.path.join(os.path.dirname(__file__), "out.json")

class ServiceTest(unittest.TestCase):

    def test_imageId_change(self):
        """
        Tests changing an imageID
        """

        imageID = "localhost:5000/fake:latest"
        ctx = sm.ServiceContext(INFILENAME)
        svc = filter(lambda x: x.description == "Zope server", ctx.services)[0]
        svc.imageID = imageID
        ctx.commit(OUTFILENAME)
        ctx = sm.ServiceContext(OUTFILENAME)
        svc = filter(lambda x: x.description == "Zope server", ctx.services)[0]
        self.assertEqual(svc.imageID, imageID)

    def test_description_remove(self):
        """
        Tests completely removing a description.
        """
        ctx = sm.ServiceContext(INFILENAME)
        svc = filter(lambda x: x.description == "Zope server", ctx.services)[0]
开发者ID:malysoun,项目名称:service-migration,代码行数:31,代码来源:test_service.py


示例13: test_sdk_versioning_bugfix_small

 def test_sdk_versioning_bugfix_small(self):
     major = int(sm.version.API_VERSION.split('.')[0])
     minor = int(sm.version.API_VERSION.split('.')[1])
     bugfx = int(sm.version.API_VERSION.split('.')[2]) - 1
     sm.require("%d.%d.%d" % (major, minor, bugfx))
开发者ID:malysoun,项目名称:service-migration,代码行数:5,代码来源:test_context.py



注:本文中的servicemigration.require函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python services.client_manager函数代码示例发布时间:2022-05-27
下一篇:
Python smprocess.SmProcess类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap