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,35 +31,42 @@ module Fog
|
|||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
if options[:freeze]
|
||||
zone[:frozen] = true
|
||||
elsif options[:publish]
|
||||
data = {}
|
||||
|
||||
if options['freeze']
|
||||
zone['frozen'] = true
|
||||
info = "freeze: Your zone is now frozen"
|
||||
elsif options['publish']
|
||||
zone[:changes] = {}
|
||||
zone[:records_to_delete].each do |record|
|
||||
zone[:records][record[:type]].delete_if { |r| r[:fqdn] == record[:fqdn] && r[:record_id] == record[:record_id] }
|
||||
end
|
||||
zone[:records_to_delete] = []
|
||||
response.body = {
|
||||
"status" => "success",
|
||||
"data" => {
|
||||
data = {
|
||||
"zone_type" => zone[:zone_type],
|
||||
"serial_style" => zone[:serial_style],
|
||||
"serial" => zone[:serial] += 1,
|
||||
"zone" => zone[:zone]
|
||||
},
|
||||
}
|
||||
info = "publish: #{zone[:zone]} published"
|
||||
elsif options['thaw']
|
||||
zone[:frozen] = false
|
||||
info = "thaw: Your zone is now thawed, you may edit normally"
|
||||
else
|
||||
raise ArgumentError
|
||||
end
|
||||
|
||||
response.body = {
|
||||
"status" => "success",
|
||||
"data" => data,
|
||||
"job_id" => Fog::Dynect::Mock.job_id,
|
||||
"msgs" => [{
|
||||
"INFO" => "publish: #{zone[:zone]} published",
|
||||
"INFO" => info,
|
||||
"SOURCE"=>"BLL",
|
||||
"ERR_CD"=>nil,
|
||||
"LVL"=>"INFO"
|
||||
}]
|
||||
}
|
||||
elsif options[:thaw]
|
||||
zone[:frozen] = false
|
||||
else
|
||||
raise ArgumentError
|
||||
end
|
||||
|
||||
response
|
||||
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
|
||||
end
|
||||
|
||||
put_zone_format = shared_format.merge({
|
||||
publish_zone_format = shared_format.merge({
|
||||
'data' => {
|
||||
'serial' => Integer,
|
||||
'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
|
||||
@dns.put_zone(@domain, :publish => true).body
|
||||
tests("put_zone('#{@domain}', 'publish' => true)").formats(publish_zone_format) do
|
||||
@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
|
||||
|
||||
get_node_list_format = shared_format.merge({
|
||||
|
|
Loading…
Reference in a new issue