Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-76

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

    Details

    • Steps to Reproduce:
      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).

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  brian.stansberry Brian Stansberry
                  Reporter:
                  arcivanov Arcadiy Ivanov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: