mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Support freeze and thaw.
This commit is contained in:
parent
18c672f194
commit
3900846820
2 changed files with 45 additions and 22 deletions
|
@ -31,36 +31,43 @@ module Fog
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
|
|
||||||
if options[:freeze]
|
data = {}
|
||||||
zone[:frozen] = true
|
|
||||||
elsif options[:publish]
|
if options['freeze']
|
||||||
|
zone['frozen'] = true
|
||||||
|
info = "freeze: Your zone is now frozen"
|
||||||
|
elsif options['publish']
|
||||||
zone[:changes] = {}
|
zone[:changes] = {}
|
||||||
zone[:records_to_delete].each do |record|
|
zone[:records_to_delete].each do |record|
|
||||||
zone[:records][record[:type]].delete_if { |r| r[:fqdn] == record[:fqdn] && r[:record_id] == record[:record_id] }
|
zone[:records][record[:type]].delete_if { |r| r[:fqdn] == record[:fqdn] && r[:record_id] == record[:record_id] }
|
||||||
end
|
end
|
||||||
zone[:records_to_delete] = []
|
zone[:records_to_delete] = []
|
||||||
response.body = {
|
data = {
|
||||||
"status" => "success",
|
"zone_type" => zone[:zone_type],
|
||||||
"data" => {
|
"serial_style" => zone[:serial_style],
|
||||||
"zone_type" => zone[:zone_type],
|
"serial" => zone[:serial] += 1,
|
||||||
"serial_style" => zone[:serial_style],
|
"zone" => zone[:zone]
|
||||||
"serial" => zone[:serial] += 1,
|
|
||||||
"zone" => zone[:zone]
|
|
||||||
},
|
|
||||||
"job_id" => Fog::Dynect::Mock.job_id,
|
|
||||||
"msgs" => [{
|
|
||||||
"INFO" => "publish: #{zone[:zone]} published",
|
|
||||||
"SOURCE"=>"BLL",
|
|
||||||
"ERR_CD"=>nil,
|
|
||||||
"LVL"=>"INFO"
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
elsif options[:thaw]
|
info = "publish: #{zone[:zone]} published"
|
||||||
|
elsif options['thaw']
|
||||||
zone[:frozen] = false
|
zone[:frozen] = false
|
||||||
|
info = "thaw: Your zone is now thawed, you may edit normally"
|
||||||
else
|
else
|
||||||
raise ArgumentError
|
raise ArgumentError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.body = {
|
||||||
|
"status" => "success",
|
||||||
|
"data" => data,
|
||||||
|
"job_id" => Fog::Dynect::Mock.job_id,
|
||||||
|
"msgs" => [{
|
||||||
|
"INFO" => info,
|
||||||
|
"SOURCE"=>"BLL",
|
||||||
|
"ERR_CD"=>nil,
|
||||||
|
"LVL"=>"INFO"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,7 +79,7 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
||||||
@dns.post_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}, {}).body
|
@dns.post_record('A', @domain, @fqdn, {'address' => '1.2.3.4'}, {}).body
|
||||||
end
|
end
|
||||||
|
|
||||||
put_zone_format = shared_format.merge({
|
publish_zone_format = shared_format.merge({
|
||||||
'data' => {
|
'data' => {
|
||||||
'serial' => Integer,
|
'serial' => Integer,
|
||||||
'serial_style' => String,
|
'serial_style' => String,
|
||||||
|
@ -88,8 +88,24 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
tests("put_zone('#{@domain}', :publish => true)").formats(put_zone_format) do
|
tests("put_zone('#{@domain}', 'publish' => true)").formats(publish_zone_format) do
|
||||||
@dns.put_zone(@domain, :publish => true).body
|
@dns.put_zone(@domain, 'publish' => true).body
|
||||||
|
end
|
||||||
|
|
||||||
|
freeze_zone_format = shared_format.merge({
|
||||||
|
'data' => {}
|
||||||
|
})
|
||||||
|
|
||||||
|
tests("put_zone('#{@domain}', 'freeze' => true)").formats(freeze_zone_format) do
|
||||||
|
@dns.put_zone(@domain, 'freeze' => true).body
|
||||||
|
end
|
||||||
|
|
||||||
|
thaw_zone_format = shared_format.merge({
|
||||||
|
'data' => {}
|
||||||
|
})
|
||||||
|
|
||||||
|
tests("put_zone('#{@domain}', 'thaw' => true)").formats(thaw_zone_format) do
|
||||||
|
@dns.put_zone(@domain, 'thaw' => true).body
|
||||||
end
|
end
|
||||||
|
|
||||||
get_node_list_format = shared_format.merge({
|
get_node_list_format = shared_format.merge({
|
||||||
|
|
Loading…
Reference in a new issue