Discussion:
[rancid] .cloginrc question. How to use wild card?
Sam Munzani
2008-02-15 18:27:21 UTC
Permalink
Team,

I have my devices named like this. xxx-rtr01, xxx-rtr02, xxx-rtr03 etc
all the way up to 10. routers 1 through 6 supports telnet method only
while 7 through 10 supports ssh only. Is there a clean way to define
these 2 groups in .cloginrc? I tried following and captured the error
messages.

*Experiment # 1: .cloginrc section*
add user test*[1-2] {admin}
add password test*[1-2] {password}
add method test*[1-2] telnet
add autoenable test*[1-2] 1

$ clogin test-rtr01

Error: invalid command name "1-2"

*Experiment # 2: *
add user test*{*\[1-6]} {admin}
add password test*{*\[1-6]} {password}
add method test*{*\[1-6]} telnet
add autoenable test*{*\[1-6]} 1

$ clogin test-rtr01
test-rtr01

Error: no password for test-rtr01 in /opt/rancid/.cloginrc.

*Experiment # 3: *
add user test{*\[1-6]} {admin}
add password test{*\[1-6]} {password}
add method test{*\[1-6]} telnet
add autoenable test{*\[1-6]} 1

$ clogin test-rtr01
test-rtr01

Error: no password for test-rtr01 in /opt/rancid/.cloginrc.

Any help is greatly appreciated.

Thanks,
sam
john heasley
2008-02-15 18:32:44 UTC
Permalink
Post by Sam Munzani
Team,
I have my devices named like this. xxx-rtr01, xxx-rtr02, xxx-rtr03 etc
all the way up to 10. routers 1 through 6 supports telnet method only
while 7 through 10 supports ssh only. Is there a clean way to define
these 2 groups in .cloginrc? I tried following and captured the error
messages.
its a glob & first match.

add method xxx-rtr0\[1-6] {telnet}
add method xxx-rtr* {ssh}

the quoting is necessary to avoid tcl's [] grammar.
Post by Sam Munzani
*Experiment # 1: .cloginrc section*
add user test*[1-2] {admin}
add password test*[1-2] {password}
add method test*[1-2] telnet
add autoenable test*[1-2] 1
$ clogin test-rtr01
Error: invalid command name "1-2"
*Experiment # 2: *
add user test*{*\[1-6]} {admin}
add password test*{*\[1-6]} {password}
add method test*{*\[1-6]} telnet
add autoenable test*{*\[1-6]} 1
$ clogin test-rtr01
test-rtr01
Error: no password for test-rtr01 in /opt/rancid/.cloginrc.
*Experiment # 3: *
add user test{*\[1-6]} {admin}
add password test{*\[1-6]} {password}
add method test{*\[1-6]} telnet
add autoenable test{*\[1-6]} 1
$ clogin test-rtr01
test-rtr01
Error: no password for test-rtr01 in /opt/rancid/.cloginrc.
Any help is greatly appreciated.
Thanks,
sam
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Sam Munzani
2008-02-15 18:43:34 UTC
Permalink
That did it. Thanks a lot John,

Sam
Post by john heasley
Post by Sam Munzani
Team,
I have my devices named like this. xxx-rtr01, xxx-rtr02, xxx-rtr03 etc
all the way up to 10. routers 1 through 6 supports telnet method only
while 7 through 10 supports ssh only. Is there a clean way to define
these 2 groups in .cloginrc? I tried following and captured the error
messages.
its a glob & first match.
add method xxx-rtr0\[1-6] {telnet}
add method xxx-rtr* {ssh}
the quoting is necessary to avoid tcl's [] grammar.
Post by Sam Munzani
*Experiment # 1: .cloginrc section*
add user test*[1-2] {admin}
add password test*[1-2] {password}
add method test*[1-2] telnet
add autoenable test*[1-2] 1
$ clogin test-rtr01
Error: invalid command name "1-2"
*Experiment # 2: *
add user test*{*\[1-6]} {admin}
add password test*{*\[1-6]} {password}
add method test*{*\[1-6]} telnet
add autoenable test*{*\[1-6]} 1
$ clogin test-rtr01
test-rtr01
Error: no password for test-rtr01 in /opt/rancid/.cloginrc.
*Experiment # 3: *
add user test{*\[1-6]} {admin}
add password test{*\[1-6]} {password}
add method test{*\[1-6]} telnet
add autoenable test{*\[1-6]} 1
$ clogin test-rtr01
test-rtr01
Error: no password for test-rtr01 in /opt/rancid/.cloginrc.
Any help is greatly appreciated.
Thanks,
sam
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Mike Ashcraft
2008-02-15 18:43:26 UTC
Permalink
Sam,



Put the entire hostname glob inside the curly braces.



For example:

Add user {test*[1-2]} {admin}



Mike



From: rancid-discuss-***@shrubbery.net
[mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Sam Munzani
Sent: Friday, February 15, 2008 11:27 AM
To: rancid-***@shrubbery.net
Subject: [rancid] .cloginrc question. How to use wild card?



Team,

I have my devices named like this. xxx-rtr01, xxx-rtr02, xxx-rtr03 etc
all the way up to 10. routers 1 through 6 supports telnet method only
while 7 through 10 supports ssh only. Is there a clean way to define
these 2 groups in .cloginrc? I tried following and captured the error
messages.

Experiment # 1: .cloginrc section
add user test*[1-2] {admin}
add password test*[1-2] {password}
add method test*[1-2] telnet
add autoenable test*[1-2] 1

$ clogin test-rtr01

Error: invalid command name "1-2"

Experiment # 2:
add user test*{*\[1-6]} {admin}
add password test*{*\[1-6]} {password}
add method test*{*\[1-6]} telnet
add autoenable test*{*\[1-6]} 1

$ clogin test-rtr01
test-rtr01

Error: no password for test-rtr01 in /opt/rancid/.cloginrc.

Experiment # 3:
add user test{*\[1-6]} {admin}
add password test{*\[1-6]} {password}
add method test{*\[1-6]} telnet
add autoenable test{*\[1-6]} 1

$ clogin test-rtr01
test-rtr01

Error: no password for test-rtr01 in /opt/rancid/.cloginrc.

Any help is greatly appreciated.

Thanks,
sam
Loading...