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

issue with Vagrant dummy vm for GCP #1

Open
laithrafid opened this issue Mar 28, 2022 · 0 comments
Open

issue with Vagrant dummy vm for GCP #1

laithrafid opened this issue Mar 28, 2022 · 0 comments

Comments

@laithrafid
Copy link
Owner

# https://github.com/mitchellh/vagrant-google
Vagrant.configure("2") do |config|
  config.vm.box_version = "0.1.0"
  config.vm.define "gcp" do |gcp|
    gcp.vm.box = "google/gce" #dummy gcp vagrantbox provided by atlas
    config.vm.provider :google do |google, override|
      google.google_project_id = "my_projectid" #from terraform
      google.google_json_key_location = "./mykeysecret.json" #terraform service account key.json
      google.image_family = "kali-rolling"
      google.name = "kali-v1.0"
      google.disk_size = 500            
      google.zone = "us-east1-c"     
      google.machine_type = "n1-standard-4"
      override.ssh.username = 'provisioner'
      override.ssh.private_key_path = 'mysectret.pub' # your ssh key
    end
  end

  config.vm.provision "shell", path: "scripts/create-swapfile.sh"
  config.vm.provision "shell", path: "scripts/install-chrome-remote-desktop.sh"
  config.vm.provision "shell", path: "scripts/all-passwordless-sudo.sh"
  config.vm.provision "shell", path: "scripts/set-hostname-kali.sh"

  config.vm.provision "shell", path: "scripts/pulseaudio.sh"
  config.vm.provision "shell", path: "scripts/install-nessus.sh"
  config.vm.provision "shell", path: "scripts/install-misc-packages.sh"
  config.vm.provision "shell", path: "scripts/install-social-engineer-toolkit.sh"
end

i think this's a vagrant issue because when i run direct call to API is working , however from vagrant hitting this error.

gcurl https://compute.googleapis.com/compute/v1/projects/my_projectid/zones/us-east1-c/diskTypes/pd-standard
{
  "kind": "compute#diskType",
  "creationTimestamp": "1969-12-31T16:00:00.000-08:00",
  "name": "pd-standard",
  "description": "Standard Persistent Disk",
  "validDiskSize": "10GB-65536GB",
  "zone": "https://www.googleapis.com/compute/v1/projects/my_projectid/zones/us-east1-c",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/my_projectid/zones/us-east1-c/diskTypes/pd-standard",
  "defaultDiskSizeGb": "500"
}

vagrant up --debug output below

Just hitting this : ==> gcp: -- Accelerators: []
ERROR warden: Error occurred: undefined method self_link' for nil:NilClass INFO warden: Beginning recovery process... INFO warden: Calling recover: #<VagrantPlugins::Google::Action::RunInstance:0x00007f83319bfc10> INFO machine: Calling action: read_state on provider Google (new) INFO interface: Machine: action ["read_state", "start", {:target=>:gcp}] INFO runner: Running action: machine_action_read_state #<Vagrant::Action::Builder:0x00007f8332306350> INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x00007f8332595df0> INFO warden: Calling IN action: #<VagrantPlugins::Google::Action::ConnectGoogle:0x00007f8332595dc8> INFO connect_google: Creating Google API client and adding to Vagrant environment INFO warden: Calling IN action: #<VagrantPlugins::Google::Action::ReadState:0x00007f8332627cf0> INFO warden: Calling OUT action: #<VagrantPlugins::Google::Action::ReadState:0x00007f8332627cf0> INFO warden: Calling OUT action: #<VagrantPlugins::Google::Action::ConnectGoogle:0x00007f8332595dc8> INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::ConfigValidate:0x00007f8332595df0> INFO interface: Machine: action ["read_state", "end", {:target=>:gcp}] INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. ERROR warden: Error occurred: undefined method self_link' for nil:NilClass
INFO warden: Beginning recovery process...
INFO warden: Recovery complete.
ERROR warden: Error occurred: undefined method self_link' for nil:NilClass INFO warden: Beginning recovery process... INFO warden: Calling recover: #<Vagrant::Action::Builtin::Call:0x00007f8331927708> INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO warden: Beginning recovery process... INFO warden: Recovery complete. INFO environment: Released process lock: machine-action-bd56383a5f174b6eb3d79cbcffb7f802 INFO environment: Running hook: environment_unload INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x00007f8331d5faa0> Traceback (most recent call last): 37: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in block (2 levels) in run'
36: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in action' 35: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:201:in call'
34: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/environment.rb:614:in lock' 33: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:215:in block in action'
32: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/machine.rb:246:in action_raw' 31: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in run'
30: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in busy' 29: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in block in run'
28: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in call' 27: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
26: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/handle_box.rb:56:in call' 25: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
24: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/config_validate.rb:25:in call' 23: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
22: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/box_check_outdated.rb:93:in call' 21: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
20: from /Users/laithrafid/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/connect_google.rb:47:in call' 19: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
18: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/call.rb:53:in call' 17: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in run'
16: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/util/busy.rb:19:in busy' 15: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/runner.rb:89:in block in run'
14: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builder.rb:149:in call' 13: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
12: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:127:in block in finalize_action' 11: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
10: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/provision.rb:80:in call' 9: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
8: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/delayed.rb:19:in call' 7: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
6: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/synced_folders.rb:87:in call' 5: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
4: from /Users/laithrafid/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/warn_networks.rb:28:in call' 3: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
2: from /Users/laithrafid/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/warn_ssh_keys.rb:28:in call' 1: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in call'
/Users/laithrafid/.vagrant.d/gems/2.7.4/gems/vagrant-google-2.7.0/lib/vagrant-google/action/run_instance.rb:117:in call': undefined method self_link' for nil:NilClass (NoMethodError)

Originally posted by @laithrafid in mitchellh/vagrant-google#234 (comment)

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

1 participant