git pull overwrites config changes?

Hi All,

    I'm a newbie but making progress here. I have an emonBase purchased in October and numerous emonTx's and emonTH's.  A week ago some additional emonTH's and emonTx's came in.

I recently followed the directions here (http://openenergymonitor.org/emon/modules/emonpi#update)  in order to use the web UI to update firmware in order to support recently purchased extra emonTx's and emonTH's.  (It's now not clear to me that that was actually needed, but that's a tangent for another day.)   That ran in to trouble with avrdude according to the logs.  Eventually I tracked that down.  It is apparently expected that in many cases one edit /home/pi/emonpi/emonpiupdate to comment out a few lines and uncomment other lines.   I've done that and the update did seem to take.  Thanks to all the answers in the forums that helped me figure that out.

Question:

I see that the update scripts run

git pull

commands.   That doesn't seem compatible with expecting simple config changes like I just made.  It seems like it would risk git pull overwriting config changes or having config changes block important git pull updates depending on how one handles this.   This would seem to be particularly troublesome when one is requesting the update from the web UI where many of the details of the git pull commands will not be apparent.

What is our recommended way to minimize the config overwrite vs blocked update concern?

 

jasonnet's picture

Re: git pull overwrites config changes?

I think I've read that there's a tentative plan to update this particular part of the code to parse out the emonhub.conf file and then appropriately take the right action.   I assume the challenge here is that this code is bash and it's not particularly easy to parse an emonhub.conf formatted file from bash.

If this is the challenge, I'll offer to write a script to copy the emonhub.conf script in to a form that is is more easily parsed by bash.   Perhaps something like the Java .properties file format?  If I were to do this, what language would we want this code to be written in?  PHP ?

pb66's picture

Re: git pull overwrites config changes?

I'm not entirely clear what it is exactly you are proposing, nor am I sure how T&G would prefer to tackle the conf files.

Ideally the git update routine should not overwrite a couple of specific files eg emonhub.conf and settings.php, IMO it's a dangerous game to start parsing emonhub.conf, that may seem the best way to edit/add entries but it assumes alot. users may already be using settings that clash with the new stuff. If there are any duplicated node ids for example the conf simply will not load, if someone has edited their sketches payloads and an update alters the payload it could corrupt their data.

It is a much better approach to explain the changes and how to add them manually for a controlled manouver or there will need to be alternative documentation on how to determine the issue, fix and correct data for a multitude of possible issues.

The firmware update script should be made to A) know what hardware is connected and B) check what firmware for that device is being used, (this should remove any need for hard-coded options). Both of these can be determined from the emonhub.conf if that data is reliable and not over-written. The update script could also remind the user manual changes are required OR if done in the right manner, the updater should be able to update the emonhub.conf directly if it were a python script rather than bash, this would also make it cross-platform and usable on all nodes with the use of a programmer lead.

The emonhub.conf format is defined by the python "configobj" module, using bash is a quick and dirty fix with limited scope. I have some concerns for 3rd parties editing the emonhub.conf directly as is can cause emonhub to fail. but I am interested in what you had in mind.

Paul

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.