From f464b382a684fee96a05f79cdeaea33664ee9105 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 31 Aug 2020 14:17:38 +0200 Subject: [PATCH] [type/__interface_ifcfg] Add --type parameter --- cdist/conf/type/__interface_ifcfg/man.rst | 4 ++++ cdist/conf/type/__interface_ifcfg/manifest | 11 +++++++++++ .../type/__interface_ifcfg/parameter/default/type | 1 + cdist/conf/type/__interface_ifcfg/parameter/required | 1 + 4 files changed, 17 insertions(+) create mode 100644 cdist/conf/type/__interface_ifcfg/parameter/default/type diff --git a/cdist/conf/type/__interface_ifcfg/man.rst b/cdist/conf/type/__interface_ifcfg/man.rst index 72b50350..54fc76b7 100644 --- a/cdist/conf/type/__interface_ifcfg/man.rst +++ b/cdist/conf/type/__interface_ifcfg/man.rst @@ -17,6 +17,10 @@ REQUIRED PARAMETERS ------------------- bootproto ... +type + The type of the interface, e.g. ``Ethernet``, ``Bridge``, ``Dummy``, + ``Loopback``. + Defaults to ``Ethernet``. OPTIONAL PARAMETERS diff --git a/cdist/conf/type/__interface_ifcfg/manifest b/cdist/conf/type/__interface_ifcfg/manifest index 62b0a9bb..a0bc0c16 100755 --- a/cdist/conf/type/__interface_ifcfg/manifest +++ b/cdist/conf/type/__interface_ifcfg/manifest @@ -61,6 +61,7 @@ fi state_should=$(cat "${__object:?}/parameter/state") bootproto=$(cat "${__object:?}/parameter/bootproto") onchange=$(cat "${__object:?}/parameter/onchange") +iftype=$(cat "${__object:?}/parameter/type") ifcfg_file="${NETWORK_SCRIPTS_DIR:?}/ifcfg-${__object_id:?}" @@ -108,6 +109,8 @@ onchange_action() { case $systype in (redhat) + opt_format TYPE "${iftype}" + for _param in onboot hotplug do _key=$(param2var "${_param}") @@ -116,6 +119,14 @@ onchange_action() { unset _param _key ;; (suse) + iftype=$(echo "${iftype}" | tr '[:upper:]' '[:lower:]') + if test "${iftype}" = 'loopback' -o "${iftype}" = 'dummy' + then + # Only use INTERFACETYPE for lo/dummy. + # cf. /usr/share/YaST2/modules/NetworkInterfaces.rb + opt_format INTERFACETYPE "${iftype}" + fi + _startmode=manual if test -f "${__object:?}/parameter/onboot" diff --git a/cdist/conf/type/__interface_ifcfg/parameter/default/type b/cdist/conf/type/__interface_ifcfg/parameter/default/type new file mode 100644 index 00000000..8942065e --- /dev/null +++ b/cdist/conf/type/__interface_ifcfg/parameter/default/type @@ -0,0 +1 @@ +Ethernet diff --git a/cdist/conf/type/__interface_ifcfg/parameter/required b/cdist/conf/type/__interface_ifcfg/parameter/required index 507318ee..8df5eed7 100644 --- a/cdist/conf/type/__interface_ifcfg/parameter/required +++ b/cdist/conf/type/__interface_ifcfg/parameter/required @@ -1 +1,2 @@ bootproto +type