duncs / clusterssh

Cluster SSH - Cluster Admin Via SSH
https://github.com/duncs/clusterssh/wiki
896 stars 79 forks source link

Debugging broken #75

Closed Ionic closed 7 years ago

Ionic commented 7 years ago

Passing --debug 4 on the command line leads to cssh being more verbose in its startup procedure, but does not correctly lead to more debug information within a session.

I do not know what the root cause is, but a (stupid) workaround is to set the debugging value in https://github.com/duncs/clusterssh/blob/c0f2b8af41c408bc2fc8494bf73113af06649fdf/lib/App/ClusterSSH/Base.pm#L39 instead of $config->{debug}. For instance, replacing $config->{debug} with 99 actually leads to a lot of debugging information (like it should be with passing --debug 4 on the command line or debug=99 in the config file.)

Further, https://github.com/duncs/clusterssh/blob/7974687cfbd3f47ba849f99a6bc485ed75672a06/lib/App/ClusterSSH/Getopt.pm#L336 looks weird - why checking and setting $options->{debug} before when later code is passing $self->debug (which looks undefined to me, as well) to $self->set_debug_level()?

Besides, there seems to be a diverging range of debug values that can be passed via --debug and specified in the configuration file. --debug values may not exceed 4, but the actual code uses debug values of at least 7, maybe even higher. A debug value specified in the configuration file is clamped to 9. That sounds very odd and non-intuitive.

Experienced this on Debian Jessie with CSSH 4.03_03.

duncs commented 7 years ago

I believe this is now fixed in commit 41fe071 which will be included in 4.09 - there were two problems here and both were related to methods being overridden.

In Getopt.pm all of the command line options are turned into accessors, so '--debug' is held in $options{debug} which in turn gets converted into $self->debug around line 311 onwards. I fixed this by skipping converting the debug method, which in turn highlighted that Base;:output was being overridden by Getopt::output, so the one in base was also renamed.

I have also increase the debug limit from 4 to 9 and noted this in the docs, since as you pointed out levels higher than 4 are used elsewhere.

Duncs

duncs commented 7 years ago

Found another issue with this - continuing to investigate

duncs commented 7 years ago

Sorted in 4f93b8f

Ionic commented 7 years ago

Thanks, I'll backport and test it next month!