feat(cred): add meta-audit command to inspect Accounts Center linked profiles and sync opm/pip accounts
This commit is contained in:
+8
-3
@@ -272,9 +272,14 @@ class CredClient:
|
|||||||
cmd = ["sudo", "-n", "ip", "netns", "exec", f"warp-{node}", sys.executable, meta_script, "list-linked", node]
|
cmd = ["sudo", "-n", "ip", "netns", "exec", f"warp-{node}", sys.executable, meta_script, "list-linked", node]
|
||||||
try:
|
try:
|
||||||
res = subprocess.run(cmd, capture_output=True, text=True, timeout=15)
|
res = subprocess.run(cmd, capture_output=True, text=True, timeout=15)
|
||||||
lines = res.stdout.strip().splitlines()
|
out = res.stdout.strip()
|
||||||
if lines:
|
if out:
|
||||||
return json.loads(lines[-1])
|
# Find outermost JSON object
|
||||||
|
start = out.find("{")
|
||||||
|
end = out.rfind("}")
|
||||||
|
if start >= 0 and end >= start:
|
||||||
|
return json.loads(out[start:end+1])
|
||||||
|
return json.loads(out)
|
||||||
return {"error": res.stderr.strip() or "No output from meta-acct.py"}
|
return {"error": res.stderr.strip() or "No output from meta-acct.py"}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {"error": str(e)}
|
return {"error": str(e)}
|
||||||
|
|||||||
+1
-1
@@ -1976,7 +1976,7 @@ def cmd_cred_meta_audit(args):
|
|||||||
else:
|
else:
|
||||||
print("\n" + c_bold(f"=== META ACCOUNTS CENTER AUDIT: {args.node} ===") + "\n")
|
print("\n" + c_bold(f"=== META ACCOUNTS CENTER AUDIT: {args.node} ===") + "\n")
|
||||||
if res.get("error"):
|
if res.get("error"):
|
||||||
print(c_err(f" Error: {res['error']}"))
|
print(c_red(f" Error: {res['error']}"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
email_str = res.get('email') or c_dim('(none / phone-only)')
|
email_str = res.get('email') or c_dim('(none / phone-only)')
|
||||||
print(f" Meta Account Email: {c_cyan(email_str)}")
|
print(f" Meta Account Email: {c_cyan(email_str)}")
|
||||||
|
|||||||
Reference in New Issue
Block a user