Hello Marius, Marius Vollmer [2017-02-10 10:31 +0200]: > > Would be nice at some point, with an inotify watch. My gut feeling was that > > this was a version 2 thing, as we don't do this right now either. > > We do, actually. If you change /var/lib/cockpit/machines.json with vi, > say, this has immediate effect on the dashboard. The magic is provided > by cockpit.file(...).watch(): > > http://cockpit-project.org/guide/latest/cockpit-file.html
Thanks for pointing out. So v1 then :-) > We have equivalent magic for watching directories, but there is no nice > JavaScript API for that yet, I think. (The "fslist1" channel payload, > documented in .../cockpit/doc/protocol.md.) I'm moving the whole reading/writing logic from JS into the bridge behind a D-Bus interface (as per Stef's recommendation), so that the handling/watching/merging of the entire machines/ directory does not need to happen on the client side. So my thought was to add a GFileMonitor to that in the bridge, and send a D-Bus signal to the client on any change, then the frontend can get the Machines property again. We don't seem to use a lot of D-Bus signals in cockpit, but protocol.md documents them and e. g. pkg/networkmanager/interfaces.js subscribes to one, so I figure that works in general? > >> If the user now adds or removes such a machine or changes the color for > >> it, where does Cockpit store this? In 10-foo.json or in 99-webui.json? > > > > Hmm, good question. My original intent was to change the file that defines > > the > > host entry, i. e. 10-foo.json in this example. This would look less > > confusing, > > but it might cause conflicts if 10-foo.json is being by puppet or similar > > which > > would then stomp over the config again. > > > > However, the same is true for pretty well every other setting that > > cockpit (indirectly) can make, such as hostname or time zone. > > Yeah, but that's a bug, not a feature. :-) Ideally, we would like to > prevent people from running into conflicts with other management tools, > see > > > https://trello.com/c/lPweIUlQ/325-spike-markers-for-config-management-tools OK, fair enough, but for now I'd treat that as an user bug (trying to simultaneously manage a machine with a config management tool and interactively) :-) Anyway, this should be moot with the following. > I would write to 99-webui.json only. OK, works for me. Thanks for your input! Martin _______________________________________________ cockpit-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
