def config_changed(): setup_ocf_files() if config('prefer-ipv6'): assert_charm_supports_ipv6() corosync_key = config('corosync_key') if not corosync_key: message = 'No Corosync key supplied, cannot proceed' status_set('blocked', message) raise Exception(message) enable_lsb_services('pacemaker') if config('prefer-ipv6'): for rid in relation_ids('hanode'): ensure_ipv6_requirements(rid) status_set('maintenance', "Setting up corosync") if configure_corosync(): pcmk.wait_for_pcmk() configure_cluster_global() configure_monitor_host() configure_stonith() update_nrpe_config()
def config_changed(): setup_ocf_files() if config('prefer-ipv6'): assert_charm_supports_ipv6() corosync_key = config('corosync_key') if not corosync_key: message = 'No Corosync key supplied, cannot proceed' status_set('blocked', message) raise Exception(message) enable_lsb_services('pacemaker') for rid in relation_ids('hanode'): hanode_relation_joined(rid) status_set('maintenance', "Setting up corosync") if configure_corosync(): try_pcmk_wait() configure_cluster_global() configure_monitor_host() configure_stonith() update_nrpe_config() cfg = config() if (is_leader() and cfg.previous('maintenance-mode') != cfg['maintenance-mode']): maintenance_mode(cfg['maintenance-mode'])
def install(): ubuntu_release = lsb_release()['DISTRIB_CODENAME'].lower() if CompareHostReleases(ubuntu_release) >= 'zesty': PACKAGES.remove('libnagios-plugin-perl') PACKAGES.append('libnagios-object-perl') # NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This # should be removed once the pacemaker package is fixed. status_set('maintenance', 'Installing apt packages') apt_install(filter_installed_packages(PACKAGES), fatal=True) setup_ocf_files()
def install(): ubuntu_release = lsb_release()['DISTRIB_CODENAME'].lower() # use libnagios on anything older than Xenial if CompareHostReleases(ubuntu_release) < 'xenial': PACKAGES.remove('libmonitoring-plugin-perl') PACKAGES.append('libnagios-plugin-perl') # NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This # should be removed once the pacemaker package is fixed. status_set('maintenance', 'Installing apt packages') apt_install(filter_installed_packages(PACKAGES), fatal=True) setup_ocf_files()
def install(): pkgs = copy.deepcopy(PACKAGES) ubuntu_release = lsb_release()['DISTRIB_CODENAME'].lower() # use libnagios on anything older than Xenial if CompareHostReleases(ubuntu_release) < 'xenial': pkgs.remove('libmonitoring-plugin-perl') pkgs.append('libnagios-plugin-perl') elif CompareHostReleases(ubuntu_release) >= 'bionic': pkgs.append('python3-libmaas') # NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This # should be removed once the pacemaker package is fixed. status_set('maintenance', 'Installing apt packages') apt_install(filter_installed_packages(pkgs), fatal=True) setup_ocf_files()
def config_changed(): # if we are paused, delay doing any config changed hooks. # It is forced on the resume. if is_unit_paused_set(): log("Unit is pause or upgrading. Skipping config_changed", "WARN") return setup_ocf_files() if config('prefer-ipv6'): assert_charm_supports_ipv6() corosync_key = config('corosync_key') if not corosync_key: message = 'No Corosync key supplied, cannot proceed' status_set('blocked', message) raise Exception(message) enable_lsb_services('pacemaker') for rid in relation_ids('hanode'): hanode_relation_joined(rid) status_set('maintenance', "Setting up corosync") if configure_corosync(): try_pcmk_wait() if is_leader(): run_initial_setup() update_nrpe_config() cfg = config() if (is_leader() and cfg.previous('maintenance-mode') != cfg['maintenance-mode']): maintenance_mode(cfg['maintenance-mode']) if config('no_quorum_policy').lower() in [ 'ignore', 'freeze', 'stop', 'suicide' ]: pcmk.set_property("no-quorum-policy", config('no_quorum_policy').lower()) else: message = 'Invalid setting for no_quorum_policy' status_set('blocked', message) status_set(*assess_status_helper())
def config_changed(): # if we are paused, delay doing any config changed hooks. # It is forced on the resume. if is_unit_paused_set(): log("Unit is pause or upgrading. Skipping config_changed", "WARN") return setup_ocf_files() if config('prefer-ipv6'): assert_charm_supports_ipv6() corosync_key = config('corosync_key') if not corosync_key: message = 'No Corosync key supplied, cannot proceed' status_set('blocked', message) raise Exception(message) enable_lsb_services('pacemaker') for rid in relation_ids('hanode'): hanode_relation_joined(rid) status_set('maintenance', "Setting up corosync") if configure_corosync(): try_pcmk_wait() failure_timeout = config('failure_timeout') configure_cluster_global(failure_timeout) configure_monitor_host() configure_stonith() update_nrpe_config() cfg = config() if (is_leader() and cfg.previous('maintenance-mode') != cfg['maintenance-mode']): maintenance_mode(cfg['maintenance-mode'])
def config_changed(): # if we are paused, delay doing any config changed hooks. # It is forced on the resume. if is_unit_paused_set(): log("Unit is pause or upgrading. Skipping config_changed", "WARN") return setup_ocf_files() if config('prefer-ipv6'): assert_charm_supports_ipv6() corosync_key = config('corosync_key') if not corosync_key: message = 'No Corosync key supplied, cannot proceed' status_set('blocked', message) raise Exception(message) enable_lsb_services('pacemaker') for rid in relation_ids('hanode'): hanode_relation_joined(rid) status_set('maintenance', "Setting up corosync") if configure_corosync(): try_pcmk_wait() configure_cluster_global() configure_monitor_host() configure_stonith() update_nrpe_config() cfg = config() if (is_leader() and cfg.previous('maintenance-mode') != cfg['maintenance-mode']): maintenance_mode(cfg['maintenance-mode'])
def install(): # NOTE(dosaboy): we currently disallow upgrades due to bug #1382842. This # should be removed once the pacemaker package is fixed. status_set('maintenance', 'Installing apt packages') apt_install(filter_installed_packages(PACKAGES), fatal=True) setup_ocf_files()