Hello,

I have a use case in which I need to get some user information (interactive 
mode) just before provisioning some shell script.

This information (username and password) needs to be passed as arguments to 
the shell provisioner script.

So my idea was to create a vagrant plugin that extends on ":shell" 
provisioner instead of the default ":provisioner", and then forward these 
additional
arguments to the shell script.

I am a new with ruby and I am getting some errors when I try to load :shell 
provisioner class
error
`plugin': Plugin superclass not found for version/component: 2 shell 
(ArgumentError) 

Could someone help me with this :-) ? Is this approach correct?

Here is my provisioner.rb:

class Provisioner < Vagrant.plugin('2', :shell)
    def provision
      print "username: "
      username = $stdin.gets.chomp
      print "password: "
      # do not show password while typing it
      system 'stty -echo'
      password = $stdin.gets.chomp
      system 'stty echo'

      config.args = [username, password]
      # call super provision
      super

    end
  end

Thanks.
Ariel.

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to