Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3705

read-resource recursive-depth has no effect when recursive=true

    XMLWordPrintable

Details

    • Hide

      ./jboss-cli.sh -c > depth1.txt <<EOF
      :read-resource(recursive=true, proxies=true, recursive-depth=1, include-runtime=true)
      EOF

      ./jboss-cli.sh -c > depth2.txt <<EOF
      :read-resource(recursive=true, proxies=true, recursive-depth=2, include-runtime=true)
      EOF

      Observe no substantive content difference between depth1.txt and depth2.txt.

      Show
      ./jboss-cli.sh -c > depth1.txt <<EOF :read-resource(recursive=true, proxies=true, recursive-depth=1, include-runtime=true) EOF ./jboss-cli.sh -c > depth2.txt <<EOF :read-resource(recursive=true, proxies=true, recursive-depth=2, include-runtime=true) EOF Observe no substantive content difference between depth1.txt and depth2.txt.

    Description

      The code inside ReadResourceHandler.doExecuteInternal(OperationContext context, ModelNode operation) goes as follows:

      final int recursiveDepth = operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).asInt(0);
      final boolean recursive = recursiveDepth > 0 || operation.get(ModelDescriptionConstants.RECURSIVE).asBoolean(false);
      

      The documentation states:

      recursive-depth – (int) – The depth to which information about child resources should be included if recursive is {{true}. If not set, the depth will be unlimited; i.e. all descendant resources will be included.

      The logic, however, as implemented goes - either recursive-depth is greater than zero OR recursive is true.

      The proper implementation should be:

      final int recursiveDepth = operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).asInt(0);
      final boolean recursive =  operation.get(ModelDescriptionConstants.RECURSIVE).asBoolean(false) && 
                      (!operation.get(ModelDescriptionConstants.RECURSIVE_DEPTH).isDefined() || recursiveDepth > 0);
      

      The above snippet works as follows: recurs IF recursive is set AND (either recursive-depth is not defined OR recursive-depth is greater than 0).

      Attachments

        Issue Links

          Activity

            People

              bstansbe@redhat.com Brian Stansberry
              arcivanov_jira Arcadiy Ivanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: