updating quiet-option bug.
[monkeysphere.git] / website / bugs / monkeysphere-ssh-proxycommand-quiet-option.mdwn
1 I don't mind the monkeysphere-ssh-proxycommand output on regular connections.
2
3 For me it looks something like this with a server not participating in the
4 monkey sphere:
5
6                 ms: processing host: chavez.mayfirst.org
7                 ms:   - key not found.
8         
9 And like this for a server participating:
10
11                 ms: processing host: george.riseup.net
12                 ms:  primary key found: 7353A74E3B757F8C
13                 ms:   * acceptable key found.
14                 ms: known_hosts file updated.
15
16 However, I have some batch scripts that run ssh that also provide output, so the monkeysphere output clutters things up.
17
18 I would really like to either have a -q/--quiet option, or, preferable for me
19 at least, would be for silent output to be the default and have a -v/--verbose
20 option to get the output. Or - maybe these should be environmental variables?
21 In any event - someway to suppress informational output would be a useful
22 improvement.
23
24 ------
25
26 I'd be fine with silent mode as a default, with a more verbose mode
27 accessible to the user who desires it.
28
29 I'd prefer an environment variable (e.g. `MONKEYSPHERE_VERBOSE` or
30 `MONKEYSPHERE_DEBUG`) over a command-line (e.g. `--verbose`) option,
31 personally.  It's more in keeping with the model we've used in general
32 so far.
33
34 --dkg
35
36 ------
37
38 I just completed this feature. I published it to a separate branch
39 (called quiet-mode). I haven't committed it to my master branch for a
40 couple reasons:
41
42  * I made some significant changes and wanted to ask Big Jimmy to take a
43  look since it's mostly his stuff I mucked about with.
44
45  * Sometime between starting my hacking and mid-way through, my
46  ~.ssh/known_hosts file got truncted to nothing. I recovered from a
47  backup. I couldn't figure out what caused that to happen and couldn't
48  replicate it. I was debugging my bash and what I was debugging involved
49  bash redirection, so it's reasonable to think that something I did
50  caused the problem. However, before committing we incorporate this, I
51  would appreciate another set of eyes on my code to make sure I'm not
52  doing something dangerous or just dumb :).
53
54 Here's an overview of what I did: 
55
56 There were two function defined in common that handle sending messages
57 to the user: log and loge. They both echo the argument passed to
58 standard error. The first one also echo's "ms: " (as a preface to the
59 message).  loge was only called in two places and I think is left over
60 cruft (let me know if I'm wrong please!). 
61
62 I've added drop in replacement functions: notice, info, and
63 debug. I've replaced all instances of log and loge with info. 
64
65 If you use notice, your message will always be sent to standard error.
66 If you use info, it will be sent to standard error if the env variable
67 MONKEYSPHERE_OUTPUT_QUIET is set to off (it is off by default).  If you
68 use debug, it will be sent to standard error only if
69 MONKEYSPHERE_OUTPUT_DEBUG is set to on (it's off by default). 
70
71 Lastly, in monkeysphere-ssh-proxycommand, I've set
72 MONKEYSPHERE_QUIET_MODE to on by default. 
73
74 So the result is: when using monkeysphere-ssh-proxycommand, you will not
75 get any output unless you set MONEKYSPHERE_OUTPUT_QUIET to off or
76 MONKEYSPHERE_OUTPUT_DEBUG to on. All other commands should work exactly
77 like they did in the past.
78
79 And... we can go through the code and change calls to the info function
80 to either notice (if we want them to be sent regardless of the QUIET
81 variable) or debug (if we want it only sent if DEBUG is set).
82
83 I'm open to suggestions, problems, etc :).
84
85 SJJ