Karaf
  1. Karaf
  2. KARAF-1014

Make files specified by ${includes} optional

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.4
    • Fix Version/s: 2.2.5, 3.0.0
    • Component/s: karaf-config
    • Labels:
      None

      Description

      The $

      {includes}

      property in custom.properties is used to list property files that will be read and evaluated by Karaf at startup. However, if a file listed this way does not exist, then Karaf fails to start. When using this as a means to give a user the possibility to add custom properties, it makes sense to change this behaviour so that Karaf picks up the file if it exists otherwise it will be ignored and Karaf will continue its startup process.

        Activity

        Jamie goodyear made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Jean-Baptiste Onofré made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Jean-Baptiste Onofré added a comment -

        Fixed on karaf-2.2.x: revision 1221877 (introduction of $

        {optionals}

        property).

        Show
        Jean-Baptiste Onofré added a comment - Fixed on karaf-2.2.x: revision 1221877 (introduction of $ {optionals} property).
        Hide
        Jean-Baptiste Onofré added a comment -

        Fixed on trunk: revision 1221872 (introduction of $

        {optionals}

        property).

        Show
        Jean-Baptiste Onofré added a comment - Fixed on trunk: revision 1221872 (introduction of $ {optionals} property).
        Jean-Baptiste Onofré made changes -
        Fix Version/s 2.2.5 [ 12317857 ]
        Fix Version/s 3.0.0 [ 12316040 ]
        Hide
        Bengt Rodehav added a comment -

        Glen (and JB),

        I agree that it is necessary to "require" a properties file as well as "optionally include" a properties file. I originally wrote that in the description but thought it better to see if there is a need for this. Your comment confirms that this is also a requirement.

        I would then propose either:

        1. Extending the syntax so that it is possible to specify whether the file should be regarded as optional or mandatory.
        2. Having one property for mandatory includes and another for optional includes.

        The second option is probably the easiest to implement. However, I'm not sure whether ordering might be an issue. Does Karaf perform a multipass evaluation so that all variables can be cross-referenced between the property files or do you only perform a single pass? In the latter case I assume that ordering matters.

        The first option lets you specify the ordering and would also let you override mandatory properties. The second option would probably imply that you first evaluate all mandatory files and then all optional files which puts a restriction on how you can order the files. Might be OK I guess and would definitely be easier to implement.

        Show
        Bengt Rodehav added a comment - Glen (and JB), I agree that it is necessary to "require" a properties file as well as "optionally include" a properties file. I originally wrote that in the description but thought it better to see if there is a need for this. Your comment confirms that this is also a requirement. I would then propose either: Extending the syntax so that it is possible to specify whether the file should be regarded as optional or mandatory. Having one property for mandatory includes and another for optional includes. The second option is probably the easiest to implement. However, I'm not sure whether ordering might be an issue. Does Karaf perform a multipass evaluation so that all variables can be cross-referenced between the property files or do you only perform a single pass? In the latter case I assume that ordering matters. The first option lets you specify the ordering and would also let you override mandatory properties. The second option would probably imply that you first evaluate all mandatory files and then all optional files which puts a restriction on how you can order the files. Might be OK I guess and would definitely be easier to implement.
        Hide
        Jean-Baptiste Onofré added a comment -

        Good point Glen. However, we have to enhance the way for the users to provide its custom file. I would prefer to let user use the custom.properties file and clearly replace variables in this file.

        Show
        Jean-Baptiste Onofré added a comment - Good point Glen. However, we have to enhance the way for the users to provide its custom file. I would prefer to let user use the custom.properties file and clearly replace variables in this file.
        Hide
        Glen Mazza added a comment -

        This seems dangerous to do. If a user explicitly specified a file that will provide some security rules or other important configuration information, but accidentally mistyped the filename in the $

        {includes}, then Karaf would run without the intended security rules or other configuration occurring and quite possibly without the Karaf administrator being aware of that fact. Nine times out of ten, the would-be Karaf user would be thrilled that Karaf refused to start, and would then fix the problem--moving the proper config file to the directory, removing the config file from the ${includes}

        property, or fixing the typo over the filename.

        Show
        Glen Mazza added a comment - This seems dangerous to do. If a user explicitly specified a file that will provide some security rules or other important configuration information, but accidentally mistyped the filename in the $ {includes}, then Karaf would run without the intended security rules or other configuration occurring and quite possibly without the Karaf administrator being aware of that fact. Nine times out of ten, the would-be Karaf user would be thrilled that Karaf refused to start, and would then fix the problem--moving the proper config file to the directory, removing the config file from the ${includes} property, or fixing the typo over the filename.
        Jean-Baptiste Onofré made changes -
        Field Original Value New Value
        Assignee Jean-Baptiste Onofré [ jbonofre ]
        Bengt Rodehav created issue -

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Bengt Rodehav
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development