knife-google 1.3.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +1 -0
  3. data/.travis.yml +15 -3
  4. data/CHANGELOG.md +4 -6
  5. data/Gemfile +3 -9
  6. data/README.md +208 -355
  7. data/RELEASE_NOTES.md +8 -17
  8. data/Rakefile +8 -49
  9. data/knife-google.gemspec +20 -17
  10. data/lib/chef/knife/cloud/google_service.rb +491 -0
  11. data/lib/chef/knife/cloud/google_service_helpers.rb +62 -0
  12. data/lib/chef/knife/cloud/google_service_options.rb +58 -0
  13. data/lib/chef/knife/google_disk_create.rb +40 -44
  14. data/lib/chef/knife/google_disk_delete.rb +22 -40
  15. data/lib/chef/knife/google_disk_list.rb +57 -51
  16. data/lib/chef/knife/google_project_quotas.rb +59 -0
  17. data/lib/chef/knife/google_region_list.rb +43 -102
  18. data/lib/chef/knife/google_region_quotas.rb +77 -0
  19. data/lib/chef/knife/google_server_create.rb +224 -505
  20. data/lib/chef/knife/google_server_delete.rb +20 -78
  21. data/lib/chef/knife/google_server_list.rb +42 -53
  22. data/lib/chef/knife/google_server_show.rb +44 -0
  23. data/lib/chef/knife/google_zone_list.rb +39 -50
  24. data/lib/knife-google/version.rb +3 -2
  25. data/spec/cloud/google_service_helpers_spec.rb +120 -0
  26. data/spec/cloud/google_service_spec.rb +832 -0
  27. data/spec/google_disk_create_spec.rb +72 -0
  28. data/spec/google_disk_delete_spec.rb +64 -0
  29. data/spec/google_disk_list_spec.rb +93 -0
  30. data/spec/google_project_quotas_spec.rb +63 -0
  31. data/spec/google_region_list_spec.rb +65 -0
  32. data/spec/google_region_quotas_spec.rb +108 -0
  33. data/spec/google_server_create_spec.rb +177 -0
  34. data/spec/google_server_delete_spec.rb +39 -0
  35. data/spec/google_server_list_spec.rb +77 -0
  36. data/spec/google_server_show_spec.rb +60 -0
  37. data/spec/google_zone_list_spec.rb +59 -0
  38. metadata +91 -114
  39. data/CONTRIB.md +0 -64
  40. data/lib/chef/knife/google_base.rb +0 -76
  41. data/lib/chef/knife/google_project_list.rb +0 -178
  42. data/lib/chef/knife/google_setup.rb +0 -31
  43. data/lib/google/compute.rb +0 -47
  44. data/lib/google/compute/client.rb +0 -216
  45. data/lib/google/compute/config.rb +0 -23
  46. data/lib/google/compute/creatable_resource_collection.rb +0 -55
  47. data/lib/google/compute/deletable_resource_collection.rb +0 -51
  48. data/lib/google/compute/disk.rb +0 -38
  49. data/lib/google/compute/exception.rb +0 -30
  50. data/lib/google/compute/firewall.rb +0 -65
  51. data/lib/google/compute/global_operation.rb +0 -60
  52. data/lib/google/compute/image.rb +0 -29
  53. data/lib/google/compute/listable_resource_collection.rb +0 -33
  54. data/lib/google/compute/machine_type.rb +0 -36
  55. data/lib/google/compute/mixins/utils.rb +0 -58
  56. data/lib/google/compute/network.rb +0 -29
  57. data/lib/google/compute/project.rb +0 -76
  58. data/lib/google/compute/region.rb +0 -31
  59. data/lib/google/compute/region_operation.rb +0 -62
  60. data/lib/google/compute/resource.rb +0 -81
  61. data/lib/google/compute/resource_collection.rb +0 -78
  62. data/lib/google/compute/server.rb +0 -88
  63. data/lib/google/compute/server/attached_disk.rb +0 -39
  64. data/lib/google/compute/server/network_interface.rb +0 -38
  65. data/lib/google/compute/server/network_interface/access_config.rb +0 -35
  66. data/lib/google/compute/server/serial_port_output.rb +0 -31
  67. data/lib/google/compute/snapshot.rb +0 -30
  68. data/lib/google/compute/version.rb +0 -19
  69. data/lib/google/compute/zone.rb +0 -34
  70. data/lib/google/compute/zone_operation.rb +0 -62
  71. data/spec/chef/knife/google_base_spec.rb +0 -46
  72. data/spec/chef/knife/google_disk_create_spec.rb +0 -37
  73. data/spec/chef/knife/google_disk_delete_spec.rb +0 -64
  74. data/spec/chef/knife/google_disk_list_spec.rb +0 -36
  75. data/spec/chef/knife/google_region_list_spec.rb +0 -32
  76. data/spec/chef/knife/google_server_create_spec.rb +0 -138
  77. data/spec/chef/knife/google_server_delete_spec.rb +0 -127
  78. data/spec/chef/knife/google_server_list_spec.rb +0 -39
  79. data/spec/chef/knife/google_setup_spec.rb +0 -24
  80. data/spec/chef/knife/google_zone_list_spec.rb +0 -32
  81. data/spec/data/client.json +0 -14
  82. data/spec/data/compute-v1.json +0 -6734
  83. data/spec/data/disk.json +0 -14
  84. data/spec/data/firewall.json +0 -13
  85. data/spec/data/global_operation.json +0 -36
  86. data/spec/data/image.json +0 -12
  87. data/spec/data/machine_type.json +0 -24
  88. data/spec/data/network.json +0 -10
  89. data/spec/data/project.json +0 -21
  90. data/spec/data/region.json +0 -23
  91. data/spec/data/serial_port_output.json +0 -5
  92. data/spec/data/server.json +0 -46
  93. data/spec/data/snapshot.json +0 -12
  94. data/spec/data/zone.json +0 -22
  95. data/spec/data/zone_operation.json +0 -36
  96. data/spec/google/compute/disk_spec.rb +0 -115
  97. data/spec/google/compute/firewall_spec.rb +0 -129
  98. data/spec/google/compute/global_operation_spec.rb +0 -62
  99. data/spec/google/compute/image_spec.rb +0 -75
  100. data/spec/google/compute/machine_type_spec.rb +0 -53
  101. data/spec/google/compute/network_spec.rb +0 -68
  102. data/spec/google/compute/project_spec.rb +0 -71
  103. data/spec/google/compute/region_spec.rb +0 -51
  104. data/spec/google/compute/server_spec.rb +0 -118
  105. data/spec/google/compute/snapshot_spec.rb +0 -57
  106. data/spec/google/compute/zone_operation_spec.rb +0 -62
  107. data/spec/google/compute/zone_spec.rb +0 -51
  108. data/spec/spec_helper.rb +0 -45
  109. data/spec/support/mocks.rb +0 -62
  110. data/spec/support/resource_examples.rb +0 -70
  111. data/spec/support/spec_google_base.rb +0 -60
@@ -1,36 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleDiskList do
19
- let(:knife_plugin) do
20
- Chef::Knife::GoogleDiskList.new(["-Z"+stored_zone.name])
21
- end
22
-
23
- it "should enlist all the GCE disks when run invoked" do
24
- zones = double(Google::Compute::ListableResourceCollection)
25
- zones.should_receive(:get).with(stored_zone.name).
26
- and_return(stored_zone)
27
- disks = double(Google::Compute::ListableResourceCollection)
28
- disks.should_receive(:list).with(:zone => stored_zone.name).
29
- and_return([stored_disk])
30
-
31
- client = double(Google::Compute::Client, :disks => disks, :zones => zones)
32
- Google::Compute::Client.stub(:from_json).and_return(client)
33
- $stdout.should_receive(:write).with(kind_of(String))
34
- knife_plugin.run
35
- end
36
- end
@@ -1,32 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleRegionList do
19
- let(:knife_plugin) do
20
- Chef::Knife::GoogleRegionList.new([])
21
- end
22
-
23
- it "should enlist all the GCE regions when run invoked" do
24
- client = double(Google::Compute::Client)
25
- Google::Compute::Client.stub(:from_json).
26
- and_return(client)
27
- client.should_receive(:regions).
28
- and_return(double("region-collection", :list => [stored_region]))
29
- $stdout.should_receive(:write).with(kind_of(String))
30
- knife_plugin.run
31
- end
32
- end
@@ -1,138 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleServerCreate do
19
- before(:each) do
20
-
21
- zones = double(Google::Compute::ListableResourceCollection)
22
- zones.should_receive(:get).with(stored_zone.name).
23
- and_return(stored_zone)
24
-
25
- machine_types = double(Google::Compute::ListableResourceCollection)
26
- machine_types.should_receive(:get).
27
- with({:name => stored_machine_type.name, :zone => stored_zone.name}).
28
- and_return(stored_machine_type)
29
-
30
- images = double(Google::Compute::ListableResourceCollection)
31
- images.should_receive(:get).
32
- with({:project => "mock-project", :name => stored_image.name}).
33
- and_return(stored_image)
34
-
35
- sizeGb = 10
36
- disks = double(Google::Compute::ListableResourceCollection)
37
- disks.should_receive(:insert).
38
- with({:sourceImage => stored_image.self_link, :zone => stored_zone.name,
39
- :name => stored_instance.name, :sizeGb => sizeGb}).
40
- and_return(stored_disk)
41
-
42
- networks = double(Google::Compute::ListableResourceCollection)
43
- networks.should_receive(:get).with(stored_network.name).
44
- and_return(stored_network)
45
-
46
- instances = double(Google::Compute::ListableResourceCollection)
47
- instances.should_receive(:create).with({
48
- :name => stored_instance.name,
49
- :zone => stored_zone.name,
50
- :machineType => stored_machine_type.self_link,
51
- #:image => stored_image.self_link,
52
- :disks => [{
53
- "boot" => true,
54
- "type" => "PERSISTENT",
55
- "mode" => "READ_WRITE",
56
- "deviceName" => "",
57
- "source" => nil}],
58
- :networkInterfaces => [{
59
- "network" => stored_network.self_link,
60
- "accessConfigs" => [{
61
- "name" => "External NAT",
62
- "type" => "ONE_TO_ONE_NAT"}]}],
63
- :serviceAccounts => [{
64
- "kind" => "compute#serviceAccount",
65
- "email" => "123845678986@project.gserviceaccount.com",
66
- "scopes" => [
67
- "https://www.googleapis.com/auth/userinfo.email",
68
- "https://www.googleapis.com/auth/compute",
69
- "https://www.googleapis.com/auth/devstorage.full_control"]}],
70
- :scheduling=>{
71
- "automaticRestart" => "false",
72
- "onHostMaintenance" => "TERMINATE"},
73
- :metadata => {"items" => []},
74
- :tags => {"items" => []}}).and_return(stored_zone_operation)
75
-
76
- instances.should_receive(:get).
77
- with(:zone => stored_zone.name, :name => stored_instance.name).
78
- and_return(stored_instance)
79
-
80
- client = double(Google::Compute::Client, :instances => instances,
81
- :images => images, :zones => zones,:machine_types => machine_types,
82
- :networks => networks, :disks => disks)
83
- Google::Compute::Client.stub(:from_json).and_return(client)
84
- end
85
-
86
- it "#run should invoke compute api to create an server with a service account" do
87
- knife_plugin = Chef::Knife::GoogleServerCreate.new([
88
- "-m"+stored_machine_type.name,
89
- "-I"+stored_image.name,
90
- "-n"+stored_network.name,
91
- "-Z"+stored_zone.name,
92
- stored_instance.name])
93
- knife_plugin.config[:service_account_scopes]=["https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.full_control"]
94
- knife_plugin.config[:service_account_name]='123845678986@project.gserviceaccount.com'
95
- knife_plugin.config[:boot_disk_size]='10'
96
- knife_plugin.config[:metadata]=[]
97
- knife_plugin.config[:tags]=[]
98
- knife_plugin.config[:public_ip]='EPHEMERAL'
99
- knife_plugin.ui.stub(:info)
100
- knife_plugin.stub(:wait_for_disk)
101
- knife_plugin.stub(:wait_for_sshd)
102
- knife_plugin.should_receive(:bootstrap_for_node).
103
- with(stored_instance,'10.100.0.10').
104
- and_return(double("Chef::Knife::Bootstrap",:run => true))
105
- knife_plugin.run
106
- end
107
-
108
- it "should read zone value from knife config file." do
109
- Chef::Config[:knife][:gce_zone] = stored_zone.name
110
- knife_plugin = Chef::Knife::GoogleServerCreate.new([
111
- "-m"+stored_machine_type.name,
112
- "-I"+stored_image.name,
113
- "-n"+stored_network.name,
114
- stored_instance.name])
115
- knife_plugin.config[:service_account_scopes]=["https://www.googleapis.com/auth/userinfo.email","https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.full_control"]
116
- knife_plugin.config[:service_account_name]='123845678986@project.gserviceaccount.com'
117
- knife_plugin.config[:boot_disk_size]='10'
118
- knife_plugin.config[:metadata]=[]
119
- knife_plugin.config[:tags]=[]
120
- knife_plugin.config[:public_ip]='EPHEMERAL'
121
- knife_plugin.ui.stub(:info)
122
- knife_plugin.stub(:wait_for_disk)
123
- knife_plugin.stub(:wait_for_sshd)
124
- knife_plugin.should_receive(:bootstrap_for_node).
125
- with(stored_instance, '10.100.0.10').
126
- and_return(double("Chef::Knife::Bootstrap", :run => true))
127
- knife_plugin.run
128
- end
129
- end
130
-
131
- describe "without appropriate command line options" do
132
- it "should throw exception when required params are not passed" do
133
- $stdout.stub(:write) # lets not print those error messages
134
- expect {
135
- Chef::Knife::GoogleServerCreate.new([ "NAME"])
136
- }.to raise_error(SystemExit)
137
- end
138
- end
@@ -1,127 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
- #
16
-
17
- require 'spec_helper'
18
-
19
- describe Chef::Knife::GoogleServerDelete do
20
- let(:knife_plugin) do
21
- Chef::Knife::GoogleServerDelete.new(
22
- [stored_instance.name, "-Z"+stored_zone.name])
23
- end
24
-
25
- it "should print out error message if the server is not found" do
26
- zones = double(Google::Compute::ListableResourceCollection)
27
- zones.should_receive(:get).with(stored_zone.name).
28
- and_return(stored_zone)
29
-
30
- instances = double(Google::Compute::DeletableResourceCollection)
31
- instances.should_receive(:get).
32
- with(:name => stored_instance.name, :zone => stored_zone.name).
33
- and_raise(Google::Compute::ResourceNotFound)
34
- instances.should_not_receive(:delete)
35
-
36
- client = double(Google::Compute::Client,
37
- :instances => instances, :zones => zones)
38
- Google::Compute::Client.stub(:from_json).and_return(client)
39
-
40
- knife_plugin.config[:yes] = true
41
- knife_plugin.ui.should_receive(:error).
42
- with("Could not locate server '#{stored_zone.name}:#{stored_instance.name}'.")
43
- knife_plugin.stub(:msg_pair)
44
- knife_plugin.run
45
- end
46
-
47
- describe "without purge" do
48
-
49
- it "should invoke api delete method when run is called" do
50
- zones = double(Google::Compute::ListableResourceCollection)
51
- zones.should_receive(:get).with(stored_zone.name).
52
- and_return(stored_zone)
53
-
54
- instances = double(Google::Compute::DeletableResourceCollection)
55
- instances.should_receive(:get).
56
- with(:name => stored_instance.name, :zone => stored_zone.name).
57
- and_return(stored_instance)
58
- instances.should_receive(:delete).
59
- with(:instance => stored_instance.name, :zone => stored_zone.name)
60
-
61
- client = double(Google::Compute::Client,
62
- :zones => zones, :instances => instances)
63
- Google::Compute::Client.stub(:from_json).and_return(client)
64
- knife_plugin.ui.should_receive(:warn)
65
- knife_plugin.config[:yes] = true
66
- knife_plugin.ui.should_receive(:warn).twice
67
- knife_plugin.stub(:msg_pair)
68
- knife_plugin.run
69
- end
70
- end
71
-
72
- describe "with purge" do
73
- it "should invoke api delete method as well as chef objects destroy when run is called" do
74
- chef_client = double(Chef::ApiClient)
75
- chef_client.should_receive(:destroy)
76
- chef_node = double(Chef::Node)
77
- chef_node.should_receive(:destroy)
78
-
79
- zones = double(Google::Compute::ListableResourceCollection)
80
- zones.should_receive(:get).with(stored_zone.name).
81
- and_return(stored_zone)
82
-
83
- instances = double(Google::Compute::DeletableResourceCollection)
84
- instances.should_receive(:get).
85
- with(:name => stored_instance.name, :zone => stored_zone.name).
86
- and_return(stored_instance)
87
- instances.should_receive(:delete).
88
- with(:instance => stored_instance.name, :zone => stored_zone.name)
89
-
90
- client = double(Google::Compute::Client,
91
- :zones => zones, :instances => instances)
92
- Google::Compute::Client.stub(:from_json).and_return(client)
93
-
94
- knife_plugin.config[:yes] = true
95
- knife_plugin.config[:purge] = true
96
- knife_plugin.ui.stub(:warn)
97
- knife_plugin.stub(:msg_pair)
98
- Chef::Node.should_receive(:load).with(stored_instance.name).
99
- and_return(chef_node)
100
- Chef::ApiClient.should_receive(:load).with(stored_instance.name).
101
- and_return(chef_client)
102
- knife_plugin.run
103
- end
104
- end
105
- end
106
-
107
- describe Chef::Knife::GoogleServerDelete do
108
- it "should read zone value from knife config file." do
109
- Chef::Config[:knife][:gce_zone] = stored_zone.name
110
- knife_plugin = Chef::Knife::GoogleServerDelete.new([stored_instance.name])
111
- zones = double(Google::Compute::ListableResourceCollection)
112
- zones.should_receive(:get).with(stored_zone.name).and_return(stored_zone)
113
-
114
- instances = double(Google::Compute::DeletableResourceCollection)
115
- instances.should_receive(:get).with(:name => stored_instance.name, :zone => stored_zone.name).
116
- and_return(stored_instance)
117
- instances.should_receive(:delete).with(:instance => stored_instance.name, :zone => stored_zone.name)
118
-
119
- client = double(Google::Compute::Client, :zones => zones, :instances => instances)
120
- Google::Compute::Client.stub(:from_json).and_return(client)
121
- knife_plugin.ui.should_receive(:warn)
122
- knife_plugin.config[:yes] = true
123
- knife_plugin.ui.should_receive(:warn).twice
124
- knife_plugin.stub(:msg_pair)
125
- knife_plugin.run
126
- end
127
- end
@@ -1,39 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleServerList do
19
- before(:each) do
20
- zones = double(Google::Compute::ListableResourceCollection)
21
- zones.should_receive(:get).with(stored_zone.name).and_return(stored_zone)
22
- instances = double(Google::Compute::DeletableResourceCollection)
23
- instances.should_receive(:list).with(:zone => stored_zone.name).and_return([stored_instance])
24
- client = double(Google::Compute::Client, :instances => instances, :zones => zones)
25
- Google::Compute::Client.stub(:from_json).and_return(client)
26
- end
27
-
28
- it "should enlist all the GCE servers when run invoked" do
29
- knife_plugin = Chef::Knife::GoogleServerList.new(["-Z"+stored_zone.name])
30
- $stdout.should_receive(:write).with(kind_of(String))
31
- knife_plugin.run
32
- end
33
-
34
- it "should list all the GCE servers when zone is set in knife.rb" do
35
- knife_plugin = Chef::Knife::GoogleServerList.new([Chef::Config[:knife][:gce_zone] = stored_zone.name])
36
- $stdout.should_receive(:write).with(kind_of(String))
37
- knife_plugin.run
38
- end
39
- end
@@ -1,24 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleSetup do
19
- let(:knife_plugin) { Chef::Knife::GoogleSetup.new(["-f credential.json"]) }
20
- it "should invoke the google-compute-client-ruby setup process" do
21
- Google::Compute::Client.should_receive(:setup)
22
- knife_plugin.run
23
- end
24
- end
@@ -1,32 +0,0 @@
1
- # Copyright 2013 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- #
15
-
16
- require 'spec_helper'
17
-
18
- describe Chef::Knife::GoogleZoneList do
19
- let(:knife_plugin) do
20
- Chef::Knife::GoogleZoneList.new([])
21
- end
22
-
23
- it "should enlist all the GCE zones when run invoked" do
24
- client = double(Google::Compute::Client)
25
- Google::Compute::Client.stub(:from_json).
26
- and_return(client)
27
- client.should_receive(:zones).
28
- and_return(double("zone-collection", :list => [stored_zone]))
29
- $stdout.should_receive(:write).with(kind_of(String))
30
- knife_plugin.run
31
- end
32
- end
@@ -1,14 +0,0 @@
1
- {
2
- "authorization_uri":"https://accounts.google.com/o/oauth2/auth",
3
- "token_credential_uri":"https://accounts.google.com/o/oauth2/token",
4
- "scope":["https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/compute.readonly","https://www.googleapis.com/auth/devstorage.full_control","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/devstorage.read_write","https://www.googleapis.com/auth/devstorage.write_only","https://www.googleapis.com/auth/userinfo.email"],
5
- "redirect_uri":"urn:ietf:wg:oauth:2.0:oob",
6
- "client_id":"xxx1112345673qww4565.apps.googleusercontent.com",
7
- "client_secret":"W5KHDDIOHDLIFDLHDOK",
8
- "access_token":"ya29sadfajdslfkjsaldSqXhdasdMk",
9
- "expires_in":3600,
10
- "refresh_token":"1sasdlkfhsaoZNiA",
11
- "id_token":"eyJrnxBX_X7IIsadfhaslkhfaskleuhfalsiehfliuhfalisudhfliasuhfalsidufhalsiufeafdfbdbfyabfiabvfafvaifvadsvtaseifvtqwfetwftbabfuasftvakiftaifteawiutfevvvvvvvvvvvvvvvvvvvvvvvvvvvvvewaffffffffffffffffffeeeeeeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffffffffffffffffffffffffffffffffffffffffuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuaqqqqqqqqqqqqqqqqqqqqqfebbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbiwwwwwwwwwwwwwwwwwwweffffffqqqqqqoiyyyyyyyyyyyyyyyyyyyqweqqqqqqqqqqqwwwwwwwwwwrrrrrrrrrrrrrrrr",
12
- "issued_at":"2013-01-18 15:25:29 -0800",
13
- "project" : "mock-project"
14
- }