Changes between Version 16 and Version 17 of CloudPlugin


Ignore:
Timestamp:
Jan 28, 2011, 11:34:07 PM (4 years ago)
Author:
robguttman
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CloudPlugin

    v16 v17  
    118118
    119119=== Instances ===
    120 Here's how to configure ec2 instance resources.  It's best to explain the configuration piecemeal:
     120Here's how to configure ec2 instance resources.  It's best to explain the configuration by example and piecemeal:
    121121
    122122{{{
     
    146146}}}
    147147
    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.
     148Whoa!  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.
    149149
    150150Only 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.