Custom attribute syntax and rules

Syntax

The syntax for a custom attribute in a Plan Script is @customattribute_name@. Custom attributes with default values can be specified as @customattribute_name:customattribute_value@.

The following is an example for customizing hostname and SSH server setting for an ESXi host:
#!/usr/bin/guestfish -f 
#set the host name for the server
esxcli system hostname set -H "@HostName:DEFAULT 
#set the SSH server flag
esxcli network firewall ruleset set --ruleset-id 
"@SSH_SERVER:DISABLE@" --enabled yes

Rules

  • Prior to Plan Script execution, custom attributes are replaced with values provided by the server profile or default values. This action is called attribute expansion.

  • The custom attribute name cannot contain spaces or special characters. It can contain numbers, underscores, and dashes.

  • The custom attribute default value cannot contain @ character. Adjacent custom attributes can be used in the format @ca1@@ca2@.

  • To include @ character in a Plan Script, use @@.

  • The custom attribute value can contain special characters and spaces. Hence custom attributes must be enclosed in single or double quotes when used in guestfish or bash commands in the Plan Script.

  • The custom attribute default value given in a Plan Script may not contain a @ character. A default value which includes the @ character, such as an email address, may be placed in the OS Build Plan or Deployment Plan as a default value. The custom attribute default value can be left blank.

  • References to other custom attributes in a custom attribute value are not supported.

  • NIC custom attributes cannot have default values.