Plugin Upgrade Information

Status
Not open for further replies.

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I'm wondering if there's any documentation in how I can have my plugins save data between plugin upgrades. my plugins keep all of their data in /usr/pbi/plugin-amd64/etc/plugin/ , a few have an SQL file managed by freenas (I'll check where I keep this). other than that, everything else should be blown away and overridden.
 
D

dlavigne

Guest
I'm pretty sure that 3770 fixes this for 9.2.1. In the mean time, I just make a tarball of the jail and store it outside the jail, or if it's just a few files, copy those files elsewhere.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I'm pretty sure that 3770 fixes this for 9.2.1. In the mean time, I just make a tarball of the jail and store it outside the jail, or if it's just a few files, copy those files elsewhere.
I don't think you understand exactly what I'm asking. as a plugin author, I was wondering if there was any documentation on the PBI update function. is there a way to specify what gets deleted or saved?
 
D

dlavigne

Guest
There's no API yet, thus no API documentation. AFAIK, reading the github code is as good as it gets ATM.
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
Take look at the update_pbi function in notifier.py (https://github.com/freenas/freenas/blob/master/gui/middleware/notifier.py?source=c#L2767). It seems it first creates a PBI out of your current plugin (current state), creates a patch from the difference of the current plugin and the downloaded/new one and then applies the patch. So, I guess (but I did not verify it) any file that is created by the post-install script (or later) would probably survive the upgrade.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Take look at the update_pbi function in notifier.py (https://github.com/freenas/freenas/blob/master/gui/middleware/notifier.py?source=c#L2767). It seems it first creates a PBI out of your current plugin (current state), creates a patch from the difference of the current plugin and the downloaded/new one and then applies the patch. So, I guess (but I did not verify it) any file that is created by the post-install script (or later) would probably survive the upgrade.

I'll play with it, depending on the plugin I actually want things deleted and reinstalled (like python source files). ideally for me it would only keep the etc/plugin directory, and install everything else like new
 
Status
Not open for further replies.
Top