summaryrefslogtreecommitdiff
path: root/.github/instructions/modules.instructions.md
blob: d7782e1e92e7685d7c6a71f36afd8717506593e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
applyTo: "plugins/**,meta/runtime.yml"
---

# Plugin conventions

## Module option descriptions

- Must be complete English sentences ending with a period.
- No grammar errors. Common mistake: "the number hops" should be "the number of hops".
- Deprecated options must include `removed_in_version` and `removed_from_collection` fields.
- Do not add new options with `deprecated: true` — remove deprecated options entirely.

## rm_templates files

Files in `plugins/module_utils/network/vyos/rm_templates/` define regex parsers and Jinja2 generators for a resource module. Each entry has:
- `name` — unique identifier
- `getval` — compiled regex with named groups
- `setval` — Jinja2 template or callable producing a VyOS CLI command
- `result` — dict mapping regex groups to facts structure
- `shared` (optional) — bool, whether the template applies to a shared config block

## meta/runtime.yml redirects

Short-name redirects must point to the actual module name with the `vyos_` prefix. For example:
```yaml
snmp_server:
  redirect: vyos.vyos.vyos_snmp_server   # correct
  # NOT: vyos.vyos.vyos_snmp_servers     # wrong (pluralized)
```

Verify any changed redirect target exists as a real module file under `plugins/modules/`.

## cliconf / terminal plugins

`plugins/cliconf/vyos.py` — do not modify without understanding edit-mode and commit semantics.
`plugins/terminal/vyos.py` — handles prompt detection; regex changes require testing against all supported VyOS versions listed in README.md.