Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using latest vagrant version throws an exception #14

Closed
morazow opened this issue Jun 16, 2021 · 1 comment
Closed

Using latest vagrant version throws an exception #14

morazow opened this issue Jun 16, 2021 · 1 comment

Comments

@morazow
Copy link

morazow commented Jun 16, 2021

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: mitchellh/vagrant-aws#566

I solved the issue using the workaround suggested on this comment: mitchellh/vagrant-aws#566 (comment)

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

@hseipp
Copy link
Member

hseipp commented Jun 23, 2021

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.

@morazow morazow closed this as completed Jul 5, 2021
hseipp added a commit that referenced this issue Dec 1, 2023
Merge pull request #46 from hseipp/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants