Add frontend column to networks & network_memberships tables so the controller knows which system owns the networks & members
Some checks are pending
/ build_macos (push) Waiting to run
/ build_windows (push) Waiting to run
/ Central Controller Build (push) Waiting to run
/ multi-arch-docker (push) Blocked by required conditions
/ build_ubuntu (push) Waiting to run

This commit is contained in:
Grant Limberg 2025-09-05 08:40:03 -07:00
parent ba6200fb96
commit 74f0525470
3 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,5 @@
ALTER TABLE network_memberships_ctl
DROP COLUMN frontend;
ALTER TABLE networks_ctl
DROP COLUMN frontend;

View file

@ -0,0 +1,5 @@
ALTER TABLE networks_ctl
ADD COLUMN frontend TEXT NOT NULL DEFAULT 'cv2';
ALTER TABLE network_memberships_ctl
ADD COLUMN frontend TEXT NOT NULL DEFAULT 'cv2';

View file

@ -615,7 +615,7 @@ void CentralDB::initializeNetworks()
sprintf(
qbuf,
"SELECT id, name, configuration , (EXTRACT(EPOCH FROM creation_time AT TIME ZONE 'UTC')*1000)::bigint, "
"(EXTRACT(EPOCH FROM last_modified AT TIME ZONE 'UTC')*1000)::bigint, revision "
"(EXTRACT(EPOCH FROM last_modified AT TIME ZONE 'UTC')*1000)::bigint, revision, frontend "
"FROM networks_ctl WHERE controller_id = '%s'",
_myAddressStr.c_str());
@ -636,6 +636,8 @@ void CentralDB::initializeNetworks()
std::optional<uint64_t> // last_modified
,
std::optional<uint64_t> // revision
,
std::string // frontend
>
row;
uint64_t count = 0;
@ -708,6 +710,7 @@ void CentralDB::initializeNetworks()
}
config["ipAssignmentPools"] =
cfgtmp["ipAssignmentPools"].is_array() ? cfgtmp["ipAssignmentPools"] : json::array();
config["frontend"] = std::get<6>(row);
Metrics::network_count++;
@ -806,6 +809,7 @@ void CentralDB::initializeMembers()
"(EXTRACT(EPOCH FROM nm.last_authorized_time AT TIME ZONE 'UTC')*1000)::bigint, "
"(EXTRACT(EPOCH FROM nm.last_deauthorized_time AT TIME ZONE 'UTC')*1000)::bigint, "
"nm.remote_trace_level, nm.remote_trace_target, nm.revision, nm.capabilities, nm.tags "
"nm.frontend "
"FROM network_memberships_ctl nm "
"INNER JOIN networks_ctl n "
" ON nm.network_id = n.id "
@ -850,6 +854,8 @@ void CentralDB::initializeMembers()
std::optional<std::string> // capabilities
,
std::optional<std::string> // tags
,
std::string // frontend
>
row;
@ -909,6 +915,7 @@ void CentralDB::initializeMembers()
config["authenticationExpiryTime"] = authentication_expiry_time.value_or(0);
config["tags"] = json::parse(tags.value_or("[]"));
config["ipAssignments"] = json::array();
config["frontend"] = std::get<17>(row);
Metrics::member_count++;