summaryrefslogtreecommitdiff
path: root/doc/forum/Could_not_load_host_key:___47__etc__47__ssh__47__ssh__95__host__95__ed25519__95__key/comment_4_38e533c398521a2f1e02fde939f753e1._comment
blob: e51c5147f0a3036b33e7c0a989c851ab9bf41891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[[!comment format=mdwn
 username="joey"
 subject="""comment 4"""
 date="2015-09-15T00:29:47Z"
 content="""
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.
"""]]