fog-core 1.43.0 → 1.44.0
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 +4 -4
- data/.gitignore +2 -2
- data/.travis.yml +15 -8
- data/Gemfile +0 -1
- data/{Gemfile18 → Gemfile.1.8.7} +0 -0
- data/Gemfile.1.9.3 +5 -0
- data/README.md +11 -0
- data/changelog.md +5 -0
- data/fog-core.gemspec +2 -0
- data/lib/fog/core/cache.rb +210 -0
- data/lib/fog/core/collection.rb +0 -1
- data/lib/fog/core/model.rb +5 -0
- data/lib/fog/core/version.rb +1 -1
- data/spec/core/cache_spec.rb +123 -0
- data/spec/service_spec.rb +2 -1
- metadata +36 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7e0a641eb2c6f28ba2026bb5fe19918d003ea7f
|
|
4
|
+
data.tar.gz: 0e72e5f6ae021ce1476d8b297747faa5da894679
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f604ea2b9c97ab0b8e596b51c749b4175b96fc3e70e7eff5ec1cc23471024c8e03774aaeec0523b8fe57211f1e6fb2006430ee422f62b1979610160ad7bd2ce8
|
|
7
|
+
data.tar.gz: 28abea55b24d79055f9c1f5a89aaa5d2dfd622875a2d7162678a5b4fc4ef21a06760d6341cad772c3846f531274b13483823484641ee474cdf4c1630ff275c11
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
|
|
3
|
-
gemfile:
|
|
4
|
-
- Gemfile
|
|
5
|
-
|
|
6
3
|
rvm:
|
|
7
|
-
- 1
|
|
8
|
-
- 2.
|
|
9
|
-
- 2.
|
|
10
|
-
-
|
|
4
|
+
- 2.1
|
|
5
|
+
- 2.2
|
|
6
|
+
- 2.3
|
|
7
|
+
- 2.4
|
|
11
8
|
- jruby-head
|
|
12
9
|
|
|
13
10
|
sudo: false
|
|
11
|
+
dist: trusty
|
|
14
12
|
|
|
15
13
|
script: bundle exec rake travis
|
|
16
14
|
|
|
17
15
|
matrix:
|
|
16
|
+
fast_finish: true
|
|
18
17
|
include:
|
|
19
18
|
- rvm: 1.8.7
|
|
20
|
-
gemfile:
|
|
19
|
+
gemfile: Gemfile.1.8.7
|
|
20
|
+
- rvm: jruby-18mode
|
|
21
|
+
gemfile: Gemfile.1.8.7
|
|
22
|
+
- rvm: 1.9.3
|
|
23
|
+
gemfile: Gemfile.1.9.3
|
|
24
|
+
- rvm: jruby-19mode
|
|
25
|
+
gemfile: Gemfile.1.9.3
|
|
21
26
|
- rvm: 2.1.0
|
|
22
27
|
gemfile: Gemfile
|
|
23
28
|
env: COVERAGE=true
|
|
29
|
+
- rvm: jruby-head
|
|
30
|
+
gemfile: Gemfile
|
|
24
31
|
allow_failures:
|
|
25
32
|
- rvm: jruby-head
|
|
26
33
|
- rvm: jruby9k
|
data/Gemfile
CHANGED
data/{Gemfile18 → Gemfile.1.8.7}
RENAMED
|
File without changes
|
data/Gemfile.1.9.3
ADDED
data/README.md
CHANGED
|
@@ -25,6 +25,17 @@ Or install it yourself as:
|
|
|
25
25
|
|
|
26
26
|
$ gem install fog-core
|
|
27
27
|
|
|
28
|
+
### Ruby 1.9.3
|
|
29
|
+
|
|
30
|
+
Some of `fog-core`'s dependencies have dropped support for Ruby 1.9.3 in later
|
|
31
|
+
versions. Rather than limit all `fog` users to older but compatible versions,
|
|
32
|
+
if you are using 1.9.3 you will need to declare a compatible version in your
|
|
33
|
+
application's `Gemfile` like:
|
|
34
|
+
|
|
35
|
+
gem "net-ssh", "< 3.0"
|
|
36
|
+
|
|
37
|
+
See `Gemfile.1.9.3` for the definitive list as tested by Travis.
|
|
38
|
+
|
|
28
39
|
## Usage
|
|
29
40
|
|
|
30
41
|
TODO: Write usage instructions here
|
data/changelog.md
CHANGED
data/fog-core.gemspec
CHANGED
|
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_dependency("builder")
|
|
22
22
|
spec.add_dependency("excon", "~> 0.49")
|
|
23
23
|
spec.add_dependency("formatador", "~> 0.2")
|
|
24
|
+
spec.add_dependency("xmlrpc") if RUBY_VERSION.to_s >= "2.4"
|
|
24
25
|
|
|
26
|
+
spec.add_development_dependency("tins") if RUBY_VERSION.to_s > "2.0"
|
|
25
27
|
spec.add_development_dependency("coveralls")
|
|
26
28
|
spec.add_development_dependency("minitest")
|
|
27
29
|
spec.add_development_dependency("minitest-stub-const")
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
require "fileutils"
|
|
3
|
+
require "yaml"
|
|
4
|
+
require "tmpdir"
|
|
5
|
+
|
|
6
|
+
module Fog
|
|
7
|
+
# A generic cache mechanism for fog resources. This can be for a server, security group, etc.
|
|
8
|
+
#
|
|
9
|
+
# Currently this is a on-disk cache using yml files per-model instance, however
|
|
10
|
+
# there is nothing in the way of extending this to use various other cache
|
|
11
|
+
# backends.
|
|
12
|
+
#
|
|
13
|
+
# == Basic functionality
|
|
14
|
+
#
|
|
15
|
+
# set the namespace where this cache will be stored:
|
|
16
|
+
#
|
|
17
|
+
# Fog::Cache.namespace_prefix = "service-account-foo-region-bar"
|
|
18
|
+
#
|
|
19
|
+
# cache to disk:
|
|
20
|
+
#
|
|
21
|
+
# # after dumping, there will be a yml file on disk:
|
|
22
|
+
# resouce.cache.dump
|
|
23
|
+
#
|
|
24
|
+
# # you can load cached data in from a different session
|
|
25
|
+
# Fog::Cache.load(Fog::Compute::AWS::Server, compute)
|
|
26
|
+
#
|
|
27
|
+
# # you can also expire cache (removes cached data assocaited with the resources of this model associated to the service passed in).
|
|
28
|
+
# Fog::Cache.expire_cache!(Fog::Compute::AWS::Server, compute)
|
|
29
|
+
#
|
|
30
|
+
# == More detailed flow/usage
|
|
31
|
+
#
|
|
32
|
+
# Normally, you would have a bunch of resources you want to cache/reload from disk.
|
|
33
|
+
# Every fog model has a +cache+ object injected to accomplish this. So in order to cache a server for exmaple
|
|
34
|
+
# you would do something like this:
|
|
35
|
+
#
|
|
36
|
+
# # note this is necessary in order to segregate usage of cache between various providers regions and accounts.
|
|
37
|
+
# # if you are using one account/region/etc only, you still must set it. 'default' will do.
|
|
38
|
+
# Fog::Cache.namespace_prefix = "prod-emea-eu-west-1"
|
|
39
|
+
#
|
|
40
|
+
# s = security_groups.sample; s.name # => "default"
|
|
41
|
+
# s.cache.dump # => 2371
|
|
42
|
+
#
|
|
43
|
+
# Now it is on disk:
|
|
44
|
+
#
|
|
45
|
+
# shai@adsk-lappy ~ % tree ~/.fog-cache/prod-emea-eu-west-1/
|
|
46
|
+
#
|
|
47
|
+
# /Users/shai/.fog-cache/prod-emea-eu-west-1/
|
|
48
|
+
# └── fog_compute_aws_real
|
|
49
|
+
# └── fog_compute_aws_securitygroup
|
|
50
|
+
# ├── default-90928073d9d5d9b4e7545e88aee7ec4f.yml
|
|
51
|
+
#
|
|
52
|
+
# You can do the same with a SecurityGroup, Instances, Elbs, etc.
|
|
53
|
+
#
|
|
54
|
+
# Note that when loading cache from disk, you need to pass the appropriate model class, and service associated with it.
|
|
55
|
+
# +Service+ is passed in is so that the service/connection details can be loaded into the loaded instances so they can be re-queried, etc.
|
|
56
|
+
# +Model+ is passed in so we can find the cache data associated to that model in the namespace of cache this session is using:
|
|
57
|
+
# Will try to load all resources associated to those. If you had 1 yml file, or 100, it would load whatever it could find.
|
|
58
|
+
# As such, the normal usage of dumping would be do it on a collection:
|
|
59
|
+
#
|
|
60
|
+
# load_balancers.each {|elb| elb.cache.dump }
|
|
61
|
+
#
|
|
62
|
+
# In order to load the cache into a different session with nothing but the service set up, use like so:
|
|
63
|
+
# As mentioned, will load all resources associated to the +model_klass+ and +service+ passed in.
|
|
64
|
+
#
|
|
65
|
+
# instances = Fog::Cache.load(Fog::Compute::AWS::Server, compute)
|
|
66
|
+
# instances.first.id # => "i-0569a70ae6f47d229"
|
|
67
|
+
#
|
|
68
|
+
# Note that if there is no cache located for the +model+ class and +service+ passed to `Fog::Cache.load`
|
|
69
|
+
# you will get an exception you can handle (for example, to load the resources for the fisrt time):
|
|
70
|
+
#
|
|
71
|
+
# Fog::Cache.expire_cache!(Fog::Compute::AWS::SecurityGroup, compute)
|
|
72
|
+
# # ... now there is no SecurityGroup cache data. So, if you tried to load it, you would get an exception:
|
|
73
|
+
#
|
|
74
|
+
# Fog::Cache.load(Fog::Compute::AWS::SecurityGroup, compute)
|
|
75
|
+
# rescue Fog::Cache::CacheNotFound => e
|
|
76
|
+
# puts "could not find any cache data for security groups on #{compute}"
|
|
77
|
+
# get_resources_and_dump
|
|
78
|
+
#
|
|
79
|
+
# == Extending cache backends
|
|
80
|
+
#
|
|
81
|
+
# Currently this is on-disk using yml. If need be, this could be extended to other cache backends:
|
|
82
|
+
#
|
|
83
|
+
# Find references of yaml in this file, split out to strategy objects/diff backends etc.
|
|
84
|
+
class Cache
|
|
85
|
+
|
|
86
|
+
# cache associated not found
|
|
87
|
+
class CacheNotFound < StandardError; end
|
|
88
|
+
|
|
89
|
+
# cache directory problem
|
|
90
|
+
class CacheDir < StandardError; end
|
|
91
|
+
|
|
92
|
+
# where different caches per +service+ api keys, regions etc, are stored
|
|
93
|
+
# see the +namespace_prefix=+ method.
|
|
94
|
+
SANDBOX = "~/.fog-cache"
|
|
95
|
+
|
|
96
|
+
# when a resource is used such as `server.cache.dump` the model klass is passed in
|
|
97
|
+
# so that it can be identified from a different session.
|
|
98
|
+
attr_reader :model
|
|
99
|
+
|
|
100
|
+
# Loads cache associated to the +model_klass+ and +service+ into memory.
|
|
101
|
+
#
|
|
102
|
+
# If no cache is found, it will raise an error for handling:
|
|
103
|
+
#
|
|
104
|
+
# rescue Fog::Cache::CacheNotFound
|
|
105
|
+
# set_initial_cache
|
|
106
|
+
#
|
|
107
|
+
def self.load(model_klass, service)
|
|
108
|
+
cache_files = Dir.glob("#{namespace(model_klass, service)}/*")
|
|
109
|
+
|
|
110
|
+
raise CacheNotFound if cache_files.empty?
|
|
111
|
+
|
|
112
|
+
loaded = cache_files.map do |path|
|
|
113
|
+
model_klass = Object.const_get(load_cache(path)[:model_klass])
|
|
114
|
+
model_klass.new(load_cache(path)[:attrs])
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
collection_klass = load_cache(cache_files.sample)[:collection_klass] &&
|
|
118
|
+
Object.const_get(load_cache(cache_files.sample)[:collection_klass])
|
|
119
|
+
|
|
120
|
+
loaded.each do |i|
|
|
121
|
+
# See https://github.com/fog/fog-aws/issues/354#issuecomment-286789702
|
|
122
|
+
i.collection = collection_klass.new(:service => service) if collection_klass
|
|
123
|
+
i.instance_variable_set(:@service, service)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# uniqe-ify based on the total of attributes. duplicate cache can exist due to
|
|
127
|
+
# `model#identity` not being unique. but if all attributes match, they are unique
|
|
128
|
+
# and shouldn't be loaded again.
|
|
129
|
+
uniq_loaded = loaded.uniq { |i| i.attributes }
|
|
130
|
+
if uniq_loaded.size != loaded.size
|
|
131
|
+
Fog::Logger.warning("Found duplicate items in the cache. Expire all & refresh cache soon.")
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Fog models created, free memory of cached data used for creation.
|
|
135
|
+
@memoized = nil
|
|
136
|
+
|
|
137
|
+
uniq_loaded
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# creates on-disk cache of this specific +model_klass+ and +@service+
|
|
141
|
+
def self.create_namespace(model_klass, service)
|
|
142
|
+
FileUtils.mkdir_p(self.namespace(model_klass, service))
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Expires cache - this does not expire all cache associated.
|
|
146
|
+
# Instead, this will remove all on-disk cache of this specific +model_klass+ and and +@service+
|
|
147
|
+
def self.expire_cache!(model_klass, service)
|
|
148
|
+
FileUtils.rm_rf(namespace(model_klass, service))
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# loads yml cache from path on disk, used
|
|
152
|
+
# to initialize Fog models.
|
|
153
|
+
def self.load_cache(path)
|
|
154
|
+
@memoized ||= {}
|
|
155
|
+
return @memoized[path] if @memoized[path]
|
|
156
|
+
@memoized[path] = YAML.load(File.read(path))
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.namespace_prefix=(name)
|
|
160
|
+
@namespace_prefix = name
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def self.namespace_prefix
|
|
164
|
+
@namespace_prefix
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# The path/namespace where the cache is stored for a specific +model_klass+ and +@service+.
|
|
168
|
+
def self.namespace(model_klass, service)
|
|
169
|
+
|
|
170
|
+
raise CacheDir.new("Must set an explicit identifier/name for this cache. Example: 'serviceX-regionY'") unless namespace_prefix
|
|
171
|
+
|
|
172
|
+
ns = File.join(SANDBOX, namespace_prefix, service.class.to_s, model_klass.to_s)
|
|
173
|
+
ns = safe_path(ns)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def self.safe_path(klass)
|
|
177
|
+
klass.to_s.gsub("::", "_").downcase
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def initialize(model)
|
|
181
|
+
@model = model
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Dump a Fog::Model resource. Every fog model/instance now has a +cache+ method/object injected in.
|
|
185
|
+
# as such you can use the #dump method to save the attributes and metadata of that instance as cache
|
|
186
|
+
# which can be re-used in some other session.
|
|
187
|
+
def dump
|
|
188
|
+
if !File.exist?(self.class.namespace(model.class, model.service))
|
|
189
|
+
self.class.create_namespace(model.class, model.service)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
data = { :identity => model.identity,
|
|
193
|
+
:model_klass => model.class.to_s,
|
|
194
|
+
:collection_klass => model.collection && model.collection.class.to_s,
|
|
195
|
+
:attrs => model.attributes }
|
|
196
|
+
|
|
197
|
+
File.open(dump_to, "w") { |f| f.write(YAML.dump(data)) }
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# the location of where to save this fog model/instance to.
|
|
201
|
+
def dump_to
|
|
202
|
+
# some fog models have an identity field that is duplicate.
|
|
203
|
+
# duplicate identities can mean the cache for that already exists.
|
|
204
|
+
# this means cache duplication is possible.
|
|
205
|
+
#
|
|
206
|
+
# see "dumping two models that have duplicate identity" test case.
|
|
207
|
+
name = "#{self.class.namespace(model.class, model.service)}/#{model.identity}-#{SecureRandom.hex}.yml"
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
data/lib/fog/core/collection.rb
CHANGED
data/lib/fog/core/model.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "fog/core/deprecated_connection_accessors"
|
|
2
|
+
require "fog/core/cache"
|
|
2
3
|
|
|
3
4
|
module Fog
|
|
4
5
|
class Model
|
|
@@ -20,6 +21,10 @@ module Fog
|
|
|
20
21
|
merge_attributes(attribs)
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
def cache
|
|
25
|
+
Fog::Cache.new(self)
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
def inspect
|
|
24
29
|
Fog::Formatador.format(self)
|
|
25
30
|
end
|
data/lib/fog/core/version.rb
CHANGED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "securerandom"
|
|
3
|
+
require "tmpdir"
|
|
4
|
+
|
|
5
|
+
module Fog
|
|
6
|
+
class SubFogTestModel < Fog::Model
|
|
7
|
+
identity :id
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module Fog
|
|
12
|
+
class SubFogTestService < Fog::Service
|
|
13
|
+
|
|
14
|
+
class Mock
|
|
15
|
+
attr_reader :options
|
|
16
|
+
|
|
17
|
+
def initialize(opts = {})
|
|
18
|
+
@options = opts
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe Fog::Cache do
|
|
25
|
+
before(:each) do
|
|
26
|
+
Fog.mock!
|
|
27
|
+
@service = Fog::SubFogTestService.new
|
|
28
|
+
Fog::Cache.namespace_prefix = "test-dir"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "has a namespace_prefix configurable" do
|
|
32
|
+
Fog::Cache.namespace_prefix = "for-service-user-region-foo"
|
|
33
|
+
|
|
34
|
+
# Expand path does not downcase. case insensitive platform tests.
|
|
35
|
+
example_cache = File.expand_path(Fog::Cache.namespace(Fog::SubFogTestModel, @service)).downcase
|
|
36
|
+
expected_namespace = File.expand_path("~/.fog-cache/for-service-user-region-foo").downcase
|
|
37
|
+
|
|
38
|
+
puts example_cache
|
|
39
|
+
puts expected_namespace
|
|
40
|
+
assert_equal example_cache.include?(expected_namespace), true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "must have a namespace_prefix configurable" do
|
|
44
|
+
Fog::Cache.namespace_prefix = nil
|
|
45
|
+
assert_raises Fog::Cache::CacheDir do
|
|
46
|
+
Fog::Cache.load(Fog::SubFogTestModel, @service)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "can create a namespace" do
|
|
51
|
+
Fog::Cache.expire_cache!(Fog::SubFogTestModel, @service)
|
|
52
|
+
assert_equal File.exist?(Fog::Cache.namespace(Fog::SubFogTestModel, @service)), false
|
|
53
|
+
|
|
54
|
+
Fog::Cache.create_namespace(Fog::SubFogTestModel, @service)
|
|
55
|
+
assert_equal File.exist?(Fog::Cache.namespace(Fog::SubFogTestModel, @service)), true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "will raise if no cache data found" do
|
|
59
|
+
Fog::Cache.expire_cache!(Fog::SubFogTestModel, @service)
|
|
60
|
+
|
|
61
|
+
assert_raises Fog::Cache::CacheNotFound do
|
|
62
|
+
Fog::Cache.load(Fog::SubFogTestModel, @service)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "can be dumped and reloaded back in" do
|
|
67
|
+
|
|
68
|
+
Fog::Cache.expire_cache!(Fog::SubFogTestModel, @service)
|
|
69
|
+
|
|
70
|
+
id = SecureRandom.hex
|
|
71
|
+
a = Fog::SubFogTestModel.new(:id => id, :service => @service)
|
|
72
|
+
|
|
73
|
+
assert_equal File.exist?(Fog::Cache.namespace(Fog::SubFogTestModel, @service)), false
|
|
74
|
+
a.cache.dump
|
|
75
|
+
assert_equal File.exist?(Fog::Cache.namespace(Fog::SubFogTestModel, @service)), true
|
|
76
|
+
|
|
77
|
+
instances = Fog::Cache.load(Fog::SubFogTestModel, @service)
|
|
78
|
+
|
|
79
|
+
assert_equal instances.first.id, a.id
|
|
80
|
+
assert_equal instances.first.class, a.class
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "dumping two models that have a duplicate identity" do
|
|
84
|
+
Fog::Cache.expire_cache!(Fog::SubFogTestModel, @service)
|
|
85
|
+
|
|
86
|
+
id = SecureRandom.hex
|
|
87
|
+
|
|
88
|
+
# security gruops on aws for eg can have the same identity group name 'default'.
|
|
89
|
+
# there are no restrictions on `identity` fog attributes to be uniq.
|
|
90
|
+
a = Fog::SubFogTestModel.new(:id => id, :service => @service, :bar => 'bar')
|
|
91
|
+
b = Fog::SubFogTestModel.new(:id => id, :service => @service, :foo => 'foo')
|
|
92
|
+
|
|
93
|
+
a.cache.dump
|
|
94
|
+
b.cache.dump
|
|
95
|
+
|
|
96
|
+
instances = Fog::Cache.load(Fog::SubFogTestModel, @service)
|
|
97
|
+
|
|
98
|
+
assert_equal instances.size, 2
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "dumping two models that have a duplicate identity twice" do
|
|
102
|
+
Fog::Cache.expire_cache!(Fog::SubFogTestModel, @service)
|
|
103
|
+
|
|
104
|
+
id = SecureRandom.hex
|
|
105
|
+
|
|
106
|
+
# security gruops on aws for eg can have the same identity group name 'default'.
|
|
107
|
+
# there are no restrictions on `identity` fog attributes to be uniq.
|
|
108
|
+
a = Fog::SubFogTestModel.new(:id => id, :service => @service, :bar => 'bar')
|
|
109
|
+
b = Fog::SubFogTestModel.new(:id => id, :service => @service, :foo => 'foo')
|
|
110
|
+
|
|
111
|
+
a.cache.dump
|
|
112
|
+
b.cache.dump
|
|
113
|
+
|
|
114
|
+
# and then again, w/out expiring cache
|
|
115
|
+
a.cache.dump
|
|
116
|
+
b.cache.dump
|
|
117
|
+
|
|
118
|
+
instances = Fog::Cache.load(Fog::SubFogTestModel, @service)
|
|
119
|
+
|
|
120
|
+
# unique-ify based on the attributes...
|
|
121
|
+
assert_equal instances.size, 2
|
|
122
|
+
end
|
|
123
|
+
end
|
data/spec/service_spec.rb
CHANGED
|
@@ -171,9 +171,10 @@ describe Fog::Service do
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
describe "when config object can configure the service itself" do
|
|
174
|
-
it "ignores the global and
|
|
174
|
+
it "ignores the global and its values" do
|
|
175
175
|
@config = MiniTest::Mock.new
|
|
176
176
|
def @config.config_service?; true; end
|
|
177
|
+
def @config.nil?; false; end
|
|
177
178
|
def @config.==(other); object_id == other.object_id; end
|
|
178
179
|
|
|
179
180
|
unexpected_usage = lambda { raise "Accessing global!" }
|
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: 1.
|
|
4
|
+
version: 1.44.0
|
|
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:
|
|
12
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: builder
|
|
@@ -53,6 +53,34 @@ dependencies:
|
|
|
53
53
|
- - "~>"
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '0.2'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: xmlrpc
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
type: :runtime
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: tins
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
56
84
|
- !ruby/object:Gem::Dependency
|
|
57
85
|
name: coveralls
|
|
58
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -179,7 +207,8 @@ files:
|
|
|
179
207
|
- CONTRIBUTING.md
|
|
180
208
|
- CONTRIBUTORS.md
|
|
181
209
|
- Gemfile
|
|
182
|
-
-
|
|
210
|
+
- Gemfile.1.8.7
|
|
211
|
+
- Gemfile.1.9.3
|
|
183
212
|
- LICENSE.md
|
|
184
213
|
- README.md
|
|
185
214
|
- Rakefile
|
|
@@ -207,6 +236,7 @@ files:
|
|
|
207
236
|
- lib/fog/core/attributes/string.rb
|
|
208
237
|
- lib/fog/core/attributes/time.rb
|
|
209
238
|
- lib/fog/core/attributes/timestamp.rb
|
|
239
|
+
- lib/fog/core/cache.rb
|
|
210
240
|
- lib/fog/core/collection.rb
|
|
211
241
|
- lib/fog/core/connection.rb
|
|
212
242
|
- lib/fog/core/credentials.rb
|
|
@@ -263,6 +293,7 @@ files:
|
|
|
263
293
|
- lib/tasks/test_task.rb
|
|
264
294
|
- spec/compute_spec.rb
|
|
265
295
|
- spec/connection_spec.rb
|
|
296
|
+
- spec/core/cache_spec.rb
|
|
266
297
|
- spec/core/model_spec.rb
|
|
267
298
|
- spec/core/stringify_keys_spec.rb
|
|
268
299
|
- spec/core/whitelist_keys_spec.rb
|
|
@@ -305,13 +336,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
305
336
|
version: '0'
|
|
306
337
|
requirements: []
|
|
307
338
|
rubyforge_project:
|
|
308
|
-
rubygems_version: 2.
|
|
339
|
+
rubygems_version: 2.6.8
|
|
309
340
|
signing_key:
|
|
310
341
|
specification_version: 4
|
|
311
342
|
summary: Shared classes and tests for fog providers and services.
|
|
312
343
|
test_files:
|
|
313
344
|
- spec/compute_spec.rb
|
|
314
345
|
- spec/connection_spec.rb
|
|
346
|
+
- spec/core/cache_spec.rb
|
|
315
347
|
- spec/core/model_spec.rb
|
|
316
348
|
- spec/core/stringify_keys_spec.rb
|
|
317
349
|
- spec/core/whitelist_keys_spec.rb
|
|
@@ -334,4 +366,3 @@ test_files:
|
|
|
334
366
|
- spec/utils_spec.rb
|
|
335
367
|
- spec/uuid_spec.rb
|
|
336
368
|
- spec/wait_for_spec.rb
|
|
337
|
-
has_rdoc:
|