Skip to content

Commit

Permalink
Fix output of too many ressouces error message
Browse files Browse the repository at this point in the history
  • Loading branch information
bdaase committed Feb 10, 2019
1 parent 2f049e8 commit abad503
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/controllers/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ def enough_resources?
max_storage_host = hosts.max_by(&:free_storage_gb)


max_cpu_host_msg = "cores: #{max_cpu_host.cpu_cores}, ram: #{max_cpu_host.ram_gb / 1024}GB, hdd: #{max_cpu_host.storage_gb / 1024}GB"
max_ram_host_msg = "cores: #{max_ram_host.cpu_cores}, ram: #{max_ram_host.ram_gb / 1024}GB, hdd: #{max_ram_host.storage_gb / 1024}GB"
max_storage_host_msg = "cores: #{max_storage_host.cpu_cores}, ram: #{max_storage_host.ram_gb / 1024}GB, hdd: #{max_storage_host.storage_gb / 1024}GB"
max_cpu_host_msg = "cores: #{max_cpu_host.cpu_cores}, ram: #{max_cpu_host.ram_gb}GB, hdd: #{max_cpu_host.storage_gb}GB"
max_ram_host_msg = "cores: #{max_ram_host.cpu_cores}, ram: #{max_ram_host.ram_gb}GB, hdd: #{max_ram_host.storage_gb}GB"
max_storage_host_msg = "cores: #{max_storage_host.cpu_cores}, ram: #{max_storage_host.ram_gb}GB, hdd: #{max_storage_host.storage_gb}GB"

error_message = "Requested VM resources are too high! Most Powerful Hosts are: Max Core Host(#{max_cpu_host_msg}) Max RAM Host(#{max_ram_host_msg}) Max HDD Host(#{max_storage_host_msg}) "
error_message = "Requested VM resources are too high! Most Powerful Hosts are:\nMax CPU Cores Host(#{max_cpu_host_msg})\nMax RAM Host(#{max_ram_host_msg})\nMax HDD Host(#{max_storage_host_msg}) "
@request.errors[:base] << error_message
false
end
Expand Down
6 changes: 3 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@
t.datetime "remember_created_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "role"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.integer "role"
t.string "first_name"
t.string "last_name"
t.string "provider"
t.string "uid"
t.string "first_name"
t.string "last_name"
t.integer "user_id"
t.string "ssh_key"
t.boolean "email_notifications", default: false
Expand Down

0 comments on commit abad503

Please sign in to comment.