ananace / foreman_hyperv

Microsoft Hyper-V compute resource for Foreman
GNU General Public License v3.0
15 stars 2 forks source link

Problem rendering compute_resources_vms/form/hyperv/_base.html.erb #7

Closed selund closed 6 years ago

selund commented 7 years ago

My knowledge of Ruby is severely limited, but it seems that "f.object.cluster" on line 5 of compute_resources_vms/form/hyperv/_base.html.erb returns "nil". To test I removed "f.object.cluster", and the template renders and show the cluster, but no computers.

5c5 < computers = (f.object.cluster || compute_resource).hosts.map(&:name)

computers = compute_resource.hosts.map(&:name)

Since I know you're working on this code I don't know if you want bug reports at this time.

ananace commented 7 years ago

That's also why I'm using a || in there, so if the server doesn't have a cluster set then it falls back to the list from the compute resource itself.

But yes, feel free to throw in more bug reports if you find them, don't only want to support my use case after all.

selund commented 7 years ago

Ok, if I don't remove (f.obcject.cluster || ) the template fails to render and in the production log I see "ActionView::Template::Error: nil is not a symbol nor a string". For some reason I though the problem started in _base.html.erb, but after checking the stack trace once more I see that It's on line 44 in lib/fog/model.rb

ananace commented 7 years ago

As it turns out, my thoughts on doing name-based lookups for all my fog models were a bit off. Should hopefully be fixed with my latest commit to fog-hyperv

Though worth noting is that right now there's no code for triggering an update after selecting a cluster, so the computer list might still be empty.

ananace commented 6 years ago

This should be fixed by now, going to close it for now though feel free to respond if the issue still exists.