def get_template(name, zone_name=nil)

      # TODO: use name parameter
      # listTemplates in CloudStack 2.2 doesn't seem to work
      # when the name parameter is specified. When this is fixed,
      # the name parameter should be added to the request.

      zone = zone_name ? get_zone(zone_name) : get_default_zone

      params = {
          'command' => 'listTemplates',
          'templateFilter' => 'executable',
      }
      params['zoneid'] = zone['id'] if zone

      json = send_request(params)

      templates = json['template']
      return nil unless templates

      templates.each { |t|
        if name.is_uuid? then
          return t if t['id'] == name
        else
          return t if t['name'] == name
        end
      }
      nil
    end
def get_template(name, zone_name=nil)

      # TODO: use name parameter
      # listTemplates in CloudStack 2.2 doesn't seem to work
      # when the name parameter is specified. When this is fixed,
      # the name parameter should be added to the request.

      zone = zone_name ? get_zone(zone_name) : get_default_zone

      params = {
          'command' => 'listTemplates',
          'templateFilter' => 'executable',
      }
      params['zoneid'] = zone['id'] if zone

      json = send_request(params)

      templates = json['template']
      return nil unless templates

      templates.each { |t|
        if name.is_uuid? then
          return t if t['id'] == name
        else
          return t if t['name'] == name
        end
      }
      nil
    end
Finds the template with the specified name.