hub: gofmt -w on 22 files, formatting only, no behaviour change (R-1160)
This commit is contained in:
1 parent
db2371c6f5
commit
d5e3c8b0d9
22 files changed
+81
-73
No files matched your search
@@ -58,10 +58,10 @@ func TestDRTierBackfill_InitializesFromReality(t *testing.T) {
|
||||
mustExec(`INSERT INTO customer_configs (customer_id, retrieval_password, api_key) VALUES (?, ?, ?)`,
|
||||
id, "pw", "key-"+id)
|
||||
}
|
||||
seedCustomer("applied") // host carries an ENABLED descriptor → must flip ON
|
||||
seedCustomer("disabled") // descriptor present but enabled:false → must stay OFF
|
||||
seedCustomer("plain") // no descriptor at all → must stay OFF
|
||||
seedCustomer("hostless") // no host row → must stay OFF
|
||||
seedCustomer("applied") // host carries an ENABLED descriptor → must flip ON
|
||||
seedCustomer("disabled") // descriptor present but enabled:false → must stay OFF
|
||||
seedCustomer("plain") // no descriptor at all → must stay OFF
|
||||
seedCustomer("hostless") // no host row → must stay OFF
|
||||
mustExec(`INSERT INTO hosts (host_id, customer_id, api_key, desired_json) VALUES (?, ?, ?, ?)`,
|
||||
"applied-01", "applied", "h1",
|
||||
`{"pbs_dr":{"enabled":true,"storage_id":"felhom-pbs","namespace":"applied"}}`)
|
||||
|
||||
@@ -76,9 +76,9 @@ func TestGlobalFloor_DBOverridesDefault(t *testing.T) {
|
||||
// EffectiveMinControllerVersion ever returns the global when an override is set.
|
||||
func TestEffectiveFloor_OverrideBeatsGlobal(t *testing.T) {
|
||||
s := newFloorTestStore(t)
|
||||
s.SetDefaultMinControllerVersion("0.85.0") // global
|
||||
mkCustomer(t, s, "c", "0.87.0") // per-customer override
|
||||
mkCustomer(t, s, "other", "") // no override → uses global
|
||||
s.SetDefaultMinControllerVersion("0.85.0") // global
|
||||
mkCustomer(t, s, "c", "0.87.0") // per-customer override
|
||||
mkCustomer(t, s, "other", "") // no override → uses global
|
||||
|
||||
if got := s.EffectiveMinControllerVersion("c"); got != "0.87.0" {
|
||||
t.Errorf("effective floor for c = %q, want 0.87.0 (override beats global)", got)
|
||||
|
||||
@@ -42,7 +42,7 @@ const (
|
||||
// matcher: fingerprints/checksums are logged by design and are public.
|
||||
var secretPatterns = []*regexp.Regexp{
|
||||
regexp.MustCompile(`-----BEGIN [A-Z ]*PRIVATE KEY-----`),
|
||||
regexp.MustCompile(`\bre_[A-Za-z0-9]{10,}`), // Resend API key shape
|
||||
regexp.MustCompile(`\bre_[A-Za-z0-9]{10,}`), // Resend API key shape
|
||||
regexp.MustCompile(`PVEAPIToken=[^\s"']+:\S+`), // Proxmox token WITH secret part
|
||||
regexp.MustCompile(`(?i)\b(password|passwd|api_key|apikey|token_secret|client_secret)=[^\s"']{6,}`),
|
||||
regexp.MustCompile(`Authorization:\s*Bearer\s+\S{16,}`),
|
||||
|
||||
@@ -24,10 +24,10 @@ func TestLastCustomerSentAt_PairingQuery(t *testing.T) {
|
||||
s := newTestStore(t)
|
||||
|
||||
// Noise that must NOT count:
|
||||
insertNotifLog(t, s, "c1", "node_down", "sent", "operator", "2026-07-22 15:00:00") // wrong channel
|
||||
insertNotifLog(t, s, "c1", "node_down", "failed", "customer", "2026-07-22 16:00:00") // wrong status
|
||||
insertNotifLog(t, s, "c1", "node_down", "sent", "operator", "2026-07-22 15:00:00") // wrong channel
|
||||
insertNotifLog(t, s, "c1", "node_down", "failed", "customer", "2026-07-22 16:00:00") // wrong status
|
||||
insertNotifLog(t, s, "c1", "backup_failed", "sent", "customer", "2026-07-22 17:00:00") // wrong type
|
||||
insertNotifLog(t, s, "c2", "node_down", "sent", "customer", "2026-07-22 18:00:00") // wrong customer
|
||||
insertNotifLog(t, s, "c2", "node_down", "sent", "customer", "2026-07-22 18:00:00") // wrong customer
|
||||
|
||||
// No qualifying row yet:
|
||||
_, ok, err := s.LastCustomerSentAt("c1", []string{"node_stale", "node_down"})
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
var (
|
||||
reANSI = regexp.MustCompile(`\x1b\[[0-9;]*m`)
|
||||
reTimestamp = regexp.MustCompile(`\d{4}[-/]\d{2}[-/]\d{2}[T ]\d{2}:\d{2}:\d{2}[.\d]*([+-]\d{2}:?\d{2})?[Z ]?:? ?`)
|
||||
reTimestamp = regexp.MustCompile(`\d{4}[-/]\d{2}[-/]\d{2}[T ]\d{2}:\d{2}:\d{2}[.\d]*([+-]\d{2}:?\d{2})?[Z ]?:? ?`)
|
||||
reSyslog = regexp.MustCompile(`[A-Z][a-z]{2}\s+\d{1,2} \d{2}:\d{2}:\d{2} `)
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// OperatorOOBNote marks the single fleet-wide operator OOB peer among wg_peers (TASK H1). It is an
|
||||
// UNBOUND peer (host_id ''), so it rides the existing empty-host_id support + the partial-unique
|
||||
// UNBOUND peer (host_id ”), so it rides the existing empty-host_id support + the partial-unique
|
||||
// idx_wg_peers_host (which only constrains non-empty host_id) without collision [OF-4]. It is pushed
|
||||
// to the endpoint by peersync like any peer (so the endpoint accepts the operator's handshake), and
|
||||
// its assigned_ip becomes each box's desired-state oob_peer_ip (rendered into wg-felhom AllowedIPs).
|
||||
@@ -33,7 +33,7 @@ func (s *Store) GetOperatorOOBPeer() (*WGPeer, error) {
|
||||
// endpoint's STATIC forward chain can hardcode the operator /32). Last-write-wins: any prior
|
||||
// operator-oob row is replaced (key rotation / IP change). Validated: assignedIP is an IPv4 host
|
||||
// address inside the endpoint's tunnel_subnet, not the network/broadcast/pbs_tunnel_ip, and not
|
||||
// already taken by a DIFFERENT (customer) peer. host_id stays '' (unbound) so it is never counted as
|
||||
// already taken by a DIFFERENT (customer) peer. host_id stays ” (unbound) so it is never counted as
|
||||
// a customer host.
|
||||
func (s *Store) SetOperatorOOBPeer(pubkey, assignedIP string) error {
|
||||
ip, err := netip.ParseAddr(assignedIP)
|
||||
@@ -100,7 +100,9 @@ const oobOperatorSSHKeyKey = "oob_operator_ssh_pubkey"
|
||||
|
||||
// SetOOBOperatorSSHKey stores the operator's SSH PUBLIC key (an authorized_keys line, delivered to
|
||||
// every box via the desired-state so felhom-sshd honours the operator login). "" clears it.
|
||||
func (s *Store) SetOOBOperatorSSHKey(pubkey string) error { return s.setSetting(oobOperatorSSHKeyKey, pubkey) }
|
||||
func (s *Store) SetOOBOperatorSSHKey(pubkey string) error {
|
||||
return s.setSetting(oobOperatorSSHKeyKey, pubkey)
|
||||
}
|
||||
|
||||
// GetOOBOperatorSSHKey returns the operator SSH public key ("" if unset).
|
||||
func (s *Store) GetOOBOperatorSSHKey() string { return s.getSetting(oobOperatorSSHKeyKey) }
|
||||
|
||||
Reference in new issue
Block a user