openhab / openhab-linuxpkg

Repo for Linux packages
Eclipse Public License 2.0
18 stars 33 forks source link

Config patching (new feature) #205

Closed mstormi closed 2 years ago

mstormi commented 2 years ago

I've been researching means to operate OH for others than myself. One of the challenges you quickly come across is the need to patch the config of an existing OH installation. openhab-cli currently removes every config bit then redeploys everything from scratch. My current favourite idea would be a "-textinput" option addition that overwrites select OH text config files, i.e. it extracts only those files from the full-config tar file that are safe to replace. I'd think that to overwrite .things, .items, .rules, .script should work even in a running OH installation without taking OH down. This wouldn't work for all the UI-entered stuff, then again there's no real point in patching those offline as all those changes can (and usually will) be interactively made to a running system anyway, including YAML copy'n'paste.

How would you want this to be implemented: pass an option to the restore script ? or rather set an env variable ?

@BClark09 wdyt ?

BClark09 commented 2 years ago

Hi @mstormi

I think a text file config only (items, rules things etc) option for the restore script is a good idea and I can see an items/things only restore useful for UI-based configurations too, e.g. where moving from one OS to another makes a full restore difficult.

This is an issue for openhab-distro though, an implementation on the ${OPENHAB_RUNTIME}/bin/restore script would automatically be available on openhab-cli as all openhab-cli does is provide a shortcut (and passthrough of options) to that script.

mstormi commented 2 years ago

Passing arguments to the restore script requires modifications to openhab-cli in the first place, see #206 .

See also openhab/openhab-distro#1310