knife-openstack 1.3.2.pre → 1.3.2.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +1 -1
  4. data/Rakefile +7 -28
  5. data/knife-openstack.gemspec +16 -16
  6. data/lib/chef/knife/cloud/openstack_server_create_options.rb +44 -44
  7. data/lib/chef/knife/cloud/openstack_service.rb +27 -31
  8. data/lib/chef/knife/cloud/openstack_service_options.rb +25 -26
  9. data/lib/chef/knife/openstack_flavor_list.rb +9 -10
  10. data/lib/chef/knife/openstack_floating_ip_allocate.rb +4 -4
  11. data/lib/chef/knife/openstack_floating_ip_associate.rb +5 -5
  12. data/lib/chef/knife/openstack_floating_ip_disassociate.rb +4 -4
  13. data/lib/chef/knife/openstack_group_list.rb +9 -11
  14. data/lib/chef/knife/openstack_helpers.rb +14 -2
  15. data/lib/chef/knife/openstack_image_list.rb +14 -15
  16. data/lib/chef/knife/openstack_network_list.rb +8 -9
  17. data/lib/chef/knife/openstack_server_create.rb +81 -84
  18. data/lib/chef/knife/openstack_server_delete.rb +25 -26
  19. data/lib/chef/knife/openstack_server_list.rb +13 -19
  20. data/lib/chef/knife/openstack_server_show.rb +11 -12
  21. data/lib/chef/knife/openstack_volume_list.rb +10 -12
  22. data/lib/knife-openstack/version.rb +1 -1
  23. data/spec/functional/flavor_list_func_spec.rb +11 -11
  24. data/spec/functional/floating_ip_list_func_spec.rb +11 -11
  25. data/spec/functional/group_list_func_spec.rb +27 -31
  26. data/spec/functional/image_list_func_spec.rb +14 -14
  27. data/spec/functional/network_list_func_spec.rb +10 -10
  28. data/spec/functional/server_create_func_spec.rb +23 -24
  29. data/spec/functional/server_delete_func_spec.rb +16 -17
  30. data/spec/functional/server_list_func_spec.rb +39 -39
  31. data/spec/functional/server_show_func_spec.rb +4 -5
  32. data/spec/functional/volume_list_func_spec.rb +9 -9
  33. data/spec/integration/cleanup.rb +8 -11
  34. data/spec/integration/openstack_spec.rb +377 -347
  35. data/spec/spec_context.rb +10 -10
  36. data/spec/spec_helper.rb +23 -27
  37. data/spec/unit/openstack_flavor_list_spec.rb +1 -1
  38. data/spec/unit/openstack_floating_ip_allocate_spec.rb +2 -3
  39. data/spec/unit/openstack_floating_ip_associate_spec.rb +2 -2
  40. data/spec/unit/openstack_floating_ip_disassociate_spec.rb +3 -3
  41. data/spec/unit/openstack_floating_ip_release_spec.rb +1 -1
  42. data/spec/unit/openstack_group_list_spec.rb +7 -7
  43. data/spec/unit/openstack_image_list_spec.rb +2 -2
  44. data/spec/unit/openstack_network_list_spec.rb +4 -4
  45. data/spec/unit/openstack_server_create_spec.rb +117 -118
  46. data/spec/unit/openstack_server_delete_spec.rb +4 -4
  47. data/spec/unit/openstack_server_list_spec.rb +2 -2
  48. data/spec/unit/openstack_server_show_spec.rb +6 -6
  49. data/spec/unit/openstack_service_spec.rb +20 -20
  50. data/spec/unit/openstack_volume_list_spec.rb +1 -1
  51. metadata +30 -2
@@ -26,16 +26,16 @@ require 'support/shared_examples_for_serverdeletecommand'
26
26
  describe Chef::Knife::Cloud::OpenstackServerDelete do
27
27
  it_behaves_like Chef::Knife::Cloud::ServerDeleteCommand, Chef::Knife::Cloud::OpenstackServerDelete.new
28
28
 
29
- include_context "#validate!", Chef::Knife::Cloud::OpenstackServerDelete.new
29
+ include_context '#validate!', Chef::Knife::Cloud::OpenstackServerDelete.new
30
30
 
31
- let (:instance) {Chef::Knife::Cloud::OpenstackServerDelete.new}
31
+ let (:instance) { Chef::Knife::Cloud::OpenstackServerDelete.new }
32
32
 
33
33
  before(:each) do
34
34
  allow(instance).to receive(:exit)
35
35
  end
36
36
 
37
- describe "#create_service_instance" do
38
- it "return OpenstackService instance" do
37
+ describe '#create_service_instance' do
38
+ it 'return OpenstackService instance' do
39
39
  expect(instance.create_service_instance).to be_an_instance_of(Chef::Knife::Cloud::OpenstackService)
40
40
  end
41
41
  end
@@ -25,7 +25,7 @@ require 'support/shared_examples_for_command'
25
25
  describe Chef::Knife::Cloud::OpenstackServerList do
26
26
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackServerList.new
27
27
 
28
- include_context "#validate!", Chef::Knife::Cloud::OpenstackServerList.new
28
+ include_context '#validate!', Chef::Knife::Cloud::OpenstackServerList.new
29
29
 
30
- let (:instance) {Chef::Knife::Cloud::OpenstackServerList.new}
30
+ let (:instance) { Chef::Knife::Cloud::OpenstackServerList.new }
31
31
  end
@@ -23,18 +23,18 @@ require 'support/shared_examples_for_command'
23
23
  describe Chef::Knife::Cloud::OpenstackServerShow do
24
24
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackServerShow.new
25
25
 
26
- include_context "#validate!", Chef::Knife::Cloud::OpenstackServerShow.new
26
+ include_context '#validate!', Chef::Knife::Cloud::OpenstackServerShow.new
27
27
 
28
- let (:instance) {Chef::Knife::Cloud::OpenstackServerShow.new}
28
+ let (:instance) { Chef::Knife::Cloud::OpenstackServerShow.new }
29
29
 
30
- context "#validate_params!" do
30
+ context '#validate_params!' do
31
31
  before(:each) do
32
- Chef::Config[:knife][:instance_id] = "instance_id"
32
+ Chef::Config[:knife][:instance_id] = 'instance_id'
33
33
  end
34
34
 
35
- it "raise error on instance_id missing" do
35
+ it 'raise error on instance_id missing' do
36
36
  Chef::Config[:knife].delete(:instance_id)
37
- expect(instance.ui).to receive(:error).with("You must provide a valid Instance Id")
37
+ expect(instance.ui).to receive(:error).with('You must provide a valid Instance Id')
38
38
  expect { instance.validate_params! }.to raise_error(Chef::Knife::Cloud::CloudExceptions::ValidationError)
39
39
  end
40
40
  end
@@ -21,9 +21,9 @@ require 'spec_helper'
21
21
  require 'chef/knife/cloud/openstack_service'
22
22
 
23
23
  describe Chef::Knife::Cloud::OpenstackService do
24
- describe "#add_api_endpoint" do
24
+ describe '#add_api_endpoint' do
25
25
  before(:each) do
26
- @api_endpoint = "https://test_openstack_api_endpoint"
26
+ @api_endpoint = 'https://test_openstack_api_endpoint'
27
27
  Chef::Config[:knife][:api_endpoint] = @api_endpoint
28
28
  @instance = Chef::Knife::Cloud::OpenstackService.new
29
29
  end
@@ -32,56 +32,56 @@ describe Chef::Knife::Cloud::OpenstackService do
32
32
  Chef::Config[:knife].delete(:api_endpoint)
33
33
  end
34
34
 
35
- it "sets the api_endpoint in auth params" do
36
- expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be == nil
35
+ it 'sets the api_endpoint in auth params' do
36
+ expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be.nil?
37
37
  @instance.add_api_endpoint
38
38
  expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be == @api_endpoint
39
39
  end
40
40
 
41
- it "does not set the endpoint when --api-endpoint option is missing" do
41
+ it 'does not set the endpoint when --api-endpoint option is missing' do
42
42
  Chef::Config[:knife][:api_endpoint] = nil
43
- expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be == nil
43
+ expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be.nil?
44
44
  @instance.add_api_endpoint
45
45
  expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to_not be == @api_endpoint
46
- expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be == nil
46
+ expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be.nil?
47
47
  end
48
48
 
49
49
  it "doesn't set an OpenStack endpoint type by default" do
50
- expect(Chef::Config[:knife][:openstack_endpoint_type]).to be == nil
50
+ expect(Chef::Config[:knife][:openstack_endpoint_type]).to be.nil?
51
51
  end
52
52
  end
53
53
 
54
- describe "#get_server" do
54
+ describe '#get_server' do
55
55
  before(:each) do
56
56
  @instance = Chef::Knife::Cloud::OpenstackService.new
57
- allow(@instance).to receive_message_chain(:connection,:servers,:get)
57
+ allow(@instance).to receive_message_chain(:connection, :servers, :get)
58
58
  end
59
59
 
60
- context "when instance_id given" do
61
- it "return server" do
62
- server_id = "123f456-123-453e-9c0c-12345a6789"
60
+ context 'when instance_id given' do
61
+ it 'return server' do
62
+ server_id = '123f456-123-453e-9c0c-12345a6789'
63
63
  expect(@instance.connection.servers).to receive(:get).and_return(server_id)
64
64
  expect(@instance.connection.servers).to_not receive(:all)
65
65
  expect(@instance.get_server(server_id)).to be == server_id
66
66
  end
67
67
  end
68
68
 
69
- context "when instance_name given" do
69
+ context 'when instance_name given' do
70
70
  before(:each) do
71
71
  expect(@instance.connection.servers).to receive(:get).and_return(nil)
72
72
  end
73
73
 
74
- let (:server_name) { "testname" }
74
+ let (:server_name) { 'testname' }
75
75
 
76
- it "return server" do
77
- expect(@instance.connection.servers).to receive(:all).with({:name=>server_name}).and_return([server_name])
76
+ it 'return server' do
77
+ expect(@instance.connection.servers).to receive(:all).with(name: server_name).and_return([server_name])
78
78
  expect(@instance.get_server(server_name)).to be == server_name
79
79
  end
80
80
 
81
- it "raise error if multiple server matches found for given instance name" do
81
+ it 'raise error if multiple server matches found for given instance name' do
82
82
  error_message = "Multiple server matches found for '#{server_name}', use an instance_id to be more specific."
83
- expect(@instance.connection.servers).to receive(:all).with({:name=>server_name}).and_return([server_name,server_name])
84
- allow(@instance).to receive_message_chain(:ui,:fatal)
83
+ expect(@instance.connection.servers).to receive(:all).with(name: server_name).and_return([server_name, server_name])
84
+ allow(@instance).to receive_message_chain(:ui, :fatal)
85
85
  expect { @instance.get_server(server_name) }.to raise_error(Chef::Knife::Cloud::CloudExceptions::ValidationError, error_message)
86
86
  end
87
87
  end
@@ -25,5 +25,5 @@ require 'support/shared_examples_for_command'
25
25
  describe Chef::Knife::Cloud::OpenstackVolumeList do
26
26
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackVolumeList.new
27
27
 
28
- include_context "#validate!", Chef::Knife::Cloud::OpenstackVolumeList.new
28
+ include_context '#validate!', Chef::Knife::Cloud::OpenstackVolumeList.new
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2.pre
4
+ version: 1.3.2.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JJ Asghar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-04 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rake
57
85
  requirement: !ruby/object:Gem::Requirement