cloudflare-dns-update 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloudflare/dns/update/command.rb +18 -17
- data/lib/cloudflare/dns/update/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: 6dad16eca439baf778b65ace80eee737f6ab3884
|
4
|
+
data.tar.gz: fec02f50d441f579a4e5d3b560c1dcfb086a9bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c35465cc6f0145337771131676d5d071c4c7d4c00b4e504c2c9452cc27dce547c4a267120c6e4b86f24f7c62c2202058b7d09050df830dfd4f18e17e9c068f
|
7
|
+
data.tar.gz: f8c26eef30fb4fe0ce5058002fd4be70ea4957be9b6ea8b45f78e182a3e62653ca926aa1d9dae12db740263e8b1c88d22bc8be90aa8b2df392d67136e830da21
|
@@ -40,6 +40,7 @@ module Cloudflare::DNS::Update
|
|
40
40
|
|
41
41
|
options do
|
42
42
|
option '-c/--configuration <path>', "Use the specified configuration file."
|
43
|
+
option '-f/--force', "Force push updates to cloudflare even if content hasn't changed.", default: false
|
43
44
|
option '--verbose | --quiet', "Verbosity of output for debugging.", key: :logging
|
44
45
|
option '-h/--help', "Print out help information."
|
45
46
|
option '-v/--version', "Print out the application version."
|
@@ -138,14 +139,13 @@ module Cloudflare::DNS::Update
|
|
138
139
|
raise RuntimeError.new("Couldn't load zone #{configuration[:zone].inspect} from API!")
|
139
140
|
end
|
140
141
|
|
141
|
-
|
142
|
-
|
142
|
+
# Make sure there is no trailing space:
|
143
143
|
content.chomp!
|
144
144
|
|
145
|
-
configuration[:
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
if content != configuration[:content] || @options[:force]
|
146
|
+
logger.info "Content changed #{content.inspect}, updating records..."
|
147
|
+
|
148
|
+
configuration[:domains].each do |record|
|
149
149
|
domain = zone.dns_records.find_by_id(record[:id])
|
150
150
|
|
151
151
|
changes = {
|
@@ -162,9 +162,12 @@ module Cloudflare::DNS::Update
|
|
162
162
|
else
|
163
163
|
logger.warn "Failed to update domain content to #{content}: #{response.errors.join(', ')}!"
|
164
164
|
end
|
165
|
-
else
|
166
|
-
logger.debug "Content hasn't changed."
|
167
165
|
end
|
166
|
+
|
167
|
+
# Save the last value of content:
|
168
|
+
configuration[:content] = content
|
169
|
+
else
|
170
|
+
logger.debug "Content hasn't changed."
|
168
171
|
end
|
169
172
|
|
170
173
|
return content
|
@@ -177,15 +180,13 @@ module Cloudflare::DNS::Update
|
|
177
180
|
elsif @options[:help]
|
178
181
|
print_usage(program_name)
|
179
182
|
else
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
update_domains
|
188
|
-
end
|
183
|
+
connect!
|
184
|
+
|
185
|
+
initialize_zone
|
186
|
+
initialize_domains
|
187
|
+
initialize_command
|
188
|
+
|
189
|
+
update_domains
|
189
190
|
end
|
190
191
|
end
|
191
192
|
end
|