IBM / StorageScaleVagrant

Example scripts and configuration files to install and configure IBM Storage Scale in a Vagrant environment
Apache License 2.0
16 stars 19 forks source link

Using latest vagrant version throws an exception #14

Closed morazow closed 3 years ago

morazow commented 3 years ago

Running the vagrant up throws the following exception:

vagrant up                                                                                   
/home/mtoraz/.vagrant.d/gems/2.6.7/gems/vagrant-aws-0.7.2/lib/vagrant-aws/action/connect_aws.rb:41:in `call': undefined method `except' for #<Hash:0x0000000001c17860> (NoMethodError)
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/warden.rb:48:in `call'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/warden.rb:48:in `call'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/builder.rb:149:in `call'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/runner.rb:89:in `block in run'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/action/runner.rb:89:in `run'                                                                                            from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:246:in `action_raw'                                                                                          from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:215:in `block in action'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:197:in `block in action'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:201:in `action'
        from /home/mtoraz/.vagrant.d/gems/2.6.7/gems/vagrant-aws-0.7.2/lib/vagrant-aws/provider.rb:32:in `state'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:541:in `state'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/machine.rb:154:in `initialize'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/vagrantfile.rb:81:in `new'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/vagrantfile.rb:81:in `machine'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/environment.rb:716:in `machine'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/plugin/v2/command.rb:180:in `block in with_target_vms'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/plugin/v2/command.rb:204:in `block in with_target_vms'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/plugin/v2/command.rb:186:in `each'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/plugin/v2/command.rb:186:in `with_target_vms'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/plugins/commands/up/command.rb:87:in `execute'                                                                 
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/cli.rb:67:in `execute'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/lib/vagrant/environment.rb:290:in `cli'
        from /opt/vagrant/embedded/gems/2.2.16/gems/vagrant-2.2.16/bin/vagrant:231:in `<main>'      

It is related to this issue: https://github.com/mitchellh/vagrant-aws/issues/566

I solved the issue using the workaround suggested on this comment: https://github.com/mitchellh/vagrant-aws/issues/566#issuecomment-580812210

I think vagrant-aws seems to be not very actively maintained, general solution would be to use differnt aws vagrant plugin.

hseipp commented 3 years ago

I can re-create this error and also can confirm that adding the workaround you pointed to resolves the issue:

diff --git a/aws/Vagrantfile b/aws/Vagrantfile
index d7d508b..cff873b 100644
--- a/aws/Vagrantfile
+++ b/aws/Vagrantfile
@@ -29,6 +29,16 @@ load File.expand_path('../Vagrantfile.aws-ami', __FILE__)
 # Load common settings
 load File.expand_path('../../shared/Vagrantfile.common', __FILE__)

+class Hash
+  def slice(*keep_keys)
+    h = {}
+    keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
+    h
+  end unless Hash.method_defined?(:slice)
+  def except(*less_keys)
+    slice(*keys - less_keys)
+  end unless Hash.method_defined?(:except)
+end

 # Customize configuration specific settings
 Vagrant.configure("2") do |config|

Once I got all cleaned up, I will create a new PR for the AWS fixes.