ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject RE: Optional task "telnet"
Date Thu, 31 May 2001 08:10:37 GMT
At 09:48 AM 5/30/01 -0600, curtis_krouse@agilent.com wrote:
>Pete,
>
>In the manual it uses syntax like this as an example:
>
><telnet userid="bob" password="badpass" server="localhost">
>   <read>/home/bob</read>
>   <write>ls</write>
>   <read string="/home/bob"/>
></telnet>
>
>This task can be rewritten as: 
><telnet server="localhost">
>   <read>ogin:</read>
>   <write>bob</write>
>   <read>assword:</read>
>   <write>badpass</write>
>   <read>/home/bob</read>
>   <write>ls</write>
>   <read>/home/bob</read>
></telnet>
>
>There is no "real" explanation of how the read and write statements work.

Okay - someone needs to send a patch for documentation then ;)

I haven't loooked at class (away from dev computer) so this explanation
could be quite wrong (though I hope not). I think telnet task behaves
similar to the expect tool.

So where you see <read>blah</blah> it means that the task will wait until
it see the string "blah" output from telnet connection. Usually what I do
in expect is to do a <read>myprompt-string</read> where myprompt string is
som string I know will appear in prompt. 

Sometimes I will manually force the prompt to some value when I start
expect via export PROMPT="expect-prompt:>" or something similar (forget the
exact syntax).

Where you see <write> that is equivelent to typing into telnet session.

So in the example where you see <read>/home/bob</read> that means the
original developer probably had a prompt that include current working
directory.

>What I'm really trying to do is login, run a perl script, wait 120 seconds
>and logout.  Then login as root run another shell script and logout.  I
>can't tell if anything is really happening.  Here's what the command session
>for ant gives me back for the following script:
>
>Ant script:
><target name="install" depends="deploy">
>	<telnet userid="name" password="wl_pswd" server="xxx.xxx.xxx.xxx">
>		<write>ls</write>
>	</telnet>
>  </target>
>
>Command line return:
>login:
>   [telnet] name
>   [telnet]  Password:
>   [telnet] ls
>
>BUILD SUCCESSFUL
>
>Total time: 9 seconds
>
>I really can't tell what has happened and the manual leaves little
>explanation...any help or suggestions would be most appreciated.

I think what is displayed is what you have <write> into telnet session.
Hopefully my explanation is useful but as I said I don't use the task and
don't have code in front of me so YMMV ;)

If you do get it working a patch to documentation would be much apprecaited
;)
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message