splicer-rackspace 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/splicer/rackspace/provider.rb +30 -29
- data/lib/splicer/rackspace/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f13814dc119b3e9aff3187ec8aebb08e1d0fe3e
|
4
|
+
data.tar.gz: 51f90db7dfe062c7cbe88c41a6c1fc20c5d9ef0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76dc848be0402ec16921e67c5fda8ca30dcdf6220f58e568213515d355bc73ccd1fa7e82aadde9646f39573b6ed6af8e432427f0308405a3c02e8cec9343e826
|
7
|
+
data.tar.gz: 3b8223d2979ffb69c294f024541375d961a0f84fd3dfd7a6a2dbbef423151f8417a71e4ec74a6e6dc2043420a7686ae45b29e5d2985bce58c83c72d3e9f6aab7
|
@@ -41,7 +41,7 @@ module Splicer
|
|
41
41
|
return false unless domain
|
42
42
|
|
43
43
|
rax_record = domain.records.detect { |r| r.name == record.name && r.type == record.type }
|
44
|
-
rax_record ? rax_record.update(record_payload(record)) : false
|
44
|
+
rax_record ? rax_record.update(record_payload(record, zone)) : false
|
45
45
|
end
|
46
46
|
|
47
47
|
def create_record_in_zone(record, zone)
|
@@ -49,7 +49,7 @@ module Splicer
|
|
49
49
|
domain = client.zones.get(zone.name) || client.zones.create(domain: zone.name, email: config.email)
|
50
50
|
|
51
51
|
rax_record = domain.records.detect { |r| r.name == record.name && r.type == record.type }
|
52
|
-
rax_record ? false : domain.records.create(record_payload(record))
|
52
|
+
rax_record ? false : domain.records.create(record_payload(record, zone))
|
53
53
|
end
|
54
54
|
|
55
55
|
def get_records_for(zone)
|
@@ -61,38 +61,39 @@ module Splicer
|
|
61
61
|
|
62
62
|
private
|
63
63
|
|
64
|
-
def record_payload(record)
|
64
|
+
def record_payload(record, zone)
|
65
65
|
payload = {
|
66
66
|
type: record.type,
|
67
|
-
name: record.name ? record.name : '',
|
67
|
+
name: record.name ? "#{record.name}.#{zone.name}" : '',
|
68
68
|
ttl: record.ttl
|
69
69
|
}
|
70
70
|
case record
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
71
|
+
when Splicer::Records::ARecord
|
72
|
+
payload.merge!({ value: record.ip })
|
73
|
+
when Splicer::Records::AAAARecord
|
74
|
+
payload.merge!({ value: record.ip })
|
75
|
+
when Splicer::Records::CNAMERecord
|
76
|
+
# Removes last period
|
77
|
+
payload.merge!({ value: record.cname.sub(/\.\z/, '') })
|
78
|
+
when Splicer::Records::MXRecord
|
79
|
+
payload.merge!({ value: record.exchanger, mxLevel: record.priority })
|
80
|
+
when Splicer::Records::NSRecord
|
81
|
+
payload.merge!({ value: record.server })
|
82
|
+
when Splicer::Records::PTRRecord
|
83
|
+
payload.merge!({ value: record.host })
|
84
|
+
when Splicer::Records::SRVRecord
|
85
|
+
payload.merge!({
|
86
|
+
value: record.target,
|
87
|
+
weight: record.weight,
|
88
|
+
priority: record.priority,
|
89
|
+
port: record.port
|
90
|
+
})
|
91
|
+
when Splicer::Records::TXTRecord
|
92
|
+
payload.merge!({
|
93
|
+
value: record.text
|
94
|
+
})
|
95
|
+
else
|
96
|
+
payload = {}
|
96
97
|
end
|
97
98
|
payload
|
98
99
|
end
|