mystro-common 0.3.0 → 0.3.1.alpha2
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 +15 -0
- data/.crackin.yml +12 -0
- data/CHANGELOG.md +31 -13
- data/Gemfile +1 -0
- data/lib/fog/ext/dynect/models/dns/records.rb +0 -57
- data/lib/mystro/cloud/connect/dynect/record.rb +0 -1
- data/lib/mystro/cloud/connect/dynect.rb +1 -1
- data/lib/mystro/common/version.rb +3 -3
- data/mystro-common.gemspec +13 -12
- data/spec/support/record.rb +34 -14
- metadata +24 -46
- data/lib/fog/ext/dynect/dns.rb +0 -140
- data/lib/fog/ext/dynect/models/dns/record.rb +0 -66
- data/lib/fog/ext/dynect/models/dns/zone.rb +0 -60
- data/lib/fog/ext/dynect/models/dns/zones.rb +0 -29
- data/lib/fog/ext/dynect/requests/dns/delete_record.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/delete_zone.rb +0 -42
- data/lib/fog/ext/dynect/requests/dns/get_all_records.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/get_node_list.rb +0 -56
- data/lib/fog/ext/dynect/requests/dns/get_record.rb +0 -85
- data/lib/fog/ext/dynect/requests/dns/get_zone.rb +0 -58
- data/lib/fog/ext/dynect/requests/dns/post_record.rb +0 -72
- data/lib/fog/ext/dynect/requests/dns/post_session.rb +0 -44
- data/lib/fog/ext/dynect/requests/dns/post_zone.rb +0 -71
- data/lib/fog/ext/dynect/requests/dns/put_zone.rb +0 -76
- data/lib/fog/ext/dynect.rb +0 -26
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NjhlMjdhZjYyYmYxYjgxNzY4ZWYyZDRjOTE1ZDU5ODdkZWIyZTMxZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGRjM2YxYzU3OGE4NWE3NGNhYzUyYzRjZGYyN2EwOGQ3OTY0N2QwNg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjJkMzFiMzMxZGY5MzM2YzY5ZjQxM2IxMjAzMjRiMGE5ZDFhMGRjYTc1Nzcz
|
10
|
+
ZmFhZmY3MjczNWZmYTJkMTA3ZTg0ODEyOGY0Y2E5ZGExY2NkMmNkNjZmOTM0
|
11
|
+
NmI3OGEzYWU0MmUxMjhhMzJhNjVkN2Q0ODgxMTcyODVkOGQyODM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzA5ZTZkOGZhN2M5NGI5ZTVlOTYzN2ZjNmM2M2NhNDExNmY2NDAxMjIzN2I1
|
14
|
+
MDExNzdkZDUxNmMzNzkyMTNmZjE0NGFjNDRiZTc3YWQ4OWFkMzg2YmZlYjgx
|
15
|
+
Mjg4MjljNGJhNDgwM2Q0MTNiMDY4NGQxMGU0YjkxOTQzOGRmOWY=
|
data/.crackin.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,21 @@
|
|
1
|
-
|
1
|
+
### Changelog
|
2
2
|
|
3
|
-
|
3
|
+
##### v0.3.1.alpha2:
|
4
|
+
* think I've resolved problem with crackin release
|
5
|
+
|
6
|
+
##### v0.3.1.alpha1:
|
7
|
+
* trouble with crackin release process
|
8
|
+
|
9
|
+
##### v0.3.1.alpha0:
|
10
|
+
* add name to crackin config
|
11
|
+
* integrate crackin for gem releases
|
12
|
+
* update to fog 1.18
|
13
|
+
* fog issues resolved
|
14
|
+
|
15
|
+
##### v0.3.0:
|
4
16
|
* sync version with server
|
5
17
|
|
6
|
-
|
18
|
+
##### v0.2.0:
|
7
19
|
* tests green.
|
8
20
|
* conversion work completed... still want to test things a bit
|
9
21
|
* custom create method for balancers
|
@@ -36,19 +48,19 @@
|
|
36
48
|
* providers support
|
37
49
|
* orgs
|
38
50
|
|
39
|
-
|
51
|
+
##### v0.1.11:
|
40
52
|
* fixes bug if disabled is not set
|
41
53
|
|
42
|
-
|
54
|
+
##### v0.1.10:
|
43
55
|
* allow for disabling plugins
|
44
56
|
|
45
|
-
|
57
|
+
##### v0.1.9:
|
46
58
|
* fucking bug in dns code again
|
47
59
|
|
48
|
-
|
60
|
+
##### v0.1.8:
|
49
61
|
* revert new dsl creeping in when it wasnt supposed to
|
50
62
|
|
51
|
-
|
63
|
+
##### v0.1.7:
|
52
64
|
* fix lingering error with Account.list change
|
53
65
|
* merge v0.1.6
|
54
66
|
* merge release v0.1.2
|
@@ -56,7 +68,7 @@
|
|
56
68
|
* ruby version file
|
57
69
|
* changelog rake tasks
|
58
70
|
|
59
|
-
|
71
|
+
##### v0.1.6:
|
60
72
|
* update rails to 3.2.14. tweak plugins jobs output to match qujo. fix issue with getting zones through fog
|
61
73
|
* smarter errors in dns connect. add and use Account#get instead of @list attr
|
62
74
|
* merge
|
@@ -65,12 +77,15 @@
|
|
65
77
|
* ruby version file
|
66
78
|
* changelog rake tasks
|
67
79
|
|
68
|
-
|
80
|
+
##### v0.1.5:
|
81
|
+
|
82
|
+
|
83
|
+
##### v0.1.4:
|
69
84
|
* merge
|
70
85
|
* hard code rake version in Gemfile to match mystro server
|
71
86
|
* support for templates in userdata, handled like files, but processed through erubis
|
72
87
|
|
73
|
-
|
88
|
+
##### v0.1.3:
|
74
89
|
* fixes bugs with dns usage and plugin methods when no plugins are defined
|
75
90
|
* update ruby version
|
76
91
|
* lock activesupport to same version as rails for mystro/server
|
@@ -80,13 +95,16 @@
|
|
80
95
|
* ruby version file
|
81
96
|
* changelog rake tasks
|
82
97
|
|
83
|
-
|
98
|
+
##### v0.1.2:
|
84
99
|
* new plugin support code for mystro-volley integration
|
85
100
|
* new DSL framework
|
86
101
|
* ruby version file
|
87
102
|
* changelog rake tasks
|
88
103
|
|
89
|
-
|
104
|
+
##### v0.1.1:
|
90
105
|
* new DSL framework
|
91
106
|
* ruby version file
|
92
107
|
|
108
|
+
##### v0.1.0:
|
109
|
+
|
110
|
+
|
data/Gemfile
CHANGED
@@ -1,62 +1,7 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ext/dynect/models/dns/record'
|
3
|
-
|
4
1
|
module Fog
|
5
2
|
module DNS
|
6
3
|
class Dynect
|
7
|
-
|
8
4
|
class Records < Fog::Collection
|
9
|
-
|
10
|
-
attribute :zone
|
11
|
-
|
12
|
-
model Fog::DNS::Dynect::Record
|
13
|
-
|
14
|
-
def all(options = {})
|
15
|
-
requires :zone
|
16
|
-
data = []
|
17
|
-
service.get_all_records(zone.domain, options).body['data'].each do |url|
|
18
|
-
(_, _, t, _, fqdn, id) = url.split('/')
|
19
|
-
type = t.gsub(/Record$/, '')
|
20
|
-
|
21
|
-
# leave out the default, read only records
|
22
|
-
# by putting this here we don't make the secondary request for these records
|
23
|
-
next if ['NS', 'SOA'].include?(type)
|
24
|
-
record = service.get_record(type, zone.domain, fqdn, 'record_id' => id).body['data']
|
25
|
-
|
26
|
-
data << {
|
27
|
-
:identity => record['record_id'],
|
28
|
-
:fqdn => record['fqdn'],
|
29
|
-
:type => record['record_type'],
|
30
|
-
:rdata => record['rdata']
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
load(data)
|
35
|
-
end
|
36
|
-
|
37
|
-
def get(record_id)
|
38
|
-
requires :zone
|
39
|
-
|
40
|
-
list = service.get_all_records(zone.domain, {}).body['data']
|
41
|
-
url = list.detect { |e| e =~ /\/#{record_id}$/ }
|
42
|
-
return unless url
|
43
|
-
(_, _, t, _, fqdn, id) = url.split('/')
|
44
|
-
type = t.gsub(/Record$/, '')
|
45
|
-
record = service.get_record(type, zone.domain, fqdn, 'record_id' => id).body['data']
|
46
|
-
|
47
|
-
new({
|
48
|
-
:identity => record['record_id'],
|
49
|
-
:fqdn => record['fqdn'],
|
50
|
-
:type => record['record_type'],
|
51
|
-
:rdata => record['rdata']
|
52
|
-
})
|
53
|
-
end
|
54
|
-
|
55
|
-
def new(attributes = {})
|
56
|
-
requires :zone
|
57
|
-
super({:zone => zone}.merge!(attributes))
|
58
|
-
end
|
59
|
-
|
60
5
|
def find_by_name(name)
|
61
6
|
requires :zone
|
62
7
|
data = []
|
@@ -79,9 +24,7 @@ module Fog
|
|
79
24
|
|
80
25
|
load(data)
|
81
26
|
end
|
82
|
-
|
83
27
|
end
|
84
|
-
|
85
28
|
end
|
86
29
|
end
|
87
30
|
end
|
data/mystro-common.gemspec
CHANGED
@@ -4,24 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'mystro/common/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
7
|
+
gem.name = 'mystro-common'
|
8
8
|
gem.version = Mystro::Common::Version::STRING
|
9
|
-
gem.authors = [
|
10
|
-
gem.email = [
|
9
|
+
gem.authors = ['Shawn Catanzarite']
|
10
|
+
gem.email = ['me@shawncatz.com']
|
11
11
|
gem.description = %q{common functionality for Mystro}
|
12
12
|
gem.summary = %q{common functionality for Mystro}
|
13
|
-
gem.homepage =
|
13
|
+
gem.homepage = 'http://github.com/mystro'
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = [
|
18
|
+
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.add_dependency
|
21
|
-
gem.add_dependency
|
22
|
-
gem.add_dependency
|
23
|
-
gem.add_dependency
|
24
|
-
gem.add_dependency
|
25
|
-
gem.add_dependency
|
26
|
-
gem.add_dependency
|
20
|
+
gem.add_dependency 'fog', '~> 1.18.0' # talk to cloud
|
21
|
+
gem.add_dependency 'unf'
|
22
|
+
gem.add_dependency 'yell', '~> 1.2.0' # logging
|
23
|
+
gem.add_dependency 'hashie' # better data objects
|
24
|
+
gem.add_dependency 'activesupport', '3.2.14' # active support
|
25
|
+
gem.add_dependency 'ipaddress' # ip address library
|
26
|
+
gem.add_dependency 'erubis' # userdata templates
|
27
|
+
gem.add_dependency 'damsel', '~> 0.1.0' # dsl
|
27
28
|
end
|
data/spec/support/record.rb
CHANGED
@@ -9,29 +9,49 @@ shared_examples "cloud record" do
|
|
9
9
|
model
|
10
10
|
end
|
11
11
|
|
12
|
-
context
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
context 'find', :find do
|
13
|
+
context 'by id' do
|
14
|
+
let(:id) { config[:id] }
|
15
|
+
let(:name) { config[:name] }
|
16
|
+
let(:found) { cloud.find(id) }
|
17
|
+
|
18
|
+
subject { found }
|
19
|
+
it { should be_instance_of(Mystro::Cloud::Record) }
|
20
|
+
its(:id) { should == id }
|
21
|
+
its(:name) { should == name }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'by name' do
|
25
|
+
let(:id) { config[:id] }
|
26
|
+
let(:name) { config[:name] }
|
27
|
+
let(:found) { cloud.find_by_name(name) }
|
28
|
+
|
29
|
+
subject { found }
|
30
|
+
it { should be_instance_of(Mystro::Cloud::Record) }
|
31
|
+
its(:id) { should == id }
|
32
|
+
its(:name) { should == name }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'doesnt exist' do
|
36
|
+
let(:id) { '123456789'}
|
37
|
+
it 'should handle missing' do
|
38
|
+
expect { cloud.find(id) }.to raise_error(Mystro::Cloud::NotFound)
|
39
|
+
#expect(found).to be(nil)
|
40
|
+
end
|
41
|
+
end
|
21
42
|
end
|
22
43
|
|
23
|
-
context
|
44
|
+
context 'all', :all do
|
24
45
|
let(:all) { cloud.all }
|
25
|
-
it
|
46
|
+
it 'should return models' do
|
26
47
|
all.each do |i|
|
27
48
|
expect(i).to be_instance_of(Mystro::Cloud::Record)
|
28
49
|
end
|
29
50
|
end
|
30
51
|
end
|
31
52
|
|
32
|
-
context
|
33
|
-
|
34
|
-
it "should create and destroy" do
|
53
|
+
context 'create and destroy', :cad do
|
54
|
+
it 'should create and destroy' do
|
35
55
|
n = cloud.create(model)
|
36
56
|
expect(n).to be_instance_of(Mystro::Cloud::Record)
|
37
57
|
expect(n.name).not_to be(nil)
|
metadata
CHANGED
@@ -1,36 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mystro-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1.alpha2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Shawn Catanzarite
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fog
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: 1.18.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
26
|
+
version: 1.18.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: unf
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: yell
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
45
|
- - ~>
|
36
46
|
- !ruby/object:Gem::Version
|
@@ -38,7 +48,6 @@ dependencies:
|
|
38
48
|
type: :runtime
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
52
|
- - ~>
|
44
53
|
- !ruby/object:Gem::Version
|
@@ -46,7 +55,6 @@ dependencies:
|
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: hashie
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
59
|
- - ! '>='
|
52
60
|
- !ruby/object:Gem::Version
|
@@ -54,7 +62,6 @@ dependencies:
|
|
54
62
|
type: :runtime
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
66
|
- - ! '>='
|
60
67
|
- !ruby/object:Gem::Version
|
@@ -62,7 +69,6 @@ dependencies:
|
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: activesupport
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
73
|
- - '='
|
68
74
|
- !ruby/object:Gem::Version
|
@@ -70,7 +76,6 @@ dependencies:
|
|
70
76
|
type: :runtime
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
80
|
- - '='
|
76
81
|
- !ruby/object:Gem::Version
|
@@ -78,7 +83,6 @@ dependencies:
|
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: ipaddress
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
87
|
- - ! '>='
|
84
88
|
- !ruby/object:Gem::Version
|
@@ -86,7 +90,6 @@ dependencies:
|
|
86
90
|
type: :runtime
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
94
|
- - ! '>='
|
92
95
|
- !ruby/object:Gem::Version
|
@@ -94,7 +97,6 @@ dependencies:
|
|
94
97
|
- !ruby/object:Gem::Dependency
|
95
98
|
name: erubis
|
96
99
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
100
|
requirements:
|
99
101
|
- - ! '>='
|
100
102
|
- !ruby/object:Gem::Version
|
@@ -102,7 +104,6 @@ dependencies:
|
|
102
104
|
type: :runtime
|
103
105
|
prerelease: false
|
104
106
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
107
|
requirements:
|
107
108
|
- - ! '>='
|
108
109
|
- !ruby/object:Gem::Version
|
@@ -110,7 +111,6 @@ dependencies:
|
|
110
111
|
- !ruby/object:Gem::Dependency
|
111
112
|
name: damsel
|
112
113
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
@@ -118,7 +118,6 @@ dependencies:
|
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
121
|
requirements:
|
123
122
|
- - ~>
|
124
123
|
- !ruby/object:Gem::Version
|
@@ -130,6 +129,7 @@ executables: []
|
|
130
129
|
extensions: []
|
131
130
|
extra_rdoc_files: []
|
132
131
|
files:
|
132
|
+
- .crackin.yml
|
133
133
|
- .gitignore
|
134
134
|
- .rspec
|
135
135
|
- .ruby-version
|
@@ -139,22 +139,7 @@ files:
|
|
139
139
|
- README.md
|
140
140
|
- Rakefile
|
141
141
|
- lib/fog/ext/balancer.rb
|
142
|
-
- lib/fog/ext/dynect.rb
|
143
|
-
- lib/fog/ext/dynect/dns.rb
|
144
|
-
- lib/fog/ext/dynect/models/dns/record.rb
|
145
142
|
- lib/fog/ext/dynect/models/dns/records.rb
|
146
|
-
- lib/fog/ext/dynect/models/dns/zone.rb
|
147
|
-
- lib/fog/ext/dynect/models/dns/zones.rb
|
148
|
-
- lib/fog/ext/dynect/requests/dns/delete_record.rb
|
149
|
-
- lib/fog/ext/dynect/requests/dns/delete_zone.rb
|
150
|
-
- lib/fog/ext/dynect/requests/dns/get_all_records.rb
|
151
|
-
- lib/fog/ext/dynect/requests/dns/get_node_list.rb
|
152
|
-
- lib/fog/ext/dynect/requests/dns/get_record.rb
|
153
|
-
- lib/fog/ext/dynect/requests/dns/get_zone.rb
|
154
|
-
- lib/fog/ext/dynect/requests/dns/post_record.rb
|
155
|
-
- lib/fog/ext/dynect/requests/dns/post_session.rb
|
156
|
-
- lib/fog/ext/dynect/requests/dns/post_zone.rb
|
157
|
-
- lib/fog/ext/dynect/requests/dns/put_zone.rb
|
158
143
|
- lib/mystro-common.rb
|
159
144
|
- lib/mystro/capistrano.rb
|
160
145
|
- lib/mystro/cloud.rb
|
@@ -208,33 +193,26 @@ files:
|
|
208
193
|
- test/config.yml
|
209
194
|
homepage: http://github.com/mystro
|
210
195
|
licenses: []
|
196
|
+
metadata: {}
|
211
197
|
post_install_message:
|
212
198
|
rdoc_options: []
|
213
199
|
require_paths:
|
214
200
|
- lib
|
215
201
|
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
-
none: false
|
217
202
|
requirements:
|
218
203
|
- - ! '>='
|
219
204
|
- !ruby/object:Gem::Version
|
220
205
|
version: '0'
|
221
|
-
segments:
|
222
|
-
- 0
|
223
|
-
hash: -201190253362544138
|
224
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
207
|
requirements:
|
227
|
-
- - ! '
|
208
|
+
- - ! '>'
|
228
209
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
230
|
-
segments:
|
231
|
-
- 0
|
232
|
-
hash: -201190253362544138
|
210
|
+
version: 1.3.1
|
233
211
|
requirements: []
|
234
212
|
rubyforge_project:
|
235
|
-
rubygems_version: 1.
|
213
|
+
rubygems_version: 2.1.10
|
236
214
|
signing_key:
|
237
|
-
specification_version:
|
215
|
+
specification_version: 4
|
238
216
|
summary: common functionality for Mystro
|
239
217
|
test_files:
|
240
218
|
- spec/cloud/aws/balancer_spec.rb
|
data/lib/fog/ext/dynect/dns.rb
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
require 'fog/dynect'
|
2
|
-
require 'fog/dns'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module DNS
|
6
|
-
class Dynect < Fog::Service
|
7
|
-
|
8
|
-
requires :dynect_customer, :dynect_username, :dynect_password
|
9
|
-
recognizes :timeout, :persistent
|
10
|
-
recognizes :provider # remove post deprecation
|
11
|
-
|
12
|
-
model_path 'fog/ext/dynect/models/dns'
|
13
|
-
model :record
|
14
|
-
collection :records
|
15
|
-
model :zone
|
16
|
-
collection :zones
|
17
|
-
|
18
|
-
request_path 'fog/ext/dynect/requests/dns'
|
19
|
-
request :delete_record
|
20
|
-
request :delete_zone
|
21
|
-
request :get_node_list
|
22
|
-
request :get_all_records
|
23
|
-
request :get_record
|
24
|
-
request :get_zone
|
25
|
-
request :post_record
|
26
|
-
request :post_session
|
27
|
-
request :post_zone
|
28
|
-
request :put_zone
|
29
|
-
|
30
|
-
class JobIncomplete < Error; end
|
31
|
-
|
32
|
-
class Mock
|
33
|
-
def initialize(options={})
|
34
|
-
@dynect_customer = options[:dynect_customer]
|
35
|
-
@dynect_username = options[:dynect_username]
|
36
|
-
@dynect_password = options[:dynect_password]
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.data
|
40
|
-
@data ||= {
|
41
|
-
:zones => {}
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.reset
|
46
|
-
@data = nil
|
47
|
-
end
|
48
|
-
|
49
|
-
def auth_token
|
50
|
-
@auth_token ||= Fog::Dynect::Mock.token
|
51
|
-
end
|
52
|
-
|
53
|
-
def data
|
54
|
-
self.class.data
|
55
|
-
end
|
56
|
-
|
57
|
-
def reset_data
|
58
|
-
self.class.reset
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
class Real
|
63
|
-
def initialize(options={})
|
64
|
-
@dynect_customer = options[:dynect_customer]
|
65
|
-
@dynect_username = options[:dynect_username]
|
66
|
-
@dynect_password = options[:dynect_password]
|
67
|
-
|
68
|
-
@connection_options = options[:connection_options] || {}
|
69
|
-
@host = 'api-v4.dynect.net'
|
70
|
-
@port = options[:port] || 443
|
71
|
-
@path = options[:path] || '/REST'
|
72
|
-
@persistent = options[:persistent] || false
|
73
|
-
@scheme = options[:scheme] || 'https'
|
74
|
-
@version = options[:version] || '3.5.2'
|
75
|
-
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
76
|
-
end
|
77
|
-
|
78
|
-
def auth_token
|
79
|
-
@auth_token ||= post_session.body['data']['token']
|
80
|
-
end
|
81
|
-
|
82
|
-
def request(params)
|
83
|
-
begin
|
84
|
-
# any request could redirect to a job
|
85
|
-
params[:expects] = Array(params[:expects]) | [307]
|
86
|
-
|
87
|
-
params[:headers] ||= {}
|
88
|
-
params[:headers]['Content-Type'] = 'application/json'
|
89
|
-
params[:headers]['API-Version'] = @version
|
90
|
-
params[:headers]['Auth-Token'] = auth_token unless params[:path] == 'Session'
|
91
|
-
params[:path] = "#{@path}/#{params[:path]}" unless params[:path] =~ %r{^#{Regexp.escape(@path)}/}
|
92
|
-
|
93
|
-
response = @connection.request(params.merge!({:host => @host}))
|
94
|
-
|
95
|
-
if response.body.empty?
|
96
|
-
response.body = {}
|
97
|
-
elsif response.headers['Content-Type'] == 'application/json'
|
98
|
-
response.body = Fog::JSON.decode(response.body)
|
99
|
-
end
|
100
|
-
|
101
|
-
if response.body['status'] == 'failure'
|
102
|
-
raise Error, response.body['msgs'].first['INFO']
|
103
|
-
end
|
104
|
-
|
105
|
-
if response.status == 307 && params[:path] !~ %r{^/REST/Job/}
|
106
|
-
response = poll_job(response, params[:expects])
|
107
|
-
end
|
108
|
-
|
109
|
-
response
|
110
|
-
rescue Excon::Errors::HTTPStatusError => error
|
111
|
-
if @auth_token && error.message =~ /login: (Bad or expired credentials|inactivity logout)/
|
112
|
-
@auth_token = nil
|
113
|
-
retry
|
114
|
-
else
|
115
|
-
raise error
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
response
|
120
|
-
end
|
121
|
-
|
122
|
-
def poll_job(response, original_expects, time_to_wait = 10)
|
123
|
-
job_location = response.headers['Location']
|
124
|
-
|
125
|
-
Fog.wait_for(time_to_wait) do
|
126
|
-
response = request(:expects => original_expects, :method => :get, :path => job_location)
|
127
|
-
response.body['status'] != 'incomplete'
|
128
|
-
end
|
129
|
-
|
130
|
-
if response.body['status'] == 'incomplete'
|
131
|
-
raise JobIncomplete.new("Job #{response.body['job_id']} is still incomplete")
|
132
|
-
end
|
133
|
-
|
134
|
-
response
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|