agentleFS
Microsoft AzureKnown publisherAzure/sap-automation-qa/skills/workspace-validator/SKILL.md

workspace-validator

Skill14 starsChanged 21 months agoMITView on GitHub

Validate an existing SAP workspace configuration before running tests — checks sap-parameters.yaml, hosts.yaml, and SSH auth readiness. Use when asked to validate or troubleshoot a workspace that already exists; not for creating a new one from scratch (see workspace-creator) and not for framework installation issues (see setup-guide). Triggered by "validate workspace", "check workspace", "workspace issues", "fix workspace", "sap-parameters check", "hosts.yaml check", "SSH auth problems", or "troubleshoot workspace".

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If no path is provided, discovers and validates all workspaces under WORKSPACES/SYSTEM/.

    line 52
  2. Distinctive:

    When run with network access to the SAP hosts, the validator tests SSH connectivity:

    line 143
  3. Distinctive:

    Before reporting validation complete:

    line 210

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Workspace Validator

Validates SAP workspace configurations before test execution. Checks file presence, field completeness, valid values, SSH authentication readiness, and inventory structure.

Locate Framework

This skill requires a trusted STAF checkout — a working tree the operator has verified out-of-band as either the official upstream (https://github.com/Azure/sap-automation-qa.git) or a fork of it, at a specific revision, with the framework marker ./scripts/sap_automation_qa.sh present. The operator must have verified both the source (upstream URL or fork URL) and the revision through a trusted out-of-band channel before running this skill, and must have cd-ed into that directory. If that state is not confirmed, stop and use the setup-guide skill first; it owns the setup workflow. Do not resume this skill until setup-guide (or the operator directly) confirms the checkout is trusted.

⚠️ This skill is guidance only. Do NOT modify any source code, scripts, or framework files. Only help the user by running the validation script and interpreting results.

When to Use

TriggerAction
validate workspace / check configRun full validation
workspace issues / fix workspaceDiagnose and fix problems
sap-parameters checkValidate SAP parameters file
hosts.yaml checkValidate Ansible inventory
SSH auth problemsCheck authentication configuration

Running Validation

python3 skills/workspace-validator/scripts/validate_workspace.py [WORKSPACE_PATH]

If no path is provided, discovers and validates all workspaces under WORKSPACES/SYSTEM/.

Examples:

# Validate specific workspace
python3 skills/workspace-validator/scripts/validate_workspace.py \
  WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00

# Validate all workspaces
python3 skills/workspace-validator/scripts/validate_workspace.py

Exit codes:

  • 0 — All critical checks passed
  • 1 — One or more critical checks failed

What Gets Validated

1. File Presence

FileStatus
sap-parameters.yamlRequired
hosts.yaml or {SID}_hosts.yamlRequired
SSH key file (files with ssh_key in the filename, e.g., ssh_key.ppk, ssh_key.pem)Conditional
password fileConditional (VMPASSWORD auth only)

2. sap-parameters.yaml Validation

Always required fields:

  • sap_sid — SAP System ID (3 chars, uppercase alphanumeric)
  • platform — Valid values: HANA, DB2
  • db_sid — Database SID
  • db_instance_number — String, 2 digits (e.g., "00")
  • database_high_availability — Boolean (true/false)
  • scs_high_availability — Boolean
  • scs_instance_number — String, 2 digits
  • ers_instance_number — String, 2 digits
  • NFS_provider — Valid values: AFS, ANF

Conditional fields:

  • database_cluster_type — Required when database_high_availability: true. Fencing mechanism — values: AFA (Azure Fencing Agent), ISCSI, ASD (Azure Shared Disks)
  • scs_cluster_type — Required when scs_high_availability: true. Fencing mechanism — values: AFA (Azure Fencing Agent), ISCSI, ASD (Azure Shared Disks)
  • database_scale_out — Boolean, defaults to false
  • key_vault_id — Azure resource ID (if Key Vault auth)
  • secret_id — Key Vault secret URL (if Key Vault auth)
  • user_assigned_identity_client_id — UUID (if MSI auth)
  • ANF_account_rg — Required when NFS_provider: ANF
  • ANF_account_name — Required when NFS_provider: ANF

Azure Backup fields (for AzureBackupDatabase tests):

  • backup_vault_resource_id — Recovery Services vault resource ID
  • backup_container_name — Format: VMAppContainer;Compute;<rg>;<vm>
  • backup_item_name — Format: saphanadatabase;<sid>;<db>
  • backup_target_filesystem_path — e.g., /hana/backup/restore
  • backup_target_container_name — Target container (ALR)
  • backup_target_database_name — e.g., SYSTEMDB
  • backup_restore_point_time — ISO 8601 UTC (empty string for latest)

3. hosts.yaml Validation

Required groups (based on test type):

  • {SID}_DB — 2 hosts (for DatabaseHighAvailability)
  • {SID}_SCS — 1 host (for CentralServicesHighAvailability)
  • {SID}_ERS — 1 host (for CentralServicesHighAvailability)
  • {SID}_PAS — 1 host (optional)
  • {SID}_APP — 1+ hosts (optional)

Required per-host fields:

  • ansible_host — IP address or hostname
  • ansible_user — SSH username (typically azureadm)
  • ansible_connection — Must be ssh
  • connection_type — Must be key
  • virtual_host — Virtual hostname for cluster resources
  • become_user — Must be root
  • os_type — Must be linux
  • vm_name — Azure VM name

Required group vars:

  • node_tier — Values: hana, scs, ers, pas, app
  • supported_tiers — List (e.g., [hana])

4. SSH Authentication

Priority order (checked top-to-bottom, first match wins):

  1. Key Vault — secret_id field in sap-parameters.yaml → MSI retrieves SSH key
  2. Local key file — File with ssh_key in the filename (e.g., ssh_key.ppk, ssh_key.pem), NOT any file with a .pem or .key extension
  3. Password file — File named password in workspace directory (VMPASSWORD auth)

5. SSH Connectivity (Optional)

When run with network access to the SAP hosts, the validator tests SSH connectivity:

# With SSH connectivity test (default when hosts are reachable)
python3 skills/workspace-validator/scripts/validate_workspace.py WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00

# Skip SSH connectivity test (CI, offline, or no network access)
STAF_SKIP_SSH=1 python3 skills/workspace-validator/scripts/validate_workspace.py WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00

What it checks:

  • Attempts ssh -o ConnectTimeout=5 {user}@{host} exit 0 for each host in inventory
  • Uses SSH key from workspace if found
  • Reports ✅ for reachable hosts, ⚠️ for unreachable (warning, not error)
  • Skipped entirely when STAF_SKIP_SSH environment variable is set

Output Format

════════════════════════════════════════════════════════════════
  Workspace Validation: DEV-WEEU-SAP01-X00
════════════════════════════════════════════════════════════════

📁 File Checks
  ✅ sap-parameters.yaml found
  ✅ hosts.yaml found
  ✅ SSH key file found (ssh_key.pem)

📋 sap-parameters.yaml
  ✅ sap_sid: X00
  ✅ platform: HANA
  ✅ database_high_availability: true
  ✅ database_cluster_type: AFA
  ❌ db_instance_number: missing (required)
  ⚠️  ANF_account_rg: missing (needed when NFS_provider=ANF)

📋 hosts.yaml
  ✅ X00_DB group: 2 hosts found
  ✅ All hosts have required fields
  ❌ X00_SCS group: missing (required for SCS HA tests)

🔐 SSH Authentication
  ✅ Key Vault auth configured (secret_id present)

🌐 SSH Connectivity
  ✅ host1 (10.0.0.1): reachable
  ⚠️  host2 (10.0.0.2): unreachable (Connection timed out)

────────────────────────────────────────────────────────────────
  Result: ❌ FAILED (2 errors, 1 warning)
────────────────────────────────────────────────────────────────

Error Handling

ErrorCauseFix
sap-parameters.yaml not foundFile missingCreate from template (use workspace-creator)
hosts.yaml not foundInventory missingCreate with all required host groups
Invalid sap_sidNot 3 chars or invalid charsUse exactly 3 uppercase alphanumeric chars
Invalid platformNot HANA or DB2Set to HANA or DB2
No SSH authentication foundNo key/vault/passwordAdd key file or configure Key Vault
{SID}_DB missingGroup not in hosts.yamlAdd group with 2 hosts for HA
virtual_host missingHost field incompleteAdd virtual hostname for cluster resource

Pre-Completion Checklist

Before reporting validation complete:

  • Script ran without Python errors
  • All critical (❌) issues are resolved or explained
  • Warnings (⚠️) are acknowledged with rationale
  • SSH authentication path is confirmed working
  • Host groups match the intended test type

Related Skills

Need to...Use skill
Create a workspace from scratchworkspace-creator
Run tests on validated workspacetest-runner
Set up the environment firstsetup-guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.