Skip to content

Commit

Permalink
Include dispatch document to YAML API
Browse files Browse the repository at this point in the history
Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Mar 13, 2024
1 parent ca64644 commit 3f94e4e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions devel/yaml_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [Interface Controller](#interface-controller)
* [Accept All MAC addresses](#accept-all-mac-addresses)
* [Copy MAC From](#copy-mac-from)
* [Dispatch script](#dispatch-script)
* [IP](#ip)
* [IP Enable](#ip-enable)
* [DHCP](#dhcp)
Expand Down Expand Up @@ -363,6 +364,32 @@ interfaces:
- name: eth1
```

#### Dispatch script

Since 2.2.17, nmstate has introduced support of invoking dispatch script upon
the activation and deactivation of interface.

For example, this desire state will instruct network backend to invoke
`echo post-up-eth1 | systemd-cat` after the interface is activated, and
`echo post-down-eth1 | systemd-cat` after the interface been deactivated.

```yml
---
interfaces:
- name: eth1
type: ethernet
state: up
dispatch:
post-activation: |
echo post-up-eth1 | systemd-cat
post-deactivation: |
echo post-down-eth1 | systemd-cat
```

Setting the `post-activation` or `post-deactivation` to empty string will
remove the dispatch scripts. Removing the interface using
`state: absent` also remove the dispatch scripts.

### IP

This is the example of interface with static IP addresses:
Expand Down

0 comments on commit 3f94e4e

Please sign in to comment.