ManageIQ/manageiq — pull request #264 by Fryguy (2014-07-23 20:24:19+00:00)
Title: [WIP] Remove UiTask and UiTaskSet as they are no longer used.

WIP - NOT READY FOR MERGE

Transferred PR from the old repo.

---
---
---

@dclarizio @h-kataria @martinpovolny Please review.

This is my first pass at removing UiTask and UiTaskSet. There are still a lot of places in the code that need changes, but I need some guidance. I've clicked all over the UI as much as I could with my limited amount of data, and I didn't see one blow-up.

So, some things I need guidance on:
- MiqGroup#role and User#role are still referenced here and there in methods in miq_group.rb and user.rb. I haven't checked elsewhere yet, nor if those methods are subsequently referenced somewhere else. I might need to walk through the code with someone on that.
- There are a bunch of specs with FactoryGirl.create(:ui_task...) Not sure what to do with those...I assume the code has to be set up to deal with the newer RBAC style, but I might need help/guidance.
- There are a bunch of specs with UiTask.stub or UiTaskSet.stub. Same as the FactoryGirl stuff, need to understand what I should do different there.

---

Some relevant git greps that might be useful. grepping for just ui_task shows a TON of strings in the UI code, so weeding through that is a little difficult.

```ruby
$ git grep "FactoryGirl.create(:ui_task"
spec/apis/vmdbws_automation_spec.rb:16: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator', :description => 'Super Administrator')
spec/apis/vmdbws_inventory_spec.rb:8: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator2', :description => 'Super Administrator')
spec/apis/vmdbws_provisioning_spec.rb:16: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator', :description => 'Super Administrator')
spec/automation/unit/method_validation/validate_quota_spec.rb:8: @approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_host_provision_request_spec.rb:18: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_host_provision_spec.rb:20: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_provision_request_spec.rb:20: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_provision_spec.rb:26: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_provision_spec.rb:43: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_provision_vmware_spec.rb:32: FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_request_spec.rb:17: @approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_miq_request_task_spec.rb:30: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/lib/miq_automation_engine/service_methods/miq_ae_service_service_template_provision_request_spec.rb:11: @approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/models/miq_host_provision_workflow_spec.rb:24: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator', :description => 'Super Administrator')
spec/models/miq_provision_workflow_spec.rb:24: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator', :description => 'Super Administrator')
spec/models/miq_request_task/guest_installation_tools_spec.rb:8: approver_role = FactoryGirl.create(:ui_task_set_approver)
spec/models/resource_action_workflow_spec.rb:8: super_role = FactoryGirl.create(:ui_task_set, :name => 'super_administrator', :description => 'Super Administrator')
```

```ruby
$ git grep UiTask
app/controllers/ops_controller/settings/common.rb:1231:# @temp[:roles] = UiTaskSet.all.sort_by{ |role| role[:description] }
app/models/miq_approval.rb:49: return true if self.approver.kind_of?(UiTaskSet) && self.approver == user.role
app/models/miq_group.rb:87: role = UiTaskSet.find_by_name(groups_to_roles[g])
app/models/miq_request.rb:109: self.miq_approvals << self.build_default_approval(UiTaskSet.find_by_name("approver"))
app/models/miq_request.rb:269: self.miq_approvals.first || self.build_default_approval(UiTaskSet.find_by_name("approver"))
app/models/miq_user_role.rb:175: # Migrate settings stored in UiTaskSet#set_data to settings
app/models/miq_user_role.rb:177: old_role = UiTaskSet.in_my_region.find_by_name(old_role_name)
spec/apis/vmdbws_automation_spec.rb:20: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/apis/vmdbws_provisioning_spec.rb:20: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/automation_request_spec.rb:9: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/automation_task_spec.rb:9: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_approval_spec.rb:9: approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_approval_spec.rb:19: approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_approval_spec.rb:44: approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_approval_spec.rb:73: approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_approval_spec.rb:109: @approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_host_provision_request_spec.rb:9: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_host_provision_workflow_spec.rb:28: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_redhat_spec.rb:10: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_redhat_via_iso_spec.rb:10: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_redhat_via_pxe_spec.rb:10: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_request_spec.rb:19: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_spec.rb:10: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_vmware_spec.rb:10: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_provision_workflow_spec.rb:28: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/miq_request_spec.rb:8: @approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/miq_request_spec.rb:46: @approver_role = UiTaskSet.create(:name => "approver", :description => "Approver")
spec/models/service_template_provision_request_spec.rb:9: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/service_template_provision_task_spec.rb:9: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/service_template_spec.rb:235: UiTaskSet.stub(:find_by_name).and_return(@approver)
spec/models/user_spec.rb:486: UiTask.seed_roles
spec/views/miq_request/_prov_options.html.erb_spec.rb:12: @approver_role = UiTaskSet.create(:name => 'approver', :description => 'Approver')
spec/views/miq_request/_prov_options.html.erb_spec.rb:76: @approver_role = UiTaskSet.create(:name => 'approver', :description => 'Approver')
```