Ensuring that components have a configuration when started

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Ensuring that components have a configuration when started

Robert Munteanu-2
Hi,

I think we have an ongoing problem with components that:

- are defined with ConfigurationPolicy.OPTIONAL
- have a configuration defined in the provisioning model

What can happen is that the component is activated, is referenced and
used, and at a later time is configured.

For an example of this see SLING-6305 [1], where the
LoginAdminWhitelist config is applied too late.

Top of my head, some (probably bad) ideas are:

1) Make the component require a configuration

This makes the component less flexible and we should aim for a minimal
configuration with Sling.

2) Post-process the configurations using the slingstart-maven-plugin
and adjust the configurationPolicy to be ConfigurationPolicy.REQUIRED

This is a bit suprising and makes it harder for components to be
switched to a default configuration after being provisioned.

Suggestions would be greatly appreciated :-)

Thanks,

Robert


[1]: https://issues.apache.org/jira/browse/SLING-6305
Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

chetan mehrotra
I think this issue should have been fixed with SLING-5779. May be the
new config that is exposed needs to be enabled for out of the box
Sling setup?
Chetan Mehrotra


On Mon, Nov 21, 2016 at 3:50 PM, Robert Munteanu <[hidden email]> wrote:

> Hi,
>
> I think we have an ongoing problem with components that:
>
> - are defined with ConfigurationPolicy.OPTIONAL
> - have a configuration defined in the provisioning model
>
> What can happen is that the component is activated, is referenced and
> used, and at a later time is configured.
>
> For an example of this see SLING-6305 [1], where the
> LoginAdminWhitelist config is applied too late.
>
> Top of my head, some (probably bad) ideas are:
>
> 1) Make the component require a configuration
>
> This makes the component less flexible and we should aim for a minimal
> configuration with Sling.
>
> 2) Post-process the configurations using the slingstart-maven-plugin
> and adjust the configurationPolicy to be ConfigurationPolicy.REQUIRED
>
> This is a bit suprising and makes it harder for components to be
> switched to a default configuration after being provisioned.
>
> Suggestions would be greatly appreciated :-)
>
> Thanks,
>
> Robert
>
>
> [1]: https://issues.apache.org/jira/browse/SLING-6305
Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Felix Meschberger-3
In reply to this post by Robert Munteanu-2
Hi

I suggest to attack the problem at the right place !

When Configuration Admin is active and configuration is stored in Configuration Admin, then configuration *is* provided as soon as such components are activated. If not, this is an SCR bug.

Now, I assume you have a provisioning problem in that the bundles are started and thus the components activated *before* the configuration is actually stored in Configuration Admin.

If this is the case, then please fix the initial provisioing process and *not* the components.

Regards
Felix

> Am 21.11.2016 um 11:20 schrieb Robert Munteanu <[hidden email]>:
>
> Hi,
>
> I think we have an ongoing problem with components that:
>
> - are defined with ConfigurationPolicy.OPTIONAL
> - have a configuration defined in the provisioning model
>
> What can happen is that the component is activated, is referenced and
> used, and at a later time is configured.
>
> For an example of this see SLING-6305 [1], where the
> LoginAdminWhitelist config is applied too late.
>
> Top of my head, some (probably bad) ideas are:
>
> 1) Make the component require a configuration
>
> This makes the component less flexible and we should aim for a minimal
> configuration with Sling.
>
> 2) Post-process the configurations using the slingstart-maven-plugin
> and adjust the configurationPolicy to be ConfigurationPolicy.REQUIRED
>
> This is a bit suprising and makes it harder for components to be
> switched to a default configuration after being provisioned.
>
> Suggestions would be greatly appreciated :-)
>
> Thanks,
>
> Robert
>
>
> [1]: https://issues.apache.org/jira/browse/SLING-6305

Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Bertrand Delacretaz
On Mon, Nov 21, 2016 at 11:25 AM, Felix Meschberger <[hidden email]> wrote:
> ...I assume you have a provisioning problem in that the bundles are started and
> thus the components activated *before* the configuration is actually stored
 in Configuration Admin....

I also think configurations should be active very early in the Sling
startup - if they are provided in the provisioning model they are
available right from the start.

-Bertrand
Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Robert Munteanu-2
In reply to this post by chetan mehrotra
Right, but I have no idea how to apply the fix after reading the issue
description :-)

Maybe you can suggest the correct value of the
sling.installer.requiredservices framework property for a service with
a given PID?

Thanks,

Robert

On Mon, 2016-11-21 at 15:53 +0530, Chetan Mehrotra wrote:

> I think this issue should have been fixed with SLING-5779. May be the
> new config that is exposed needs to be enabled for out of the box
> Sling setup?
> Chetan Mehrotra
>
>
> On Mon, Nov 21, 2016 at 3:50 PM, Robert Munteanu <[hidden email]>
> wrote:
> > Hi,
> >
> > I think we have an ongoing problem with components that:
> >
> > - are defined with ConfigurationPolicy.OPTIONAL
> > - have a configuration defined in the provisioning model
> >
> > What can happen is that the component is activated, is referenced
> > and
> > used, and at a later time is configured.
> >
> > For an example of this see SLING-6305 [1], where the
> > LoginAdminWhitelist config is applied too late.
> >
> > Top of my head, some (probably bad) ideas are:
> >
> > 1) Make the component require a configuration
> >
> > This makes the component less flexible and we should aim for a
> > minimal
> > configuration with Sling.
> >
> > 2) Post-process the configurations using the slingstart-maven-
> > plugin
> > and adjust the configurationPolicy to be
> > ConfigurationPolicy.REQUIRED
> >
> > This is a bit suprising and makes it harder for components to be
> > switched to a default configuration after being provisioned.
> >
> > Suggestions would be greatly appreciated :-)
> >
> > Thanks,
> >
> > Robert
> >
> >
> > [1]: https://issues.apache.org/jira/browse/SLING-6305

Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Robert Munteanu-2
In reply to this post by Felix Meschberger-3
On Mon, 2016-11-21 at 10:25 +0000, Felix Meschberger wrote:

> Hi
>
> I suggest to attack the problem at the right place !
>
> When Configuration Admin is active and configuration is stored in
> Configuration Admin, then configuration *is* provided as soon as such
> components are activated. If not, this is an SCR bug.
>
> Now, I assume you have a provisioning problem in that the bundles are
> started and thus the components activated *before* the configuration
> is actually stored in Configuration Admin.
>
> If this is the case, then please fix the initial provisioing process
> and *not* the components.

Agreed, and I think that's what SLING-5779 does. And yes, I reported
it, but my bad memory prevented me from remembering that :-)

Robert

>
> Regards
> Felix
>
> > Am 21.11.2016 um 11:20 schrieb Robert Munteanu <[hidden email]>
> > :
> >
> > Hi,
> >
> > I think we have an ongoing problem with components that:
> >
> > - are defined with ConfigurationPolicy.OPTIONAL
> > - have a configuration defined in the provisioning model
> >
> > What can happen is that the component is activated, is referenced
> > and
> > used, and at a later time is configured.
> >
> > For an example of this see SLING-6305 [1], where the
> > LoginAdminWhitelist config is applied too late.
> >
> > Top of my head, some (probably bad) ideas are:
> >
> > 1) Make the component require a configuration
> >
> > This makes the component less flexible and we should aim for a
> > minimal
> > configuration with Sling.
> >
> > 2) Post-process the configurations using the slingstart-maven-
> > plugin
> > and adjust the configurationPolicy to be
> > ConfigurationPolicy.REQUIRED
> >
> > This is a bit suprising and makes it harder for components to be
> > switched to a default configuration after being provisioned.
> >
> > Suggestions would be greatly appreciated :-)
> >
> > Thanks,
> >
> > Robert
> >
> >
> > [1]: https://issues.apache.org/jira/browse/SLING-6305
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Robert Munteanu-2
In reply to this post by Bertrand Delacretaz
On Mon, 2016-11-21 at 14:14 +0100, Bertrand Delacretaz wrote:

> On Mon, Nov 21, 2016 at 11:25 AM, Felix Meschberger <[hidden email]
> om> wrote:
> > ...I assume you have a provisioning problem in that the bundles are
> > started and
> > thus the components activated *before* the configuration is
> > actually stored
>
>  in Configuration Admin....
>
> I also think configurations should be active very early in the Sling
> startup - if they are provided in the provisioning model they are
> available right from the start.

That's something which is not 100% clear to me - why are they not
available from the start. The configadmin and osgi installer bundles
are available early in the process, definitely before the repository is
up so the LoginAdministrativeWhitelist component should start with a
configuration available.

I think a hint is present in Carsten's comment from [1]

> the issue here is that the support for configurations is available
after the OSGi installer already started its work. The installer is
happily installing bundles and only once that is done completely it
picks up the configuration support which was registered while it was
installing the bundles

Robert


[1]: https://issues.apache.org/jira/browse/SLING-5779?focusedCommentId=
15329297&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
tabpanel#comment-15329297
Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

chetan mehrotra
In reply to this post by Robert Munteanu-2
On Mon, Nov 21, 2016 at 7:01 PM, Robert Munteanu <[hidden email]> wrote:
> Maybe you can suggest the correct value of the
> sling.installer.requiredservices framework property for a service with
> a given PID

From test case case it looks like following framework property should work

sling.installer.requiredservices=resourcetransformer:org.osgi.service.cm,installtaskfactory:org.osgi.service.cm

Chetan Mehrotra
Reply | Threaded
Open this post in threaded view
|

Re: Ensuring that components have a configuration when started

Robert Munteanu-2
On Mon, 2016-11-21 at 20:04 +0530, Chetan Mehrotra wrote:

> On Mon, Nov 21, 2016 at 7:01 PM, Robert Munteanu <[hidden email]>
> wrote:
> > Maybe you can suggest the correct value of the
> > sling.installer.requiredservices framework property for a service
> > with
> > a given PID
>
> From test case case it looks like following framework property should
> work
>
> sling.installer.requiredservices=resourcetransformer:org.osgi.service
> .cm,installtaskfactory:org.osgi.service.cm

Hm, unfortunately it does not. I set it initially, with no effect. Then
when I read your response I realised that the updated bundle is not
part of the launchpad, but even after the update it does not work.

Robert