Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow files lost when the network hostname is changed #1631

Closed
Dannsei opened this issue Feb 14, 2018 · 7 comments

Comments

@Dannsei
Copy link

@Dannsei Dannsei commented Feb 14, 2018

What are the steps to reproduce?

  1. Create and deploy a flow
  2. Change the network hostname

What happens?

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:

  • Node-RED version: 0.18.2
  • node.js version: 8.9.4
  • npm version:
  • Platform/OS: Raspbian OS Stretch (Linux 4.9.59+ #1047)
  • Browser:

(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.

@knolleary

This comment has been minimized.

Copy link
Member

@knolleary knolleary commented Feb 14, 2018

This is how it has always been. You can specify a flow file on both the command line or settings file.

Given we're moving to projects there's no real prospect of changing this behaviour now.

@knolleary knolleary closed this Feb 14, 2018
@Dannsei

This comment has been minimized.

Copy link
Author

@Dannsei Dannsei commented Feb 14, 2018

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)

@knolleary

This comment has been minimized.

Copy link
Member

@knolleary knolleary commented Feb 14, 2018

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.

@Dannsei

This comment has been minimized.

Copy link
Author

@Dannsei Dannsei commented Feb 14, 2018

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).

@dceejay

This comment has been minimized.

Copy link
Member

@dceejay dceejay commented Feb 14, 2018

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 .flow_{hostname}.json.backup that the previous level flow is copied to first before writing over it. So that should still be there with the old hostname also.

@Bhafner2

This comment has been minimized.

Copy link

@Bhafner2 Bhafner2 commented Oct 21, 2019

Pleas give us a workaround!
Something like a global-flow.

@knolleary

This comment has been minimized.

Copy link
Member

@knolleary knolleary commented Oct 21, 2019

This issue has been closed for over a year. There are two workarounds provided in my first comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.