libre-server / rolekit

'rolekit' is a daemon for Linux systems providing a stable D-BUS interface to manage the deployment of ​Server Roles.
19 stars 7 forks source link

Check for .rksave files if the 'sed' fails in the DB role deploy. #21

Closed sgallagher closed 8 years ago

sgallagher commented 8 years ago

It's theoretically possible (though unlikely) for one of the the calls to sed to fail in DB role deployment after having written the .rksave file. We should attempt to restore it.

nphilipp commented 8 years ago

Hmm, what's the reason to use sed, an external program, in the first place?

Besides that I noticed that the sed scripts we use depend on that the processed files contain certain lines, if they are missing or sufficiently different (because someone fiddled with the file before, because the shipped default files changed), they'll fail to add the configuration we want to have deployed.

It's plain to me that we can't foresee every possible oddity in there, but the role should be able to just add the desired lines to the files if the lines we expect to change are missing.

What do you think?

sgallagher commented 8 years ago

Yeah, that code is a bit fragile. It's built on the flimsy assumption that rolekit was the first method by which the database server role is being set up. I used sed in the first place simply because it was easy and fast and I was on a deadline. If you think it makes more sense to manipulate that file in a different way, by all means rewrite it.