Attrib Model¶
They provide a mechanism that NodeRoles can use to easily pull in data
from other sources without having to know how to parse that other source’s blob of JSON.
- They provide an easy-to-use REST API to let users get and set their
data with built-in validation.
- They act as a building block for UI developers to write custom view
templates for workloads that require them.
Defining Attribs¶
- NodeRole user data, sysdata, and wall data.
- DeploymentRole user data and wall data.
- Role template data
- Node data (via its related NodeRoles)
- Deployment data (via the deployment’s DeploymentRoles)
attribs:
- name: provisioner-target_os
description: "The operating system to install on a node"
map: 'crowbar/target_os'
schema:
type: str
required: true
enum:
- ubuntu-12.04
- redhat-6.5
- centos-6.5
Attrib Fields¶
name: The internal name of the Attrib. Attrib names must be globally unique.
description: A brief description of the data that the Attrib manipulates.
- map: The path into a blob of JSON that the Attrib uses to find its
data. In this example, the map field tells the Attrib that its data can be found at
blob["crowbar"]["target_os"]. Map is also used when mixing attribs back together to pass them off to a Jig run.
- schema: A
Kwalify | schema fragment that describes what valid data for this attribute | looks like. Note that this is a schema fragment – it will be | wrapped in the following template for actual validation:
type: map required: true mapping: <attrib name>: <schema fragment>