knife-profitbricks 1.2.1 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +303 -96
  4. data/knife-profitbricks.gemspec +1 -1
  5. data/lib/chef/knife/profitbricks_base.rb +24 -0
  6. data/lib/chef/knife/profitbricks_composite_server_create.rb +59 -45
  7. data/lib/chef/knife/profitbricks_contract_list.rb +37 -0
  8. data/lib/chef/knife/profitbricks_datacenter_create.rb +8 -7
  9. data/lib/chef/knife/profitbricks_firewall_create.rb +15 -15
  10. data/lib/chef/knife/profitbricks_firewall_delete.rb +6 -8
  11. data/lib/chef/knife/profitbricks_firewall_list.rb +6 -5
  12. data/lib/chef/knife/profitbricks_ipblock_create.rb +6 -7
  13. data/lib/chef/knife/profitbricks_ipfailover_add.rb +60 -0
  14. data/lib/chef/knife/profitbricks_ipfailover_remove.rb +60 -0
  15. data/lib/chef/knife/profitbricks_lan_create.rb +5 -3
  16. data/lib/chef/knife/profitbricks_lan_list.rb +1 -1
  17. data/lib/chef/knife/profitbricks_nic_create.rb +12 -14
  18. data/lib/chef/knife/profitbricks_nic_delete.rb +4 -3
  19. data/lib/chef/knife/profitbricks_nic_list.rb +4 -3
  20. data/lib/chef/knife/profitbricks_server_create.rb +14 -16
  21. data/lib/chef/knife/profitbricks_server_delete.rb +1 -1
  22. data/lib/chef/knife/profitbricks_server_list.rb +1 -1
  23. data/lib/chef/knife/profitbricks_server_reboot.rb +1 -1
  24. data/lib/chef/knife/profitbricks_server_start.rb +1 -1
  25. data/lib/chef/knife/profitbricks_server_stop.rb +1 -1
  26. data/lib/chef/knife/profitbricks_volume_attach.rb +5 -5
  27. data/lib/chef/knife/profitbricks_volume_create.rb +38 -18
  28. data/lib/chef/knife/profitbricks_volume_delete.rb +1 -1
  29. data/lib/chef/knife/profitbricks_volume_detach.rb +4 -4
  30. data/lib/chef/knife/profitbricks_volume_list.rb +5 -6
  31. data/lib/knife-profitbricks/version.rb +1 -1
  32. data/spec/chef/knife/profitbricks_composite_server_create_spec.rb +64 -0
  33. data/spec/chef/knife/profitbricks_contract_list_spec.rb +20 -0
  34. data/spec/chef/knife/profitbricks_datacenter_create_spec.rb +44 -0
  35. data/spec/chef/knife/profitbricks_datacenter_delete_spec.rb +39 -0
  36. data/spec/chef/knife/profitbricks_datacenter_list_spec.rb +7 -6
  37. data/spec/chef/knife/profitbricks_firewall_create_spec.rb +74 -0
  38. data/spec/chef/knife/profitbricks_firewall_delete_spec.rb +86 -0
  39. data/spec/chef/knife/profitbricks_firewall_list_spec.rb +61 -0
  40. data/spec/chef/knife/profitbricks_image_list_spec.rb +19 -0
  41. data/spec/chef/knife/profitbricks_ipblock_create_spec.rb +39 -0
  42. data/spec/chef/knife/profitbricks_ipblock_delete_spec.rb +37 -0
  43. data/spec/chef/knife/profitbricks_ipfailover_add_spec.rb +80 -0
  44. data/spec/chef/knife/profitbricks_ipfailover_remove_spec.rb +85 -0
  45. data/spec/chef/knife/profitbricks_lan_create_spec.rb +59 -0
  46. data/spec/chef/knife/profitbricks_lan_delete_spec.rb +58 -0
  47. data/spec/chef/knife/profitbricks_lan_list_spec.rb +37 -0
  48. data/spec/chef/knife/profitbricks_location_list_spec.rb +24 -0
  49. data/spec/chef/knife/profitbricks_nic_create_spec.rb +71 -0
  50. data/spec/chef/knife/profitbricks_nic_delete_spec.rb +69 -0
  51. data/spec/chef/knife/profitbricks_nic_list_spec.rb +69 -0
  52. data/spec/chef/knife/profitbricks_server_create_spec.rb +63 -0
  53. data/spec/chef/knife/profitbricks_server_delete_spec.rb +63 -0
  54. data/spec/chef/knife/profitbricks_server_list_spec.rb +65 -0
  55. data/spec/chef/knife/profitbricks_server_reboot_spec.rb +65 -0
  56. data/spec/chef/knife/profitbricks_server_start_spec.rb +68 -0
  57. data/spec/chef/knife/profitbricks_server_stop_spec.rb +65 -0
  58. data/spec/chef/knife/profitbricks_volume_attach_spec.rb +70 -0
  59. data/spec/chef/knife/profitbricks_volume_create_spec.rb +63 -0
  60. data/spec/chef/knife/profitbricks_volume_delete_spec.rb +70 -0
  61. data/spec/chef/knife/profitbricks_volume_detach_spec.rb +81 -0
  62. data/spec/chef/knife/profitbricks_volume_list_spec.rb +80 -0
  63. data/spec/spec_helper.rb +22 -3
  64. data/spec/test.sh +1 -1
  65. metadata +81 -18
data/spec/spec_helper.rb CHANGED
@@ -5,11 +5,30 @@ require 'chef'
5
5
  RSpec.configure do |config|
6
6
  config.before(:each) do
7
7
  Chef::Config.reset
8
- { :profitbricks_username => 'farid.shah@profitbricks.com',
9
- :profitbricks_password => 'spc2015',
10
- :profitbricks_url => 'https://spc.profitbricks.com'
8
+ {
9
+ profitbricks_username: ENV['PROFITBRICKS_USERNAME'],
10
+ profitbricks_password: ENV['PROFITBRICKS_PASSWORD'],
11
+ profitbricks_url: ENV['PROFITBRICKS_API_URL']
11
12
  }.each do |key, value|
12
13
  Chef::Config[:knife][key] = value
13
14
  end
14
15
  end
15
16
  end
17
+
18
+ class Chef
19
+ class Knife
20
+ end
21
+ end
22
+
23
+ def get_image(image_name, image_type, image_location)
24
+ images = ProfitBricks::Image.list
25
+ min_image = nil
26
+ images.each do |image|
27
+
28
+ has_substring = image.properties['name'].downcase.include? image_name
29
+ if image.properties['public'] == true && image.properties['imageType'] == image_type && image.properties['location'] == image_location && has_substring
30
+ min_image = image
31
+ end
32
+ end
33
+ min_image
34
+ end
data/spec/test.sh CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/bin/sh
2
2
 
3
- knife profitbricks datacenter create --name "Test Datacenter" --location "us/lasdev"
3
+ knife profitbricks datacenter create --name "Test Datacenter" --location "us/las"
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-profitbricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Devenport
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: profitbricks-sdk-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
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
40
  version: '12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.6'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '10.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.2'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.2'
83
83
  description: Official Chef Knife plugin for ProfitBricks platform using REST API
@@ -87,7 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
90
+ - ".gitignore"
91
91
  - Gemfile
92
92
  - LICENSE.txt
93
93
  - README.md
@@ -95,6 +95,7 @@ files:
95
95
  - knife-profitbricks.gemspec
96
96
  - lib/chef/knife/profitbricks_base.rb
97
97
  - lib/chef/knife/profitbricks_composite_server_create.rb
98
+ - lib/chef/knife/profitbricks_contract_list.rb
98
99
  - lib/chef/knife/profitbricks_datacenter_create.rb
99
100
  - lib/chef/knife/profitbricks_datacenter_delete.rb
100
101
  - lib/chef/knife/profitbricks_datacenter_list.rb
@@ -105,6 +106,8 @@ files:
105
106
  - lib/chef/knife/profitbricks_ipblock_create.rb
106
107
  - lib/chef/knife/profitbricks_ipblock_delete.rb
107
108
  - lib/chef/knife/profitbricks_ipblock_list.rb
109
+ - lib/chef/knife/profitbricks_ipfailover_add.rb
110
+ - lib/chef/knife/profitbricks_ipfailover_remove.rb
108
111
  - lib/chef/knife/profitbricks_lan_create.rb
109
112
  - lib/chef/knife/profitbricks_lan_delete.rb
110
113
  - lib/chef/knife/profitbricks_lan_list.rb
@@ -124,7 +127,37 @@ files:
124
127
  - lib/chef/knife/profitbricks_volume_detach.rb
125
128
  - lib/chef/knife/profitbricks_volume_list.rb
126
129
  - lib/knife-profitbricks/version.rb
130
+ - spec/chef/knife/profitbricks_composite_server_create_spec.rb
131
+ - spec/chef/knife/profitbricks_contract_list_spec.rb
132
+ - spec/chef/knife/profitbricks_datacenter_create_spec.rb
133
+ - spec/chef/knife/profitbricks_datacenter_delete_spec.rb
127
134
  - spec/chef/knife/profitbricks_datacenter_list_spec.rb
135
+ - spec/chef/knife/profitbricks_firewall_create_spec.rb
136
+ - spec/chef/knife/profitbricks_firewall_delete_spec.rb
137
+ - spec/chef/knife/profitbricks_firewall_list_spec.rb
138
+ - spec/chef/knife/profitbricks_image_list_spec.rb
139
+ - spec/chef/knife/profitbricks_ipblock_create_spec.rb
140
+ - spec/chef/knife/profitbricks_ipblock_delete_spec.rb
141
+ - spec/chef/knife/profitbricks_ipfailover_add_spec.rb
142
+ - spec/chef/knife/profitbricks_ipfailover_remove_spec.rb
143
+ - spec/chef/knife/profitbricks_lan_create_spec.rb
144
+ - spec/chef/knife/profitbricks_lan_delete_spec.rb
145
+ - spec/chef/knife/profitbricks_lan_list_spec.rb
146
+ - spec/chef/knife/profitbricks_location_list_spec.rb
147
+ - spec/chef/knife/profitbricks_nic_create_spec.rb
148
+ - spec/chef/knife/profitbricks_nic_delete_spec.rb
149
+ - spec/chef/knife/profitbricks_nic_list_spec.rb
150
+ - spec/chef/knife/profitbricks_server_create_spec.rb
151
+ - spec/chef/knife/profitbricks_server_delete_spec.rb
152
+ - spec/chef/knife/profitbricks_server_list_spec.rb
153
+ - spec/chef/knife/profitbricks_server_reboot_spec.rb
154
+ - spec/chef/knife/profitbricks_server_start_spec.rb
155
+ - spec/chef/knife/profitbricks_server_stop_spec.rb
156
+ - spec/chef/knife/profitbricks_volume_attach_spec.rb
157
+ - spec/chef/knife/profitbricks_volume_create_spec.rb
158
+ - spec/chef/knife/profitbricks_volume_delete_spec.rb
159
+ - spec/chef/knife/profitbricks_volume_detach_spec.rb
160
+ - spec/chef/knife/profitbricks_volume_list_spec.rb
128
161
  - spec/spec_helper.rb
129
162
  - spec/test.sh
130
163
  homepage: https://github.com/profitbricks/knife-profitbricks
@@ -137,21 +170,51 @@ require_paths:
137
170
  - lib
138
171
  required_ruby_version: !ruby/object:Gem::Requirement
139
172
  requirements:
140
- - - '>='
173
+ - - ">="
141
174
  - !ruby/object:Gem::Version
142
175
  version: '0'
143
176
  required_rubygems_version: !ruby/object:Gem::Requirement
144
177
  requirements:
145
- - - '>='
178
+ - - ">="
146
179
  - !ruby/object:Gem::Version
147
180
  version: '0'
148
181
  requirements: []
149
182
  rubyforge_project:
150
- rubygems_version: 2.0.14
183
+ rubygems_version: 2.4.5
151
184
  signing_key:
152
185
  specification_version: 4
153
186
  summary: Chef Knife plugin for ProfitBricks platform
154
187
  test_files:
188
+ - spec/chef/knife/profitbricks_composite_server_create_spec.rb
189
+ - spec/chef/knife/profitbricks_contract_list_spec.rb
190
+ - spec/chef/knife/profitbricks_datacenter_create_spec.rb
191
+ - spec/chef/knife/profitbricks_datacenter_delete_spec.rb
155
192
  - spec/chef/knife/profitbricks_datacenter_list_spec.rb
193
+ - spec/chef/knife/profitbricks_firewall_create_spec.rb
194
+ - spec/chef/knife/profitbricks_firewall_delete_spec.rb
195
+ - spec/chef/knife/profitbricks_firewall_list_spec.rb
196
+ - spec/chef/knife/profitbricks_image_list_spec.rb
197
+ - spec/chef/knife/profitbricks_ipblock_create_spec.rb
198
+ - spec/chef/knife/profitbricks_ipblock_delete_spec.rb
199
+ - spec/chef/knife/profitbricks_ipfailover_add_spec.rb
200
+ - spec/chef/knife/profitbricks_ipfailover_remove_spec.rb
201
+ - spec/chef/knife/profitbricks_lan_create_spec.rb
202
+ - spec/chef/knife/profitbricks_lan_delete_spec.rb
203
+ - spec/chef/knife/profitbricks_lan_list_spec.rb
204
+ - spec/chef/knife/profitbricks_location_list_spec.rb
205
+ - spec/chef/knife/profitbricks_nic_create_spec.rb
206
+ - spec/chef/knife/profitbricks_nic_delete_spec.rb
207
+ - spec/chef/knife/profitbricks_nic_list_spec.rb
208
+ - spec/chef/knife/profitbricks_server_create_spec.rb
209
+ - spec/chef/knife/profitbricks_server_delete_spec.rb
210
+ - spec/chef/knife/profitbricks_server_list_spec.rb
211
+ - spec/chef/knife/profitbricks_server_reboot_spec.rb
212
+ - spec/chef/knife/profitbricks_server_start_spec.rb
213
+ - spec/chef/knife/profitbricks_server_stop_spec.rb
214
+ - spec/chef/knife/profitbricks_volume_attach_spec.rb
215
+ - spec/chef/knife/profitbricks_volume_create_spec.rb
216
+ - spec/chef/knife/profitbricks_volume_delete_spec.rb
217
+ - spec/chef/knife/profitbricks_volume_detach_spec.rb
218
+ - spec/chef/knife/profitbricks_volume_list_spec.rb
156
219
  - spec/spec_helper.rb
157
220
  - spec/test.sh