def make_bindnetaddr(): host = crm_script.host() hostinfo = crm_script.output(2)[host] ba = crm_script.param('bindnetaddr') if ba: return ba # if not, try to figure it out based # on preferred interface iface = crm_script.param('iface') if isinstance(iface, dict): iface = iface[host] interfaces = hostinfo['net']['interfaces'] if not iface: for info in interfaces: if info.get('Destination') == '0.0.0.0': iface = info.get('Iface') break try: for info in interfaces: if info.get('Iface') != iface: continue dst = info.get('Destination') if dst != '0.0.0.0': return info.get('Destination') except: pass crm_script.fail_exit("Could not discover appropriate bindnetaddr")
def make_bindnetaddr(): host = crm_script.host() hostinfo = crm_script.output(1)[host] ba = crm_script.param('bindnetaddr') if ba: return ba # if not, try to figure it out based # on preferred interface iface = crm_script.param('iface') if isinstance(iface, dict): iface = iface[host] interfaces = hostinfo['net']['interfaces'] if not iface: for info in interfaces: if info.get('Destination') == '0.0.0.0': iface = info.get('Iface') break try: for info in interfaces: if info.get('Iface') != iface: continue dst = info.get('Destination') if dst != '0.0.0.0': return info.get('Destination') except: pass crm_script.fail_exit("Could not discover appropriate bindnetaddr")
#!/usr/bin/env python import crm_script import os import stat host = crm_script.host() others = crm_script.output(1).keys() others.remove(host) COROSYNC_AUTH = '/etc/corosync/authkey' COROSYNC_CONF = '/etc/corosync/corosync.conf' def make_opts(): from psshlib import api as pssh opts = pssh.Options() opts.timeout = 60 opts.recursive = True opts.user = '******' opts.ssh_options += [ 'PasswordAuthentication=no', 'StrictHostKeyChecking=no', 'ControlPersist=no' ] return opts def check_results(pssh, results): failures = [] for host, result in results.items(): if isinstance(result, pssh.Error): failures.add("%s: %s" % (host, str(result)))
#!/usr/bin/env python import crm_script import os import stat host = crm_script.host() others = crm_script.output(2).keys() others.remove(host) COROSYNC_AUTH = '/etc/corosync/authkey' COROSYNC_CONF = '/etc/corosync/corosync.conf' def make_opts(): import parallax opts = parallax.Options() opts.timeout = 60 opts.recursive = True opts.user = '******' opts.ssh_options += ['PasswordAuthentication=no', 'StrictHostKeyChecking=no', 'ControlPersist=no'] return opts def check_results(parallax, results): failures = [] for host, result in results.items(): if isinstance(result, parallax.Error): failures.add("%s: %s" % (host, str(result))) if failures: