Skip to content

Commit

Permalink
Fixed marklogic-community#468: preserving group info at expand of imp…
Browse files Browse the repository at this point in the history
…ort server/db
  • Loading branch information
grtjn committed Jun 30, 2015
1 parent 0d9e53e commit 3581598
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -3471,7 +3471,8 @@ declare function setup:get-http-appservers-from-config(
return
element gr:http-server
{
$server/@*[fn:not(fn:local-name(.) = "import")],
attribute group { setup:get-group-name($server) },
$server/(@* except (@import, @group)),
$imported-http/@*[fn:not(fn:local-name(.) = $server/@*/fn:local-name(.))],
$server/*,
let $ignore := $server/*/fn:node-name(.)
Expand Down Expand Up @@ -5490,7 +5491,8 @@ declare function setup:get-databases-from-config(
return
element db:database
{
$db/@*[fn:not(fn:local-name(.) = "import")],
attribute group {setup:get-group-name($db)},
$db/(@* except (@import, @group)),
$imported-db/@*[fn:not(fn:local-name(.) = $db/@*/fn:local-name(.))],
$db/*,
let $ignore := $db/*/fn:node-name(.)
Expand Down Expand Up @@ -5654,19 +5656,24 @@ declare function setup:create-ssl-certificate-templates($import-config as elemen

};

declare function setup:get-group($server-config as element()) as xs:unsignedLong
declare function setup:get-group-name($server-config as element()) as xs:string
{
(: app servers :)
if ($server-config/ancestor::gr:group/gr:group-name) then
xdmp:group($server-config/ancestor::gr:group/gr:group-name)
$server-config/ancestor::gr:group/gr:group-name
(: databases :)
else if ($server-config/@group) then
xdmp:group($server-config/@group)
$server-config/@group
(: revert to defaults :)
else if ($server-config/ancestor::*:configuration/@default-group) then
xdmp:group($server-config/ancestor::*:configuration/@default-group)
$server-config/ancestor::*:configuration/@default-group
else
xdmp:group("Default")
"Default"
};

declare function setup:get-group($server-config as element()) as xs:unsignedLong
{
xdmp:group(setup:get-group-name($server-config))
};

declare function setup:get-host-group($host-config as element(ho:host)) as xs:unsignedLong
Expand Down

0 comments on commit 3581598

Please sign in to comment.