openhab / openhab-distro

The binary distribution of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.3k stars 394 forks source link

Bindings not uninstalled when removed from addons.cfg #700

Closed mhilbush closed 6 years ago

mhilbush commented 6 years ago

I upgraded my test system from 1250 to the latest snapshot 1271. In the course of trying to track down the cause an NPE in ThingManager at startup, I removed all the bindings that were specified in my services/addons.cfg file. Looking in the console, none of those bindings were uninstalled. In Paper UI, the bindings still showed as installed. And, I was able to uninstall those bindings using Paper UI.

When I added the bindings back into addons.cfg, they were installed again (which is the expected behavior). However, removing them from addons.cfg, resulted in the same behavior as described above. So this appears to be reproducible.

I know there are issues related to bindings being mysteriously uninstalled. But this is a new and different behavior (at least for me), and I didn’t see any issues logged for this problem.

mhilbush commented 6 years ago

Adding a little more info on my observations... Hope this is helpful.

Enabled DEBUG on org.openhab.core.

Precondition: Only PaperUI is installed.

Adding ntp binding to addons.cfg resulted in this being logged immediately after saving the file:

2018-05-04 12:03:31.674 [DEBUG] [org.openhab.core.karaf              ] - ServiceEvent MODIFIED - {org.openhab.core.karaf.internal.FeatureInstaller, org.osgi.service.cm.ConfigurationListener}={action=, package=minimal, service.id=179, service.bundleid=178, service.scope=bundle, binding=ntp, persistence=, transformation=, misc=, component.name=org.openhab.addons, service.config.label=Add-on Management, component.id=10, ui=paper, voice=, service.config.category=system, service.config.description.uri=system:addons, service.pid=org.openhab.addons} - org.openhab.core.karaf
2018-05-04 12:03:32.449 [DEBUG] [core.karaf.internal.FeatureInstaller] - Installed 'openhab-binding-ntp'

A few seconds later the scheduled feature install job runs.

2018-05-04 12:03:38.297 [DEBUG] [core.karaf.internal.FeatureInstaller] - Running scheduled sync job

Removed ntp binding from addons.cfg. Nothing was logged until the feature installer job ran about 30+ seconds later.

2018-05-04 12:04:38.298 [DEBUG] [core.karaf.internal.FeatureInstaller] - Running scheduled sync job

The ntp binding was not uninstalled.

mhilbush commented 6 years ago

Also for completeness, including my addons.cfg.

# The base installation package of this openHAB instance (default is "standard")
# Valid options:
#   - minimal  : Installation only with dashboard, but no UIs or other addons
#   - standard : Typical installation with all standards UIs
#   - demo     : A demo setup which includes UIs, a few bindings, config files etc.
package = minimal

# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
#binding = astro,http1,ntp,serial1,systeminfo,weatherunderground
#binding = ntp

# A comma-separated list of UIs to install (e.g. "basic,paper")
#ui = basic,paper,habmin,habpanel
ui = paper

# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
#persistence = rrd4j,mysql,gcal

# A comma-separated list of actions to install (e.g. "mail,pushover")
#action = mail

# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
#transformation = javascript,jsonpath,map

# A comma-separated list of voice services to install (e.g. "marytts,freetts")
#voice = voicerss

# A comma-separated list of miscellaneous services to install (e.g. "myopenhab")
#misc = gcal1,restdocs
mhilbush commented 6 years ago

Ok, final update (I think).

I reverted to my backup of build 1250. I confirmed that removing a binding from addons.cfg results in the binding being uninstalled. So it must be something that changed between 1250 and 1271.

mhilbush commented 6 years ago

I'm going to close this at it appears to be an error on my part.

Note to self. You can't comment out the lines in addons.cfg and expect the bindings in that line to be uninstalled. You must have an empty "binding = " line.

For example, this works correctly.

binding = 

This doesn't work

#binding = ntp

Sorry for the confusion.

kaikreuzer commented 6 years ago

Ah, glad you solved it before I found the time to look at it more closely! Yes, your comment is right: If there is no content (and comments are considered no content) in the file, it means that there is no definition of the bindings that should be installed and thus nothing is changes in the status quo. Glad to hear that this works so successfully 😆