Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #345 from grtjn/317-restart-without-group
Browse files Browse the repository at this point in the history
Fixed #317: regression in restart
  • Loading branch information
dmcassel committed Jan 20, 2015
2 parents 59fa164 + c4d6478 commit b709c9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions deploy/lib/Help.rb
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions deploy/lib/server_config.rb
Expand Up @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions deploy/lib/xquery/setup.xqy
Expand Up @@ -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)
Expand Down

0 comments on commit b709c9b

Please sign in to comment.