Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Ruby 2.6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.4
ruby-version: '3.4'

- name: Unit tests
run: |
Expand Down
16 changes: 12 additions & 4 deletions lib/vagrant-google/action/run_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class RunInstance # rubocop:disable Metrics/ClassLength
include Vagrant::Util::Retryable

FOG_ERRORS = [
Fog::Compute::Google::NotFound,
Fog::Compute::Google::Error,
Fog::Google::Compute::NotFound,
Fog::Google::Compute::Error,
Fog::Errors::Error
].freeze

Expand Down Expand Up @@ -193,10 +193,11 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
source_image: image
)
disk.wait_for { disk.ready? }
disk.reload
disk_created_by_vagrant = true
else
disk = env[:google_compute].disks.get(disk_name, zone)
if disk.nil?
if disk.nil? || disk.status.nil?
# disk not found... create it with name
disk = env[:google_compute].disks.create(
name: disk_name,
Expand All @@ -206,6 +207,7 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
source_image: image
)
disk.wait_for { disk.ready? }
disk.reload
disk_created_by_vagrant = true
end
end
Expand Down Expand Up @@ -265,12 +267,14 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
zone_name: zone,
source_image: additional_disk_image
)
additional_disk.wait_for { additional_disk.ready? }
additional_disk.reload
else
# additional_disk_name set in disk_config
additional_disk_name = disk_config[:disk_name]

additional_disk = env[:google_compute].disks.get(additional_disk_name, zone)
if additional_disk.nil?
if additional_disk.nil? || additional_disk.status.nil?
# disk not found... create it with name
additional_disk = env[:google_compute].disks.create(
name: additional_disk_name,
Expand All @@ -280,6 +284,10 @@ def call(env) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
source_image: additional_disk_image
)
additional_disk.wait_for { additional_disk.ready? }
additional_disk.reload
else
# disk exists, manually set self_link if not present
additional_disk.self_link ||= "https://compute.googleapis.com/compute/v1/projects/#{project_id}/zones/#{zone}/disks/#{additional_disk_name}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-google/action/start_instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def call(env)
timeout: env[:machine].provider_config.instance_ready_timeout
end
end
rescue Fog::Compute::Google::Error => e
rescue Fog::Google::Compute::Error => e
raise Errors::FogError, :message => e.message
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-google/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# limitations under the License.
module VagrantPlugins
module Google
VERSION = "2.7.0".freeze
VERSION = "2.8.0".freeze
end
end
1 change: 1 addition & 0 deletions test/unit/common/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
its("enable_secure_boot") { should be_falsey }
its("enable_vtpm") { should be_falsey }
its("enable_integrity_monitoring") { should be_falsey }
its("resource_policies") { should == [] }
end

describe "overriding defaults" do
Expand Down
2 changes: 1 addition & 1 deletion vagrant-google.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "vagrant-google"

s.add_runtime_dependency "fog-google", "~> 1.17.0"
s.add_runtime_dependency "fog-google", "~> 1.25.0"

# This is a restriction to avoid errors on `failure_message_for_should`
# TODO: revise after vagrant_spec goes past >0.0.1 (at master@e623a56)
Expand Down