Skip to content

Latest commit

 

History

History
137 lines (122 loc) · 4.45 KB

File metadata and controls

137 lines (122 loc) · 4.45 KB

🛠️ Troubleshooting - Lab 32: Finance Pack Audit and Approval Gate

This guide captures the common issues and recovery steps documented for the lab.

Issue: YAML configuration not loading

(venv) toor@ip-172-31-10-231:~/finance-approval-lab/approval-system$ python3 -c "import yaml; yaml.safe_load(open('config/approval_rules.yaml'))"
{'approval_gates': [{'name': 'budget_review', 'threshold': 1000, 'approvers': ['finance_manager', 'team_lead'], 'required_approvals': 2}, {'name': 'infrastructure_cost', 'threshold': 5000, 'approvers': ['finance_manager', 'cto'], 'required_approvals': 2}], 'audit_settings': {'log_directory': 'logs', 'retention_days': 90, 'log_format': 'json'}}
  • Check file permissions

Issue: Audit logs not writing

  • Ensure log directory exists and is writable
(venv) toor@ip-172-31-10-231:~/finance-approval-lab/approval-system$ df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/root         30G   11G   19G  37% /
tmpfs            1.9G     0  1.9G   0% /dev/shm
tmpfs            768M  1.5M  767M   1% /run
tmpfs            5.0M     0  5.0M   0% /run/lock
efivarfs         128K  3.9K  120K   4% /sys/firmware/efi/efivars
/dev/nvme0n1p16  881M  136M  684M  17% /boot
/dev/nvme0n1p15  105M  6.1M   99M   6% /boot/efi
tmpfs            384M  108K  384M   1% /run/user/1000
  • Verify Python has write permissions

Issue: Approval state not persisting

  • State storage has been implemented using a JSON file in the data/ directory
  • Ensure atomic write operations are working correctly
  • If needed, inspect the state file:
(venv) toor@ip-172-31-10-231:~/finance-approval-lab/approval-system$ python3 -m json.tool data/approval_requests.json
{
    "REQ001": {
        "request_id": "REQ001",
        "amount": 500.0,
        "requester": "dev_user",
        "description": "Minor config update",
        "created_at": "2026-04-12T18:13:08.745224+05:30",
        "status": "approved",
        "gate_name": "auto_approved",
        "required_approvals": 0,
        "authorized_approvers": [],
        "approvals": []
    },
    "REQ002": {
        "request_id": "REQ002",
        "amount": 1500.0,
        "requester": "dev_user",
        "description": "Infrastructure upgrade",
        "created_at": "2026-04-12T18:13:12.425444+05:30",
        "status": "approved",
        "gate_name": "budget_review",
        "required_approvals": 2,
        "authorized_approvers": [
            "finance_manager",
            "team_lead"
        ],
        "approvals": [
            {
                "approver": "finance_manager",
                "timestamp": "2026-04-12T18:13:14.926554+05:30"
            },
            {
                "approver": "team_lead",
                "timestamp": "2026-04-12T18:13:16.509624+05:30"
            }
        ],
        "approved_at": "2026-04-12T18:13:16.509648+05:30"
    },
    "REQ003": {
        "request_id": "REQ003",
        "amount": 7000.0,
        "requester": "ops_user",
        "description": "Cluster expansion",
        "created_at": "2026-04-12T18:13:19.129542+05:30",
        "status": "approved",
        "gate_name": "infrastructure_cost",
        "required_approvals": 2,
        "authorized_approvers": [
            "finance_manager",
            "cto"
        ],
        "approvals": [
            {
                "approver": "finance_manager",
                "timestamp": "2026-04-12T18:13:21.827937+05:30"
            },
            {
                "approver": "cto",
                "timestamp": "2026-04-12T18:13:23.105108+05:30"
            }
        ],
        "approved_at": "2026-04-12T18:13:23.105130+05:30"
    },
    "REQ004": {
        "request_id": "REQ004",
        "amount": 2000.0,
        "requester": "test_user",
        "description": "Test deployment",
        "created_at": "2026-04-12T18:13:28.354743+05:30",
        "status": "pending",
        "gate_name": "budget_review",
        "required_approvals": 2,
        "authorized_approvers": [
            "finance_manager",
            "team_lead"
        ],
        "approvals": []
    }
}

Issue: Git repository issues

(venv) toor@ip-172-31-10-231:~/finance-approval-lab/approval-system$ git init
Reinitialized existing Git repository in /home/toor/finance-approval-lab/approval-system/.git/

(venv) toor@ip-172-31-10-231:~/finance-approval-lab/approval-system$ git config --list
user.name=Lab User
user.email=user@lab.local
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true