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

Group not propagated for servers/databases using @import #468

Closed
peetkes opened this issue Jun 23, 2015 · 1 comment
Closed

Group not propagated for servers/databases using @import #468

peetkes opened this issue Jun 23, 2015 · 1 comment

Comments

@peetkes
Copy link
Contributor

peetkes commented Jun 23, 2015

When you add unit testing to your roxy configuration, the config will be expanded for the test http-server and the test-content database. However, the setup.xqy script does not take the group for the http server and the database into account when it expands the @import attribute. That info effectively gets lost when recreating server and database xml to merge the settings. As a result the server and database end up in the Default group, which may potentially not contain any hosts, so server because unreachable, and the database will have no forests.

This can be fixed by creation of extra function:

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
    $server-config/ancestor::gr:group/gr:group-name
  (: databases :)
  else if ($server-config/@group) then
    $server-config/@group
  (: revert to defaults :)
  else if ($server-config/ancestor::*:configuration/@default-group) then
    $server-config/ancestor::*:configuration/@default-group
  else
    "Default"
};

and rewrite the function setup:get-group to :

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

In function setup:get-http-appservers-from-config (around line 3463) an attribute group must be added to the gr:http-server element:

        element gr:http-server
        {
          attribute group { setup:get-group-name($server) },
          $server/@*[fn:not(fn:local-name(.) = "import")],
          $imported-http/@*[fn:not(fn:local-name(.) = $server/@*/fn:local-name(.))],

In function setup:get-databases-from-config (around line 5480) an attribute group must be added to the db:database element:

        element db:database
        {
          attribute group {setup:get-group-name($db)},
          $db/@*[fn:not(fn:local-name(.) = "import")],
@grtjn grtjn changed the title @import attribute not propagated to the correct group in multi group configuration Group not propagated for servers/databases using @import Jun 23, 2015
@grtjn grtjn added this to the 1.7.3 milestone Jun 23, 2015
grtjn added a commit to grtjn/roxy that referenced this issue Jun 30, 2015
dmcassel added a commit that referenced this issue Jul 8, 2015
Fixed #468: preserving group info at expand of import server/db
@dmcassel
Copy link
Collaborator

dmcassel commented Jul 8, 2015

fixed in dev

@dmcassel dmcassel closed this as completed Jul 8, 2015
grtjn added a commit to grtjn/roxy that referenced this issue Jan 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants