[ 
https://issues.apache.org/jira/browse/KARAF-4843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15695456#comment-15695456
 ] 

ASF GitHub Bot commented on KARAF-4843:
---------------------------------------

GitHub user cfiehe reopened a pull request:

    https://github.com/apache/karaf/pull/268

    [KARAF-4843] Updating factory configuration leads to new configurati…

    …on instance

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cfiehe/karaf KARAF-4843

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/karaf/pull/268.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #268
    
----
commit e852225cdca1a1d831ceffc4b253ff2126652850
Author: Christoph Fiehe <christoph.fi...@materna.de>
Date:   2016-11-24T08:18:08Z

    [KARAF-4843] Updating factory configuration leads to new configuration 
instance

----


> Updating factory configuration leads to new configuration instance
> ------------------------------------------------------------------
>
>                 Key: KARAF-4843
>                 URL: https://issues.apache.org/jira/browse/KARAF-4843
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-config
>    Affects Versions: 4.1.0
>            Reporter: Jens Offenbach
>
> Start with a fresh Karaf 4.1.0-SNAPSHOT installation and validate that 
> felix.fileinstall.enableConfigSave = true is set. 
> Scenario:
> - Create a factory configuration.
> - Update the configuration.
> Result:
> The configuration gets updated, but a new configuration with another 
> incorrect service.factoryPid gets created:
> Steps to reproduce:
> {code}
> karaf@root()> config:edit --factory com.example.TestConfig
> karaf@root()> config:property-set A B
> karaf@root()> config:update
> karaf@root()> config:list '(service.factoryPid=com.example.TestConfig*)'
> ----------------------------------------------------------------
> Pid:            com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af
> FactoryPid:     com.example.TestConfig
> BundleLocation: null
> Properties:
>    A = B
>    service.factoryPid = com.example.TestConfig
>    service.pid = com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af
> karaf@root()> config:edit 
> com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af
> karaf@root()> config:property-set A C
> karaf@root()> config:update
> karaf@root()> config:list '(service.factoryPid=com.example.TestConfig*)'
> ----------------------------------------------------------------
> Pid:            com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af
> FactoryPid:     com.example.TestConfig
> BundleLocation: null
> Properties:
>    A = C
>    service.factoryPid = com.example.TestConfig
>    service.pid = com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af
> ----------------------------------------------------------------
> Pid:            
> com.example.TestConfig.8d22975e.22055df0-4a85-4b87-94c6-7787cd84a8e5
> FactoryPid:     com.example.TestConfig.8d22975e
> BundleLocation: null
> Properties:
>    A = C
>    felix.fileinstall.filename = 
> file:/opt/apache-karaf-4.1.0-SNAPSHOT/etc/com.example.TestConfig.8d22975e-3cb3-477c-985d-7c1a1d9f98af.cfg
>    service.factoryPid = com.example.TestConfig.8d22975e
>    service.pid = 
> com.example.TestConfig.8d22975e.22055df0-4a85-4b87-94c6-7787cd84a8e5
> karaf@root()> config:list '(service.factoryPid=com.example.TestConfigd*)'
> {code}
> I think that there is a problem with fileinstall and hyphen handling. The 
> string before the hyphen is interpreted as factoryPid resulting in 
> "com.example.TestConfig.8d22975e". Fileinstall tries to find the existing 
> configuration using the key "felix.fileinstall.filename" which is not set by 
> "ConfigRepositoryImpl".
> Solution:
> I am not sure, but I think, that in the "update"-method of 
> "ConfigRepositoryImpl", the "felix.fileinstall.filename"-property has to be 
> set explicitly and that an alias has be used that does not contain a hyphen.
> It would be nice to add an "-alias" option to the command "config:edit" that 
> allows a user to specify the alias that gets used for the factory 
> configuration. Unfortunately, the alias does not get used when the 
> configuration gets created for the first time. Only its update leads to a 
> file creation that gets considered by Fileinstall.
> What are your thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to