From c4d6478e39b3ba3823d57d49c617d4fc580d33d0 Mon Sep 17 00:00:00 2001 From: Geert Josten Date: Fri, 16 Jan 2015 16:52:12 +0100 Subject: [PATCH] Fixed #317: fixed regression in restart, and logging/docs for it --- deploy/lib/Help.rb | 5 +++-- deploy/lib/server_config.rb | 10 ++++++---- deploy/lib/xquery/setup.xqy | 5 +++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/deploy/lib/Help.rb b/deploy/lib/Help.rb index 9a390f26..e25d2aef 100644 --- a/deploy/lib/Help.rb +++ b/deploy/lib/Help.rb @@ -191,14 +191,15 @@ def self.initcpf def self.restart <<-DOC.strip_heredoc - Usage: ml {env} restart [group] [options] + Usage: ml {env} restart [{groupname}|cluster] [options] General options: -v, [--verbose] # Verbose output Restart the MarkLogic process in the given environment on each host in the specified group. If no group is specified, restart the MarkLogic process - on each host in the group to which the target host belongs. + on each host in the group to which the target host belongs. Use 'cluster' + to restart all hosts within the cluster to which the target belongs. DOC end diff --git a/deploy/lib/server_config.rb b/deploy/lib/server_config.rb index ae4a9275..4b633c3c 100644 --- a/deploy/lib/server_config.rb +++ b/deploy/lib/server_config.rb @@ -401,14 +401,16 @@ def execute_query(query, properties = {}) def restart group = ARGV.shift # Exclude any argument passed from command line. - if group.index("-") == 0 + if group && group.index("-") == 0 group = nil end - if group - logger.info "Restarting MarkLogic Server group #{group} on #{@hostname}" + if group && group == "cluster" + logger.info "Restarting MarkLogic Server cluster of #{@hostname}" + elsif group + logger.info "Restarting MarkLogic Server group #{group}" else - logger.info "Restarting MarkLogic Server on #{@hostname}" + logger.info "Restarting MarkLogic Server group of #{@hostname}" end logger.debug "this: #{self}" setup = File.read ServerConfig.expand_path("#{@@path}/lib/xquery/setup.xqy") diff --git a/deploy/lib/xquery/setup.xqy b/deploy/lib/xquery/setup.xqy index b08083e5..159558d5 100644 --- a/deploy/lib/xquery/setup.xqy +++ b/deploy/lib/xquery/setup.xqy @@ -849,6 +849,11 @@ declare function setup:do-restart($group-name as xs:string?) as item()* xdmp:group() else try { xdmp:group($group-name) } catch($ignore) {} + let $group-name := + if ($group-id) then + xdmp:group-name($group-id) + else + $group-name let $host-ids := if ($group-id) then xdmp:group-hosts($group-id)