本文整理汇总了Python中scalarizr.bus.bus.on函数的典型用法代码示例。如果您正苦于以下问题:Python on函数的具体用法?Python on怎么用?Python on使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了on函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: on_init
def on_init(self):
if is_cloud_controller():
bus.on(
start=self.on_start,
host_init_response=self.on_host_init_response,
before_host_up=self.on_before_host_up,
reload=self.on_reload
)
self._init_objects()
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:9,代码来源:cloudfoundry.py
示例17: __init__
def __init__(self):
LOG.debug("HAProxyHandler __init__")
self.api = haproxy_api.HAProxyAPI()
self._proxies = None
self.on_reload()
bus.on(
init=self.on_init,
reload=self.on_reload
)
开发者ID:chenleji,项目名称:scalarizr,代码行数:9,代码来源:haproxy.py
示例18: 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)
self._insert_iptables_rules()
if __node__['state'] == ScalarizrState.BOOTSTRAPPING:
self._stop_service('Configuring')
开发者ID:AnyBucket,项目名称:scalarizr,代码行数:9,代码来源:nginx.py
示例19: __init__
def __init__(self):
super(ChefHandler, self).__init__()
bus.on(init=self.on_init)
self._chef_data = None
self._run_list = None
self._with_json_attributes = None
self._platform = bus.platform
self._global_variables = {}
self._init_script = initdv2.lookup('chef')
开发者ID:chenleji,项目名称:scalarizr,代码行数:10,代码来源:chef.py
示例20: __init__
def __init__(self):
super(LifeCycleHandler, self).__init__()
self._logger = logging.getLogger(__name__)
self._op_api = operation.OperationAPI()
self._system_api = system_api.SystemAPI()
bus.define_events(
# Fires before HostInit message is sent
# @param msg
"before_host_init",
# Fires after HostInit message is sent
"host_init",
# Fires when HostInitResponse received
# @param msg
"host_init_response",
# Fires before HostUp message is sent
# @param msg
"before_host_up",
# Fires after HostUp message is sent
"host_up",
# Fires before RebootStart message is sent
# @param msg
"before_reboot_start",
# Fires after RebootStart message is sent
"reboot_start",
# Fires before RebootFinish message is sent
# @param msg
"before_reboot_finish",
# Fires after RebootFinish message is sent
"reboot_finish",
# Fires before Restart message is sent
# @param msg: Restart message
"before_restart",
# Fires after Restart message is sent
"restart",
# Fires before Hello message is sent
# @param msg
"before_hello",
# Fires after Hello message is sent
"hello",
# Fires after HostDown message is sent
# @param msg
"before_host_down",
# Fires after HostDown message is sent
"host_down",
#
# Service events
#
# Fires when behaviour is configured
# @param service_name: Service name. Ex: mysql
"service_configured",
)
bus.on(init=self.on_init, start=self.on_start, reload=self.on_reload, shutdown=self.on_shutdown)
self.on_reload()
开发者ID:chenleji,项目名称:scalarizr,代码行数:54,代码来源:lifecycle.py
注:本文中的scalarizr.bus.bus.on函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论