generated sling configuration does not contain the variable

Description

In some case the generated sling configuration files is wrong.

To reproduce the bug:

  1. prepare a handelbar template

  2. define only the configuration "foo" in the environment and "bar" not.

Expectation: a sling configuration file is generated:

com.example.ServiceConfiguration.config

Actual: 2 configuration files are generated.

  • com.example.ServiceConfiguration.config (the file is empty)

  • foo="foo".config (the file is empty)

Gliffy Diagrams

Activity

Show:

Guiquan Weng January 14, 2016 at 9:36 AM

it works perfectly. thanks

Stefan Seifert January 13, 2016 at 3:59 PM

this should work:

when you use

you have still one superfluous line break if notExistingVar is not set. or perhaps the indentation was not correct. you should see the syntax problem when you outcomment the sling-provisioning-osgiconfig post processor in your role file.

Guiquan Weng January 11, 2016 at 2:59 PM

you are right. the problem is the white spaces.

I am able to simplify the test case to

With

I get 2 file generated, the same like above.

With

only one empty file is generated "com.example.ServiceConfigurationfoo="foo".config".

Do you have other suggestions?
thanks in advance.

Stefan Seifert December 21, 2015 at 9:45 AM

i tried to reproduce the problem with two new unit tests:
https://github.com/wcm-io-devops/conga-sling-plugin/commit/7807862901acc6b82541d795878b86827547dd4e

but all tests succeeded.

so my only assumption is there is some problem with whitespace handling in your provisioning template file. please comment out the sling-provisioning-osgiconfig post processor for debugging purpose in your role definition and check the .provisioning file that is generated as intermediate file before it is converted to the single .config snippets.

i assume there you will find that the line foo="foo" startes directly on the beginning of the line and is not indented properly. if this is the case fix your handlebars template. your can control whitespaces around the handlebar expressions with insertion ~ characters, see http://devops.wcm.io/conga/handlebars-quickstart.html#Whitespace_handling

if this is not the case please provide what exactly you have got in the file which produced the problem.

Guiquan Weng December 11, 2015 at 10:12 AM
Edited

just notice the title is not good after the issue is created. but I am not able to update the issue title.

I am able to edit the issue after a few seconds

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Created December 11, 2015 at 10:10 AM
Updated January 14, 2016 at 9:37 AM
Resolved January 14, 2016 at 9:37 AM