Page MenuHomeDevCentral

Add debug scripts for Vault, OVH, and VIP assignment
Needs ReviewPublic

Authored by yousra on Tue, Mar 31, 21:25.
Tags
None
Referenced Files
F25326482: D4034.id10544.diff
Thu, Apr 9, 18:52
F25296599: D4034.id10543.diff
Thu, Apr 9, 02:44
Unknown Object (File)
Wed, Apr 8, 17:52
Unknown Object (File)
Wed, Apr 8, 12:15
Unknown Object (File)
Wed, Apr 8, 09:30
Unknown Object (File)
Tue, Apr 7, 21:37
Unknown Object (File)
Tue, Apr 7, 15:05
Unknown Object (File)
Tue, Apr 7, 05:27

Details

Summary

Add some useful debug scripts for Vault access, OVH credentials access and client setup, and VIP assignment checks

  • debug_connection_vault.py
  • debug_vault_ovh_credentials.py
  • debug_check_vip_ovh.py
Test Plan

On /usr/local/libexec/carp :

  • sudo python3 debug_connection_vault.py : to verify Vault connection
  • sudo python3 debug_vault_ovh_credentials.py : to verify that we can access to OVH credentials and create ovh client
  • sudo python3 debug_check_vip_ovh.py : to check which router MAC currently holds the VIP on OVH

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Skipped
Unit
No Test Coverage
Branch
debug-carp
Build Status
Buildable 6576
Build 6860: arc lint + arc unit

Event Timeline

yousra requested review of this revision.Tue, Mar 31, 21:25
yousra created this revision.
roles/router/carp/files/debug_check_vip_ovh.py
22 ↗(On Diff #10543)

Should be provisioned by Salt.

We've two strategies for that.

(1) older strategy was to templatize Python scripts, ie treat this as Jinja templates

(2) newer strategy is usually to provision a YAML template with Salt, and keep this as a pure Python script reading that YAML

I've checked, PyYAML is installed on router role, so second strategy works:

dereckson in 🌐 router-002 in ~ 
❯ python3
Python 3.11.14 (main, Feb  7 2026, 01:06:44) [Clang 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd7080 on freebsd15
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>>
roles/router/carp/init.sls
44

Don't put .py prefix

Put everything in {{ dirs.bin }}/ directly. That's the convention on UNIX machines.

Minor changes to the script names in init.sls

yousra edited the test plan for this revision. (Show Details)
yousra edited the test plan for this revision. (Show Details)

Many changes:

  • Improved scripts structure by separating configuration, helper functions, main function and entry point.
  • Set correct permissions (not 0 in front and string (like '0644') for Salt (more like 644), only on Ansible) for the debug scripts.
  • Executable files do not require extensions on Unix systems, as execution is determined by the shebang.
  • Using a YAML file (method PyYAML) to get the value of VAULT_CONFIG (created on D4033)