Skip to content
Snippets Groups Projects
Commit e8b2b584 authored by Grant Young's avatar Grant Young
Browse files

Fix get-postgresql-primary command for Geo

Will now return Geo PG primary as well

Changelog: fixed
parent cbc06636
No related branches found
No related tags found
2 merge requests!51Validate shift of Heptapod 0.25 to oldstable series,!44GitLab 14.0
......@@ -15,8 +15,12 @@
result = []
Resolv::DNS.open(nameserver_port: [['127.0.0.1', 8600]]) do |dns|
result = dns.getresources("master.#{postgresql_service_name}.service.consul", Resolv::DNS::Resource::IN::SRV).map do |srv|
"#{dns.getaddress(srv.target)}:#{srv.port}"
['master', 'standby-leader'].each do |postgresql_primary_service_name|
result = dns.getresources("#{postgresql_primary_service_name}.#{postgresql_service_name}.service.consul", Resolv::DNS::Resource::IN::SRV).map do |srv|
"#{dns.getaddress(srv.target)}:#{srv.port}"
end
return result unless result.empty?
end
end
......@@ -20,9 +24,7 @@
end
end
raise 'PostgreSQL Primary could not be found via Consul DNS' if result.empty?
result
raise 'PostgreSQL Primary could not be found via Consul DNS'
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment