Hi Ravi. Looks pretty good, though I think that arm had a better api for this. The SETCONF and RESETCONF do the exact same thing except for undefined values (the two controller methods would probably be combined if tor could break backward comparability). Stem's Controller shouldn't blindly mirror the control-spec if we can do better. ;)
Pushed an alternative implementation to the 'setconf-wrapper' branch of my personal repo...
Heh, I went back and forth on adding a default parameter while using this for get_conf(), but left it out since get_conf_map() (its only other user) didn't need it. Looks like I was wrong.
Now I'm a little tempted to drop default in favor of just returning the key by default when lookup fails (since that's what all of its consumers want), but guess it's better to leave it as-is in case other queries want the default to be something else.
if response.message.startswith("Unrecognized option: Unknown option '"):
What happens if there are multiple unknown options? Do we then fall through to raising a InvalidRequest? What sorts of issues did you see with a 513 and 553 status?
+__all__ = [
"control_message",
"control_line",
"getinfo",
"getconf",
"protocolinfo",
"authchallenge",
"singleline"
+]
Good change. Mind changing the other init.py files too?
Hi Ravi. Looks pretty good, though I think that arm had a better api for this. The SETCONF and RESETCONF do the exact same thing except for undefined values (the two controller methods would probably be combined if tor could break backward comparability). Stem's Controller shouldn't blindly mirror the control-spec if we can do better. ;)
I think having seperate set_conf & reset_conf would be better. Even if both the methods were combined, it would be neater to be able to do
controller.reset_conf('this')
instead of
controller.set_conf('this', None, True)
Ideally, developers will be using the reset_conf method to reset configuration options only. I was on the fence about letting reset_conf also modify configuration values, because of what you mentioned (it does the same thing), but then that would make it impossible to do "RESETCONF x=y".
What happens if there are multiple unknown options? Do we then fall through to raising a InvalidRequest? What sorts of issues did you see with a 513 and 553 status?
We'll raise InvalidArguments with just the first invalid argument in exception.arguments.
Some examples...
setconf hiddenserviceport="2839 232.23.2.32:7832" hiddenservicedir="/tmp"513 Unacceptable option value: Failed to configure rendezvous options. See logs for details.setconf dirport=abcd513 Unacceptable option value: Invalid DirPort/DirListenAddress configurationsetconf disabledebuggerattachment=0553 Transition not allowed: While Tor is running, disabling DisableDebuggerAttachment is not allowed.
Good change. Mind changing the other init.py files too?
After this is merged.