Who needs more field types if you can have all of them? | SUSE Communities

Who needs more field types if you can have all of them?

Share
Share

Formulas with Forms are one of the most powerful features that make SUSE Manager the ideal tool for consistently managing the configuration of hundreds or thousands of servers. If you don’t know about them yet, you may want to read this previous post first.

Since we added Formulas with Forms to SUSE Manager, customers, partners, and of course our own engineering teams, have started using them for a variety of use cases.

We deliberately tried to keep things as simple as possible, so that you can turn the example files of Salt Formulas into easy to use forms with only a few lines of extra markup. But our early adopters identified one feature gap that really needed to be closed to bring Formulas with Forms to the next level:

In many cases, you need to have a way of providing “one or more” configuration parameters of the same type to a system. Real life examples include configuring local users on a system, partition tables, or host names a system should listen to.

Well, the upcoming SUSE Manager 3.2, which has just entered beta phase, will provide just that. And we’ve chosen an approach that is both extremely flexible and easy to use. Instead of adding additional field types, we’ve chosen an approach that lets you create your own “composite field types” from all the existing fields!

Let’s start with a few screenshots and the code behind them:

 

Managing Users

Create one or more users, but not more than five. The first one defaults to “root”. The second has a default of “admin”.

Form for managing users

Form for managing users

users:
  $type: edit-group
  $minItems: 1
  $maxItems: 5
  $itemName: User ${name}
  $prototype:
    name:
      $placeholder: Enter username here
    password:
      $type: password
  $default:
    - name: root
    - name: admin

 

Managing Host Names

At least two host names need to be set. No upper limit.

Form for managing hostnames

Form for managing hostnames

hostnames:
  $type: edit-group
  $minItems: 2
  $itemName: Name ${name}
  $prototype:
    name:
      $placeholder: Enter fully qualified hostname here
    ipaddress:
      $name: IP Address
      $placeholder: 0.0.0.0

 

Managing Hard Disk Partitions

Form for managing partitions

Form for managing partitions

partitions:
  $type: edit-group
  $minItems: 1
  $maxItems: 4
  $itemName: Partition ${name}
  $prototype:
    name:
      $default: New partition
    mountpoint:
      $placeholder: Needs to start with a /
    size:
      $type: number
      $name: Size in GB
  $default:
    - name: Boot
      mountpoint: /boot
    - name: Root
      mountpoint: /
      size: 5000

This is a real life example taken from the new “Saltboot” feature that will be used for SUSE Manager for Retail.

As you can see from those snippets, the new “edit-group” fields allow you to specify any repeatable data structure that can be described using the existing field types “by example”. A repeatable group of fields can be as simple as a single text value or as complex as you want it to be, with checkboxes, dropdowns and so on. You can provide not just the “prototype” that is used as the template for new groups of fields, but also a minimum and maximum number of field groups and, just like with other field types, a set of default values.

And if you are really adventurous, you can even nest edit-group sections! This doesn’t look very pretty in Beta 1 yet, but we’re working on it.

If you want to give this feature a try and aren’t part of the SUSE Manager beta program yet, please reach out to your SUSE customer care or sales contact, so we can get you added! I’ll keep you posted about all the upcoming features in version 3.2 that will make SUSE Manager even more useful than today.

This is Joachim Werner blogging live from rainy Nuremberg, were we’re always trying new forms of making forms more useful. 🙂

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

No comments yet

Avatar photo
5,509 views