|author||Joey Hess||2015-09-14 21:54:57 -0400|
|committer||Joey Hess||2015-09-14 21:54:57 -0400|
Diffstat (limited to 'doc/forum/Could_not_load_host_key:___47__etc__47__ssh__47__ssh__95__host__95__ed25519__95__key')
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/forum/Could_not_load_host_key:___47__etc__47__ssh__47__ssh__95__host__95__ed25519__95__key/comment_4_38e533c398521a2f1e02fde939f753e1._comment b/doc/forum/Could_not_load_host_key:___47__etc__47__ssh__47__ssh__95__host__95__ed25519__95__key/comment_4_38e533c398521a2f1e02fde939f753e1._comment
new file mode 100644
@@ -0,0 +1,35 @@
+ subject="""comment 4"""
+I've fixed this bug. I thought about adding a type based
+validation when privdata is being set, but in the end decided against it
+for a couple reasons:
+* Doesn't fix existing privdata files.
+* The privdata file could be edited by the user, etc and the validation
+ wouldn't be run.
+* A user could just as well paste in a file and omit pasting the trailing
+ newline, so the validation would need to check if there was a trailing
+ newline when it's significant.
+* If the validation is by what the type of privdata is used for, this
+ disconnects the validation from the property that consumes the privdata.
+ Seems better to centralize all handling of a particular peice of privdata
+ in once place.
+* I was having some difficulty implementing it..
+Instead, I settled on making PrivData a newtype,
+and adding some accessor functions for it:
+ privDataLines :: PrivData -> [String]
+ privDataVal :: PrivDara -> String -- returned string never contains newlines
+This helps document the issue, and like `lines "a"` is the same as `lines
+"a\n"`, using privDataLines will give the same result whether the trailing
+newline was chomped or not. So, propellor no longer removes trailing newlines
+when the user is inputting privdata.
+The ssh property is adjusted to use privDataLines and add a trailing
+newline when writing files, and problem solved.