def create
if input.machine_id
Machine.find(input.machine_id).update_attribute(:hostname, input.hostname)
else
system_name = input.system_name
repo = input.repo
email = input.email
cobbler_profile = _get_cobbler_profile(system_name, repo)
cobbler_distro = _get_cobbler_distro(cobbler_profile["distro"], repo)
Syncer::lock do
@host = _get_best_host(cobbler_profile["virt_ram"], cobbler_distro["arch"])
begin
_koan(@host, system_name, repo)
@machine = Machine.create :name => system_name, :repo => repo,
:email => email, :cloud => @host,
:state => "Installing", :created_date => DateTime.now(),
:node_name => system_name
render :_koan
rescue Exception => e
@exception = e
render :_error
end
end
end
end