Skip to content

Instantly share code, notes, and snippets.

@mvidner
Last active March 20, 2018 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvidner/02ce608fb6ce0e3eacfa20dda104bc52 to your computer and use it in GitHub Desktop.
Save mvidner/02ce608fb6ce0e3eacfa20dda104bc52 to your computer and use it in GitHub Desktop.

This is a clarifying update to the AutoYaST documentation, applicable to all versions.

Resources and Properties

A resource element either contains multiple and distinct property and resource elements, or multiple instances of the same resource element, or it is empty. The permissible content of a resource element is specified in the schema files.

A property element is either empty or contains a literal value. The permissible property elements and values in each resource element are specified in the schema files

An element can be either a container of other elements (a resource) or it has a literal value (a property); it can never be both. This restriction is specified in the schema files. A configuration component with more than one value must either be represented as an embedded list in a property value or as a nested resource.

An empty element, such as <foo></foo> or <bar/> will be NOT present in the parsed data model. Usually this is interpreted as wanting a sensible default value. In cases where you need an explicit empty string instead, use a CDATA section: <foo><![CDATA[]]></foo>.

Nested Resources

Nested resource elements allow a tree-like structure of configuration components to be built to any level.

There are two kinds of nested resources: maps and lists. Maps, also known as associative arrays, hashes, or dictionaries, contain mixed contents, identified by their tag names. Lists, or arrays, have all items of the same type.

...
<drive>
  <device>/dev/sda</device>
  <partitions config:type="list">
     <partition>
        <size>10G</size>
        <mount>/</mount>
     </partition>
     <partition>
        <size>1G</size>
        <mount>/tmp</mount>
     </partition>
  </partitions>
</drive>
....

In the example above the drive resource is a map consisting of a device property and a partitions resource. The partitions resource is a list containing multiple instances of the partition resource. Each partition resource is a map containing a size and mount property.

The default type of a nested resource is map. Lists must be marked as such using the config:type="list" attribute.

Attributes

Global attributes are used to define metadata on resources and properties. Attributes are used to define context switching. They are also used for naming and typing properties as shown in the previous sections. Attributes are in a separate namespace so they do not need to be treated as reserved words in the default namespace.

The config:type attribute determines the type of the resource or property in the parsed data model. For resources, lists need a list type whereas a map is the default type that does not need an attribute. For properties, boolean, symbol, and integer can be used, the default being a string.

Previously this section stated that all attributes are optional, which is not true. It may appear so because various parts of the schema are not very consistent in their usage of data types. In some places an enumeration is represented by a symbol, elsewhere a string is required. One resource needs config:type="integer", another will parse the number from a string property. Some resources use config:type="boolean", other want "yes" or even "1". If in doubt, consult the schema file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment