Python bus.on函数代码示例(python中scalarizr.bus.bus.on函数的典型用法)

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


Python bus.on函数代码示例(python中scalarizr.bus.bus.on函数的典型用法)

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

示例1: __init__

 def __init__(self):
        self.mysql = mysql_svc.MySQL()
        cnf_ctl = MysqlCnfController() if __mysql__['behavior'] in ('mysql2', 'percona') else None  # mariadb dont do old presets 
        ServiceCtlHandler.__init__(self,
                        __mysql__['behavior'],
                        self.mysql.service,
                        cnf_ctl)

        self.preset_provider = mysql_svc.MySQLPresetProvider()
        preset_service.services[__mysql__['behavior']] = self.preset_provider

        bus.on(init=self.on_init, reload=self.on_reload)
        bus.define_events(
                'before_mysql_data_bundle',
                'mysql_data_bundle',
                # @param host: New master hostname
                'before_mysql_change_master',
                # @param host: New master hostname
                # @param log_file: log file to start from
                # @param log_pos: log pos to start from
                'mysql_change_master'
                'before_slave_promote_to_master',
                'slave_promote_to_master'
        )

        self._mysql_api = mysql_api.MySQLAPI()
        self._op_api = operation_api.OperationAPI()
        self._backup_id = None
        self._data_bundle_id = None
        self.on_reload()
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:30,代码来源:mysql2.py

示例2: on_init

 def on_init(self):
        bus.on("host_init_response", self.on_host_init_response)
        bus.on("before_host_up", self.on_before_host_up)
        bus.on("before_hello", self.on_before_hello)
        if bus.event_defined('rebundle_cleanup_image'):
            bus.on("rebundle_cleanup_image", self.cleanup_hosts_file)
        bus.on("before_host_down", self.on_before_host_down)

        if 'bootstrapping' == __node__['state']:

            self.cleanup_hosts_file('/')
            self._logger.info('Performing initial cluster reset')

            if os.path.exists(DEFAULT_STORAGE_PATH):
                rabbitmq_user = pwd.getpwnam("rabbitmq")
                os.chown(DEFAULT_STORAGE_PATH, rabbitmq_user.pw_uid, rabbitmq_user.pw_gid)

            self.service.start()
            self.rabbitmq.stop_app()
            self.rabbitmq.reset()
            self.service.stop()


        elif 'running' == __node__['state']:
            rabbitmq_vol = __rabbitmq__['volume']

            if not __rabbitmq__['volume'].mounted_to():
                self.service.stop()
                rabbitmq_vol.ensure()
            self.service.start()

            __rabbitmq__['volume'] = rabbitmq_vol
开发者ID:yoyama,项目名称:scalarizr,代码行数:32,代码来源:rabbitmq.py

示例3: on_init

def on_init(self):
		bus.on("host_init_response", self.on_host_init_response)
		bus.on("before_host_up", self.on_before_host_up)
		bus.on("before_hello", self.on_before_hello)
		bus.on("rebundle_cleanup_image", self.cleanup_hosts_file)
		bus.on("before_host_down", self.on_before_host_down)

		if self.cnf.state == ScalarizrState.BOOTSTRAPPING:
			
			self.cleanup_hosts_file('/')
			self._logger.info('Performing initial cluster reset')

			if os.path.exists(DEFAULT_STORAGE_PATH):
				rabbitmq_user = pwd.getpwnam("rabbitmq")
				os.chown(DEFAULT_STORAGE_PATH, rabbitmq_user.pw_uid, rabbitmq_user.pw_gid)

			self.service.start()
			self.rabbitmq.stop_app()
			self.rabbitmq.reset()
			self.service.stop()


		elif self.cnf.state == ScalarizrState.RUNNING:
			
			storage_conf = storage.Storage.restore_config(self._volume_config_path)
			storage_conf['tags'] = self.rabbitmq_tags
			self.storage_vol = storage.Storage.create(storage_conf)
			if not self.storage_vol.mounted():
				self.service.stop()
				self.storage_vol.mount()
			self.service.start()
开发者ID:golovast,项目名称:scalarizr,代码行数:31,代码来源:rabbitmq.py

示例4: __init__

 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     preset_service.services[BEHAVIOUR] = self.preset_provider
     FarmSecurityMixin.__init__(self, [11211])
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
开发者ID:yoyama,项目名称:scalarizr,代码行数:7,代码来源:memcached.py

示例5: on_init

 def on_init(self):
        bus.on(host_init_response=self.on_host_init_response, block_device_mounted=self.on_block_device_mounted)

        # Add internal messages to scripting skip list
        try:
            for m in (Messages.INT_SERVER_REBOOT, Messages.INT_SERVER_HALT, Messages.HOST_INIT_RESPONSE):
                scalarizr.handlers.script_executor.skip_events.add(m)
        except AttributeError:
            pass

        # Mount all filesystems
        if os_dist["family"] != "Windows":
            system2(("mount", "-a"), raise_exc=False)

        # cloud-init scripts may disable root ssh login
        for path in ("/etc/ec2-init/ec2-config.cfg", "/etc/cloud/cloud.cfg"):
            if os.path.exists(path):
                c = None
                with open(path, "r") as fp:
                    c = fp.read()
                c = re.sub(re.compile(r"^disable_root[^:=]*([:=]).*", re.M), r"disable_root\1 0", c)
                with open(path, "w") as fp:
                    fp.write(c)

        # Add firewall rules
        # if self._cnf.state in (ScalarizrState.BOOTSTRAPPING, ScalarizrState.IMPORTING):
        self._insert_iptables_rules()
        # if __node__['state'] !=  ScalarizrState.IMPORTING:
        if __node__["state"] == "running":
            scalarizr.handlers.sync_globals()
开发者ID:chenleji,项目名称:scalarizr,代码行数:30,代码来源:lifecycle.py

示例6: on_init

 def on_init(self):
     bus.on(
         start=self.on_start,
         before_host_up=self.on_before_host_up,
         host_init_response=self.on_host_init_response,
         before_reboot_finish=self.on_before_reboot_finish,
     )
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:7,代码来源:apache.py

示例7: on_init

 def on_init(self, *args, **kwds):
     bus.on(
             host_init_response=self.on_host_init_response,
             before_host_up=self.on_before_host_up,
             reload=self.on_reload,
             start=self.on_start
     )
开发者ID:yoyama,项目名称:scalarizr,代码行数:7,代码来源:chef.py

示例8: __init__

 def __init__(self):
     self._service_name = SERVICE_NAME
     ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup(SERVICE_NAME))
     bus.on("init", self.on_init)
     bus.define_events(
         'before_postgresql_data_bundle',
         
         'postgresql_data_bundle',
         
         # @param host: New master hostname 
         'before_postgresql_change_master',
         
         # @param host: New master hostname 
         'postgresql_change_master',
         
         'before_slave_promote_to_master',
         
         'slave_promote_to_master'
     )   
     
     self._phase_postgresql = 'Configure PostgreSQL'
     self._phase_data_bundle = self._op_data_bundle = 'PostgreSQL data bundle'
     self._phase_backup = self._op_backup = 'PostgreSQL backup'
     self._step_upload_to_cloud_storage = 'Upload data to cloud storage'
     self._step_accept_scalr_conf = 'Accept Scalr configuration'
     self._step_patch_conf = 'Patch configuration files'
     self._step_create_storage = 'Create storage'
     self._step_init_master = 'Initialize Master'
     self._step_init_slave = 'Initialize Slave'
     self._step_create_data_bundle = 'Create data bundle'
     self._step_change_replication_master = 'Change replication Master'
     self._step_collect_host_up_data = 'Collect HostUp data'
     
     self.on_reload() 
开发者ID:yoyama,项目名称:scalarizr,代码行数:34,代码来源:postgresql.py

示例9: on_init

def on_init(self):
		bus.on("before_host_init", self.on_before_host_init)
		bus.on("host_init_response", self.on_host_init_response)
		try:
			handlers.script_executor.skip_events.add(Messages.INT_BLOCK_DEVICE_UPDATED)
		except AttributeError:
			pass
开发者ID:golovast,项目名称:scalarizr,代码行数:7,代码来源:block_device.py

示例10: __init__

 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     FarmSecurityMixin.__init__(self)
     self.init_farm_security([11211])
     ServiceCtlHandler.__init__(self, BEHAVIOUR, memcached_api.MemcachedInitScript())
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
开发者ID:chenleji,项目名称:scalarizr,代码行数:8,代码来源:memcached.py

示例11: __init__

def __init__(self, num_entries = 20, send_interval = '30s'):
		logging.Handler.__init__(self)	
		
		m = INTERVAL_RE.match(send_interval)
		self.send_interval = (int(m.group('seconds') or 0) + 60*int(m.group('minutes') or 0)) or 1
		self.num_entries = num_entries
		self._logger = logging.getLogger(__name__)
		bus.on("shutdown", self.on_shutdown)
开发者ID:golovast,项目名称:scalarizr,代码行数:8,代码来源:log.py

示例12: __init__

 def __init__(self):
     self.preset_provider = MemcachedPresetProvider()
     preset_service.services[BEHAVIOUR] = self.preset_provider
     ServiceCtlHandler.__init__(self, SERVICE_NAME, initdv2.lookup('memcached'), MemcachedCnfController())
     FarmSecurityMixin.__init__(self, [11211])
     self._logger = logging.getLogger(__name__)
     self._queryenv = bus.queryenv_service
     bus.on("init", self.on_init)
开发者ID:notbrain,项目名称:scalarizr,代码行数:8,代码来源:memcached.py

示例13: __init__

 def __init__(self):
     handlers.Handler.__init__(self)
     bus.on(
         init=self.on_init, 
         start=self.on_start
     )
     self.api = tomcat_api.TomcatAPI()
     self.service = self.api.service
开发者ID:chenleji,项目名称:scalarizr,代码行数:8,代码来源:tomcat.py

示例14: __init__

def __init__(self):
		self._logger = logging.getLogger(__name__)
		self._iptables = iptables
		if not self._iptables.enabled():
			raise HandlerError('iptables is not installed. iptables is required for cassandra behaviour')
		

		bus.on("init", self.on_init)
开发者ID:golovast,项目名称:scalarizr,代码行数:8,代码来源:cassandra.py

示例15: on_init

def on_init(self, *args, **kwds):
		LOG.debug('Called on_init')
		bus.on(
			reload=self.on_reload,
			start=self.on_start,
			before_host_up=self.on_before_host_up,
			before_reboot_start=self.on_before_reboot_start
		)
开发者ID:golovast,项目名称:scalarizr,代码行数:8,代码来源:cloudfoundry.py

本文标签属性:

示例:示例的拼音

代码:代码零九

Python:python是什么

bus:不死的我先点满霸王色

上一篇:派出所执勤点什么意思(大运会消防安保办公室和执勤点作用)(大运会消防安保办公室和执勤点什么意思大运会消防安全工作)
下一篇:什么什么之隔(成语,一 *之隔)(一水之隔、天渊之隔、天渊之隔、一水之隔、一水之隔、一水之隔)

为您推荐