Skip to content

Wire Reference

Mason J. Katz edited this page Dec 15, 2015 · 1 revision

The Stacki XML framework is called Wire. To explain how wire is structured, we first have to understand the process of installation of a backend node.

Order of Installation

When the anaconda installer performs the OS installation, it does it in the following order.

  1. Hardware Probing - The installer starts by probing the hardware and enumerates all the devices.

  2. Network setup - The installer then configures the network with IP address, netmask, and gateway information

  3. Kickstart Retrieval - The installer retrieves a kickstart file from the frontend that provides it with instructions on how to proceed with the installation.

  4. Main section - The installer configures timezones, root passwords, etc. This section typically includes Kickstart directives.

  5. Pre section - This section consists of instructions to be run before the partitioning, and package installation. This typically is used to setup the installer environment so that partitioning may be changed. This section is typically coded in shell, or python.

  6. Disk setup and partitioning - Next, the installer configures the disks attached to the system, partitions them, formats them and makes them available to the installer.

  7. Package Installation - This section contains a list of packages to be installed on the system.

  8. Post Section - This section consists of instructions to be run after package installation. This section may be coded in any interpreted language that is available on the installed system.

  9. Pre-boot Section - This section is run on first-boot before any services or daemons are started.

  10. Post-Boot Section - This section is a collection of shell scripts that are run on first-boot after all services and daemons have started. This is typically used to run scripts that interact with system daemons, or to finish and clean-up the installation process.

To extend backend node functionality, the sections most likely to require modifications are the package section and the post sections.

Wire XML Syntax Reference

The Stacki Wire XML framework supports the following tags.

<pre> Tag

This tag allows the admin to run scripts in the installer before the package installation, and disk configuration is done. Internally, Stacki uses this section to configure disk controllers, and partitions. Example:

  • This example looks at the partitions that the installer is aware of and keeps a copy of that in a file.

    <pre>
    cat /proc/partitions > /tmp/partitions.state
    </pre>

<package> Tag

This tag allows the admin to add packages to the installation.

 <package>httpd</package>
 <package meta="1">gnome-desktop</package>

The meta="1" attribute informs the installer that the package is a group package.

<post> Tag

This tag allows the admin to run scripts after the package installation is done. The scripts can be in any interpreted language present on the installed system. Examples:

  • A simple shell command that runs chkconfig to enable the Apache web server.

    <post>
    /sbin/chkconfig --enable httpd
    </post>
  • This post section is interpreted as python code.

    <post interpreter="/opt/rocks/bin/python">
    import os, sys
    import subprocess
    p = subprocess.Popen(['/sbin/chkconfig','--enable','httpd'])
    rc = p.wait()
    if rc != 0:
    	sys.stderr.write('Chkconfig Failed\n')
    </post>
  • The --nochroot argument causes the execution of the post section in a non-chrooted environment. Typically, after the package installation starts the post sections are run in a chrooted environment running under /mnt/sysimage - ie.- In the installer /mnt/sysimage is the / filesystem on the installed machine.

    <post arg="--nochroot">
    cp /tmp/anaconda.log /mnt/sysimage/tmp/anaconda.log
    </post>

<file> Tag

This tag allows the admin to create files on the filesystem of the installing machine. This tag is a resides inside a <post> tag. Examples:

  • This creates a file called /tmp/hello.log that contains the word "HELLO" in it.

    <post>
    	<file name="/tmp/hello.log">
      HELLO
      </file>
    </post>
  • This appends to a file called /tmp/hello.log.

    <post>
      <file name="/tmp/hello.log" mode="append">
      WORLD
      </file>
    </post>
  • This creates a file called /tmp/hello.log with chmod permissions of 0400.

    <post>
      <file name="/tmp/hello.log" perms="0400">
      HELLO
      </file>
    </post>
  • This creates a file called /tmp/hello.log owned by user root and group apache.

    <post>
      <file name="/tmp/hello.log" owner="root:apache">
      HELLO
      </file>
    </post>

<boot> tag

This tag controls both the Pre-boot section and the Post-boot section of the installation.

  • Pre-boot section - Removes a file before all the other daemons have started.

    <boot order="pre">
    rm -rf /tmp/hello.log
    </boot>
  • Post-boot section - Creates the /etc/hosts file by running a Stacki report.

    <boot order="post">
    /opt/stack/bin/stack report host > /etc/hosts
    </boot>
Clone this wiki locally