Revision 384ab422 src/cli/onehost

View differences:

src/cli/onehost
123 123
            STDERR.puts "\t -v hypervisor driver"
124 124
            exit -1
125 125
        end
126
        
126

  
127 127
        ec2_host = !options[:ec2access].nil? && !options[:ec2secret].nil?
128 128

  
129 129
        cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID
130 130
        helper.create_resource(options) do |host|
131
                host.allocate(args[0],
132
                              options[:im],
133
                              options[:vm],
134
                              cid)
135
                if ec2_host
131
                rc = host.allocate(args[0], options[:im], options[:vm], cid)
132

  
133
                if ec2_host && !OpenNebula.is_error?(rc)
136 134
               	    template = "EC2_ACCESS=\"#{options[:ec2access]}\"\n"\
137 135
               		    "EC2_SECRET=\"#{options[:ec2secret]}\"\n"\
138 136

  
139
                    host.update(template, true)
137
                    rc = host.update(template, true)
140 138
                end
141 139

  
140
                rc
142 141
        end
143 142
    end
144 143

  

Also available in: Unified diff