Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/746#discussion_r127499434
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java 
---
    @@ -308,11 +326,16 @@ private synchronized void close() {
                     // no such managed bundle
                     Maybe<Bundle> b = 
Osgis.bundleFinder(osgiManager.framework).symbolicName(result.getMetadata().getSymbolicName()).version(result.getMetadata().getSuppliedVersionString()).find();
                     if (b.isPresent()) {
    -                    // if it's non-brooklyn installed then fail
    -                    // (e.g. someone trying to install brooklyn or guice 
through this mechanism!)
    -                    result.bundle = b.get();
    -                    result.code = 
OsgiBundleInstallationResult.ResultCode.ERROR_INSTALLING_BUNDLE;
    -                    throw new IllegalStateException("Bundle 
"+result.getMetadata().getVersionedName()+" already installed in framework but 
not managed by Brooklyn; cannot install or update through Brooklyn");
    +                    // bundle already installed to OSGi subsystem but 
brooklyn not aware of it;
    +                    // this will often happen on a karaf restart so don't 
be too strict!
    +                    // in this case let's uninstall it to make sure we 
have the right bundle and checksum
    +                    // (in case where user has replaced a JAR file in 
persisted state,
    +                    // or where they osgi installed something and are now 
uploading it or something else) 
    +                    // but let's just assume it's the same; worst case if 
not user will
    +                    // have to uninstall it then reinstall it to do the 
replacement
    +                    // (means you can't just replace a JAR in persisted 
state however)
    +                    log.debug("Brooklyn install of 
"+result.getMetadata().getVersionedName()+" detected already loaded in OSGi; 
uninstalling that to reinstall as Brooklyn-managed");
    +                    b.get().uninstall();
    --- End diff --
    
    We'll need some more checks around this, or maybe a rethink of how it's 
done altogether - try deploying this bom file via the REST API:
    
        brooklyn.catalog:
          id: hack
          bundle: org.apache.brooklyn.karaf-init
          version: 0.12.0.SNAPSHOT
          name: Hack
          itemType: template
      
          item:
            services:
            - type: 
org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
    
    and it will happily uninstall our karaf-init bundle; killing Brooklyn 
altogether (not the Karaf process).  You can even do 
    
        brooklyn.catalog:
          id: hack
          bundle: org.apache.karaf.bundle.core
          version: 4.0.8
          name: Hack
          itemType: template
        
          item:
            services:
            - type: 
org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
    
    
    which Karaf doesn't react well to.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to