Skip to content

Commit

Permalink
Add preemptible support
Browse files Browse the repository at this point in the history
  • Loading branch information
Masashi Terui committed Dec 15, 2015
1 parent 045a14f commit 045ffdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/kitchen/driver/gce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Gce < Kitchen::Driver::SSHBase
default_config :zone_name, nil
default_config :google_key_location, nil
default_config :google_json_key_location, nil
default_config :preemptible, false

required_config :google_client_email
required_config :google_project
Expand Down Expand Up @@ -119,7 +120,9 @@ def create_server(disk)
tags: config[:tags],
zone_name: config[:zone_name],
public_key_path: config[:public_key_path],
username: config[:username]
username: config[:username],
preemptible: config[:preemptible],
on_host_maintenance: config[:preemptible] ? 'TERMINATE': 'MIGRATE'
)
end

Expand Down
6 changes: 4 additions & 2 deletions spec/kitchen/driver/gce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
username: ENV['USER'],
zone_name: nil,
google_key_location: nil,
google_json_key_location: nil
google_json_key_location: nil,
preemptible: false
}

defaults.each do |k, v|
Expand All @@ -115,7 +116,8 @@
username: 'root',
zone_name: 'europe-west1-a',
google_key_location: '/path/to/foo.p12',
google_json_key_location: '/path/to/bar.json'
google_json_key_location: '/path/to/bar.json',
preemptible: true
}

let(:config) { overrides }
Expand Down

0 comments on commit 045ffdf

Please sign in to comment.