Live data from Hacker News

Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

blog.robertelder.org

1–10 of 106 posts

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#2
Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things. It's always better and more robust to have a proper interface to script things instead of relying on matching brittle text/regex responses and timers and such. Of course sometimes it's not possible, so expect comes in handy.

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#4
I use pexpect as the basis of an automation framework I use a lot:

https://github.com/ianmiell/shutit/blob/master/README.md

Recently I used it to migrate an etcd cluster within OpenShift reproducibly:

https://medium.com/@zwischenzugs/migrating-an-openshift-etcd...

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#5
Don Libes' Exploring Expect[1] is a devops classic (if there is such a thing). It would be nice if O'Reilly would make the text (completely) freely accessible[2], as they have done with some of their other older titles[3].

See also the Caius framework[4].

[1] http://shop.oreilly.com/product/9781565920903.do

[2] https://www.safaribooksonline.com/library/view/exploring-exp...

[3] http://www.oreilly.com/openbook/

[4] http://caiusproject.com/

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#6
Expect was great when I had to automate ssh'ing into a bunch of different machines with generated passphrases. Not the best for security, but the machines were in a private network and key auth was not used at the time. Saved a lot of typing!

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#7

Expect is cool, I have used it in the past as well as the expect perl module, but in my opinion is always a suboptimal way to automate things. It's always better and more robust to have a proper interface to script things instead of relying on matching brittle text/regex responses and timers and such. Of course sometimes it's not possible, so expect comes in handy.

I 100% agree. If I can use paramiko/fabric or something similar, I prefer it way more than expect.

If you have a slave device over RS232, expect is probably your only option. But if that remote item is running sshd, you are way better off without expect.

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#8

I use pexpect as the basis of an automation framework I use a lot: https://github.com/ianmiell/shutit/blob/master/README.md Recently I used it to migrate an etcd cluster within OpenShift reproducibly: https://medium.com/@zwischenzugs/migrating-an-openshift-etcd...

PS I also wrote autopexpect, which is based on another underrated tool (autoexpect)

https://github.com/ianmiell/autopexpect

http://expect.sourceforge.net/example/autoexpect.man.html

Re: Don Libes' Expect: A Surprisingly Underappreciated Unix Automation Tool

#9
Expect is great for persuading things, particularly poorly written Java monoliths that use text interactive installers, to play nicely with ansible. On more than one occasion it has been tasked with handling one.

You run autoexpect first to record what you want it to do on a dry run, then tidy up the generated expect script, then plug it into ansible as a raw task.

Granted this shouldn't be a problem in 2016 but some vendors are idiots. But thanks to expect my life is a little more comfortable :)

Post reply on HN