def _run_cleanup(local_node, hosts, workdir, opts): "Clean up after the cluster script" if hosts and workdir: cleanscript = os.path.join(workdir, 'crm_clean.py') for host, result in _pssh_call(hosts, "%s %s" % (cleanscript, workdir), opts).iteritems(): if isinstance(result, pssh.Error): err_buf.debug("[%s]: Failed to clean up %s" % (host, workdir)) err_buf.error("[%s]: Clean: %s" % (host, result)) else: _print_output(host, *result) _cleanup_local(workdir)
def _extract_localnode(hosts): """ Remove loal node from hosts list, so we can treat it separately """ this_node = utils.this_node() hosts2 = [] local_node = None for h, p, u in hosts: if h != this_node: hosts2.append((h, p, u)) else: local_node = (h, p, u) err_buf.debug("Local node: %s, Remote hosts: %s" % (local_node, ', '.join(h[0] for h in hosts2))) return local_node, hosts2
def _extract_localnode(hosts): """ Remove loal node from hosts list, so we can treat it separately """ this_node = utils.this_node() hosts2 = [] local_node = None for h, p, u in hosts: if h != this_node: hosts2.append((h, p, u)) else: local_node = (h, p, u) err_buf.debug("Local node: %s, Remote hosts: %s" % ( local_node, ', '.join(h[0] for h in hosts2))) return local_node, hosts2
def _pssh_copy(hosts, src, dst, opts): "pssh.copy with debug logging" if config.core.debug or options.regression_tests: err_buf.debug("pssh.copy(%s, %s, %s)" % (repr(hosts), src, dst)) return pssh.copy(hosts, src, dst, opts)
def _pssh_call(hosts, cmd, opts): "pssh.call with debug logging" if config.core.debug or options.regression_tests: err_buf.debug("pssh.call(%s, %s)" % (repr(hosts), cmd)) return pssh.call(hosts, cmd, opts)
def debug(self, msg): err_buf.debug(msg)