oxidized
oxidized copied to clipboard
Allow configure mode in prompt regex
To properly use oxidized-script and switch to configure terminal, the prompt regex needs to accept <hostname>(config)#
and all other context layers (vlan-... etc.).
With the given regex, oxidized-script times out once the context is switched to configure terminal because the regex does not match anymore.
"But wait, there's more". Some older firmwares of HP Procurve do not accept password username plaintext password
which caused the prompt regex to fail when issuing password manager
.
host(config)# password manager New password for manager: ... Please retype new password for manager: ... host(config)#
Basically ^\r?([\w .-]+: |([\w.-]+(([\w.-]+))*#) )$
would allow any prompt ending with :
additionally to a proper prompt. But I'm not sure, if this is the way we want to go here.
Similar changes to allow configure terminal may apply to other hardware as well.
- nos.rb ->
^(?:\e[..h)?[\w.-]+(([\w.-]+))*# $
@mrplow87 the block (config)
you mentioned can repeat? if not you could replace the *
for ?
:neckbeard:
Oh, that's my laziness and old habit to get zero occurances of that group matched. Will be replaced!
Definitely a legit problem. But I think we probably should have separate regexp for different state.
Possibly we should make prompt an instance of new prompts class. And for backward compatibility 'prompt = x' would be equivalent to 'prompt.exec = x'. Then we add 'prompt.config = y'.
But then the class probably should indicate WHEN should we expect each prompt.
I think this needs more thought. 7
Please fix the conflict and add your change to CHANGELOG