Revision 572e83aa

View differences:

src/cloud/ec2/lib/ImageEC2.rb
1
# -------------------------------------------------------------------------- #
2
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org)             #
3
#                                                                            #
4
# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
5
# not use this file except in compliance with the License. You may obtain    #
6
# a copy of the License at                                                   #
7
#                                                                            #
8
# http://www.apache.org/licenses/LICENSE-2.0                                 #
9
#                                                                            #
10
# Unless required by applicable law or agreed to in writing, software        #
11
# distributed under the License is distributed on an "AS IS" BASIS,          #
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
13
# See the License for the specific language governing permissions and        #
14
# limitations under the License.                                             #
15
#--------------------------------------------------------------------------- #
16

  
17
require 'uuid'
18
require 'OpenNebula'
19

  
20
include OpenNebula
21

  
22
class ImageEC2 < Image
23
    
24
    ONE_IMAGE = %q{
25
        NAME = "ec2-<%= uuid %>"
26
        TYPE = OS
27
    }.gsub(/^        /, '')
28
    
29
    def to_one_template()
30
        uuid = UUID.generate
31
        
32
        one = ERB.new(ONE_IMAGE)
33
        return one.result(binding)
34
    end
35
end

Also available in: Unified diff