Changes between Version 16 and Version 17 of CloudPlugin
- Timestamp:
- Jan 28, 2011, 10:34:07 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CloudPlugin
v16 v17 118 118 119 119 === Instances === 120 Here's how to configure ec2 instance resources. It's best to explain the configuration piecemeal:120 Here's how to configure ec2 instance resources. It's best to explain the configuration by example and piecemeal: 121 121 122 122 {{{ … … 146 146 }}} 147 147 148 Whoa! The {{{fields}}} option is a list of those chef attributes (aka fields) where you want to provide either a display name, a format handler, or both. So for example, {{{ec2.instance_type as Instance Type}}} above will use 'Instance Type' as the name of the {{{ec2.instance_type}}} attribute's the column or field. To define a display name (or label) for an attribute, list the attribute name followed by {{{ as }}} followed by the display name.148 Whoa! The {{{fields}}} option is a list of those chef attributes (aka fields) where you want to provide either a display name, a format handler, or both. So for example, {{{ec2.instance_type as Instance Type}}} above will use 'Instance Type' wherever the name of the {{{ec2.instance_type}}} field is to be displayed. 149 149 150 150 Only slightly more complicated are handlers to format fields. So for example, {{{ohai_time_ as Last Check-in < AgoEpochHandler}}} has a display name as we've seen plus the {{{< AgoEpochHandler}}} directs the plugin to use a specific handler to format the {{{ohai_time}}} field's value. In this example, the {{{AgoEpochHandler}}} handler converts an epoch to a string format such as "0:08:36 ago" meaning "8 minutes and 36 seconds ago" as shown in the screenshot above. But wait, what's up with the underscore after the {{{ohai_time_}}}? In most cases when using a handler, you should postfix the field's name with an underscore ({{{_}}}) so that the re-formatted value doesn't get written back to the field's value. ''[I'm likely to get rid of the underscore business to make it simpler, but that's what it is for now. - rhg]'' See the {{{handlers.py}}} file for a full list of provided field handlers.