From c1ae3ccb2f725d0d94eaec9eeae7c8f5f98a5e45 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sun, 25 Oct 2020 11:13:06 +0100 Subject: [PATCH] [type/__uci*] Remove public-facing transaction "interface" --- cdist/conf/type/__uci/man.rst | 13 ++++--------- cdist/conf/type/__uci_section/man.rst | 9 ++------- cdist/conf/type/__uci_section/manifest | 10 ++++------ 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/cdist/conf/type/__uci/man.rst b/cdist/conf/type/__uci/man.rst index c7f5f4f0..8c3f79f1 100644 --- a/cdist/conf/type/__uci/man.rst +++ b/cdist/conf/type/__uci/man.rst @@ -11,8 +11,6 @@ DESCRIPTION This cdist type can be used to alter configuration options in OpenWrt's Unified Configuration Interface (UCI) system. -Options can be applied in batches if the ``--transaction`` parameter is used. - REQUIRED PARAMETERS ------------------- @@ -30,9 +28,6 @@ OPTIONAL PARAMETERS ------------------- state ``present`` or ``absent``, defaults to ``present``. -transaction - The name of the transaction this option belongs to. - If none is given: ``default`` is used. type If the type should generate an option or a list. One of: ``option`` or ``list``. @@ -55,10 +50,10 @@ EXAMPLES # Set DHCP option 252: tell DHCP clients to not ask for proxy information. __uci dhcp.lan.dhcp_option --type list --value '252,"\n"' - # Enable NTP and NTPd (in one transaction) - __uci system.ntp.enabled --value 1 --transaction ntp - __uci system.ntp.enable_server --value 1 --transaction ntp - __uci system.ntp.server --type list --transaction ntp \ + # Enable NTP and NTPd (each is applied individually) + __uci system.ntp.enabled --value 1 + __uci system.ntp.enable_server --value 1 + __uci system.ntp.server --type list \ --value '0.openwrt.pool.ntp.org' \ --value '1.openwrt.pool.ntp.org' \ --value '2.openwrt.pool.ntp.org' \ diff --git a/cdist/conf/type/__uci_section/man.rst b/cdist/conf/type/__uci_section/man.rst index 753d00b3..a0ab78e8 100644 --- a/cdist/conf/type/__uci_section/man.rst +++ b/cdist/conf/type/__uci_section/man.rst @@ -53,9 +53,6 @@ option shell argument. state ``present`` or ``absent``, defaults to ``present``. -transaction - The name of the transaction this option belongs to. - The value will be forwarded to :strong:`cdist-type__uci`\ (7). type The type of the section in the format: ``.`` @@ -71,13 +68,13 @@ EXAMPLES .. code-block:: sh # Configure the dropbear daemon - __uci_section dropbear --type dropbear.dropbear --transaction sshd \ + __uci_section dropbear --type dropbear.dropbear \ --match Port=22 --option Port=22 \ --option PasswordAuth=off \ --option RootPasswordAuth=off # Define a firewall zone comprised of lan and wlan networks - __uci_section firewall.internal --type firewall.zone --transaction fw \ + __uci_section firewall.internal --type firewall.zone \ --option name='internal' \ --list network='lan' \ --list network='wlan' \ @@ -87,7 +84,6 @@ EXAMPLES # Block SSH access from the guest network __uci_section firewall.block_ssh_from_guest --type firewall.rule \ - --transaction fwrules \ --option name='Block-SSH-Access-from-Guest' \ --option src='guest' \ --option proto='tcp' \ @@ -96,7 +92,6 @@ EXAMPLES # Configure a Wi-Fi access point __uci_section wireless.default_radio0 --type wireless.wifi-iface \ - --transaction wifi \ --option device='radio0' \ --option mode='ap' \ --option network='wlan' \ diff --git a/cdist/conf/type/__uci_section/manifest b/cdist/conf/type/__uci_section/manifest index 208a2c4e..41e30a07 100755 --- a/cdist/conf/type/__uci_section/manifest +++ b/cdist/conf/type/__uci_section/manifest @@ -46,7 +46,6 @@ esac section=$(cat "${__object:?}/explorer/match") state_should=$(cat "${__object:?}/parameter/state") -transaction_name=$(cat "${__object:?}/parameter/transaction") case $state_should in @@ -106,8 +105,7 @@ in fi # Make sure the section itself is present - __uci "${section}" --state present --transaction "${transaction_name}" \ - --value "${sect_type}" + __uci "${section}" --state present --value "${sect_type}" export require=__uci/"${section}" # Delete options/lists not in "should" @@ -115,7 +113,7 @@ in | while read -r optname do grep_line "${optname}" "${listnames_should}" "${optnames_should}" || { - __uci "${section}.${optname}" --state absent --transaction "${transaction_name}" + __uci "${section}.${optname}" --state absent } &2