fog-core 2.1.0 → 2.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0aee45dc29f92c62460bf1f6890e64520140a18b
4
- data.tar.gz: c3be3faff02a6fc5ad8abce9d5a35a6f31813130
2
+ SHA256:
3
+ metadata.gz: 05c847bc564020b5055a150c17bb795291f30a47d49dce0b6f10d7f1e1614890
4
+ data.tar.gz: 8afc26f283b6bac00119d6691da155ae036ec9f6460f934a03914a246d353dca
5
5
  SHA512:
6
- metadata.gz: f92b4ccd509d68170148a500bbe0d75e251328dcf9a2bf23032ca8eb443603e0fcae54055df491f05fa9dd936b54add5280c7a85fa2791832b54e0e97d441fe6
7
- data.tar.gz: ddc135fde954a4cd3fd64e803fb44a6b890172738fa8f476b10c9e974d11dda53254157f8160b86b49aac16617ec02f3304c36a34823eb212d2f6a2d21ef1d76
6
+ metadata.gz: 6a3def76d1bd1def16905844c05066048a6272ce2be692c7730e574684ac7af8036bdbea333898541539eda8c87b2c2ee90ba99c109f98ecea23735509fa0782
7
+ data.tar.gz: 1a8cb41c7e3896b84cd1790471747bb02ab72da460a2b39c9364d1374bdd8a89983318ff44424f4e9b0df24fa706646cb47e56110c12cbb1ce54343d99de3846
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked stale due to inactivity.
14
+ It will be closed if no further activity occurs.
15
+ Thank you for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
@@ -8,7 +8,11 @@ New contributors are always welcome, when it doubt please ask questions. We stri
8
8
  * Offer feedback on open [pull requests](https://github.com/fog/fog-core/pulls).
9
9
  * Review open [issues](https://github.com/fog/fog-core/issues) for things to help on.
10
10
  * [Create an issue](https://github.com/fog/fog-core/issues/new) to start a discussion on additions or features.
11
- * Fork the project, add your changes and tests to cover them in a topic branch.
11
+ * Fork the project
12
+ * Setup
13
+ * bundle install
14
+ * bundle exec rake
15
+ * Add your changes and tests to cover them in a topic branch.
12
16
  * Commit your changes and rebase against `fog/fog-core` to ensure everything is up to date.
13
17
  * [Submit a pull request](https://github.com/fog/fog-core/compare/)
14
18
 
@@ -1,295 +1,301 @@
1
1
  2.1.0 03/10/2018
2
2
  ==========================================================
3
3
 
4
- remove libvirt_uri duplication
5
- fix dnsimple auth variables
6
- add kubevirt provider
7
- fix net-ssh paranoid deprecation
8
- fix nil fetch on object reload
4
+ - remove libvirt_uri duplication
5
+ - fix dnsimple auth variables
6
+ - add kubevirt provider
7
+ - fix net-ssh paranoid deprecation
8
+ - fix nil fetch on object reload
9
9
 
10
10
  2.0.0 01/03/2018
11
11
  ==========================================================
12
12
 
13
- fix association reload
14
- drop ruby <2 support
15
- fix net-ssh usage
16
- add mime-type dependency
13
+ - Breaking Changes
14
+ - Association reload - model#reload now resets the model
15
+ to the current remote state. See discussion in
16
+ https://github.com/fog/fog-aws/pull/433,
17
+ particularly 24ea4675bfd28c93d1344bf666ebafd0f4826b8f
18
+ - drop ruby <2 support
19
+ - Added
20
+ - add mime-type dependency
21
+ - Fixed
22
+ - fix deprecation warning from net-ssh
17
23
 
18
24
  1.45.0 08/01/2017
19
25
  ==========================================================
20
26
 
21
- remove xmlrpc requirement/usage
22
- fix for nested const across ruby versions
23
- remove array#sample usage for legacy ruby compatibility
24
- simplify uniq for cache and fix for legacy ruby
25
- remove debugging puts from cache
26
- tweak tins version for 1.9
27
- loosen 2.1.x travis config to 2.1
28
- add 1.9 compatible term-ansicolor
29
- fix rubocop for 1.9.3
30
- enable metadata for cache
31
- add specs for server#sshable
32
- add exponential backoff for server#sshable?
33
- add server#ready? to base server for clarity
34
- bump excon dependency
27
+ - remove xmlrpc requirement/usage
28
+ - fix for nested const across ruby versions
29
+ - remove array#sample usage for legacy ruby compatibility
30
+ - simplify uniq for cache and fix for legacy ruby
31
+ - remove debugging puts from cache
32
+ - tweak tins version for 1.9
33
+ - loosen 2.1.x travis config to 2.1
34
+ - add 1.9 compatible term-ansicolor
35
+ - fix rubocop for 1.9.3
36
+ - enable metadata for cache
37
+ - add specs for server#sshable
38
+ - add exponential backoff for server#sshable?
39
+ - add server#ready? to base server for clarity
40
+ - bump excon dependency
35
41
 
36
42
  1.44.3 05/25/2017
37
43
  ==========================================================
38
44
 
39
- fix cache when no home directory defined
45
+ - fix cache when no home directory defined
40
46
 
41
47
  1.44.2 05/18/2017
42
48
  ==========================================================
43
49
 
44
- fix homedirectory usage for caching
50
+ - fix homedirectory usage for caching
45
51
 
46
52
  1.44.1 05/01/2017
47
53
  ==========================================================
48
54
 
49
- remove xml-rpc dependency (as it is causing issues)
55
+ - remove xml-rpc dependency (as it is causing issues)
50
56
 
51
57
  1.44.0 04/28/2017
52
58
  ==========================================================
53
59
 
54
- add basic caching support
60
+ - add basic caching support
55
61
 
56
62
  1.43.0 09/28/2016
57
63
  ==========================================================
58
64
 
59
- fix digitalocean compatibility
60
- update README badges
65
+ - fix digitalocean compatibility
66
+ - update README badges
61
67
 
62
68
  1.42.0 07/05/2016
63
69
  ==========================================================
64
70
 
65
- make namespace detection fix 1.8.x compatible
71
+ - make namespace detection fix 1.8.x compatible
66
72
 
67
73
  1.41.0 07/01/2016
68
74
  ==========================================================
69
75
 
70
- bump as 1.40.1 is not showing up in some cases
76
+ - bump as 1.40.1 is not showing up in some cases
71
77
 
72
78
  1.40.1 06/28/2016
73
79
  ==========================================================
74
80
 
75
- fix namespace constant detection
81
+ - fix namespace constant detection
76
82
 
77
83
  1.40.0 05/19/2016
78
84
  ==========================================================
79
85
 
80
- add minitest helpers for schema (parity to shindo)
86
+ - add minitest helpers for schema (parity to shindo)
81
87
 
82
88
  1.39.0 05/11/2016
83
89
  ==========================================================
84
90
 
85
- cleanup warnings
86
- add NFV module
87
- only dup frozen strings
91
+ - cleanup warnings
92
+ - add NFV module
93
+ - only dup frozen strings
88
94
 
89
95
  1.38.0 04/20/2016
90
96
  ==========================================================
91
97
 
92
- more specific service not found error
93
- fix string freeze issue for ruby 2.3
94
- bump excon dep
98
+ - more specific service not found error
99
+ - fix string freeze issue for ruby 2.3
100
+ - bump excon dep
95
101
 
96
102
  1.37.0 03/31/2016
97
103
  ==========================================================
98
104
 
99
- remove hp from providers
100
- re-raise mime-type error, rather than exiting
101
- fix tests
102
- add introspection module
105
+ - remove hp from providers
106
+ - re-raise mime-type error, rather than exiting
107
+ - fix tests
108
+ - add introspection module
103
109
 
104
110
  1.36.0 02/23/2016
105
111
  ==========================================================
106
112
 
107
- default digitalocean to v2
108
- fix eager/auto-loading
109
- add cloud-at-cost
113
+ - default digitalocean to v2
114
+ - fix eager/auto-loading
115
+ - add cloud-at-cost
110
116
 
111
117
  1.35.0 11/24/2015
112
118
  ==========================================================
113
119
 
114
- make mime/types require optional
115
- fix warnings about net-ssh vs net-cp
120
+ - make mime/types require optional
121
+ - fix warnings about net-ssh vs net-cp
116
122
 
117
123
  1.34.0 11/16/2015
118
124
  ==========================================================
119
125
 
120
- make net/ssh and net/scp requires optional
126
+ - make net/ssh and net/scp requires optional
121
127
 
122
128
  1.33.0 11/15/2015
123
129
  ==========================================================
124
130
 
125
- relax net/ssh and net/scp requirement
131
+ - relax net/ssh and net/scp requirement
126
132
 
127
133
  1.32.1 08/12/2015
128
134
  ==========================================================
129
135
 
130
- expose identities in models
136
+ - expose identities in models
131
137
 
132
138
  1.32.0 07/02/2015
133
139
  ==========================================================
134
140
 
135
- fix/refactor service initializers
141
+ - fix/refactor service initializers
136
142
 
137
143
  1.31.1 06/17/2015
138
144
  ==========================================================
139
145
 
140
- fixes around unknown providers/services
146
+ - fixes around unknown providers/services
141
147
 
142
148
  1.31.0 06/17/2015
143
149
  ==========================================================
144
150
 
145
- use relative paths
146
- add digital ocean examples
147
- reinstate baremetal
148
- add softlayer examples
149
- add digital ocean v2 support
150
- setup fog model equality to check identities (if available)
151
- use Fog.interval in wait_for
152
- reduce memory footprint
153
- fix account handling
151
+ - use relative paths
152
+ - add digital ocean examples
153
+ - reinstate baremetal
154
+ - add softlayer examples
155
+ - add digital ocean v2 support
156
+ - setup fog model equality to check identities (if available)
157
+ - use Fog.interval in wait_for
158
+ - reduce memory footprint
159
+ - fix account handling
154
160
 
155
161
  1.30.0 04/02/2015
156
162
  ==========================================================
157
163
 
158
- bump excon dep
159
- use float times, instead of integers for Fog::Time
160
- don't raise if final wait_for yield true
161
- fix bug around formatador and #map on models
162
- fix around `to_time` to avoid conflicts with Rails monkey patches
163
- update specs
164
- update style
165
- fix `WhitelistKeys` for 1.8.7
166
- remove unreachable code
167
- convert hash helpers to minispec
168
- fix require order for coverage
169
- fix ruby 2.2 warning
170
- bump excon dependency
171
- fix readme link
164
+ - bump excon dep
165
+ - use float times, instead of integers for Fog::Time
166
+ - don't raise if final wait_for yield true
167
+ - fix bug around formatador and #map on models
168
+ - fix around `to_time` to avoid conflicts with Rails monkey patches
169
+ - update specs
170
+ - update style
171
+ - fix `WhitelistKeys` for 1.8.7
172
+ - remove unreachable code
173
+ - convert hash helpers to minispec
174
+ - fix require order for coverage
175
+ - fix ruby 2.2 warning
176
+ - bump excon dependency
177
+ - fix readme link
172
178
 
173
179
  1.29.0 02/19/2015
174
180
  ==========================================================
175
181
 
176
- minor refactoring
177
- add ability to add additional user agent info to requests
182
+ - minor refactoring
183
+ - add ability to add additional user agent info to requests
178
184
 
179
185
  1.28.0 01/30/2015
180
186
  ==========================================================
181
187
 
182
- add Fog::Baremetal
188
+ - add Fog::Baremetal
183
189
 
184
190
  1.27.4 01/26/2015
185
191
  ==========================================================
186
192
 
187
- model fix for new formatador usage
188
- fixes around formatador delegation
193
+ - model fix for new formatador usage
194
+ - fixes around formatador delegation
189
195
 
190
196
  1.27.3 12/01/2014
191
197
  ==========================================================
192
198
 
193
- rubocop fixes for fog collection
194
- simpler ruby version checking/skipping
195
- fix requires_one
199
+ - rubocop fixes for fog collection
200
+ - simpler ruby version checking/skipping
201
+ - fix requires_one
196
202
 
197
203
  1.27.2 18/12/2014
198
204
  ==========================================================
199
205
 
200
- fix several requires in service abstraction code
206
+ - fix several requires in service abstraction code
201
207
 
202
208
  1.27.1 12/12/2014
203
209
  ==========================================================
204
210
 
205
- fix typo in model load paths fix
211
+ - fix typo in model load paths fix
206
212
 
207
213
  1.27.0 12/12/2014
208
214
  ==========================================================
209
215
 
210
- return fog/bin stuff to fog/fog
211
- add support for multiple request/model load paths
216
+ - return fog/bin stuff to fog/fog
217
+ - add support for multiple request/model load paths
212
218
 
213
219
 
214
220
  1.26.0 12/02/2014
215
221
  ==========================================================
216
222
 
217
- remove rackspace logic
218
- use new travis builds
219
- fix error handling around credential fetch
220
- move fog/bin stuff to fog-core
221
- fix circular reference in collection.rb
223
+ - remove rackspace logic
224
+ - use new travis builds
225
+ - fix error handling around credential fetch
226
+ - move fog/bin stuff to fog-core
227
+ - fix circular reference in collection.rb
222
228
 
223
229
 
224
230
  1.25.0 11/18/2014
225
231
  ==========================================================
226
232
 
227
- add alias options for associations
228
- improve spec message
229
- add feature to overwrite keys on hash of attributes generation
230
- remove method_missing from model
231
- add rubocop
232
- fix rubocop warnings
233
- return collections on association getters
234
- fix require bug in service
235
- put fog and fog-core versions in user agent
236
- don't mutate/destroy encoding in get_body_size
237
- fix error output in from const_get usage
238
- separate to have distinct version from fog
233
+ - add alias options for associations
234
+ - improve spec message
235
+ - add feature to overwrite keys on hash of attributes generation
236
+ - remove method_missing from model
237
+ - add rubocop
238
+ - fix rubocop warnings
239
+ - return collections on association getters
240
+ - fix require bug in service
241
+ - put fog and fog-core versions in user agent
242
+ - don't mutate/destroy encoding in get_body_size
243
+ - fix error output in from const_get usage
244
+ - separate to have distinct version from fog
239
245
 
240
246
 
241
247
  1.24.0 08/26/2014
242
248
  ==========================================================
243
249
 
244
- fixes for defaulting attributes
245
- add method for getting all attributes
246
- add methods for associations
247
- add all_attributes, all_associations and all_associations_and_attributes helper methods
248
- remove no-longer-needed gem update on travis
249
- add all_values
250
- fixes to avoid path conflicts with fog/fog
250
+ - fixes for defaulting attributes
251
+ - add method for getting all attributes
252
+ - add methods for associations
253
+ - add all_attributes, all_associations and all_associations_and_attributes helper methods
254
+ - remove no-longer-needed gem update on travis
255
+ - add all_values
256
+ - fixes to avoid path conflicts with fog/fog
251
257
 
252
258
  1.23.0 07/16/2014
253
259
  ==========================================================
254
260
 
255
- attribute whitelisting
256
- abstract out stringify for possible reuse
257
- more specific naming
258
- reorg
259
- add path_prefix
260
- fix time conversion to work with XMLRPC
261
- add more specific per-type attribute tests
262
- lock down rest-client for 1.8.7
263
- allow namespace flipflop for dns
264
- fix identity lookup
265
- better default attribute value setting
266
- bump excon
261
+ - attribute whitelisting
262
+ - abstract out stringify for possible reuse
263
+ - more specific naming
264
+ - reorg
265
+ - add path_prefix
266
+ - fix time conversion to work with XMLRPC
267
+ - add more specific per-type attribute tests
268
+ - lock down rest-client for 1.8.7
269
+ - allow namespace flipflop for dns
270
+ - fix identity lookup
271
+ - better default attribute value setting
272
+ - bump excon
267
273
 
268
274
  1.22.0 04/17/2014 1c086852e40e4c1ad7ed138834e4a1505ddb1416
269
275
  ==========================================================
270
276
 
271
- attribute whitelisting
272
- abstract out stringify for possible reuse
273
- more specific naming
274
- reorg
275
- add path_prefix
276
- fix time conversion to work with XMLRPC
277
- add more specific per-type attribute tests
278
- lock down rest-client for 1.8.7
279
- allow namespace flipflop for dns
280
- fix identity lookup
281
- better default attribute value setting
282
- bump excon
277
+ - attribute whitelisting
278
+ - abstract out stringify for possible reuse
279
+ - more specific naming
280
+ - reorg
281
+ - add path_prefix
282
+ - fix time conversion to work with XMLRPC
283
+ - add more specific per-type attribute tests
284
+ - lock down rest-client for 1.8.7
285
+ - allow namespace flipflop for dns
286
+ - fix identity lookup
287
+ - better default attribute value setting
288
+ - bump excon
283
289
 
284
290
  1.22.0 04/17/2014 1c086852e40e4c1ad7ed138834e4a1505ddb1416
285
291
  ==========================================================
286
292
 
287
- tests/cleanup/fixes
293
+ - tests/cleanup/fixes
288
294
 
289
295
  1.21.1 03/18/2014 3a803405ba60ded421f4bd14677cd3c76cb7e6ab
290
296
  ==========================================================
291
297
 
292
- remove json/xml modules and code
293
- add travis/coveralls
294
- update from upstream
295
- bump/loosen excon dependency
298
+ - remove json/xml modules and code
299
+ - add travis/coveralls
300
+ - update from upstream
301
+ - bump/loosen excon dependency
@@ -1,21 +1,5 @@
1
1
  module Fog
2
2
  module Account
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
-
9
- if provider == :stormondemand
10
- require "fog/account/storm_on_demand"
11
- Fog::Account::StormOnDemand.new(attributes)
12
- else
13
- super(orig_attributes)
14
- end
15
- end
16
-
17
- def self.providers
18
- Fog.services[:account] || []
19
- end
20
4
  end
21
5
  end
@@ -1,16 +1,5 @@
1
1
  module Fog
2
2
  module Billing
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
- if provider == :stormondemand
9
- require "fog/billing/storm_on_demand"
10
- Fog::Billing::StormOnDemand.new(attributes)
11
- else
12
- super(orig_attributes)
13
- end
14
- end
15
4
  end
16
5
  end
@@ -7,16 +7,6 @@ module Fog
7
7
  provider = attributes.delete(:provider).to_s.downcase.to_sym
8
8
 
9
9
  case provider
10
- when :gogrid
11
- require "fog/go_grid/compute"
12
- Fog::Compute::GoGrid.new(attributes)
13
- when :new_servers
14
- require "fog/bare_metal_cloud/compute"
15
- Fog::Logger.deprecation "`new_servers` is deprecated. Please use `bare_metal_cloud` instead."
16
- Fog::Compute::BareMetalCloud.new(attributes)
17
- when :baremetalcloud
18
- require "fog/bare_metal_cloud/compute"
19
- Fog::Compute::BareMetalCloud.new(attributes)
20
10
  when :rackspace
21
11
  version = attributes.delete(:version)
22
12
  version = version.to_s.downcase.to_sym unless version.nil?
@@ -38,18 +28,6 @@ module Fog
38
28
  require 'fog/digitalocean/compute'
39
29
  Fog::Compute::DigitalOcean.new(attributes)
40
30
  end
41
- when :stormondemand
42
- require "fog/compute/storm_on_demand"
43
- Fog::Compute::StormOnDemand.new(attributes)
44
- when :vcloud
45
- require "fog/vcloud/compute"
46
- Fog::Vcloud::Compute.new(attributes)
47
- when :vclouddirector
48
- require "fog/vcloud_director/compute"
49
- Fog::Compute::VcloudDirector.new(attributes)
50
- when :cloudatcost
51
- require "fog/cloudatcost/compute"
52
- Fog::Compute::CloudAtCost.new(attributes)
53
31
  else
54
32
  super(orig_attributes)
55
33
  end
@@ -79,14 +79,26 @@ module Fog
79
79
 
80
80
  def all_attributes
81
81
  self.class.attributes.reduce({}) do |hash, attribute|
82
- hash[masks[attribute]] = send(attribute)
82
+ if masks[attribute].nil?
83
+ Fog::Logger.deprecation("Please define #{attribute} using the Fog DSL")
84
+ hash[attribute] = send(attribute)
85
+ else
86
+ hash[masks[attribute]] = send(attribute)
87
+ end
88
+
83
89
  hash
84
90
  end
85
91
  end
86
92
 
87
93
  def all_associations
88
94
  self.class.associations.keys.reduce({}) do |hash, association|
89
- hash[masks[association]] = associations[association] || send(association)
95
+ if masks[association].nil?
96
+ Fog::Logger.deprecation("Please define #{association} using the Fog DSL")
97
+ hash[association] = associations[association] || send(association)
98
+ else
99
+ hash[masks[association]] = associations[association] || send(association)
100
+ end
101
+
90
102
  hash
91
103
  end
92
104
  end
@@ -44,12 +44,10 @@ module Fog
44
44
  # @option params [Class] :instrumentor Responds to #instrument as in ActiveSupport::Notifications
45
45
  # @option params [String] :instrumentor_name Name prefix for #instrument events. Defaults to 'excon'
46
46
  def initialize(url, persistent = false, params = {})
47
- if params[:path_prefix]
48
- if params[:path]
49
- raise ArgumentError, "optional arg 'path' is invalid when 'path_prefix' is provided"
50
- end
47
+ @path_prefix = params.delete(:path_prefix)
51
48
 
52
- @path_prefix = params.delete(:path_prefix)
49
+ if @path_prefix && params[:path]
50
+ raise ArgumentError, "optional arg 'path' is invalid when 'path_prefix' is provided"
53
51
  end
54
52
 
55
53
  params[:debug_response] = true unless params.key?(:debug_response)
@@ -21,11 +21,21 @@ module Fog
21
21
  Fog.services[new_service] ||= []
22
22
  Fog.services[new_service] |= [to_s.split("::").last.downcase.to_sym]
23
23
  @services_registry ||= {}
24
- @services_registry[new_service] = [to_s, constant_string].join("::")
24
+ @services_registry[new_service] = service_klass(constant_string)
25
25
  end
26
26
 
27
27
  def services
28
28
  @services_registry.keys
29
29
  end
30
+
31
+ def service_klass(constant_string)
32
+ eval([to_s, constant_string].join("::"))
33
+ [to_s, constant_string].join("::")
34
+ rescue NameError
35
+ provider = to_s.split("::").last
36
+ Fog::Logger.deprecation("Unable to load #{[to_s, constant_string].join("::")}")
37
+ Fog::Logger.deprecation("The format #{['Fog', constant_string, provider].join("::")} is deprecated")
38
+ ['Fog', constant_string, provider].join("::")
39
+ end
30
40
  end
31
41
  end
@@ -6,7 +6,7 @@ module Fog
6
6
 
7
7
  def new(attributes)
8
8
  attributes = attributes.dup # Prevent delete from having side effects
9
- provider = attributes.delete(:provider).to_s.downcase.to_sym
9
+ provider = check_provider_alias(attributes.delete(:provider).to_s.downcase.to_sym)
10
10
  provider_name = Fog.providers[provider]
11
11
 
12
12
  raise ArgumentError, "#{provider} is not a recognized provider" unless providers.include?(provider)
@@ -24,16 +24,24 @@ module Fog
24
24
 
25
25
  private
26
26
 
27
+ # This method should be removed once all providers are extracted.
28
+ # Bundler will correctly require all dependencies automatically and thus
29
+ # fog-core wont need to know any specifics providers. Each provider will
30
+ # have to load its dependencies.
27
31
  def require_service_provider_library(service, provider)
28
32
  require "fog/#{provider}/#{service}"
29
33
  rescue LoadError # Try to require the service provider in an alternate location
34
+ Fog::Logger.deprecation("Unable to require fog/#{provider}/#{service}")
35
+ Fog::Logger.deprecation("The format fog/#{service}/#{provider} is deprecated")
30
36
  require "fog/#{service}/#{provider}"
31
37
  end
32
38
 
33
39
  def service_provider_constant(service_name, provider_name)
34
- Fog.const_get(service_name).const_get(*const_get_args(provider_name))
35
- rescue NameError # Try to find the constant from in an alternate location
36
40
  Fog.const_get(provider_name).const_get(*const_get_args(service_name))
41
+ rescue NameError # Try to find the constant from in an alternate location
42
+ Fog::Logger.deprecation("Unable to load Fog::#{provider_name}::#{service_name}")
43
+ Fog::Logger.deprecation("The format Fog::#{service_name}::#{provider_name} is deprecated")
44
+ Fog.const_get(service_name).const_get(*const_get_args(provider_name))
37
45
  end
38
46
 
39
47
  def const_get_args(*args)
@@ -43,5 +51,29 @@ module Fog
43
51
  def service_name
44
52
  name.split("Fog::").last
45
53
  end
54
+
55
+ def check_provider_alias(provider)
56
+ case provider
57
+ when :baremetalcloud
58
+ Fog::Logger.deprecation(':baremetalcloud is deprecated. Use :bare_metal_cloud instead!')
59
+ :bare_metal_cloud
60
+ when :gogrid
61
+ Fog::Logger.deprecation(':gogrid is deprecated. Use :go_grid instead!')
62
+ :go_grid
63
+ when :internetarchive
64
+ Fog::Logger.deprecation(':internetarchive is deprecated. Use :internet_archive instead!')
65
+ :internet_archive
66
+ when :new_servers
67
+ Fog::Logger.deprecation(':new_servers is deprecated. Use :bare_metal_cloud instead!')
68
+ :bare_metal_cloud
69
+ when :stormondemand
70
+ Fog::Logger.deprecation(':stormondemand is deprecated. Use :storm_on_demand instead!')
71
+ :storm_on_demand
72
+ when :vclouddirector
73
+ Fog::Logger.deprecation(':vclouddirector is deprecated. Use :vcloud_director instead!')
74
+ :vcloud_director
75
+ else provider
76
+ end
77
+ end
46
78
  end
47
79
  end
@@ -34,32 +34,10 @@ module Fog
34
34
 
35
35
  class Real
36
36
  def initialize(address, username, options)
37
- begin
38
- require "net/ssh"
39
- rescue LoadError
40
- Fog::Logger.warning("'net/ssh' missing, please install and try again.")
41
- exit(1)
42
- end
43
-
44
- key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)
45
-
46
- unless options[:key_data] || options[:keys] || options[:password] || key_manager.agent
47
- raise ArgumentError, ":key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH"
48
- end
49
-
50
- options[:timeout] ||= 30
51
- if options[:key_data] || options[:keys]
52
- options[:keys_only] = true
53
- # Explicitly set these so net-ssh doesn"t add the default keys
54
- # as seen at https://github.com/net-ssh/net-ssh/blob/master/lib/net/ssh/authentication/session.rb#L131-146
55
- options[:keys] = [] unless options[:keys]
56
- options[:key_data] = [] unless options[:key_data]
57
- end
58
-
37
+ assert_net_ssh_loaded
59
38
  @address = address
60
39
  @username = username
61
- @options = { :paranoid => false, :verify_host_key => false }.merge(options)
62
- @options.delete(:paranoid) if Net::SSH::VALID_OPTIONS.include? :verify_host_key
40
+ @options = build_options(options)
63
41
  end
64
42
 
65
43
  def run(commands, &blk)
@@ -107,6 +85,50 @@ module Fog
107
85
  end
108
86
  results
109
87
  end
88
+
89
+ private
90
+
91
+ def assert_net_ssh_loaded
92
+ begin
93
+ require "net/ssh"
94
+ rescue LoadError
95
+ Fog::Logger.warning("'net/ssh' missing, please install and try again.")
96
+ exit(1)
97
+ end
98
+ end
99
+
100
+ # Modifies the given `options` hash AND returns a new hash.
101
+ # TODO: Probably shouldn't modify the given hash.
102
+ def build_options(options)
103
+ validate_options(options)
104
+ merge_default_options_into(options)
105
+ end
106
+
107
+ def merge_default_options_into(options)
108
+ options[:timeout] ||= 30
109
+ if options[:key_data] || options[:keys]
110
+ options[:keys_only] = true
111
+ # Explicitly set these so net-ssh doesn"t add the default keys
112
+ # as seen at https://github.com/net-ssh/net-ssh/blob/master/lib/net/ssh/authentication/session.rb#L131-146
113
+ options[:keys] = [] unless options[:keys]
114
+ options[:key_data] = [] unless options[:key_data]
115
+ end
116
+
117
+ # net-ssh has deprecated :paranoid in favor of :verify_host_key
118
+ # https://github.com/net-ssh/net-ssh/pull/524
119
+ opts = { :paranoid => false, :verify_host_key => false }.merge(options)
120
+ if Net::SSH::VALID_OPTIONS.include? :verify_host_key
121
+ otps.delete(:paranoid)
122
+ end
123
+ opts
124
+ end
125
+
126
+ def validate_options(options)
127
+ key_manager = Net::SSH::Authentication::KeyManager.new(nil, options)
128
+ unless options[:key_data] || options[:keys] || options[:password] || key_manager.agent
129
+ raise ArgumentError, ":key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH"
130
+ end
131
+ end
110
132
  end
111
133
 
112
134
  class Result
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Core
3
- VERSION = "2.1.0"
3
+ VERSION = "2.1.1"
4
4
  end
5
5
  end
@@ -2,17 +2,6 @@ module Fog
2
2
  module DNS
3
3
  extend Fog::ServicesMixin
4
4
 
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup # prevent delete from having side effects
7
- case attributes.delete(:provider).to_s.downcase.to_sym
8
- when :stormondemand
9
- require "fog/dns/storm_on_demand"
10
- Fog::DNS::StormOnDemand.new(attributes)
11
- else
12
- super(orig_attributes)
13
- end
14
- end
15
-
16
5
  def self.zones
17
6
  zones = []
18
7
  providers.each do |provider|
@@ -1,16 +1,5 @@
1
1
  module Fog
2
2
  module Monitoring
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
- if provider == :stormondemand
9
- require "fog/monitoring/storm_on_demand"
10
- Fog::Monitoring::StormOnDemand.new(attributes)
11
- else
12
- super(orig_attributes)
13
- end
14
- end
15
4
  end
16
5
  end
@@ -1,17 +1,5 @@
1
1
  module Fog
2
2
  module Network
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup # Prevent delete from having side effects
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
-
9
- if provider == :stormondemand
10
- require "fog/network/storm_on_demand"
11
- return Fog::Network::StormOnDemand.new(attributes)
12
- else
13
- super(orig_attributes)
14
- end
15
- end
16
4
  end
17
5
  end
@@ -9,20 +9,6 @@ module Fog
9
9
  module Storage
10
10
  extend Fog::ServicesMixin
11
11
 
12
- def self.new(orig_attributes)
13
- attributes = orig_attributes.dup # prevent delete from having side effects
14
- case attributes.delete(:provider).to_s.downcase.to_sym
15
- when :internetarchive
16
- require "fog/internet_archive/storage"
17
- Fog::Storage::InternetArchive.new(attributes)
18
- when :stormondemand
19
- require "fog/storage/storm_on_demand"
20
- Fog::Storage::StormOnDemand.new(attributes)
21
- else
22
- super(orig_attributes)
23
- end
24
- end
25
-
26
12
  def self.directories
27
13
  directories = []
28
14
  providers.each do |provider|
@@ -1,17 +1,5 @@
1
1
  module Fog
2
2
  module Support
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
-
9
- if provider == :stormondemand
10
- require "fog/support/storm_on_demand"
11
- Fog::Support::StormOnDemand.new(attributes)
12
- else
13
- super(orig_attributes)
14
- end
15
- end
16
4
  end
17
5
  end
@@ -1,17 +1,5 @@
1
1
  module Fog
2
2
  module VPN
3
3
  extend Fog::ServicesMixin
4
-
5
- def self.new(orig_attributes)
6
- attributes = orig_attributes.dup
7
- provider = attributes.delete(:provider).to_s.downcase.to_sym
8
-
9
- if provider == :stormondemand
10
- require "fog/vpn/storm_on_demand"
11
- Fog::VPN::StormOnDemand.new(attributes)
12
- else
13
- super(orig_attributes)
14
- end
15
- end
16
4
  end
17
5
  end
@@ -16,8 +16,8 @@ describe "Fog::Compute" do
16
16
  end
17
17
 
18
18
  module Fog
19
- module Compute
20
- class TheRightWay
19
+ module TheRightWay
20
+ class Compute
21
21
  def initialize(_args); end
22
22
  end
23
23
  end
@@ -25,7 +25,7 @@ describe "Fog::Compute" do
25
25
 
26
26
  it "instantiates an instance of Fog::Compute::<Provider> from the :provider keyword arg" do
27
27
  compute = Fog::Compute.new(:provider => :therightway)
28
- assert_instance_of(Fog::Compute::TheRightWay, compute)
28
+ assert_instance_of(Fog::TheRightWay::Compute, compute)
29
29
  end
30
30
 
31
31
  module Fog
@@ -36,8 +36,8 @@ describe "Fog::Compute" do
36
36
  end
37
37
 
38
38
  module Fog
39
- module TheWrongWay
40
- class Compute
39
+ module Compute
40
+ class TheWrongWay
41
41
  def initialize(_args); end
42
42
  end
43
43
  end
@@ -45,7 +45,7 @@ describe "Fog::Compute" do
45
45
 
46
46
  it "instantiates an instance of Fog::<Provider>::Compute from the :provider keyword arg" do
47
47
  compute = Fog::Compute.new(:provider => :thewrongway)
48
- assert_instance_of(Fog::TheWrongWay::Compute, compute)
48
+ assert_instance_of(Fog::Compute::TheWrongWay, compute)
49
49
  end
50
50
 
51
51
  module Fog
@@ -58,7 +58,10 @@ describe "Fog::Compute" do
58
58
  module Fog
59
59
  module BothWays
60
60
  class Compute
61
- def initialize(_args); end
61
+ attr_reader :args
62
+ def initialize(args)
63
+ @args = args
64
+ end
62
65
  end
63
66
  end
64
67
  end
@@ -66,18 +69,15 @@ describe "Fog::Compute" do
66
69
  module Fog
67
70
  module Compute
68
71
  class BothWays
69
- attr_reader :args
70
- def initialize(args)
71
- @args = args
72
- end
72
+ def initialize(_args); end
73
73
  end
74
74
  end
75
75
  end
76
76
 
77
77
  describe "when both Fog::Compute::<Provider> and Fog::<Provider>::Compute exist" do
78
- it "prefers Fog::Compute::<Provider>" do
78
+ it "prefers Fog::<Provider>::Compute" do
79
79
  compute = Fog::Compute.new(:provider => :bothways)
80
- assert_instance_of(Fog::Compute::BothWays, compute)
80
+ assert_instance_of(Fog::BothWays::Compute, compute)
81
81
  end
82
82
  end
83
83
 
@@ -16,8 +16,8 @@ describe "Fog::Identity" do
16
16
  end
17
17
 
18
18
  module Fog
19
- module Identity
20
- class TheRightWay
19
+ module TheRightWay
20
+ class Identity
21
21
  def initialize(_args); end
22
22
  end
23
23
  end
@@ -25,27 +25,27 @@ describe "Fog::Identity" do
25
25
 
26
26
  it "instantiates an instance of Fog::Identity::<Provider> from the :provider keyword arg" do
27
27
  identity = Fog::Identity.new(:provider => :therightway)
28
- assert_instance_of(Fog::Identity::TheRightWay, identity)
28
+ assert_instance_of(Fog::TheRightWay::Identity, identity)
29
29
  end
30
30
 
31
31
  module Fog
32
- module Rackspace
32
+ module TheWrongWay
33
33
  extend Provider
34
34
  service(:identity, "Identity")
35
35
  end
36
36
  end
37
37
 
38
38
  module Fog
39
- module Rackspace
40
- class Identity
39
+ module Identity
40
+ class TheWrongWay
41
41
  def initialize(_args); end
42
42
  end
43
43
  end
44
44
  end
45
45
 
46
46
  it "instantiates an instance of Fog::<Provider>::Identity from the :provider keyword arg" do
47
- identity = Fog::Identity.new(:provider => :rackspace)
48
- assert_instance_of(Fog::Rackspace::Identity, identity)
47
+ identity = Fog::Identity.new(:provider => :thewrongway)
48
+ assert_instance_of(Fog::Identity::TheWrongWay, identity)
49
49
  end
50
50
 
51
51
  module Fog
@@ -58,7 +58,10 @@ describe "Fog::Identity" do
58
58
  module Fog
59
59
  module BothWays
60
60
  class Identity
61
- def initialize(_args); end
61
+ attr_reader :args
62
+ def initialize(args)
63
+ @args = args
64
+ end
62
65
  end
63
66
  end
64
67
  end
@@ -66,10 +69,7 @@ describe "Fog::Identity" do
66
69
  module Fog
67
70
  module Identity
68
71
  class BothWays
69
- attr_reader :args
70
- def initialize(args)
71
- @args = args
72
- end
72
+ def initialize(_args); end
73
73
  end
74
74
  end
75
75
  end
@@ -77,7 +77,7 @@ describe "Fog::Identity" do
77
77
  describe "when both Fog::Identity::<Provider> and Fog::<Provider>::Identity exist" do
78
78
  it "prefers Fog::Identity::<Provider>" do
79
79
  identity = Fog::Identity.new(:provider => :bothways)
80
- assert_instance_of(Fog::Identity::BothWays, identity)
80
+ assert_instance_of(Fog::BothWays::Identity, identity)
81
81
  end
82
82
  end
83
83
 
@@ -16,16 +16,16 @@ describe "Fog::Storage" do
16
16
  end
17
17
 
18
18
  module Fog
19
- module Storage
20
- class TheRightWay
19
+ module TheRightWay
20
+ class Storage
21
21
  def initialize(_args); end
22
22
  end
23
23
  end
24
24
  end
25
25
 
26
- it "instantiates an instance of Fog::Storage::<Provider> from the :provider keyword arg" do
26
+ it "instantiates an instance of Fog::<Provider>::Storage from the :provider keyword arg" do
27
27
  compute = Fog::Storage.new(:provider => :therightway)
28
- assert_instance_of(Fog::Storage::TheRightWay, compute)
28
+ assert_instance_of(Fog::TheRightWay::Storage, compute)
29
29
  end
30
30
 
31
31
  module Fog
@@ -33,19 +33,17 @@ describe "Fog::Storage" do
33
33
  extend Provider
34
34
  service(:storage, "Storage")
35
35
  end
36
- end
37
36
 
38
- module Fog
39
- module TheWrongWay
40
- class Storage
37
+ module Storage
38
+ class TheWrongWay
41
39
  def initialize(_args); end
42
40
  end
43
41
  end
44
42
  end
45
43
 
46
- it "instantiates an instance of Fog::<Provider>::Storage from the :provider keyword arg" do
44
+ it "instantiates an instance of Fog::Storage::<Provider> from the :provider keyword arg" do
47
45
  compute = Fog::Storage.new(:provider => :thewrongway)
48
- assert_instance_of(Fog::TheWrongWay::Storage, compute)
46
+ assert_instance_of(Fog::Storage::TheWrongWay, compute)
49
47
  end
50
48
 
51
49
  module Fog
@@ -58,7 +56,11 @@ describe "Fog::Storage" do
58
56
  module Fog
59
57
  module BothWays
60
58
  class Storage
61
- def initialize(_args); end
59
+ attr_reader :args
60
+
61
+ def initialize(args)
62
+ @args = args
63
+ end
62
64
  end
63
65
  end
64
66
  end
@@ -66,11 +68,7 @@ describe "Fog::Storage" do
66
68
  module Fog
67
69
  module Storage
68
70
  class BothWays
69
- attr_reader :args
70
-
71
- def initialize(args)
72
- @args = args
73
- end
71
+ def initialize(_args); end
74
72
  end
75
73
  end
76
74
  end
@@ -78,7 +76,7 @@ describe "Fog::Storage" do
78
76
  describe "when both Fog::Storage::<Provider> and Fog::<Provider>::Storage exist" do
79
77
  it "prefers Fog::Storage::<Provider>" do
80
78
  compute = Fog::Storage.new(:provider => :bothways)
81
- assert_instance_of(Fog::Storage::BothWays, compute)
79
+ assert_instance_of(Fog::BothWays::Storage, compute)
82
80
  end
83
81
  end
84
82
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Light
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-10 00:00:00.000000000 Z
12
+ date: 2018-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -201,6 +201,7 @@ executables: []
201
201
  extensions: []
202
202
  extra_rdoc_files: []
203
203
  files:
204
+ - ".github/stale.yml"
204
205
  - ".gitignore"
205
206
  - ".rubocop.yml"
206
207
  - ".travis.yml"
@@ -335,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
336
  version: '0'
336
337
  requirements: []
337
338
  rubyforge_project:
338
- rubygems_version: 2.6.11
339
+ rubygems_version: 2.7.6
339
340
  signing_key:
340
341
  specification_version: 4
341
342
  summary: Shared classes and tests for fog providers and services.