def resource_cleanup( runner: CommandRunner, resource: Optional[str] = None, node: Optional[str] = None, operation: Optional[str] = None, interval: Optional[str] = None, strict: bool = False, ): cmd = [__exec("crm_resource"), "--cleanup"] if resource: cmd.extend(["--resource", resource]) if node: cmd.extend(["--node", node]) if operation: cmd.extend(["--operation", operation]) if interval: cmd.extend(["--interval", interval]) if strict: cmd.extend(["--force"]) stdout, stderr, retval = runner.run(cmd) if retval != 0: raise LibraryError( reports.resource_cleanup_error(join_multilines([stderr, stdout]), resource, node)) # usefull output (what has been done) goes to stderr return join_multilines([stdout, stderr])
def resource_cleanup(runner, resource=None, node=None, force=False): if not force and not node and not resource: summary = ClusterState(get_cluster_status_xml(runner)).summary operations = summary.nodes.attrs.count * summary.resources.attrs.count if operations > __RESOURCE_CLEANUP_OPERATION_COUNT_THRESHOLD: raise LibraryError( reports.resource_cleanup_too_time_consuming( __RESOURCE_CLEANUP_OPERATION_COUNT_THRESHOLD ) ) cmd = [__exec("crm_resource"), "--cleanup"] if resource: cmd.extend(["--resource", resource]) if node: cmd.extend(["--node", node]) stdout, stderr, retval = runner.run(cmd) if retval != 0: raise LibraryError( reports.resource_cleanup_error( join_multilines([stderr, stdout]), resource, node ) ) # usefull output (what has been done) goes to stderr return join_multilines([stdout, stderr])
def resource_cleanup(runner, resource=None, node=None, force=False): if not force and not node and not resource: summary = ClusterState(get_cluster_status_xml(runner)).summary operations = summary.nodes.attrs.count * summary.resources.attrs.count if operations > __RESOURCE_CLEANUP_OPERATION_COUNT_THRESHOLD: raise LibraryError( reports.resource_cleanup_too_time_consuming( __RESOURCE_CLEANUP_OPERATION_COUNT_THRESHOLD ) ) cmd = [__exec("crm_resource"), "--cleanup"] if resource: cmd.extend(["--resource", resource]) if node: cmd.extend(["--node", node]) stdout, stderr, retval = runner.run(cmd) if retval != 0: raise LibraryError( reports.resource_cleanup_error( join_multilines([stderr, stdout]), resource, node ) ) # usefull output (what has been done) goes to stderr return join_multilines([stdout, stderr])
def resource_cleanup( runner, resource=None, node=None, operation=None, interval=None ): cmd = [__exec("crm_resource"), "--cleanup"] if resource: cmd.extend(["--resource", resource]) if node: cmd.extend(["--node", node]) if operation: cmd.extend(["--operation", operation]) if interval: cmd.extend(["--interval", interval]) stdout, stderr, retval = runner.run(cmd) if retval != 0: raise LibraryError( reports.resource_cleanup_error( join_multilines([stderr, stdout]), resource, node ) ) # usefull output (what has been done) goes to stderr return join_multilines([stdout, stderr])
def resource_cleanup(runner, resource=None, node=None): cmd = [__exec("crm_resource"), "--cleanup"] if resource: cmd.extend(["--resource", resource]) if node: cmd.extend(["--node", node]) stdout, stderr, retval = runner.run(cmd) if retval != 0: raise LibraryError( reports.resource_cleanup_error(join_multilines([stderr, stdout]), resource, node)) # usefull output (what has been done) goes to stderr return join_multilines([stdout, stderr])