Skip to content

Commit

Permalink
Merge pull request fog#2400 from maestrodev/aws-dns-status
Browse files Browse the repository at this point in the history
[aws|dns] Don't set mock changes to INSYNC immediately, only after some timeout
  • Loading branch information
geemus committed Nov 19, 2013
2 parents 6d1106f + 747c7f2 commit e0835fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/dns/change_resource_record_sets.rb
Expand Up @@ -180,7 +180,7 @@ def change_resource_record_sets(zone_id, change_batch, options = {})
if errors.empty?
change = {
:id => change_id,
:status => 'INSYNC',
:status => 'PENDING',
:submitted_at => Time.now.utc.iso8601
}
self.data[:changes][change[:id]] = change
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/aws/requests/dns/create_hosted_zone.rb
Expand Up @@ -82,7 +82,7 @@ def create_hosted_zone(name, options = {})
}
change = {
:id => Fog::AWS::Mock.change_id,
:status => 'INSYNC',
:status => 'PENDING',
:submitted_at => Time.now.utc.iso8601
}
self.data[:changes][change[:id]] = change
Expand Down
4 changes: 3 additions & 1 deletion lib/fog/aws/requests/dns/get_change.rb
Expand Up @@ -43,9 +43,11 @@ def get_change(change_id)

if change
response.status = 200
submitted_at = Time.parse(change[:submitted_at])
response.body = {
'Id' => change[:id],
'Status' => 'INSYNC', # TODO do some logic here
# set as insync after some time
'Status' => (submitted_at + (Fog.timeout/4).to_i) < Time.now ? 'INSYNC' : change[:status],
'SubmittedAt' => change[:submitted_at]
}
response
Expand Down

0 comments on commit e0835fd

Please sign in to comment.