glassfish
  1. glassfish
  2. GLASSFISH-16316

System properties with variables in them should not be expanded/replaced in the UI

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1.1_b03
    • Component/s: rest-interface
    • Labels:
      None
    • Environment:

      redhat enterprise 6.0

      Description

      With Glassfish 3.1 b43, when I create a system property that includes a system property inside it, it is expanded in the UI, but seems to be stored correctly in domain.xml.
      Create a system property named whatever.
      Set it's value to "$

      {com.sun.aas.instanceRoot}

      /config/cluster1-config/app.properties"
      Save the changes.
      It will display as "/glassfish-install-location/glassfish/domains/domain1/config/cluster1-config/app.properties" It should display with the ${} syntax, and not replace it with the domain's value.

      This is especially confusing when you're using the admin gui to set up a cluster's config and it replaces the variable with the value for domain1.

        Activity

        Hide
        Anissa Lam added a comment -

        Admin console uses REST API to get the information, and the property value has already been 'evaluated' before it gets back to the console.
        Some info for Jason to reproduce the case.

        • in the console, go to server-config->System Properties. Create a system property with name=TEST and value=$ {ccom.sun.aas.instanceRoot}

          /foo

        • Save.

        This is persisted correctly in domain.xml, and in CLI, you can see that the value is returned exactly like what you filled in.

        %asadmin get server.system-property.TEST
        server.system-property.TEST.name=TEST
        server.system-property.TEST.value=$

        {com.sun.aas.instanceRoot}

        /foo
        Command get executed successfully.

        But doing
        http://localhost:4848/management/domain/configs/config/server-config/system-properties.json
        will give
        {"exit_code":"SUCCESS","extraProperties":{"systemProperties":[

        {"name":"TEST","value":"\/Users\/anilam\/Awork\/V3\/v3\/dist-gf\/glassfish\/domains\/domain1\/foo"}

        ]}}

        thats why console is showing the resolved value.
        I think this needs to be fixed. Otherwise user has to change this back to the variable everytime they need to edit the properties.

        Show
        Anissa Lam added a comment - Admin console uses REST API to get the information, and the property value has already been 'evaluated' before it gets back to the console. Some info for Jason to reproduce the case. in the console, go to server-config->System Properties. Create a system property with name=TEST and value=$ {ccom.sun.aas.instanceRoot} /foo Save. This is persisted correctly in domain.xml, and in CLI, you can see that the value is returned exactly like what you filled in. %asadmin get server.system-property.TEST server.system-property.TEST.name=TEST server.system-property.TEST.value=$ {com.sun.aas.instanceRoot} /foo Command get executed successfully. But doing http://localhost:4848/management/domain/configs/config/server-config/system-properties.json will give {"exit_code":"SUCCESS","extraProperties":{"systemProperties":[ {"name":"TEST","value":"\/Users\/anilam\/Awork\/V3\/v3\/dist-gf\/glassfish\/domains\/domain1\/foo"} ]}} thats why console is showing the resolved value. I think this needs to be fixed. Otherwise user has to change this back to the variable everytime they need to edit the properties.
        Hide
        Jason Lee added a comment -

        The problem here is that the hidden CLI created to perform this operation deals with SystemPropertiesBag objects, which appear to resolve the tokens to their values. The solution, then, seems to be to remove that code and deal only with the HK2 Dom objects (which is what the get command does). I've made that change and created tests that verify the correct behavior for DAS, standalone instance, cluster, and clustered instance system properties. The diff is attached for 3.1.1 review.

        Show
        Jason Lee added a comment - The problem here is that the hidden CLI created to perform this operation deals with SystemPropertiesBag objects, which appear to resolve the tokens to their values. The solution, then, seems to be to remove that code and deal only with the HK2 Dom objects (which is what the get command does). I've made that change and created tests that verify the correct behavior for DAS, standalone instance, cluster, and clustered instance system properties. The diff is attached for 3.1.1 review.
        Hide
        Jason Lee added a comment -
        • Why fix this issue in 3.1.1?
          • As I understand it, this is a regression from v3
        • Which is the targeted build of 3.1.1 for this fix?
          • b03
        • Do regression tests exist for this issue?
          • The diff attached adds regression tests
        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
          • The SystemPropertiesTest test suite in the REST dev tests should be sufficient (though the related Admin Console tests might also be appropriate)
        Show
        Jason Lee added a comment - Why fix this issue in 3.1.1? As I understand it, this is a regression from v3 Which is the targeted build of 3.1.1 for this fix? b03 Do regression tests exist for this issue? The diff attached adds regression tests Which tests should QA (re)run to verify the fix did not destabilize GlassFish? The SystemPropertiesTest test suite in the REST dev tests should be sufficient (though the related Admin Console tests might also be appropriate)
        Hide
        ludo added a comment -

        Change seems good. I like to extensive test case...
        I guess, the console tests are fine as well...

        Show
        ludo added a comment - Change seems good. I like to extensive test case... I guess, the console tests are fine as well...
        Hide
        Jason Lee added a comment -

        Fix committed to trunk. Branch commit approval still pending.

        Show
        Jason Lee added a comment - Fix committed to trunk. Branch commit approval still pending.
        Hide
        scatari added a comment -

        Approved.

        Show
        scatari added a comment - Approved.
        Hide
        Jason Lee added a comment -

        Fix committed to the branch.

        Show
        Jason Lee added a comment - Fix committed to the branch.

          People

          • Assignee:
            Jason Lee
            Reporter:
            Jim Cullison
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: