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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9325ef5229cb9e11dd797df6016985219d8d3bb8
4
- data.tar.gz: a48cba9df16494208d1a6f7cd295e59310757899
3
+ metadata.gz: 8f13814dc119b3e9aff3187ec8aebb08e1d0fe3e
4
+ data.tar.gz: 51f90db7dfe062c7cbe88c41a6c1fc20c5d9ef0d
5
5
  SHA512:
6
- metadata.gz: 0764521d534c8b2aab6d8f3b35ffc1fce48038660bfdc7de870925757158cfcf218b3a4c2ff83a6dc9c0c782a764ae6691af55d16bb8b5713758cd56ae164784
7
- data.tar.gz: fc2b518b362b9002dbb191f8de64ef93b02895b7bd5eaae7680db75092eaac830f2633195f687a12280bb6838b69da60185fb755d700e1cbc55dc0e6d5fb3f1b
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
- 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
- payload.merge!({ value: record.cname })
77
- when Splicer::Records::MXRecord
78
- payload.merge!({ value: record.exchanger, mxLevel: record.priority })
79
- when Splicer::Records::NSRecord
80
- payload.merge!({ value: record.server })
81
- when Splicer::Records::PTRRecord
82
- payload.merge!({ value: record.host })
83
- when Splicer::Records::SRVRecord
84
- payload.merge!({
85
- value: record.target,
86
- weight: record.weight,
87
- priority: record.priority,
88
- port: record.port
89
- })
90
- when Splicer::Records::TXTRecord
91
- payload.merge!({
92
- value: record.text
93
- })
94
- else
95
- payload = {}
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
@@ -1,5 +1,5 @@
1
1
  module Splicer
2
2
  module Rackspace
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splicer-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Garcia