module Fog
  module Compute
    class Brkt
      class Real
        def update_server_template(id, attributes)
          request(
            :expects => [202],
            :method  => "POST",
            :path    => "v1/api/config/instancetemplate/#{id}"
          )
        end
      end

      class Mock
        def update_server_template(id, attributes)
          server_template_data = self.data[:server_templates][id]
          server_template_data.merge!(Fog::StringifyKeys.stringify(attributes))
          Excon::Response.new(:body => server_template_data)
        end
      end
    end
  end
end

module Fog
  module Compute
    class Brkt
      class Real
        def update_server_template(id, attributes)
          attributes[:image_definition] = attributes[:image_definition]["id"]
          request(
            :expects => [202],
            :method  => "POST",
            :path    => "v1/api/config/instancetemplate/#{id}",
            :body    => Fog::JSON.encode(attributes)
          )
        end
      end

      class Mock
        def update_server_template(id, attributes)
          server_template_data = self.data[:server_templates][id]
          server_template_data.merge!(Fog::StringifyKeys.stringify(attributes))
          Excon::Response.new(:body => server_template_data)
        end
      end
    end
  end
end

Fix update for server templates
Fix update for server templates

- options/attributes were not being sent to the server (oops)
