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

    https://github.com/apache/brooklyn-server/pull/867#discussion_r146482165
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java 
---
    @@ -379,8 +379,15 @@ private synchronized void close() {
                     if (canUpdate()) { 
                         result.bundle = 
osgiManager.framework.getBundleContext().getBundle(result.getMetadata().getOsgiUniqueUrl());
                         if (result.getBundle()==null) {
    -                        log.warn("Brooklyn thought is was already managing 
bundle "+result.getMetadata().getVersionedName()+" but it's not installed to 
framework; reinstalling it");
    -                        updating = false;
    +                        if (hasBundleOnInstall(osgiManager, 
inferredMetadata, zipFile)) {
    +                            // e.g. happens if system-bundle is brought 
under management, and then try to add it again:
    +                            // if added from "initial catalog" has it, and 
then added from persisted state as well.
    +                            result.setIgnoringAlreadyInstalled();
    +                            return 
ReferenceWithError.newInstanceWithoutError(result);
    --- End diff --
    
    This return path only takes effect if passing the `canUpdate()` check on 
line 379 but presumably behaviour should be the same as for a non-snapshot 
version?
    
    Is the checksum check we do in the other block (line 397 in new money) is 
equivalent or if we need a super-set check combining that line with 
`hasBundleOnInstall()`.
    
    Probably those checks and the two `ignoringAlreadyInstalled` returns should 
be moved to before line 379.
    
    I'd also rename the new `hasBundleOnInstall` method to 
`isEquivalentBundleAlreadyOsgiInstalled` or something else a little more 
descriptive.


---

Reply via email to