There's a completely undocumented (outside of the Pickaxe book) Ruby STDLIB module called 'expect' that you could use in 1.8.7, open up irb and give it a whirl. You can find other expect like gems (or at least crib how they're using the pty)[1]. I think you'll want something like expect4r[2] extended for NetApp.
HTH, Justin 1. https://rubygems.org/search?utf8=%E2%9C%93&query=expect 2. https://github.com/jesnault/expect4r On Thu, Feb 7, 2013 at 7:18 AM, fatmcgav <fatmc...@gmail.com> wrote: > John > > Cheers for the response... > > Unfortunately SnapDrive is not my program - It's a NetApp program, so I'm > not going to be able to change it :( > Also doesn't look like it's designed to support command line args... :( :( > > But in principle, it looks like it's possible, but a bit hacky... > > Cheers > Gavin > > > On 7 February 2013 14:42, jcbollinger <john.bollin...@stjude.org> wrote: > >> >> >> On Thursday, February 7, 2013 5:12:41 AM UTC-6, Gavin Williams wrote: >>> >>> Morning all >>> >>> I'm looking at writing a set of types/providers to handle NetApp >>> SnapDrive configuration and usage... >>> >>> There's quite a lot to SnapDrive, so initially, I'm just trying to get >>> it to manage credentials. >>> >>> The challenge I can immediately see is that for me to set a credential, >>> the command prompts for a password input twice... Example command run is: >>> # snapdrive config set sd-act-star-db05 act-star-nactl01 >>> Password for sd-act-star-db05: >>> Retype password: >>> 0000-957 Warning: Optionally, Please set -mgmtpath interface for >>> act-star-nactl01 to be used as data interface i.e >>> snapdrive config set -mgmtpath <mgmtpath> act-star-nactl01 >>> >>> Is it possible to cater for this in a provider? >>> >>> >> >> In principle, you can redirect appropriate canned responses into the >> command's standard input. I don't recall offhand whether Puppet's built-in >> executor facilities support that directly, but you can always wrap up >> something like that in a 'bash -c' command. >> >> It would be far better, however, if the configuration program were built >> to be scriptable (i.e. to not require interactive I/O). For one thing, >> does your installer prompt for a password even when it is run by root >> (which is what the agent will do in the usual configuration)? Does it >> support command-line options by which you can bypass any other Q&A? >> >> >> John >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to puppet-users+unsubscr...@googlegroups.com. >> To post to this group, send email to puppet-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/puppet-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users+unsubscr...@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.