knife-google 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fb67127a3cc6cd2859f32160e8b08612eeff968
4
- data.tar.gz: 99833b9f9980664e97fb5e2d243fd5ed541f7ee2
3
+ metadata.gz: 7c8c3ce126c26763999d4c405ab503bfd00a296a
4
+ data.tar.gz: a6cd46a5d89830b1e94f649e4c8c9d43945970d1
5
5
  SHA512:
6
- metadata.gz: bf712c5c7f3b7cc0a4086b04cf5d7db3c27c9f110bfcb56f8e5234faf5688e05711a1fd59d000de4035b8621c7787ff9a87195024fd5122ddc196978b668dd66
7
- data.tar.gz: 051a36a7ce5831cbedf78dbcf0179d779a8e18aab4fe9ae7d720443172b7da1df1b132f444ac938927cb06b50b768484e724c98a10f597b07d52b74ba0d42652
6
+ metadata.gz: b55e55cbecd39e3a11ef3fc5a15afb3be6162f2e0580b617c029487fb74205bd938cba99b89542fef9c5943e9fc5cc39ed78a8c57c12bb4c507aa740d27b1b72
7
+ data.tar.gz: f2eb3103f4480d9781e4fd8b5eb56026bfeda281a1d7bd468501df68b938073e0449bb23337ce8d2b190ea196f894522141a5b0e0aa1134cccf2b53c5da03e7b
@@ -2,9 +2,10 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  rvm:
5
- - 2.0.0
6
- - 2.1
7
- - 2.2
5
+ - 2.1.10
6
+ - 2.2.5
7
+ - 2.3.1
8
+ - ruby-head
8
9
  branches:
9
10
  only:
10
11
  - master
@@ -1,7 +1,11 @@
1
1
  # knife-google Change Log
2
2
 
3
- ## v2.2.0 (2016-03-17)
4
3
 
4
+ ## v2.2.1 (2016-09-27)
5
+ * [pr#112](https://github.com/chef/knife-google/pull/112) Fixed the zone and region listing
6
+ * [pr#109](https://github.com/chef/knife-google/pull/109) Add aliases to match image families and add Ubuntu 16.04
7
+
8
+ ## v2.2.0 (2016-03-17)
5
9
  * [pr#102](https://github.com/chef/knife-google/pull/102) Added support for preemptible instances
6
10
  * [pr#103](https://github.com/chef/knife-google/pull/103) Added support for deploying instances on subnetworks
7
11
  * [pr#103](https://github.com/chef/knife-google/pull/104) Added gcloud-style image aliases (i.e. image "centos-7" will get you the latest CentOS 7 disk image)
@@ -66,9 +66,13 @@ class Chef::Knife::Cloud
66
66
  "sles-11" => { project: "suse-cloud", prefix: "sles-11" },
67
67
  "sles-12" => { project: "suse-cloud", prefix: "sles-12" },
68
68
  "ubuntu-12-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1204-precise" },
69
+ "ubuntu-1204-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1204-precise" },
69
70
  "ubuntu-14-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1404-trusty" },
71
+ "ubuntu-1404-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1404-trusty" },
70
72
  "ubuntu-15-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1504-vivid" },
71
73
  "ubuntu-15-10" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1510-wily" },
74
+ "ubuntu-16-04" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
75
+ "ubuntu-1604-lts" => { project: "ubuntu-os-cloud", prefix: "ubuntu-1604-xenial" },
72
76
  "windows-2008-r2" => { project: "windows-cloud", prefix: "windows-server-2008-r2" },
73
77
  "windows-2012-r2" => { project: "windows-cloud", prefix: "windows-server-2012-r2" },
74
78
  }
@@ -27,7 +27,7 @@ class Chef::Knife::Cloud
27
27
  include GoogleServiceHelpers
28
28
  include GoogleServiceOptions
29
29
 
30
- banner "knife google zone list"
30
+ banner "knife google region list"
31
31
 
32
32
  def validate_params!
33
33
  check_for_missing_config_values!
@@ -14,7 +14,7 @@
14
14
  #
15
15
  module Knife
16
16
  module Google
17
- VERSION = "2.2.0".freeze
17
+ VERSION = "2.2.1".freeze
18
18
  MAJOR, MINOR, TINY = VERSION.split(".")
19
19
  end
20
20
  end
@@ -26,7 +26,7 @@ end
26
26
  describe Chef::Knife::Cloud::GoogleServiceHelpers do
27
27
  let(:tester) { Tester.new }
28
28
 
29
- describe '#create_service_instance' do
29
+ describe "#create_service_instance" do
30
30
  it "creates a GoogleService instance" do
31
31
  expect(tester).to receive(:locate_config_value).with(:gce_project).and_return("test_project")
32
32
  expect(tester).to receive(:locate_config_value).with(:gce_zone).and_return("test_zone")
@@ -48,7 +48,7 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
48
48
  end
49
49
  end
50
50
 
51
- describe '#check_for_missing_config_values' do
51
+ describe "#check_for_missing_config_values" do
52
52
  it "does not raise an exception if all parameters are present" do
53
53
  expect(tester).to receive(:locate_config_value).with(:gce_project).and_return("project")
54
54
  expect(tester).to receive(:locate_config_value).with(:gce_zone).and_return("zone")
@@ -70,7 +70,7 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
70
70
  end
71
71
  end
72
72
 
73
- describe '#private_ip_for' do
73
+ describe "#private_ip_for" do
74
74
  it "returns the IP address if it exists" do
75
75
  network_interface = double("network_interface", network_ip: "1.2.3.4")
76
76
  server = double("server", network_interfaces: [network_interface])
@@ -86,7 +86,7 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
86
86
  end
87
87
  end
88
88
 
89
- describe '#public_ip_for' do
89
+ describe "#public_ip_for" do
90
90
  it "returns the IP address if it exists" do
91
91
  access_config = double("access_config", nat_ip: "4.3.2.1")
92
92
  network_interface = double("network_interface", access_configs: [access_config])
@@ -104,7 +104,7 @@ describe Chef::Knife::Cloud::GoogleServiceHelpers do
104
104
  end
105
105
  end
106
106
 
107
- describe '#valid_disk_size?' do
107
+ describe "#valid_disk_size?" do
108
108
  it "returns true if the disk is between 10 and 10,000" do
109
109
  expect(tester.valid_disk_size?(50)).to eq(true)
110
110
  end
@@ -65,7 +65,7 @@ describe Chef::Knife::Cloud::GoogleService do
65
65
  allow(service).to receive(:connection).and_return(connection)
66
66
  end
67
67
 
68
- describe '#connection' do
68
+ describe "#connection" do
69
69
  it "returns a properly configured ComputeService" do
70
70
  compute_service = double("compute_service")
71
71
  client_options = double("client_options")
@@ -85,7 +85,7 @@ describe Chef::Knife::Cloud::GoogleService do
85
85
  end
86
86
  end
87
87
 
88
- describe '#authorization' do
88
+ describe "#authorization" do
89
89
  it "returns a Google::Auth authorization object" do
90
90
  auth_object = double("auth_object")
91
91
  expect(Google::Auth).to receive(:get_application_default).and_return(auth_object)
@@ -93,7 +93,7 @@ describe Chef::Knife::Cloud::GoogleService do
93
93
  end
94
94
  end
95
95
 
96
- describe '#create_server' do
96
+ describe "#create_server" do
97
97
  it "creates and returns the created instance" do
98
98
  create_instance_obj = double("instance_obj")
99
99
  create_options = { name: "test_instance" }
@@ -110,7 +110,7 @@ describe Chef::Knife::Cloud::GoogleService do
110
110
  end
111
111
  end
112
112
 
113
- describe '#delete_server' do
113
+ describe "#delete_server" do
114
114
  context "when the instance does not exist" do
115
115
  before do
116
116
  allow(service.ui).to receive(:warn)
@@ -144,29 +144,29 @@ describe Chef::Knife::Cloud::GoogleService do
144
144
  end
145
145
  end
146
146
 
147
- describe '#get_server' do
147
+ describe "#get_server" do
148
148
  it "returns an instance" do
149
149
  expect(connection).to receive(:get_instance).with(project, zone, "test_instance").and_return("instance")
150
150
  expect(service.get_server("test_instance")).to eq("instance")
151
151
  end
152
152
  end
153
153
 
154
- describe '#list_zones' do
154
+ describe "#list_zones" do
155
155
  subject { service.list_zones }
156
156
  it_behaves_like "a paginated list fetcher", :list_zones, :items, "test_project"
157
157
  end
158
158
 
159
- describe '#list_disks' do
159
+ describe "#list_disks" do
160
160
  subject { service.list_disks }
161
161
  it_behaves_like "a paginated list fetcher", :list_disks, :items, "test_project", "test_zone"
162
162
  end
163
163
 
164
- describe '#list_regions' do
164
+ describe "#list_regions" do
165
165
  subject { service.list_regions }
166
166
  it_behaves_like "a paginated list fetcher", :list_regions, :items, "test_project"
167
167
  end
168
168
 
169
- describe '#list_project_quotas' do
169
+ describe "#list_project_quotas" do
170
170
  let(:response) { double("response") }
171
171
 
172
172
  before do
@@ -185,7 +185,7 @@ describe Chef::Knife::Cloud::GoogleService do
185
185
  end
186
186
  end
187
187
 
188
- describe '#validate_server_create_options!' do
188
+ describe "#validate_server_create_options!" do
189
189
  let(:options) do
190
190
  {
191
191
  machine_type: "test_type",
@@ -235,13 +235,13 @@ describe Chef::Knife::Cloud::GoogleService do
235
235
  end
236
236
  end
237
237
 
238
- describe '#check_api_call' do
238
+ describe "#check_api_call" do
239
239
  it "returns false if the block raises a ClientError" do
240
240
  expect(service.check_api_call { raise Google::Apis::ClientError.new("whoops") }).to eq(false)
241
241
  end
242
242
 
243
243
  it "raises an exception if the block raises something other than a ClientError" do
244
- expect { service.check_api_call { raise RuntimeError.new("whoops") } }.to raise_error(RuntimeError)
244
+ expect { service.check_api_call { raise "whoops" } }.to raise_error(RuntimeError)
245
245
  end
246
246
 
247
247
  it "returns true if the block does not raise an exception" do
@@ -249,7 +249,7 @@ describe Chef::Knife::Cloud::GoogleService do
249
249
  end
250
250
  end
251
251
 
252
- describe '#valid_machine_type?' do
252
+ describe "#valid_machine_type?" do
253
253
  it "returns false if no matchine type was specified" do
254
254
  expect(service.valid_machine_type?(nil)).to eq(false)
255
255
  end
@@ -262,7 +262,7 @@ describe Chef::Knife::Cloud::GoogleService do
262
262
  end
263
263
  end
264
264
 
265
- describe '#valid_network?' do
265
+ describe "#valid_network?" do
266
266
  it "returns false if no network was specified" do
267
267
  expect(service.valid_network?(nil)).to eq(false)
268
268
  end
@@ -275,7 +275,7 @@ describe Chef::Knife::Cloud::GoogleService do
275
275
  end
276
276
  end
277
277
 
278
- describe '#valid_subnet?' do
278
+ describe "#valid_subnet?" do
279
279
  it "returns false if no subnet was specified" do
280
280
  expect(service.valid_subnet?(nil)).to eq(false)
281
281
  end
@@ -289,7 +289,7 @@ describe Chef::Knife::Cloud::GoogleService do
289
289
  end
290
290
  end
291
291
 
292
- describe '#image_exist?' do
292
+ describe "#image_exist?" do
293
293
  it "checks the image using check_api_call" do
294
294
  expect(connection).to receive(:get_image).with("image_project", "image_name")
295
295
  expect(service).to receive(:check_api_call).and_call_original
@@ -298,7 +298,7 @@ describe Chef::Knife::Cloud::GoogleService do
298
298
  end
299
299
  end
300
300
 
301
- describe '#valid_public_ip_setting?' do
301
+ describe "#valid_public_ip_setting?" do
302
302
  it "returns true if the public_ip is nil" do
303
303
  expect(service.valid_public_ip_setting?(nil)).to eq(true)
304
304
  end
@@ -322,7 +322,7 @@ describe Chef::Knife::Cloud::GoogleService do
322
322
  end
323
323
  end
324
324
 
325
- describe '#valid_ip_address' do
325
+ describe "#valid_ip_address" do
326
326
  it "returns false if IPAddr is unable to parse the address" do
327
327
  expect(IPAddr).to receive(:new).with("not_an_ip").and_raise(IPAddr::InvalidAddressError)
328
328
  expect(service.valid_ip_address?("not_an_ip")).to eq(false)
@@ -334,7 +334,7 @@ describe Chef::Knife::Cloud::GoogleService do
334
334
  end
335
335
  end
336
336
 
337
- describe '#region' do
337
+ describe "#region" do
338
338
  it "returns the region for a given zone" do
339
339
  zone_obj = double("zone_obj", region: "/path/to/test_region")
340
340
  expect(connection).to receive(:get_zone).with(project, zone).and_return(zone_obj)
@@ -342,7 +342,7 @@ describe Chef::Knife::Cloud::GoogleService do
342
342
  end
343
343
  end
344
344
 
345
- describe '#instance_object_for' do
345
+ describe "#instance_object_for" do
346
346
  let(:instance_object) { double("instance_object") }
347
347
  let(:options) do
348
348
  {
@@ -387,7 +387,7 @@ describe Chef::Knife::Cloud::GoogleService do
387
387
  end
388
388
  end
389
389
 
390
- describe '#instance_disks_for' do
390
+ describe "#instance_disks_for" do
391
391
 
392
392
  before do
393
393
  expect(service).to receive(:instance_boot_disk_for).with(options).and_return("boot_disk")
@@ -433,7 +433,7 @@ describe Chef::Knife::Cloud::GoogleService do
433
433
  end
434
434
  end
435
435
 
436
- describe '#instance_boot_disk_for' do
436
+ describe "#instance_boot_disk_for" do
437
437
  it "sets up a disk object and returns it" do
438
438
  disk = double("disk")
439
439
  params = double("params")
@@ -464,7 +464,7 @@ describe Chef::Knife::Cloud::GoogleService do
464
464
  end
465
465
  end
466
466
 
467
- describe '#boot_disk_type_for' do
467
+ describe "#boot_disk_type_for" do
468
468
  it "returns pd-ssd if boot_disk_ssd is true" do
469
469
  expect(service.boot_disk_type_for(boot_disk_ssd: true)).to eq("pd-ssd")
470
470
  end
@@ -474,7 +474,7 @@ describe Chef::Knife::Cloud::GoogleService do
474
474
  end
475
475
  end
476
476
 
477
- describe '#image_search_for' do
477
+ describe "#image_search_for" do
478
478
  context "when the user supplies an image project" do
479
479
  it "returns the image URL based on the image project" do
480
480
  expect(service).to receive(:image_url_for).with("test_project", "test_image").and_return("image_url")
@@ -527,7 +527,7 @@ describe Chef::Knife::Cloud::GoogleService do
527
527
  end
528
528
  end
529
529
 
530
- describe '#image_url_for' do
530
+ describe "#image_url_for" do
531
531
  it "returns nil if the image does not exist" do
532
532
  expect(service).to receive(:image_exist?).with("image_project", "image_name").and_return(false)
533
533
  expect(service.image_url_for("image_project", "image_name")).to eq(nil)
@@ -539,7 +539,7 @@ describe Chef::Knife::Cloud::GoogleService do
539
539
  end
540
540
  end
541
541
 
542
- describe '#image_alias_url' do
542
+ describe "#image_alias_url" do
543
543
  context "when the image_alias is not a valid alias" do
544
544
  it "returns nil" do
545
545
  expect(service.image_alias_url("fake_alias")).to eq(nil)
@@ -583,7 +583,7 @@ describe Chef::Knife::Cloud::GoogleService do
583
583
  end
584
584
  end
585
585
 
586
- describe '#boot_disk_name_for' do
586
+ describe "#boot_disk_name_for" do
587
587
  it "returns the boot disk name if supplied by the user" do
588
588
  options = { name: "instance_name", boot_disk_name: "disk_name" }
589
589
  expect(service.boot_disk_name_for(options)).to eq("disk_name")
@@ -595,13 +595,13 @@ describe Chef::Knife::Cloud::GoogleService do
595
595
  end
596
596
  end
597
597
 
598
- describe '#machine_type_url_for' do
598
+ describe "#machine_type_url_for" do
599
599
  it "returns a properly-formatted machine type URL" do
600
600
  expect(service.machine_type_url_for("test_type")).to eq("zones/test_zone/machineTypes/test_type")
601
601
  end
602
602
  end
603
603
 
604
- describe '#instance_metadata_for' do
604
+ describe "#instance_metadata_for" do
605
605
  it "returns nil if the passed-in metadata is nil" do
606
606
  expect(service.instance_metadata_for(nil)).to eq(nil)
607
607
  end
@@ -629,7 +629,7 @@ describe Chef::Knife::Cloud::GoogleService do
629
629
  end
630
630
  end
631
631
 
632
- describe '#instance_network_interfaces_for' do
632
+ describe "#instance_network_interfaces_for" do
633
633
  let(:interface) { double("interface" ) }
634
634
  let(:options) { { network: "test_network", public_ip: "public_ip" } }
635
635
 
@@ -677,20 +677,20 @@ describe Chef::Knife::Cloud::GoogleService do
677
677
  end
678
678
  end
679
679
 
680
- describe '#network_url_for' do
680
+ describe "#network_url_for" do
681
681
  it "returns a properly-formatted network URL" do
682
682
  expect(service.network_url_for("test_network")).to eq("projects/test_project/global/networks/test_network")
683
683
  end
684
684
  end
685
685
 
686
- describe '#subnet_url_for' do
686
+ describe "#subnet_url_for" do
687
687
  it "returns a properly-formatted subnet URL" do
688
688
  expect(service).to receive(:region).and_return("test_region")
689
689
  expect(service.subnet_url_for("test_subnet")).to eq("projects/test_project/regions/test_region/subnetworks/test_subnet")
690
690
  end
691
691
  end
692
692
 
693
- describe '#instance_scheduling_for' do
693
+ describe "#instance_scheduling_for" do
694
694
  it "returns a properly-formatted scheduling object" do
695
695
  scheduling = double("scheduling")
696
696
  options = { auto_restart: "auto_restart", auto_migrate: "auto_migrate", preemptible: "preempt" }
@@ -705,7 +705,7 @@ describe Chef::Knife::Cloud::GoogleService do
705
705
  end
706
706
  end
707
707
 
708
- describe '#migrate_setting_for' do
708
+ describe "#migrate_setting_for" do
709
709
  it "returns MIGRATE when auto_migrate is true" do
710
710
  expect(service.migrate_setting_for(true)).to eq("MIGRATE")
711
711
  end
@@ -715,7 +715,7 @@ describe Chef::Knife::Cloud::GoogleService do
715
715
  end
716
716
  end
717
717
 
718
- describe '#instance_service_accounts_for' do
718
+ describe "#instance_service_accounts_for" do
719
719
  it "returns nil if service_account_scopes is nil" do
720
720
  expect(service.instance_service_accounts_for({})).to eq(nil)
721
721
  end
@@ -741,7 +741,7 @@ describe Chef::Knife::Cloud::GoogleService do
741
741
  end
742
742
  end
743
743
 
744
- describe '#service_account_scope_url' do
744
+ describe "#service_account_scope_url" do
745
745
  it "returns the passed-in scope if it already looks like a scope URL" do
746
746
  scope = "https://www.googleapis.com/auth/fake_scope"
747
747
  expect(service.service_account_scope_url(scope)).to eq(scope)
@@ -753,7 +753,7 @@ describe Chef::Knife::Cloud::GoogleService do
753
753
  end
754
754
  end
755
755
 
756
- describe '#translate_scope_alias' do
756
+ describe "#translate_scope_alias" do
757
757
  it "returns a scope for a given alias" do
758
758
  expect(service.translate_scope_alias("storage-rw")).to eq("devstorage.read_write")
759
759
  end
@@ -763,7 +763,7 @@ describe Chef::Knife::Cloud::GoogleService do
763
763
  end
764
764
  end
765
765
 
766
- describe '#instance_tags_for' do
766
+ describe "#instance_tags_for" do
767
767
  it "returns nil if tags is nil" do
768
768
  expect(service.instance_tags_for(nil)).to eq(nil)
769
769
  end
@@ -782,7 +782,7 @@ describe Chef::Knife::Cloud::GoogleService do
782
782
  end
783
783
  end
784
784
 
785
- describe '#network_for' do
785
+ describe "#network_for" do
786
786
  it "returns the network name if it exists" do
787
787
  interface = double("interface", network: "/some/path/to/default_network")
788
788
  instance = double("instance", network_interfaces: [interface])
@@ -798,14 +798,14 @@ describe Chef::Knife::Cloud::GoogleService do
798
798
  end
799
799
  end
800
800
 
801
- describe '#machine_type_for' do
801
+ describe "#machine_type_for" do
802
802
  it "returns the machine type name" do
803
803
  instance = double("instance", machine_type: "/some/path/to/test_type")
804
804
  expect(service.machine_type_for(instance)).to eq("test_type")
805
805
  end
806
806
  end
807
807
 
808
- describe '#public_project_for_image' do
808
+ describe "#public_project_for_image" do
809
809
  {
810
810
  "centos" => "centos-cloud",
811
811
  "container-vm" => "google-containers",
@@ -823,13 +823,13 @@ describe Chef::Knife::Cloud::GoogleService do
823
823
  end
824
824
  end
825
825
 
826
- describe '#disk_type_url_for' do
826
+ describe "#disk_type_url_for" do
827
827
  it "returns a properly-formatted disk type URL" do
828
828
  expect(service.disk_type_url_for("disk_type")).to eq("zones/test_zone/diskTypes/disk_type")
829
829
  end
830
830
  end
831
831
 
832
- describe '#paginated_results' do
832
+ describe "#paginated_results" do
833
833
  let(:response) { double("response") }
834
834
  let(:api_method) { :list_stuff }
835
835
  let(:items_method) { :items }
@@ -893,7 +893,7 @@ describe Chef::Knife::Cloud::GoogleService do
893
893
  end
894
894
  end
895
895
 
896
- describe '#wait_for_status' do
896
+ describe "#wait_for_status" do
897
897
  let(:item) { double("item") }
898
898
 
899
899
  before do
@@ -940,7 +940,7 @@ describe Chef::Knife::Cloud::GoogleService do
940
940
  end
941
941
  end
942
942
 
943
- describe '#wait_for_operation' do
943
+ describe "#wait_for_operation" do
944
944
  let(:operation) { double("operation", name: "operation-123") }
945
945
 
946
946
  it "raises a properly-formatted exception when errors exist" do
@@ -963,14 +963,14 @@ describe Chef::Knife::Cloud::GoogleService do
963
963
  end
964
964
  end
965
965
 
966
- describe '#zone_operation' do
966
+ describe "#zone_operation" do
967
967
  it "fetches the operation from the API and returns it" do
968
968
  expect(connection).to receive(:get_zone_operation).with(project, zone, "operation-123").and_return("operation")
969
969
  expect(service.zone_operation("operation-123")).to eq("operation")
970
970
  end
971
971
  end
972
972
 
973
- describe '#operation_errors' do
973
+ describe "#operation_errors" do
974
974
  let(:operation) { double("operation") }
975
975
  let(:error_obj) { double("error_obj") }
976
976
 
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleDiskCreate do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  before do
35
35
  allow(command).to receive(:check_for_missing_config_values!)
36
36
  allow(command).to receive(:valid_disk_size?).and_return(true)
@@ -59,7 +59,7 @@ describe Chef::Knife::Cloud::GoogleDiskCreate do
59
59
  end
60
60
  end
61
61
 
62
- describe '#execute_command' do
62
+ describe "#execute_command" do
63
63
  it "calls the service to create the disk" do
64
64
  expect(command).to receive(:locate_config_value).with(:disk_size).and_return("size")
65
65
  expect(command).to receive(:locate_config_value).with(:disk_type).and_return("type")
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleDiskDelete do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  before do
35
35
  allow(command).to receive(:check_for_missing_config_values!)
36
36
  end
@@ -53,7 +53,7 @@ describe Chef::Knife::Cloud::GoogleDiskDelete do
53
53
  end
54
54
  end
55
55
 
56
- describe '#execute_command' do
56
+ describe "#execute_command" do
57
57
  it "calls the service to delete each disk" do
58
58
  expect(service).to receive(:delete_disk).with("disk1")
59
59
  expect(service).to receive(:delete_disk).with("disk2")
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleDiskList do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,14 +38,14 @@ describe Chef::Knife::Cloud::GoogleDiskList do
38
38
  end
39
39
  end
40
40
 
41
- describe '#query_resource' do
41
+ describe "#query_resource" do
42
42
  it "uses the service to list disks" do
43
43
  expect(service).to receive(:list_disks).and_return("disks")
44
44
  expect(command.query_resource).to eq("disks")
45
45
  end
46
46
  end
47
47
 
48
- describe '#format_status_value' do
48
+ describe "#format_status_value" do
49
49
  it "returns green when the status is ready" do
50
50
  expect(command.ui).to receive(:color).with("ready", :green)
51
51
  command.format_status_value("ready")
@@ -57,13 +57,13 @@ describe Chef::Knife::Cloud::GoogleDiskList do
57
57
  end
58
58
  end
59
59
 
60
- describe '#format_disk_type' do
60
+ describe "#format_disk_type" do
61
61
  it "returns a properly-formatted disk type" do
62
62
  expect(command.format_disk_type("a/b/c/disk_type")).to eq("disk_type")
63
63
  end
64
64
  end
65
65
 
66
- describe '#format_source_image' do
66
+ describe "#format_source_image" do
67
67
  it "returns 'unknown' if the source is nil" do
68
68
  expect(command.format_source_image(nil)).to eq("unknown")
69
69
  end
@@ -77,7 +77,7 @@ describe Chef::Knife::Cloud::GoogleDiskList do
77
77
  end
78
78
  end
79
79
 
80
- describe '#format_users' do
80
+ describe "#format_users" do
81
81
  it "returns 'unknown' if the source is nil" do
82
82
  expect(command.format_users(nil)).to eq("none")
83
83
  end
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleProjectQuotas do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,20 +38,20 @@ describe Chef::Knife::Cloud::GoogleProjectQuotas do
38
38
  end
39
39
  end
40
40
 
41
- describe '#query_resource' do
41
+ describe "#query_resource" do
42
42
  it "uses the service to list project quotas" do
43
43
  expect(service).to receive(:list_project_quotas).and_return("quotas")
44
44
  expect(command.query_resource).to eq("quotas")
45
45
  end
46
46
  end
47
47
 
48
- describe '#format_name' do
48
+ describe "#format_name" do
49
49
  it "returns a properly-formatted name" do
50
50
  expect(command.format_name("something_cool_here")).to eq("Something Cool Here")
51
51
  end
52
52
  end
53
53
 
54
- describe '#format_number' do
54
+ describe "#format_number" do
55
55
  it "returns an integer as a string if the number is a whole number" do
56
56
  expect(command.format_number(2.0)).to eq("2")
57
57
  end
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleRegionList do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,14 +38,14 @@ describe Chef::Knife::Cloud::GoogleRegionList do
38
38
  end
39
39
  end
40
40
 
41
- describe '#query_resource' do
41
+ describe "#query_resource" do
42
42
  it "uses the service to list regions" do
43
43
  expect(service).to receive(:list_regions).and_return("regions")
44
44
  expect(command.query_resource).to eq("regions")
45
45
  end
46
46
  end
47
47
 
48
- describe '#format_status_value' do
48
+ describe "#format_status_value" do
49
49
  it "returns green when the status is up" do
50
50
  expect(command.ui).to receive(:color).with("up", :green)
51
51
  command.format_status_value("up")
@@ -57,7 +57,7 @@ describe Chef::Knife::Cloud::GoogleRegionList do
57
57
  end
58
58
  end
59
59
 
60
- describe '#format_zones' do
60
+ describe "#format_zones" do
61
61
  it "returns properly-formatted zones" do
62
62
  expect(command.format_zones(["a/b/zone1", "c/d/zone2"])).to eq("zone1, zone2")
63
63
  end
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleRegionQuotas do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,7 +38,7 @@ describe Chef::Knife::Cloud::GoogleRegionQuotas do
38
38
  end
39
39
  end
40
40
 
41
- describe '#execute_command' do
41
+ describe "#execute_command" do
42
42
  let(:ui) { double("ui") }
43
43
  let(:regions) { [region1] }
44
44
 
@@ -90,13 +90,13 @@ describe Chef::Knife::Cloud::GoogleRegionQuotas do
90
90
  end
91
91
  end
92
92
 
93
- describe '#format_name' do
93
+ describe "#format_name" do
94
94
  it "returns a properly-formatted name" do
95
95
  expect(command.format_name("something_cool_here")).to eq("Something Cool Here")
96
96
  end
97
97
  end
98
98
 
99
- describe '#format_number' do
99
+ describe "#format_number" do
100
100
  it "returns an integer as a string if the number is a whole number" do
101
101
  expect(command.format_number(2.0)).to eq("2")
102
102
  end
@@ -33,7 +33,7 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
33
33
 
34
34
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
35
35
 
36
- describe '#validate_params!' do
36
+ describe "#validate_params!" do
37
37
  before do
38
38
  allow(command).to receive(:check_for_missing_config_values!)
39
39
  allow(command).to receive(:valid_disk_size?).and_return(true)
@@ -87,7 +87,7 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
87
87
  end
88
88
  end
89
89
 
90
- describe '#before_bootstrap' do
90
+ describe "#before_bootstrap" do
91
91
  before do
92
92
  allow(command).to receive(:ip_address_for_bootstrap)
93
93
  allow(command).to receive(:locate_config_value)
@@ -125,41 +125,41 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
125
125
  end
126
126
  end
127
127
 
128
- describe '#get_node_name' do
128
+ describe "#get_node_name" do
129
129
  it "overrides the original method to return nil" do
130
130
  expect(command.get_node_name("name", "prefix")).to eq(nil)
131
131
  end
132
132
  end
133
133
 
134
- describe '#project' do
134
+ describe "#project" do
135
135
  it "returns the project from the config" do
136
136
  expect(command).to receive(:locate_config_value).with(:gce_project).and_return("test_project")
137
137
  expect(command.project).to eq("test_project")
138
138
  end
139
139
  end
140
140
 
141
- describe '#zone' do
141
+ describe "#zone" do
142
142
  it "returns the zone from the config" do
143
143
  expect(command).to receive(:locate_config_value).with(:gce_zone).and_return("test_zone")
144
144
  expect(command.zone).to eq("test_zone")
145
145
  end
146
146
  end
147
147
 
148
- describe '#email' do
148
+ describe "#email" do
149
149
  it "returns the email from the config" do
150
150
  expect(command).to receive(:locate_config_value).with(:gce_email).and_return("test_email")
151
151
  expect(command.email).to eq("test_email")
152
152
  end
153
153
  end
154
154
 
155
- describe '#preemptible?' do
155
+ describe "#preemptible?" do
156
156
  it "returns the preemptible setting from the config" do
157
157
  expect(command).to receive(:locate_config_value).with(:preemptible).and_return("test_preempt")
158
158
  expect(command.preemptible?).to eq("test_preempt")
159
159
  end
160
160
  end
161
161
 
162
- describe '#auto_migrate?' do
162
+ describe "#auto_migrate?" do
163
163
  it "returns false if the instance is preemptible" do
164
164
  expect(command).to receive(:preemptible?).and_return(true)
165
165
  expect(command.auto_migrate?).to eq(false)
@@ -172,7 +172,7 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
172
172
  end
173
173
  end
174
174
 
175
- describe '#auto_restart?' do
175
+ describe "#auto_restart?" do
176
176
  it "returns false if the instance is preemptible" do
177
177
  expect(command).to receive(:preemptible?).and_return(true)
178
178
  expect(command.auto_restart?).to eq(false)
@@ -185,7 +185,7 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
185
185
  end
186
186
  end
187
187
 
188
- describe '#ip_address_for_bootstrap' do
188
+ describe "#ip_address_for_bootstrap" do
189
189
  it "returns the public IP by default" do
190
190
  expect(command).to receive(:locate_config_value).with(:use_private_ip).and_return(false)
191
191
  expect(command).to receive(:public_ip_for).and_return("1.2.3.4")
@@ -205,21 +205,21 @@ describe Chef::Knife::Cloud::GoogleServerCreate do
205
205
  end
206
206
  end
207
207
 
208
- describe '#metadata' do
208
+ describe "#metadata" do
209
209
  it "returns a hash of metadata" do
210
210
  expect(command).to receive(:locate_config_value).with(:metadata).and_return(["key1=value1", "key2=value2"])
211
211
  expect(command.metadata).to eq({ "key1" => "value1", "key2" => "value2" })
212
212
  end
213
213
  end
214
214
 
215
- describe '#boot_disk_size' do
215
+ describe "#boot_disk_size" do
216
216
  it "returns the disk size as an integer" do
217
217
  expect(command).to receive(:locate_config_value).with(:boot_disk_size).and_return("20")
218
218
  expect(command.boot_disk_size).to eq(20)
219
219
  end
220
220
  end
221
221
 
222
- describe '#reset_windows_password' do
222
+ describe "#reset_windows_password" do
223
223
  it "returns the password from the gcewinpass instance" do
224
224
  winpass = double("winpass", new_password: "my_password")
225
225
  expect(GoogleComputeWindowsPassword).to receive(:new).and_return(winpass)
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleServerDelete do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::ServerDeleteCommand, described_class.new(["test_instance"])
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
  command.validate_params!
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleServerList do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,7 +38,7 @@ describe Chef::Knife::Cloud::GoogleServerList do
38
38
  end
39
39
  end
40
40
 
41
- describe '#format_status_value' do
41
+ describe "#format_status_value" do
42
42
  it "returns green when the status is ready" do
43
43
  expect(command.ui).to receive(:color).with("ready", :green)
44
44
  command.format_status_value("ready")
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleServerShow do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  before do
35
35
  allow(command).to receive(:check_for_missing_config_values!)
36
36
  end
@@ -30,7 +30,7 @@ describe Chef::Knife::Cloud::GoogleZoneList do
30
30
 
31
31
  it_behaves_like Chef::Knife::Cloud::Command, described_class.new
32
32
 
33
- describe '#validate_params!' do
33
+ describe "#validate_params!" do
34
34
  it "checks for missing config values" do
35
35
  expect(command).to receive(:check_for_missing_config_values!)
36
36
 
@@ -38,14 +38,14 @@ describe Chef::Knife::Cloud::GoogleZoneList do
38
38
  end
39
39
  end
40
40
 
41
- describe '#query_resource' do
41
+ describe "#query_resource" do
42
42
  it "uses the service to list zones" do
43
43
  expect(service).to receive(:list_zones).and_return("zones")
44
44
  expect(command.query_resource).to eq("zones")
45
45
  end
46
46
  end
47
47
 
48
- describe '#format_status_value' do
48
+ describe "#format_status_value" do
49
49
  it "returns green when the status is up" do
50
50
  expect(command.ui).to receive(:color).with("up", :green)
51
51
  command.format_status_value("up")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chiraq Jog
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-03-17 00:00:00.000000000 Z
16
+ date: 2016-09-27 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: chef
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  requirements: []
210
210
  rubyforge_project:
211
- rubygems_version: 2.4.8
211
+ rubygems_version: 2.5.1
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Google Compute Engine Support for Chef's Knife Command