From 9070450a38e5a3e87e7c15cc4fb77e208ee5b5e4 Mon Sep 17 00:00:00 2001 From: Ricardo Coelho Date: Thu, 23 Sep 2021 23:01:39 -0300 Subject: [PATCH] fix: undefined method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Erro ao executar vagrant up --provider=aws. Solução adicionar as seguintes linhas ao vagrante 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 Solução foi encontrada nas referências abaixo. https://github.com/mitchellh/vagrant-aws/issues/568 https://github.com/mitchellh/vagrant-aws/issues/566 On branch master Changes to be committed: modified: README.md modified: Vagrantfile --- README.md | 7 ++++++- Vagrantfile | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1d8988..8ee7aed 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ $ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dumm aws.access_key_id = "YOUR KEY" aws.secret_access_key = "YOUR SECRET KEY" ``` - Estas duas variaveis são preenchidas com chaves obtidas no [console do IAM](https://console.aws.amazon.com/iam) de sua conta AWS e devem ser mantidas em segredo. #### [Amazon Machine Images (AMI)](https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/AMIs.html) @@ -75,6 +74,12 @@ Ao invés de [criar um par de chaves usando o Amazon EC2](https://docs.aws.amazo [Abra o console do Amazon EC2]( https://console.aws.amazon.com/ec2/) em Redes e segurança selecione pares de chaves. Em ações selecione importar pares de chaves e cole o conteúdo do arquivo vagrant.pub criado anteriormente. Em nosso exemplo nomeamos esta chave no console AWS como vagrant. +#### Interação com o ambiente. +``` +$ vagrant up --provider=aws +$ vagrant destroy -f +``` + ## Autor e referências Ricardo Coelho diff --git a/Vagrantfile b/Vagrantfile index 44c7a84..b447e6c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,12 +1,24 @@ # -*- mode: ruby -*- # vi: set ft=ruby : +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 + Vagrant.configure("2") do |config| config.vm.box = "dummy" config.vm.provider :aws do |aws, override| aws.access_key_id = "AKIASIX4VFN7ZA45UZOB" aws.secret_access_key = "IdevldVEJG/2uFmtujunplOFJ2/HzcgSstdzPLVx" + aws.ami = "ami-02e2a5679226e293c" override.ssh.username = "admin"