Commit fe55e180 authored by Nick Thomas's avatar Nick Thomas

Fix the primary version and revision being incorrect on Geo secondaries

parent b62ef094
module EE
module GeoHelper
def node_vue_list_properties
version, revision =
if ::Gitlab::Geo.primary?
[::Gitlab::VERSION, ::Gitlab::REVISION]
else
status = ::Gitlab::Geo.primary_node&.status
[status&.version, status&.revision]
end
{
primary_version: version.to_s,
primary_revision: revision.to_s,
node_details_path: admin_geo_nodes_path.to_s,
node_actions_allowed: ::Gitlab::Database.read_write?.to_s,
node_edit_allowed: ::Gitlab::Geo.license_allows?.to_s
}
end
def node_namespaces_options(namespaces)
namespaces.map { |g| { id: g.id, text: g.full_name } }
end
......
......@@ -23,6 +23,6 @@
.alert.alert-warning WARNING: Please upgrade PostgreSQL to version 9.6 or greater. The status of the replication cannot be determined reliably with the current version.
- if @nodes.any?
#js-geo-nodes{ data: { primary_version: "#{Gitlab::VERSION}", primary_revision: "#{Gitlab::REVISION}", node_details_path: "#{admin_geo_nodes_path}", node_actions_allowed: "#{Gitlab::Database.read_write?}", node_edit_allowed: "#{Gitlab::Geo.license_allows?}" } }
#js-geo-nodes{ data: node_vue_list_properties }
- else
= render 'shared/empty_states/geo'
......@@ -426,7 +426,7 @@ describe GeoNodeStatus, :geo do
end
describe '#version' do
it { expect(status.version).to eq(Gitlab::VERSION) }
it { expect(status.version).to eq(Gitlab::VERSION) }
end
describe '#revision' do
......
......@@ -89,6 +89,7 @@ describe API::GeoNodes, :geo, api: true do
it 'fetches the current node status' do
stub_current_geo_node(secondary)
expect(GeoNode).to receive(:find).and_return(secondary)
expect(GeoNodeStatus).to receive(:current_node_status).and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment