Multi-Field Updates
Description
Within Config Shell, it is possible to update multiple fields with one command line. This is restricted to ‘flat’ fields within the current context ie arrays and sub-objects cannot currently be updated all in one command line.
For example, the following port fields can all be changed in a single command: baudrate, databits, escape_char, label, logging_level, mode, parity, pinout
and stopbits
. Other complex fields such as control_code
and ip_alias
cannot be modified from the port item context in one commands (multiple commands are needed).
Example
The following command sets the baudrate, escape_char
and label
fields.
config(port port01): baudrate 115200 escape_char ! label "My Router"
The changes will be staged in Config Shell. Use the apply
command to save the changes to config.
To further update the control_codes
and ip_aliases
, multiple commands are required as follows:
config(port port01): control_code
config(port port01 control_code): break b chooser c
config(port port01 control_code): up
config(port port01): ip_alias
config(port port01 ip_alias): add
config(port port01 ip_alias 1): interface net1 ipaddress 10.83.0.6/24
config(port port01 ip_alias 1): up
config(port port01 ip_alias): up
config(port port01): changes
Entity port item port01 (edit)
control_code (object)
break b
chooser c
ip_alias (array)
1 (object)
interface net1
ipaddress 10.83.0.6/24
config(port port01):
If certain fields are hidden and only visible by first configuring other fields, these hidden fields need to be set in another line. For example, the kernel_debug
field is only revealed by setting the field mode
of a port to localConsole
, so this is configured on the next line:
config: port port03
config(port port03): mode localConsole baudrate 115200 databits 7 label aaa
logging_level eventsOnly parity even
config(port port03): kernel_debug true
Error Messages
If there is an error while processing a multiple-fields command, the staged values in configuration will not be changed. If there were no staged changes on the item, then no staged changes will appear. If there were already staged changes, then those staged changes will not be affected.
In the following example, the user description was previously changed to “my user”
config(user consoleuser): show
Entity user item consoleuser
description my user *
enabled true
no_password false
password ""
ssh_password_enabled true
groups (array)
0 consoleuser
If a bad field name or value is supplied on the command line, then the existing staged value is retained. The bad field name is highlighted using a ^ marker.
config(user consoleuser): description "My console user" invalid true
^
Invalid input detected at '^' marker.
config(user consoleuser):
If the field is missing a value, a different error message is displayed:
config(user consoleuser): description "My console user" enabled
Incomplete command.
config(user consoleuser): show
Entity user item consoleuser
description my user *
enabled true
no_password false
password ""
ssh_password_enabled true
groups (array)
0 consoleuser
The bad value for the field is indicated by an error message hinting the expected type of the value:
config(user consoleuser): description "My console user" enabled bad
Value bad for field enabled cannot be parsed as a boolean.
config(user consoleuser): show
Entity user item consoleuser
description my user *
enabled true
no_password false
password ""
ssh_password_enabled true
groups (array)
0 consoleuser
Changes to previous functionality:
With the new show
command, some previous syntax has changed. Just typing a field name is now an error condition. Previously this would be equivalent to the show command.
config: user root
config(user root): description
Incomplete command.
config(user root):