From be5904748802ed1ca68bf7fc99a2b5b50ed38755 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Wed, 24 Jun 2020 13:38:51 +0200 Subject: [PATCH] [type/__interface] Add --onchange parameter --- .../__interface/files/backends/ifupdown.d/manifest | 5 +++++ cdist/conf/type/__interface/man.rst | 11 +++++++++++ .../conf/type/__interface/parameter/default/onchange | 1 + cdist/conf/type/__interface/parameter/optional | 1 + 4 files changed, 18 insertions(+) create mode 100644 cdist/conf/type/__interface/parameter/default/onchange diff --git a/cdist/conf/type/__interface/files/backends/ifupdown.d/manifest b/cdist/conf/type/__interface/files/backends/ifupdown.d/manifest index 6b9af804..69cd515d 100755 --- a/cdist/conf/type/__interface/files/backends/ifupdown.d/manifest +++ b/cdist/conf/type/__interface/files/backends/ifupdown.d/manifest @@ -92,6 +92,11 @@ then set -- "$@" --comment "$(cat "${__object}/parameter/comment")" fi +if test -s "${__object}/parameter/onchange" +then + set -- "$@" --onchange "$(cat "${__object}/parameter/onchange")" +fi + if test -s "${__object}/parameter/extra-config" then while read -r _opt diff --git a/cdist/conf/type/__interface/man.rst b/cdist/conf/type/__interface/man.rst index fc0772cf..3dc35f87 100644 --- a/cdist/conf/type/__interface/man.rst +++ b/cdist/conf/type/__interface/man.rst @@ -57,6 +57,17 @@ extra-config Using this option makes the configuration non-portable to other backends. If this option is used extensively, it is recommended to use the respective backend type directly. +onchange + The action to perform if the interface configuration has changed. + Available options are: + leave (default) + Do nothing. + up + Bring the interface up if it is down. + down + Bring the interface down if it is up. + refresh + Refresh the interface (down && up). BOOLEAN PARAMETERS diff --git a/cdist/conf/type/__interface/parameter/default/onchange b/cdist/conf/type/__interface/parameter/default/onchange new file mode 100644 index 00000000..e8f9c907 --- /dev/null +++ b/cdist/conf/type/__interface/parameter/default/onchange @@ -0,0 +1 @@ +leave diff --git a/cdist/conf/type/__interface/parameter/optional b/cdist/conf/type/__interface/parameter/optional index c17ca504..0af245b0 100644 --- a/cdist/conf/type/__interface/parameter/optional +++ b/cdist/conf/type/__interface/parameter/optional @@ -3,5 +3,6 @@ comment gateway name netmask +onchange state type