Revision c5dc6a3c src/cli/onehost

View differences:

src/cli/onehost
32 32
require 'command_parser'
33 33
require 'one_helper/onehost_helper'
34 34
require 'one_helper/onecluster_helper'
35
require 'ec2_driver'
36 35

  
37 36
cmd=CommandParser::CmdParser.new(ARGV) do
38 37
    usage "`onehost` <command> [<args>] [<options>]"
......
124 123
            STDERR.puts "\t -v hypervisor driver"
125 124
            exit -1
126 125
        end
126
        
127
        ec2_host = !options[:ec2access].nil? && !options[:ec2secret].nil?
127 128

  
128
        encrypt(options) 
129
        if ec2_host
130
            ec2_opts = {
131
                :access => options[:ec2access],
132
                :secret => options[:ec2secret]
133
            }
129 134

  
130
        cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID
135
            encrypt_opts = helper.encrypt(ec2_opts) 
136
            helper.decrypt(encrypt_opts)
137

  
138
        end
131 139

  
140
        cid = options[:cluster] || ClusterPool::NONE_CLUSTER_ID
132 141
        helper.create_resource(options) do |host|
133 142
                host.allocate(args[0],
134 143
                              options[:im],
135 144
                              options[:vm],
136 145
                              cid)
146
				#template=""
147
				#encrypt_opts.each do |key, value|
148
           		#	template << "#{key}=\"+value\"\n"\
149
				#end
150

  
151
               	template = "EC2_ACCESS=\"#{encrypt_opts[:access]}\"\n"\
152
               		"EC2_SECRET=\"#{encrypt_opts[:secret]}\"\n"\
153

  
154
                host.update(template, true)
155

  
156

  
137 157
        end
138 158
    end
139 159

  

Also available in: Unified diff