knife-google 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/CONTRIB.md +64 -0
- data/Gemfile +11 -0
- data/README.md +287 -0
- data/Rakefile +53 -0
- data/knife-google.gemspec +26 -0
- data/lib/chef/knife/google_base.rb +39 -68
- data/lib/chef/knife/google_disk_create.rb +60 -0
- data/lib/chef/knife/google_disk_delete.rb +60 -0
- data/lib/chef/knife/google_disk_list.rb +75 -0
- data/lib/chef/knife/google_server_create.rb +273 -184
- data/lib/chef/knife/google_server_delete.rb +74 -32
- data/lib/chef/knife/google_server_list.rb +45 -64
- data/lib/chef/knife/google_setup.rb +31 -0
- data/lib/chef/knife/google_zone_list.rb +78 -0
- data/lib/google/compute.rb +46 -0
- data/lib/google/compute/client.rb +188 -0
- data/lib/google/compute/config.rb +23 -0
- data/lib/google/compute/creatable_resource_collection.rb +38 -0
- data/lib/google/compute/deletable_resource_collection.rb +51 -0
- data/lib/google/compute/disk.rb +40 -0
- data/lib/google/compute/exception.rb +28 -0
- data/lib/google/compute/firewall.rb +65 -0
- data/lib/google/compute/global_operation.rb +60 -0
- data/lib/google/compute/image.rb +30 -0
- data/lib/google/compute/kernel.rb +20 -0
- data/lib/google/compute/listable_resource_collection.rb +33 -0
- data/lib/google/compute/machine_type.rb +36 -0
- data/lib/google/compute/mixins/utils.rb +58 -0
- data/lib/google/compute/network.rb +29 -0
- data/lib/google/compute/project.rb +76 -0
- data/lib/google/compute/resource.rb +81 -0
- data/lib/google/compute/resource_collection.rb +78 -0
- data/lib/google/compute/server.rb +87 -0
- data/lib/google/compute/server/attached_disk.rb +39 -0
- data/lib/google/compute/server/network_interface.rb +38 -0
- data/lib/google/compute/server/network_interface/access_config.rb +35 -0
- data/lib/google/compute/server/serial_port_output.rb +31 -0
- data/lib/google/compute/snapshot.rb +30 -0
- data/lib/google/compute/version.rb +19 -0
- data/lib/google/compute/zone.rb +32 -0
- data/lib/google/compute/zone_operation.rb +60 -0
- data/lib/knife-google/version.rb +18 -2
- data/spec/chef/knife/google_base_spec.rb +46 -0
- data/spec/chef/knife/google_disk_create_spec.rb +36 -0
- data/spec/chef/knife/google_disk_delete_spec.rb +65 -0
- data/spec/chef/knife/google_disk_list_spec.rb +36 -0
- data/spec/chef/knife/google_server_create_spec.rb +84 -0
- data/spec/chef/knife/google_server_delete_spec.rb +105 -0
- data/spec/chef/knife/google_server_list_spec.rb +39 -0
- data/spec/chef/knife/google_setup_spec.rb +25 -0
- data/spec/chef/knife/google_zone_list_spec.rb +32 -0
- data/spec/data/client.json +14 -0
- data/spec/data/compute-v1beta14.json +3386 -0
- data/spec/data/disk.json +15 -0
- data/spec/data/firewall.json +13 -0
- data/spec/data/global_operation.json +36 -0
- data/spec/data/image.json +12 -0
- data/spec/data/kernel.json +15 -0
- data/spec/data/machine_type.json +24 -0
- data/spec/data/network.json +10 -0
- data/spec/data/project.json +21 -0
- data/spec/data/serial_port_output.json +5 -0
- data/spec/data/server.json +46 -0
- data/spec/data/snapshot.json +12 -0
- data/spec/data/zone.json +30 -0
- data/spec/data/zone_operation.json +36 -0
- data/spec/google/compute/disk_spec.rb +105 -0
- data/spec/google/compute/firewall_spec.rb +128 -0
- data/spec/google/compute/global_operation_spec.rb +62 -0
- data/spec/google/compute/image_spec.rb +75 -0
- data/spec/google/compute/kernel_spec.rb +49 -0
- data/spec/google/compute/machine_type_spec.rb +53 -0
- data/spec/google/compute/network_spec.rb +68 -0
- data/spec/google/compute/project_spec.rb +71 -0
- data/spec/google/compute/server_spec.rb +125 -0
- data/spec/google/compute/snapshot_spec.rb +69 -0
- data/spec/google/compute/zone_operation_spec.rb +62 -0
- data/spec/google/compute/zone_spec.rb +50 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/mocks.rb +62 -0
- data/spec/support/resource_examples.rb +70 -0
- data/spec/support/spec_google_base.rb +56 -0
- metadata +121 -31
- data/README.rdoc +0 -96
@@ -0,0 +1,69 @@
|
|
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
|
+
require 'spec_helper'
|
15
|
+
|
16
|
+
describe Google::Compute::Snapshot do
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@mock_api_client=mock(Google::APIClient, :authorization= =>{}, :auto_refresh_token= =>{})
|
20
|
+
@mock_api_client.stub!(:discovered_api).and_return(mock_compute)
|
21
|
+
Google::APIClient.stub!(:new).and_return(@mock_api_client)
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:client) do
|
25
|
+
Google::Compute::Client.from_json(mock_data_file(Google::Compute::Client))
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like Google::Compute::Resource
|
29
|
+
|
30
|
+
it "#get should return an individual snapshot" do
|
31
|
+
@mock_api_client.should_receive(:execute).
|
32
|
+
with(:api_method=>mock_compute.snapshots.get,
|
33
|
+
:parameters=>{"snapshot"=>"mock-snapshot", :project=>"mock-project"},:body_object=>nil).
|
34
|
+
and_return(mock_response(Google::Compute::Snapshot))
|
35
|
+
snapshot = client.snapshots.get('mock-snapshot')
|
36
|
+
snapshot.should be_a_kind_of Google::Compute::Snapshot
|
37
|
+
snapshot.name.should eq('mock-snapshot')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "#list should return an array of snapshots" do
|
41
|
+
@mock_api_client.should_receive(:execute).
|
42
|
+
with(:api_method=>mock_compute.snapshots.list,
|
43
|
+
:parameters=>{:project=>"mock-project"},:body_object=>nil).
|
44
|
+
and_return(mock_response(Google::Compute::Snapshot,true))
|
45
|
+
snapshots = client.snapshots.list
|
46
|
+
snapshots.should_not be_empty
|
47
|
+
snapshots.all?{|s| s.is_a?(Google::Compute::Snapshot)}.should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "#create should create a new snapshot" do
|
51
|
+
disk = 'https://www.googleapis.com/compute/v1beta13/projects/mock-project/disks/mock-disk'
|
52
|
+
@mock_api_client.should_receive(:execute).
|
53
|
+
with(:api_method=>mock_compute.snapshots.insert,
|
54
|
+
:parameters=>{:project=>"mock-project"},
|
55
|
+
:body_object=>{:name=>'api-snapshot', :sourceDisk=>disk}).
|
56
|
+
and_return(mock_response(Google::Compute::GlobalOperation))
|
57
|
+
|
58
|
+
o = client.snapshots.create(:name=>'api-snapshot', :sourceDisk=>disk)
|
59
|
+
o.should be_a_kind_of Google::Compute::GlobalOperation
|
60
|
+
end
|
61
|
+
|
62
|
+
it "#delete should delete an existing snapshot" do
|
63
|
+
@mock_api_client.should_receive(:execute).
|
64
|
+
with(:api_method=>mock_compute.snapshots.delete,
|
65
|
+
:parameters=>{:project=>"mock-project",'snapshot'=>'mock-snapshot'},:body_object=>nil).
|
66
|
+
and_return(mock_response(Google::Compute::GlobalOperation))
|
67
|
+
o = client.snapshots.delete('mock-snapshot')
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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
|
+
require 'spec_helper'
|
15
|
+
|
16
|
+
describe Google::Compute::ZoneOperation do
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@mock_api_client=mock(Google::APIClient, :authorization= =>{}, :auto_refresh_token= =>{})
|
20
|
+
@mock_api_client.stub!(:discovered_api).and_return(mock_compute)
|
21
|
+
Google::APIClient.stub!(:new).and_return(@mock_api_client)
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:client) do
|
25
|
+
Google::Compute::Client.from_json(mock_data_file(Google::Compute::Client))
|
26
|
+
end
|
27
|
+
|
28
|
+
it_should_behave_like Google::Compute::Resource
|
29
|
+
|
30
|
+
it "#list should return an array of zone operations" do
|
31
|
+
@mock_api_client.should_receive(:execute).
|
32
|
+
with(:api_method=>mock_compute.zone_operations.list,
|
33
|
+
:parameters=>{ :project=>"mock-project"},:body_object=>nil).
|
34
|
+
and_return(mock_response(Google::Compute::ZoneOperation, true))
|
35
|
+
|
36
|
+
operations = client.zoneOperations.list
|
37
|
+
operations.should_not be_empty
|
38
|
+
operations.all?{|o| o.is_a?(Google::Compute::ZoneOperation)}.should be_true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "#get should return an individual zone operation" do
|
42
|
+
@mock_api_client.should_receive(:execute).
|
43
|
+
with(:api_method=>mock_compute.zone_operations.get,
|
44
|
+
:parameters=>{"zoneOperation"=>"mock-zone-operation", :project=>"mock-project"},:body_object=>nil).
|
45
|
+
and_return(mock_response(Google::Compute::ZoneOperation))
|
46
|
+
|
47
|
+
operation = client.zoneOperations.get('mock-zone-operation')
|
48
|
+
operation.should be_a_kind_of Google::Compute::ZoneOperation
|
49
|
+
operation.name.should eq('mock-zone-operation')
|
50
|
+
operation.should respond_to(:progress)
|
51
|
+
operation.start_time.should be_a_kind_of(Time)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "#delete should delete an existing zone operation" do
|
55
|
+
@mock_api_client.should_receive(:execute).
|
56
|
+
with(:api_method=>mock_compute.zone_operations.delete,
|
57
|
+
:parameters=>{"zoneOperation"=>"mock-zone-operation", :project=>"mock-project"},:body_object=>nil).
|
58
|
+
and_return(mock_response)
|
59
|
+
|
60
|
+
client.zoneOperations.delete('mock-zone-operation')
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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
|
+
require 'spec_helper'
|
16
|
+
|
17
|
+
describe Google::Compute::Zone do
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@mock_api_client=mock(Google::APIClient, :authorization= =>{}, :auto_refresh_token= =>{})
|
21
|
+
@mock_api_client.stub!(:discovered_api).and_return(mock_compute)
|
22
|
+
Google::APIClient.stub!(:new).and_return(@mock_api_client)
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:client) do
|
26
|
+
Google::Compute::Client.from_json(mock_data_file(Google::Compute::Client))
|
27
|
+
end
|
28
|
+
|
29
|
+
it_should_behave_like Google::Compute::Resource
|
30
|
+
|
31
|
+
it "#get should return an individual zone" do
|
32
|
+
@mock_api_client.should_receive(:execute).
|
33
|
+
with(:api_method=>mock_compute.zones.get,
|
34
|
+
:parameters=>{"zone"=>"mock-zone", :project=>"mock-project"},:body_object=>nil).
|
35
|
+
and_return(mock_response(Google::Compute::Zone))
|
36
|
+
zone = client.zones.get('mock-zone')
|
37
|
+
zone.should be_a_kind_of Google::Compute::Zone
|
38
|
+
zone.name.should eq('mock-zone')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "#list should return an array of zones" do
|
42
|
+
@mock_api_client.should_receive(:execute).
|
43
|
+
with(:api_method=>mock_compute.zones.list,
|
44
|
+
:parameters=>{ :project=>"mock-project"},:body_object=>nil).
|
45
|
+
and_return(mock_response(Google::Compute::Zone, true))
|
46
|
+
zones = client.zones.list
|
47
|
+
zones.should_not be_empty
|
48
|
+
zones.all?{|zone| zone.is_a?(Google::Compute::Zone)}.should be_true
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,44 @@
|
|
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 'simplecov'
|
17
|
+
SimpleCov.start do
|
18
|
+
add_filter "/spec/"
|
19
|
+
add_filter "/.bundle/"
|
20
|
+
add_filter "/pkg/"
|
21
|
+
add_filter "/pkg/"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'google/compute'
|
25
|
+
|
26
|
+
require 'support/resource_examples'
|
27
|
+
require 'support/mocks'
|
28
|
+
|
29
|
+
require 'chef'
|
30
|
+
require 'chef/knife/google_server_create'
|
31
|
+
require 'chef/knife/google_server_delete'
|
32
|
+
require 'chef/knife/google_server_list'
|
33
|
+
require 'chef/knife/google_disk_list'
|
34
|
+
require 'chef/knife/google_disk_create'
|
35
|
+
require 'chef/knife/google_disk_delete'
|
36
|
+
require 'chef/knife/google_zone_list'
|
37
|
+
require 'chef/knife/google_setup'
|
38
|
+
|
39
|
+
require 'support/spec_google_base'
|
40
|
+
|
41
|
+
RSpec.configure do |config|
|
42
|
+
config.include SpecData
|
43
|
+
config.include Mocks
|
44
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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
|
+
module Mocks
|
16
|
+
SPEC_DATA_FOLDER = File.expand_path('../../data', __FILE__)
|
17
|
+
|
18
|
+
def mock_data(klass)
|
19
|
+
return File.read(mock_data_file(klass))
|
20
|
+
end
|
21
|
+
|
22
|
+
def mock_list_data(klass)
|
23
|
+
return '{"items":[' + File.read(mock_data_file(klass)) + ']}'
|
24
|
+
end
|
25
|
+
|
26
|
+
def mock_data_file(klass)
|
27
|
+
class_name = klass.name.split('::').last.snake_case
|
28
|
+
if class_name == "instance"
|
29
|
+
json_file = File.expand_path(File.join(SPEC_DATA_FOLDER , 'server.json'))
|
30
|
+
else
|
31
|
+
json_file = File.expand_path(File.join(SPEC_DATA_FOLDER , class_name + '.json'))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def instance_from_mock_data(klass)
|
36
|
+
klass.new(mock_hash(klass))
|
37
|
+
end
|
38
|
+
|
39
|
+
def mock_hash(klass)
|
40
|
+
MultiJson.load(mock_data(klass))
|
41
|
+
end
|
42
|
+
|
43
|
+
def mock_compute
|
44
|
+
@compute ||=
|
45
|
+
begin
|
46
|
+
data_file = File.join(SPEC_DATA_FOLDER,'compute-v1beta14.json')
|
47
|
+
u = Addressable::URI.parse('URI:https://www.googleapis.com/discovery/v1/apis/compute/v1beta14/rest')
|
48
|
+
compute = Google::APIClient::API.new(u,MultiJson.load(File.read(data_file)))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def mock_response(klass=nil,list = false)
|
53
|
+
body = if klass.nil?
|
54
|
+
nil
|
55
|
+
elsif list
|
56
|
+
mock_list_data(klass)
|
57
|
+
else
|
58
|
+
mock_data(klass)
|
59
|
+
end
|
60
|
+
mock(klass,:success? => true, :response=>mock('some',:body=>body))
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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
|
+
shared_examples Google::Compute::Resource do
|
16
|
+
|
17
|
+
let (:resource) do
|
18
|
+
instance_from_mock_data(described_class)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be of compute# kind" do
|
22
|
+
resource.kind.should match('compute#')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be a subclass of Google::Compute::Resource" do
|
26
|
+
resource.should be_a_kind_of(Google::Compute::Resource)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "#id should have a valid id" do
|
30
|
+
resource.id.should be_a_kind_of(Integer)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "#creation_timestamp should have a valid creation timestamp" do
|
34
|
+
unless resource.creation_timestamp.nil?
|
35
|
+
resource.creation_timestamp.should be_a_kind_of(Time)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "#type should have same type is class" do
|
40
|
+
# TODO(erjohnso): {global,zone}operations are not resources
|
41
|
+
# and instances are servers
|
42
|
+
if ["globaloperation", "zoneoperation"].include? resource.class.class_name
|
43
|
+
resource.type.downcase.should eq("operation")
|
44
|
+
elsif resource.class.class_name == "server"
|
45
|
+
resource.type.downcase.should eq("instance")
|
46
|
+
else
|
47
|
+
resource.type.downcase.should eq(resource.class.class_name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should have a valid description" do
|
52
|
+
# TODO(erjohnso): {global,zone}operations are not resources
|
53
|
+
# mock-{zone,global}-operation
|
54
|
+
unless resource.name.split('-').last == "operation"
|
55
|
+
resource.description.should_not be_nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "#project should have a valid project name" do
|
60
|
+
resource.project.should_not be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it "#self_link should have a valid https self link" do
|
64
|
+
URI.parse(resource.self_link).should be_a_kind_of(URI::HTTPS)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "#to_s should return its name when converted to string" do
|
68
|
+
resource.to_s.should eq(resource.name)
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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
|
+
require 'spec_helper'
|
16
|
+
require 'google/compute'
|
17
|
+
|
18
|
+
module SpecData
|
19
|
+
SPEC_DATA_DIR = File.expand_path('../../data', __FILE__)
|
20
|
+
|
21
|
+
def stored_instance
|
22
|
+
@instance ||= Google::Compute::Server.new(load_json("server.json"))
|
23
|
+
end
|
24
|
+
|
25
|
+
def stored_global_operation
|
26
|
+
@global_operation ||= Google::Compute::GlobalOperation.new(load_json("global_operation.json"))
|
27
|
+
end
|
28
|
+
|
29
|
+
def stored_zone_operation
|
30
|
+
@zone_operation ||= Google::Compute::ZoneOperation.new(load_json("zone_operation.json"))
|
31
|
+
end
|
32
|
+
|
33
|
+
def stored_disk
|
34
|
+
@disk ||= Google::Compute::Disk.new(load_json("disk.json"))
|
35
|
+
end
|
36
|
+
|
37
|
+
def stored_zone
|
38
|
+
@zone ||= Google::Compute::Zone.new(load_json("zone.json"))
|
39
|
+
end
|
40
|
+
|
41
|
+
def stored_image
|
42
|
+
@image ||= Google::Compute::Image.new(load_json("image.json"))
|
43
|
+
end
|
44
|
+
|
45
|
+
def stored_machine_type
|
46
|
+
@machine_type ||= Google::Compute::MachineType.new(load_json("machine_type.json"))
|
47
|
+
end
|
48
|
+
|
49
|
+
def stored_network
|
50
|
+
@network ||= Google::Compute::Network.new(load_json 'network.json')
|
51
|
+
end
|
52
|
+
|
53
|
+
def load_json file
|
54
|
+
MultiJson.load(File.read("#{SPEC_DATA_DIR}/#{file}"))
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,21 +1,25 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-google
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.1
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
-
|
13
|
+
- Chiraq Jog
|
14
|
+
- Ranjib Dey
|
15
|
+
- James Tucker
|
16
|
+
- Paul Rossman
|
17
|
+
- Eric Johnson
|
14
18
|
autorequire:
|
15
19
|
bindir: bin
|
16
20
|
cert_chain: []
|
17
21
|
|
18
|
-
date:
|
22
|
+
date: 2013-05-14 00:00:00 Z
|
19
23
|
dependencies:
|
20
24
|
- !ruby/object:Gem::Dependency
|
21
25
|
name: chef
|
@@ -34,55 +38,49 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
version_requirements: *id001
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
41
|
+
name: google-api-client
|
38
42
|
prerelease: false
|
39
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
44
|
none: false
|
41
45
|
requirements:
|
42
46
|
- - ">="
|
43
47
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
48
|
+
hash: 3
|
45
49
|
segments:
|
46
|
-
- 2
|
47
50
|
- 0
|
48
|
-
|
49
|
-
version: 2.0.3
|
51
|
+
version: "0"
|
50
52
|
type: :runtime
|
51
53
|
version_requirements: *id002
|
52
54
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
55
|
+
name: multi_json
|
54
56
|
prerelease: false
|
55
57
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
58
|
none: false
|
57
59
|
requirements:
|
58
60
|
- - ">="
|
59
61
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
62
|
+
hash: 3
|
61
63
|
segments:
|
62
|
-
- 1
|
63
64
|
- 0
|
64
|
-
|
65
|
-
version: 1.0.1
|
65
|
+
version: "0"
|
66
66
|
type: :runtime
|
67
67
|
version_requirements: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: mixlib-config
|
70
70
|
prerelease: false
|
71
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
76
|
+
hash: 3
|
77
77
|
segments:
|
78
|
-
- 1
|
79
78
|
- 0
|
80
|
-
|
81
|
-
version: 1.0.4
|
79
|
+
version: "0"
|
82
80
|
type: :runtime
|
83
81
|
version_requirements: *id004
|
84
82
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
83
|
+
name: rspec
|
86
84
|
prerelease: false
|
87
85
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
86
|
none: false
|
@@ -93,10 +91,10 @@ dependencies:
|
|
93
91
|
segments:
|
94
92
|
- 0
|
95
93
|
version: "0"
|
96
|
-
type: :
|
94
|
+
type: :development
|
97
95
|
version_requirements: *id005
|
98
96
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
97
|
+
name: rake
|
100
98
|
prerelease: false
|
101
99
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
100
|
none: false
|
@@ -107,25 +105,117 @@ dependencies:
|
|
107
105
|
segments:
|
108
106
|
- 0
|
109
107
|
version: "0"
|
110
|
-
type: :
|
108
|
+
type: :development
|
111
109
|
version_requirements: *id006
|
112
|
-
|
113
|
-
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: simplecov
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
type: :development
|
123
|
+
version_requirements: *id007
|
124
|
+
description: Google Compute Engine Support for Chef's Knife Command
|
125
|
+
email: raggi@google.com
|
114
126
|
executables: []
|
115
127
|
|
116
128
|
extensions: []
|
117
129
|
|
118
130
|
extra_rdoc_files:
|
119
|
-
- README.
|
131
|
+
- README.md
|
120
132
|
- LICENSE
|
133
|
+
- CONTRIB.md
|
121
134
|
files:
|
135
|
+
- .gitignore
|
136
|
+
- CONTRIB.md
|
137
|
+
- Gemfile
|
122
138
|
- LICENSE
|
123
|
-
- README.
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- knife-google.gemspec
|
124
142
|
- lib/chef/knife/google_base.rb
|
143
|
+
- lib/chef/knife/google_disk_create.rb
|
144
|
+
- lib/chef/knife/google_disk_delete.rb
|
145
|
+
- lib/chef/knife/google_disk_list.rb
|
125
146
|
- lib/chef/knife/google_server_create.rb
|
126
|
-
- lib/chef/knife/google_server_list.rb
|
127
147
|
- lib/chef/knife/google_server_delete.rb
|
148
|
+
- lib/chef/knife/google_server_list.rb
|
149
|
+
- lib/chef/knife/google_setup.rb
|
150
|
+
- lib/chef/knife/google_zone_list.rb
|
151
|
+
- lib/google/compute.rb
|
152
|
+
- lib/google/compute/client.rb
|
153
|
+
- lib/google/compute/config.rb
|
154
|
+
- lib/google/compute/creatable_resource_collection.rb
|
155
|
+
- lib/google/compute/deletable_resource_collection.rb
|
156
|
+
- lib/google/compute/disk.rb
|
157
|
+
- lib/google/compute/exception.rb
|
158
|
+
- lib/google/compute/firewall.rb
|
159
|
+
- lib/google/compute/global_operation.rb
|
160
|
+
- lib/google/compute/image.rb
|
161
|
+
- lib/google/compute/kernel.rb
|
162
|
+
- lib/google/compute/listable_resource_collection.rb
|
163
|
+
- lib/google/compute/machine_type.rb
|
164
|
+
- lib/google/compute/mixins/utils.rb
|
165
|
+
- lib/google/compute/network.rb
|
166
|
+
- lib/google/compute/project.rb
|
167
|
+
- lib/google/compute/resource.rb
|
168
|
+
- lib/google/compute/resource_collection.rb
|
169
|
+
- lib/google/compute/server.rb
|
170
|
+
- lib/google/compute/server/attached_disk.rb
|
171
|
+
- lib/google/compute/server/network_interface.rb
|
172
|
+
- lib/google/compute/server/network_interface/access_config.rb
|
173
|
+
- lib/google/compute/server/serial_port_output.rb
|
174
|
+
- lib/google/compute/snapshot.rb
|
175
|
+
- lib/google/compute/version.rb
|
176
|
+
- lib/google/compute/zone.rb
|
177
|
+
- lib/google/compute/zone_operation.rb
|
128
178
|
- lib/knife-google/version.rb
|
179
|
+
- spec/chef/knife/google_base_spec.rb
|
180
|
+
- spec/chef/knife/google_disk_create_spec.rb
|
181
|
+
- spec/chef/knife/google_disk_delete_spec.rb
|
182
|
+
- spec/chef/knife/google_disk_list_spec.rb
|
183
|
+
- spec/chef/knife/google_server_create_spec.rb
|
184
|
+
- spec/chef/knife/google_server_delete_spec.rb
|
185
|
+
- spec/chef/knife/google_server_list_spec.rb
|
186
|
+
- spec/chef/knife/google_setup_spec.rb
|
187
|
+
- spec/chef/knife/google_zone_list_spec.rb
|
188
|
+
- spec/data/client.json
|
189
|
+
- spec/data/compute-v1beta14.json
|
190
|
+
- spec/data/disk.json
|
191
|
+
- spec/data/firewall.json
|
192
|
+
- spec/data/global_operation.json
|
193
|
+
- spec/data/image.json
|
194
|
+
- spec/data/kernel.json
|
195
|
+
- spec/data/machine_type.json
|
196
|
+
- spec/data/network.json
|
197
|
+
- spec/data/project.json
|
198
|
+
- spec/data/serial_port_output.json
|
199
|
+
- spec/data/server.json
|
200
|
+
- spec/data/snapshot.json
|
201
|
+
- spec/data/zone.json
|
202
|
+
- spec/data/zone_operation.json
|
203
|
+
- spec/google/compute/disk_spec.rb
|
204
|
+
- spec/google/compute/firewall_spec.rb
|
205
|
+
- spec/google/compute/global_operation_spec.rb
|
206
|
+
- spec/google/compute/image_spec.rb
|
207
|
+
- spec/google/compute/kernel_spec.rb
|
208
|
+
- spec/google/compute/machine_type_spec.rb
|
209
|
+
- spec/google/compute/network_spec.rb
|
210
|
+
- spec/google/compute/project_spec.rb
|
211
|
+
- spec/google/compute/server_spec.rb
|
212
|
+
- spec/google/compute/snapshot_spec.rb
|
213
|
+
- spec/google/compute/zone_operation_spec.rb
|
214
|
+
- spec/google/compute/zone_spec.rb
|
215
|
+
- spec/spec_helper.rb
|
216
|
+
- spec/support/mocks.rb
|
217
|
+
- spec/support/resource_examples.rb
|
218
|
+
- spec/support/spec_google_base.rb
|
129
219
|
homepage: http://wiki.opscode.com/display/chef
|
130
220
|
licenses: []
|
131
221
|
|
@@ -158,6 +248,6 @@ rubyforge_project:
|
|
158
248
|
rubygems_version: 1.8.10
|
159
249
|
signing_key:
|
160
250
|
specification_version: 3
|
161
|
-
summary: Google Compute
|
251
|
+
summary: Manage Google Compute Engine servers, disks, and zones
|
162
252
|
test_files: []
|
163
253
|
|