knife-openstack 1.3.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +21 -0
  3. data/.gitignore +5 -0
  4. data/.travis.yml +9 -7
  5. data/CHANGELOG.md +174 -92
  6. data/Gemfile +15 -3
  7. data/README.md +96 -68
  8. data/Rakefile +19 -6
  9. data/knife-openstack.gemspec +17 -15
  10. data/lib/chef/knife/cloud/openstack_server_create_options.rb +36 -35
  11. data/lib/chef/knife/cloud/openstack_service.rb +7 -6
  12. data/lib/chef/knife/cloud/openstack_service_options.rb +18 -17
  13. data/lib/chef/knife/openstack_flavor_list.rb +11 -10
  14. data/lib/chef/knife/openstack_floating_ip_allocate.rb +13 -12
  15. data/lib/chef/knife/openstack_floating_ip_associate.rb +9 -8
  16. data/lib/chef/knife/openstack_floating_ip_disassociate.rb +9 -8
  17. data/lib/chef/knife/openstack_floating_ip_list.rb +10 -9
  18. data/lib/chef/knife/openstack_floating_ip_release.rb +7 -6
  19. data/lib/chef/knife/openstack_group_list.rb +13 -12
  20. data/lib/chef/knife/openstack_helpers.rb +8 -7
  21. data/lib/chef/knife/openstack_image_list.rb +14 -13
  22. data/lib/chef/knife/openstack_network_list.rb +10 -9
  23. data/lib/chef/knife/openstack_server_create.rb +57 -56
  24. data/lib/chef/knife/openstack_server_delete.rb +7 -6
  25. data/lib/chef/knife/openstack_server_list.rb +16 -15
  26. data/lib/chef/knife/openstack_server_show.rb +17 -16
  27. data/lib/chef/knife/openstack_volume_list.rb +10 -9
  28. data/lib/knife-openstack/version.rb +3 -2
  29. data/spec/functional/flavor_list_func_spec.rb +13 -12
  30. data/spec/functional/floating_ip_list_func_spec.rb +14 -13
  31. data/spec/functional/group_list_func_spec.rb +29 -28
  32. data/spec/functional/image_list_func_spec.rb +15 -14
  33. data/spec/functional/network_list_func_spec.rb +13 -12
  34. data/spec/functional/server_create_func_spec.rb +29 -28
  35. data/spec/functional/server_delete_func_spec.rb +18 -17
  36. data/spec/functional/server_list_func_spec.rb +43 -42
  37. data/spec/functional/server_show_func_spec.rb +7 -6
  38. data/spec/functional/volume_list_func_spec.rb +12 -11
  39. data/spec/integration/cleanup.rb +6 -5
  40. data/spec/integration/openstack_spec.rb +287 -286
  41. data/spec/spec_context.rb +10 -9
  42. data/spec/spec_helper.rb +38 -37
  43. data/spec/unit/openstack_flavor_list_spec.rb +6 -5
  44. data/spec/unit/openstack_floating_ip_allocate_spec.rb +14 -13
  45. data/spec/unit/openstack_floating_ip_associate_spec.rb +11 -10
  46. data/spec/unit/openstack_floating_ip_disassociate_spec.rb +12 -11
  47. data/spec/unit/openstack_floating_ip_list_spec.rb +6 -5
  48. data/spec/unit/openstack_floating_ip_release_spec.rb +13 -12
  49. data/spec/unit/openstack_group_list_spec.rb +11 -10
  50. data/spec/unit/openstack_image_list_spec.rb +6 -5
  51. data/spec/unit/openstack_network_list_spec.rb +8 -7
  52. data/spec/unit/openstack_server_create_spec.rb +131 -130
  53. data/spec/unit/openstack_server_delete_spec.rb +8 -7
  54. data/spec/unit/openstack_server_list_spec.rb +6 -5
  55. data/spec/unit/openstack_server_show_spec.rb +10 -9
  56. data/spec/unit/openstack_service_spec.rb +26 -25
  57. data/spec/unit/openstack_volume_list_spec.rb +6 -5
  58. metadata +9 -105
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
4
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
@@ -18,15 +19,15 @@
18
19
  # See the License for the specific language governing permissions and
19
20
  # limitations under the License.
20
21
 
21
- require 'spec_helper'
22
- require 'chef/knife/openstack_server_delete'
23
- require 'chef/knife/cloud/openstack_service'
24
- require 'support/shared_examples_for_serverdeletecommand'
22
+ require "spec_helper"
23
+ require "chef/knife/openstack_server_delete"
24
+ require "chef/knife/cloud/openstack_service"
25
+ require "support/shared_examples_for_serverdeletecommand"
25
26
 
26
27
  describe Chef::Knife::Cloud::OpenstackServerDelete do
27
28
  it_behaves_like Chef::Knife::Cloud::ServerDeleteCommand, Chef::Knife::Cloud::OpenstackServerDelete.new
28
29
 
29
- include_context '#validate!', Chef::Knife::Cloud::OpenstackServerDelete.new
30
+ include_context "#validate!", Chef::Knife::Cloud::OpenstackServerDelete.new
30
31
 
31
32
  let (:instance) { Chef::Knife::Cloud::OpenstackServerDelete.new }
32
33
 
@@ -34,8 +35,8 @@ describe Chef::Knife::Cloud::OpenstackServerDelete do
34
35
  allow(instance).to receive(:exit)
35
36
  end
36
37
 
37
- describe '#create_service_instance' do
38
- it 'return OpenstackService instance' do
38
+ describe "#create_service_instance" do
39
+ it "return OpenstackService instance" do
39
40
  expect(instance.create_service_instance).to be_an_instance_of(Chef::Knife::Cloud::OpenstackService)
40
41
  end
41
42
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
@@ -17,15 +18,15 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
20
- require 'spec_helper'
21
- require 'chef/knife/openstack_server_list'
22
- require 'chef/knife/cloud/openstack_service'
23
- require 'support/shared_examples_for_command'
21
+ require "spec_helper"
22
+ require "chef/knife/openstack_server_list"
23
+ require "chef/knife/cloud/openstack_service"
24
+ require "support/shared_examples_for_command"
24
25
 
25
26
  describe Chef::Knife::Cloud::OpenstackServerList do
26
27
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackServerList.new
27
28
 
28
- include_context '#validate!', Chef::Knife::Cloud::OpenstackServerList.new
29
+ include_context "#validate!", Chef::Knife::Cloud::OpenstackServerList.new
29
30
 
30
31
  let (:instance) { Chef::Knife::Cloud::OpenstackServerList.new }
31
32
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Ameya Varade (<ameya.varade@clogeny.com>)
3
4
  # Copyright:: Copyright (c) 2013-2014 Chef Software, Inc.
@@ -15,26 +16,26 @@
15
16
  # See the License for the specific language governing permissions and
16
17
  # limitations under the License.
17
18
 
18
- require 'spec_helper'
19
- require 'chef/knife/openstack_server_show'
20
- require 'chef/knife/cloud/openstack_service'
21
- require 'support/shared_examples_for_command'
19
+ require "spec_helper"
20
+ require "chef/knife/openstack_server_show"
21
+ require "chef/knife/cloud/openstack_service"
22
+ require "support/shared_examples_for_command"
22
23
 
23
24
  describe Chef::Knife::Cloud::OpenstackServerShow do
24
25
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackServerShow.new
25
26
 
26
- include_context '#validate!', Chef::Knife::Cloud::OpenstackServerShow.new
27
+ include_context "#validate!", Chef::Knife::Cloud::OpenstackServerShow.new
27
28
 
28
29
  let (:instance) { Chef::Knife::Cloud::OpenstackServerShow.new }
29
30
 
30
- context '#validate_params!' do
31
+ context "#validate_params!" do
31
32
  before(:each) do
32
- Chef::Config[:knife][:instance_id] = 'instance_id'
33
+ Chef::Config[:knife][:instance_id] = "instance_id"
33
34
  end
34
35
 
35
- it 'raise error on instance_id missing' do
36
+ it "raise error on instance_id missing" do
36
37
  Chef::Config[:knife].delete(:instance_id)
37
- expect(instance.ui).to receive(:error).with('You must provide a valid Instance Id')
38
+ expect(instance.ui).to receive(:error).with("You must provide a valid Instance Id")
38
39
  expect { instance.validate_params! }.to raise_error(Chef::Knife::Cloud::CloudExceptions::ValidationError)
39
40
  end
40
41
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
@@ -17,13 +18,13 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
20
- require 'spec_helper'
21
- require 'chef/knife/cloud/openstack_service'
21
+ require "spec_helper"
22
+ require "chef/knife/cloud/openstack_service"
22
23
 
23
24
  describe Chef::Knife::Cloud::OpenstackService do
24
- describe '#add_api_endpoint' do
25
+ describe "#add_api_endpoint" do
25
26
  before(:each) do
26
- @api_endpoint = 'https://test_openstack_api_endpoint'
27
+ @api_endpoint = "https://test_openstack_api_endpoint"
27
28
  Chef::Config[:knife][:api_endpoint] = @api_endpoint
28
29
  @instance = Chef::Knife::Cloud::OpenstackService.new
29
30
  end
@@ -32,13 +33,13 @@ describe Chef::Knife::Cloud::OpenstackService do
32
33
  Chef::Config[:knife].delete(:api_endpoint)
33
34
  end
34
35
 
35
- it 'sets the api_endpoint in auth params' do
36
+ it "sets the api_endpoint in auth params" do
36
37
  expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be_nil
37
38
  @instance.add_api_endpoint
38
39
  expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be == @api_endpoint
39
40
  end
40
41
 
41
- it 'does not set the endpoint when --api-endpoint option is missing' do
42
+ it "does not set the endpoint when --api-endpoint option is missing" do
42
43
  Chef::Config[:knife][:api_endpoint] = nil
43
44
  expect(@instance.instance_variable_get(:@auth_params)[:openstack_auth_url]).to be_nil
44
45
  @instance.add_api_endpoint
@@ -51,34 +52,34 @@ describe Chef::Knife::Cloud::OpenstackService do
51
52
  end
52
53
  end
53
54
 
54
- describe '#get_server' do
55
+ describe "#get_server" do
55
56
  before(:each) do
56
57
  @instance = Chef::Knife::Cloud::OpenstackService.new
57
58
  allow(@instance).to receive_message_chain(:connection, :servers, :get)
58
59
  end
59
60
 
60
- context 'when instance_id given' do
61
- it 'return server' do
62
- server_id = '123f456-123-453e-9c0c-12345a6789'
61
+ context "when instance_id given" do
62
+ it "return server" do
63
+ server_id = "123f456-123-453e-9c0c-12345a6789"
63
64
  expect(@instance.connection.servers).to receive(:get).and_return(server_id)
64
65
  expect(@instance.connection.servers).to_not receive(:all)
65
66
  expect(@instance.get_server(server_id)).to be == server_id
66
67
  end
67
68
  end
68
69
 
69
- context 'when instance_name given' do
70
+ context "when instance_name given" do
70
71
  before(:each) do
71
72
  expect(@instance.connection.servers).to receive(:get).and_return(nil)
72
73
  end
73
74
 
74
- let (:server_name) { 'testname' }
75
+ let (:server_name) { "testname" }
75
76
 
76
- it 'return server' do
77
+ it "return server" do
77
78
  expect(@instance.connection.servers).to receive(:all).with(name: server_name).and_return([server_name])
78
79
  expect(@instance.get_server(server_name)).to be == server_name
79
80
  end
80
81
 
81
- it 'raise error if multiple server matches found for given instance name' do
82
+ it "raise error if multiple server matches found for given instance name" do
82
83
  error_message = "Multiple server matches found for '#{server_name}', use an instance_id to be more specific."
83
84
  expect(@instance.connection.servers).to receive(:all).with(name: server_name).and_return([server_name, server_name])
84
85
  allow(@instance).to receive_message_chain(:ui, :fatal)
@@ -87,39 +88,39 @@ describe Chef::Knife::Cloud::OpenstackService do
87
88
  end
88
89
  end
89
90
 
90
- describe '#get_auth_params' do
91
+ describe "#get_auth_params" do
91
92
  let(:auth_params) do
92
93
  Chef::Knife::Cloud::OpenstackService.new.instance_variable_get(:@auth_params)
93
94
  end
94
95
 
95
- it 'sets ssl_verify_peer to false when openstack_insecure is true' do
96
+ it "sets ssl_verify_peer to false when openstack_insecure is true" do
96
97
  Chef::Config[:knife][:openstack_insecure] = true
97
98
  expect(auth_params[:connection_options][:ssl_verify_peer]).to be false
98
99
  end
99
100
 
100
- it 'only copies openstack options from Fog' do
101
+ it "only copies openstack options from Fog" do
101
102
  params = auth_params.keys - [:provider, :connection_options]
102
- expect(params.all? { |p| p.to_s.start_with?('openstack') }).to be true
103
+ expect(params.all? { |p| p.to_s.start_with?("openstack") }).to be true
103
104
  end
104
105
 
105
- context 'when openstack_password is set' do
106
+ context "when openstack_password is set" do
106
107
  before(:each) do
107
- @expected = 'password'
108
+ @expected = "password"
108
109
  Chef::Config[:knife][:openstack_password] = @expected
109
110
  end
110
111
 
111
- it 'sets openstack_api_key from openstack_password' do
112
+ it "sets openstack_api_key from openstack_password" do
112
113
  expect(auth_params[:openstack_api_key]).to be == @expected
113
114
  end
114
115
 
115
- it 'prefers openstack_password over openstack_api_key' do
116
- Chef::Config[:knife][:openstack_api_key] = 'unexpected'
116
+ it "prefers openstack_password over openstack_api_key" do
117
+ Chef::Config[:knife][:openstack_api_key] = "unexpected"
117
118
  expect(auth_params[:openstack_api_key]).to be == @expected
118
119
  end
119
120
  end
120
121
 
121
- it 'uses openstack_api_key if openstack_password is not set' do
122
- @expected = 'password'
122
+ it "uses openstack_api_key if openstack_password is not set" do
123
+ @expected = "password"
123
124
  Chef::Config[:knife][:openstack_api_key] = @expected
124
125
  expect(auth_params[:openstack_api_key]).to be == @expected
125
126
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #
2
3
  # Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
3
4
  # Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
@@ -17,13 +18,13 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
20
- require 'spec_helper'
21
- require 'chef/knife/openstack_volume_list'
22
- require 'chef/knife/cloud/openstack_service'
23
- require 'support/shared_examples_for_command'
21
+ require "spec_helper"
22
+ require "chef/knife/openstack_volume_list"
23
+ require "chef/knife/cloud/openstack_service"
24
+ require "support/shared_examples_for_command"
24
25
 
25
26
  describe Chef::Knife::Cloud::OpenstackVolumeList do
26
27
  it_behaves_like Chef::Knife::Cloud::Command, Chef::Knife::Cloud::OpenstackVolumeList.new
27
28
 
28
- include_context '#validate!', Chef::Knife::Cloud::OpenstackVolumeList.new
29
+ include_context "#validate!", Chef::Knife::Cloud::OpenstackVolumeList.new
29
30
  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
4
+ version: 2.0.0
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-10-07 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '11'
33
+ version: '12'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '11'
40
+ version: '12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: knife-cloud
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,104 +52,6 @@ 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'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec-core
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec-expectations
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rspec-mocks
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec_junit_formatter
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
55
  description: A Chef knife plugin for OpenStack clouds.
154
56
  email:
155
57
  - jj@chef.io
@@ -159,6 +61,7 @@ extra_rdoc_files:
159
61
  - README.md
160
62
  - LICENSE
161
63
  files:
64
+ - ".github/ISSUE_TEMPLATE.md"
162
65
  - ".gitignore"
163
66
  - ".travis.yml"
164
67
  - CHANGELOG.md
@@ -218,7 +121,8 @@ files:
218
121
  - spec/unit/openstack_service_spec.rb
219
122
  - spec/unit/openstack_volume_list_spec.rb
220
123
  homepage: https://github.com/chef/knife-openstack
221
- licenses: []
124
+ licenses:
125
+ - Apache-2.0
222
126
  metadata: {}
223
127
  post_install_message:
224
128
  rdoc_options: []
@@ -228,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
132
  requirements:
229
133
  - - ">="
230
134
  - !ruby/object:Gem::Version
231
- version: '0'
135
+ version: 2.2.2
232
136
  required_rubygems_version: !ruby/object:Gem::Requirement
233
137
  requirements:
234
138
  - - ">="
@@ -236,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
140
  version: '0'
237
141
  requirements: []
238
142
  rubyforge_project:
239
- rubygems_version: 2.2.2
143
+ rubygems_version: 2.5.1
240
144
  signing_key:
241
145
  specification_version: 4
242
146
  summary: A Chef knife plugin for OpenStack clouds.