Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
What are the steps to reproduce?
The flow diappears - the .json flow file in the .node-red directory are now empty.
A new flow file is created in the .node-red directory with the filename based on the hostname. Both the new json flow file and original flow file are empty and no backup file in the directory. (Installed modules are unaffected).
(Note - if the network hostname uses hyphens - as is legal - then the original flow file may be overwritten rather than additional flow files created. e.g. if changing hostname from PIZW to PIZW-1, there will only be one set of flow files - flows_PIZW.json and flows_PIZW_cred.json. Presumably node red only uses the hostname up to the hypen in naming the flow file because hypens should not be used in unix filenames except at the start).
What do you expect to happen?
The flow file to not be altered by a change in the network hostname of the device.
Alternatively, if for some reason it is necessary to create a new flow file when the hostname is changed, then I would expect the original flow file to be unaltered (even if hypens are used - as with change from PIZW to PIZW-1).
Please tell us about your environment:
(Changing network hostname via network options in raspi-config)
Suggestions for fix:
Node red would not use the hostname for naming the flow file. (unless a good reason for this)
Preferably, the user should be able to name the flow file and save it via the gui, and be able to choose which flow file to open (the currenlty open flow file would be loaded by default). Having to enable and use projects just to do file open/saveas seems overkill.
So a user changes the network hostname via raspi-config and all the flows they created are lost - and that behaviour is considered to be acceptable?
What other actions might result in flow files being wiped? (It is even more of a concern if wiping out flow files without warning is considered acceptable behaviour)
There are no actions that will wipe flow files. Nothing is lost - the files are still there. Do not interpret my comments as endorsement for randomly wiping files - we don't do that.
There are historic reasons why it uses the hostname by default - it allowed you to have multiple flow files in your node-red directory that is copied onto multiple devices as a single image and each device picks up its own flows with no further configuration needed.
I am sympathetic to this scenario, but it has never really been brought up as something to change given the various ways we provide to specify a fixed flow file name.
If we were to change it, we then have the challenge of how to do so without breaking all existing users that rely on this behaviour.
Thanks for this explanation of why the hostname is used.
You said 'the files are still there'. Yes, the files are there, but they are empty after the hosthame is changed - the contents are deleted although the files still appear in the .node-red directory.
Or should I be looking elsewhere for the files? (do they get moved to another directory? if so, where?)
As originally stated, the issue is that changing the hostname wipes the original flow files (as well as creating new empty flow files).
The only time the flow file is written is when you hit deploy - so changing the hostname can't delete the file. There should also be a backup file created (as a hidden file) usually called