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()
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()
def __init__(self, **kwds): super(PostgresqlSnapBackup, self).__init__(**kwds) self.service = initdv2.lookup(SERVICE_NAME) self.psql = PSQL() self.on( freeze=self.freeze, unfreeze=self.unfreeze )
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)
def __init__(self): self._init_script = initdv2.lookup(__mysql__['behavior']) definitions = {'ON':'1', 'TRUE':'1','OFF':'0','FALSE':'0'} CnfController.__init__(self, __mysql__['behavior'], mysql_svc.MYCNF_PATH, 'mysql', definitions) #TRUE,FALSE
def __init__(self): self.postgresql = PostgreSql() conf_path = os.path.join(self.postgresql.unified_etc_path, 'postgresql.conf') config_object = PostgresqlConf(conf_path) service = initdv2.lookup(SERVICE_NAME) config_mapping = {'postgresql.conf': config_object} PresetProvider.__init__(self, service, config_mapping) LOG.debug("Presets got config: %s" % conf_path)
def __init__(self): self._init_script = initdv2.lookup(__mysql__['behavior']) self.sendline = '' definitions = {'ON': '1', 'TRUE': '1', 'OFF' :'0', 'FALSE': '0'} CnfController.__init__(self, __mysql__['behavior'], mysql_svc.MYCNF_PATH, 'mysql', definitions) #TRUE,FALSE
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')
def __init__(self): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) if not os.path.exists(MYCNF_PATH): if linux.os.redhat_family and os.path.exists('/usr/share/mysql/my-medium.cnf'): shutil.copy('/usr/share/mysql/my-medium.cnf', MYCNF_PATH) else: fp = open(MYCNF_PATH, 'w') fp.write('[mysqld]') fp.close()
def __init__(self): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) if not os.path.exists(MYCNF_PATH): if disttool.is_redhat_based() and os.path.exists("/usr/share/mysql/my-medium.cnf"): shutil.copy("/usr/share/mysql/my-medium.cnf", MYCNF_PATH) else: fp = open(MYCNF_PATH, "w") fp.write("[mysqld]") fp.close()
def __init__(self): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) if not os.path.exists(MYCNF_PATH): if disttool.is_redhat_based() and os.path.exists( '/usr/share/mysql/my-medium.cnf'): shutil.copy('/usr/share/mysql/my-medium.cnf', MYCNF_PATH) else: fp = open(MYCNF_PATH, 'w') fp.write('[mysqld]') fp.close()
def __init__(self): self._logger = logging.getLogger(__name__) for dirname in os.listdir('/usr/lib/rabbitmq/lib/'): if dirname.startswith('rabbitmq_server'): self.plugin_dir = os.path.join('/usr/lib/rabbitmq/lib/', dirname, 'plugins') break else: raise Exception('RabbitMQ plugin directory not found') self.service = initdv2.lookup(SERVICE_NAME)
def on_reload(self): _is_win = linux.os.windows_family self._chef_client_bin = None self._chef_data = None self._client_conf_path = _is_win and r'C:\chef\client.rb' or '/etc/chef/client.rb' self._validator_key_path = _is_win and r'C:\chef\validation.pem' or '/etc/chef/validation.pem' self._client_key_path = _is_win and r'C:\chef\client.pem' or '/etc/chef/client.pem' self._json_attributes_path = _is_win and r'C:\chef\first-run.json' or '/etc/chef/first-run.json' self._with_json_attributes = False self._platform = bus.platform self._global_variables = {} self._init_script = initdv2.lookup('chef')
def __init__(self): bus.on("init", self.on_init) self._logger = logging.getLogger(__name__) self.rabbitmq = rabbitmq_svc.rabbitmq self.service = initdv2.lookup(BuiltinBehaviours.RABBITMQ) self._service_name = BEHAVIOUR self.on_reload() if 'ec2' == self.platform.name: self._logger.debug('Setting hostname_as_pubdns to 0') __ec2__ = __node__['ec2'] __ec2__['hostname_as_pubdns'] = 0
def on_reload(self): self._queryenv = bus.queryenv_service self._platform = bus.platform self._cnf = bus.cnf ini = self._cnf.rawini self._role_name = ini.get(config.SECT_GENERAL, config.OPT_ROLE_NAME) self._storage_path = STORAGE_PATH self._volume_config_path = self._cnf.private_path(os.path.join('storage', STORAGE_VOLUME_CNF)) self._snapshot_config_path = self._cnf.private_path(os.path.join('storage', STORAGE_SNAPSHOT_CNF)) self.default_service = initdv2.lookup(SERVICE_NAME)
def __init__(self): self._cnf = bus.cnf ServiceCtlHandler.__init__(self, BEHAVIOUR, initdv2.lookup('nginx'), NginxCnfController()) self._logger = logging.getLogger(__name__) self.preset_provider = NginxPresetProvider() self.api = NginxAPI() self._terminating_servers = [] preset_service.services[BEHAVIOUR] = self.preset_provider bus.define_events("nginx_upstream_reload") bus.on(init=self.on_init, reload=self.on_reload) self.on_reload()
def __init__(self): bus.on("init", self.on_init) self._logger = logging.getLogger(__name__) self.rabbitmq = rabbitmq_svc.RabbitMQ() self.service = initdv2.lookup(BuiltinBehaviours.RABBITMQ) self._service_name = BEHAVIOUR self.on_reload() if 'ec2' == self.platform.name: self._logger.debug('Setting hostname_as_pubdns to 0') __ec2__ = __node__['ec2'] __ec2__['hostname_as_pubdns'] = 0
def __init__(self): self._cnf = bus.cnf self._nginx_v2_flag_filepath = os.path.join(bus.etc_path, "private.d/nginx_v2") ServiceCtlHandler.__init__(self, BEHAVIOUR, initdv2.lookup('nginx'), NginxCnfController()) self._logger = logging.getLogger(__name__) self.preset_provider = NginxPresetProvider() self.api = NginxAPI() self.api.init_service() self._terminating_servers = [] bus.define_events("nginx_upstream_reload") bus.on(init=self.on_init, reload=self.on_reload) self.on_reload()
def __init__(self): if not software.whereis('rabbitmqctl'): raise HandlerError("Rabbitmqctl binary was not found. Check your installation.") bus.on("init", self.on_init) self._logger = logging.getLogger(__name__) self.rabbitmq = rabbitmq_svc.rabbitmq self.service = initdv2.lookup(BuiltinBehaviours.RABBITMQ) self._service_name = BEHAVIOUR self.on_reload() if 'ec2' == self.platform.name: updates = dict(hostname_as_pubdns = '0') self.cnf.update_ini('ec2', {'ec2': updates}, private=False)
def __init__(self): if not software.whereis('rabbitmqctl'): raise HandlerError("Rabbitmqctl binary was not found. Check your installation.") bus.on("init", self.on_init) self._logger = logging.getLogger(__name__) self.rabbitmq = rabbitmq_svc.rabbitmq self.service = initdv2.lookup(BuiltinBehaviours.RABBITMQ) self._service_name = BEHAVIOUR self.on_reload() if 'ec2' == self.platform.name: self._logger.debug('Setting hostname_as_pubdns to 0') __ec2__ = __node__['ec2'] __ec2__['hostname_as_pubdns'] = 0
def __init__(self): self._logger = logging.getLogger(__name__) try: self.version = software.rabbitmq_software_info().version except: self._logger.error("Can't install RabbitMQ") raise for dirname in os.listdir('/usr/lib/rabbitmq/lib/'): if dirname.startswith('rabbitmq_server'): self.plugin_dir = os.path.join('/usr/lib/rabbitmq/lib/', dirname, 'plugins') break else: raise Exception('RabbitMQ plugin directory not found') self.service = initdv2.lookup(SERVICE_NAME)
def main(): init_script() logger = logging.getLogger("scalarizr.scripts.udev") logger.info("Starting udev script...") try: initd = initdv2.lookup('scalarizr') if initd.running: msg_service = bus.messaging_service producer = msg_service.get_producer() msg = msg_service.new_message(Messages.INT_BLOCK_DEVICE_UPDATED) for k, v in os.environ.items(): msg.body[k.lower()] = v producer.send(Queues.CONTROL, msg) except (BaseException, Exception), e: logger.exception(e)
def __init__(self): super(ChefHandler, self).__init__() bus.on(init=self.on_init) self._chef_client_bin = None self._chef_data = None self._run_list = [] if linux.os.windows_family: self._client_conf_path = r"C:\chef\client.rb" self._validator_key_path = r"C:\chef\validation.pem" self._client_key_path = r"C:\chef\client.pem" self._json_attributes_path = r"C:\chef\first-run.json" else: self._client_conf_path = "/etc/chef/client.rb" self._validator_key_path = "/etc/chef/validation.pem" self._client_key_path = "/etc/chef/client.pem" self._json_attributes_path = "/etc/chef/first-run.json" self._with_json_attributes = False self._platform = bus.platform self._global_variables = {} self._init_script = initdv2.lookup("chef")
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._hir_volume_growth = None self._postgresql_api = postgresql_api.PostgreSQLAPI() self.on_reload()
def __init__(self): super(ChefHandler, self).__init__() bus.on(init=self.on_init) self._chef_client_bin = None self._chef_data = None self._run_list = [] if linux.os.windows_family: self._client_conf_path = r'C:\chef\client.rb' self._validator_key_path = r'C:\chef\validation.pem' self._client_key_path = r'C:\chef\client.pem' self._json_attributes_path = r'C:\chef\first-run.json' else: self._client_conf_path = '/etc/chef/client.rb' self._validator_key_path = '/etc/chef/validation.pem' self._client_key_path = '/etc/chef/client.pem' self._json_attributes_path = '/etc/chef/first-run.json' self._with_json_attributes = False self._platform = bus.platform self._global_variables = {} self._init_script = initdv2.lookup('chef')
def main(): init_script() logger = logging.getLogger("scalarizr.scripts.udev") logger.info("Starting udev script...") try: initd = initdv2.lookup('scalarizr') if initd.running: channel = '/tmp/udev-block-device' with open(channel, 'w+') as fp: fp.write(os.environ['DEVNAME']) msg_service = bus.messaging_service producer = msg_service.get_producer() msg = msg_service.new_message(Messages.INT_BLOCK_DEVICE_UPDATED) for k, v in os.environ.items(): msg.body[k.lower()] = v producer.send(Queues.CONTROL, msg) except (BaseException, Exception), e: logger.exception(e)
def __init__(self): __rabbitmq__['rabbitmqctl'] = software.which('rabbitmqctl') __rabbitmq__['rabbitmq-server'] = software.which('rabbitmq-server') # RabbitMQ from Ubuntu repo puts rabbitmq-plugins in non-obvious place __rabbitmq__['rabbitmq-plugins'] = software.which( 'rabbitmq-plugins', '/usr/lib/rabbitmq/bin/') self._logger = logging.getLogger(__name__) try: self.version = software.rabbitmq_software_info().version except: self._logger.error("Can't install RabbitMQ") raise for dirname in os.listdir('/usr/lib/rabbitmq/lib/'): if dirname.startswith('rabbitmq_server'): self.plugin_dir = os.path.join('/usr/lib/rabbitmq/lib/', dirname, 'plugins') break else: raise Exception('RabbitMQ plugin directory not found') self.service = initdv2.lookup(SERVICE_NAME)
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._postgresql_api = postgresql_api.PostgreSQLAPI() self.on_reload()
def __init__(self, config_object): service = initdv2.lookup(SERVICE_NAME) config_mapping = {'postgresql.conf': config_object} PresetProvider.__init__(self, service, config_mapping)
def __init__(self): nginx_conf_path = __nginx__['nginx.conf'] config_mapping = {'nginx.conf': NginxConf(nginx_conf_path)} service = initdv2.lookup('nginx') PresetProvider.__init__(self, service, config_mapping)
def __init__(self): self.service = initdv2.lookup("apache") self.mod_ssl = DebianBasedModSSL( ) if linux.os.debian_family else RedHatBasedModSSL() self.current_open_ports = [] self._query_env = bus.queryenv_service
def __init__(self, version, pg_keys_dir): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) self._logger = logging.getLogger(__name__) self.pg_keys_dir = pg_keys_dir self.version = version
def __init__(self): nginx_conf_path = os.path.join(os.path.dirname(__nginx__['app_include_path']), 'nginx.conf') config_mapping = {'nginx.conf':NginxConf(nginx_conf_path)} service = initdv2.lookup('nginx') PresetProvider.__init__(self, service, config_mapping)
def __init__(self): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) self.pg_keys_dir = os.path.join(private_dir, 'keys')
def __init__(self): self._logger = logging.getLogger(__name__) self._initd = initdv2.lookup(SERVICE_NAME) bus.on(reload=self.on_reload) self.on_reload()
def __init__(self): service = initdv2.lookup(SERVICE_NAME) config_mapping = {PRESET_FNAME: MySQLConf(MYCNF_PATH)} PresetProvider.__init__(self, service, config_mapping)
def __init__(self): self._logger = logging.getLogger(__name__) self.service = initdv2.lookup(BEHAVIOUR) self._service_name = BEHAVIOUR bus.on(init=self.on_init)
def __init__(self): self.service = initdv2.lookup("apache") self.mod_ssl = DebianBasedModSSL() if linux.os.debian_family else RedHatBasedModSSL() self.current_open_ports = [] self._query_env = bus.queryenv_service
def __init__(self): self._initd = initdv2.lookup('mysql') #_ServiceCtlHandler.__init__(self,self.SERVICE_NAME, self._initd, MockCnfController()) super(MockHandler, self).__init__(self.SERVICE_NAME, self._initd, MockCnfController())
def __init__(self): nginx_conf_path = __nginx__['nginx.conf'] config_mapping = {'nginx.conf':NginxConf(nginx_conf_path)} service = initdv2.lookup('nginx') PresetProvider.__init__(self, service, config_mapping)
def __init__(self): service = initdv2.lookup(SERVICE_NAME) config_mapping = {'memcached.conf':MemcachedConf(mcd_conf_path)} PresetProvider.__init__(self, service, config_mapping)
def __init__(self, config_object): service = initdv2.lookup(SERVICE_NAME) config_mapping = {'postgresql.conf':config_object} PresetProvider.__init__(self, service, config_mapping)
def __init__(self, keyfile=None): self.keyfile = keyfile self._objects = {} self._logger = logging.getLogger(__name__) self.default_init_script = initdv2.lookup(SERVICE_NAME)
def __init__(self): 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)
def __init__(self): service = initdv2.lookup(SERVICE_NAME) config_mapping = {PRESET_FNAME:MySQLConf(MYCNF_PATH)} PresetProvider.__init__(self, service, config_mapping)
def __init__(self): self._objects = {} self.service = initdv2.lookup(SERVICE_NAME) self.pg_keys_dir = os.path.join(__node__['private_dir'], 'keys') self.first_start = None