[ https://issues.apache.org/jira/browse/KARAF-4843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved KARAF-4843. ------------------------------------ Resolution: Fixed Fix Version/s: 4.1.0 Thx a ton for the patch ! > 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 > Assignee: Guillaume Nodet > Fix For: 4.1.0 > > > 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)