Skip to content

Commit

Permalink
Merge pull request ManageIQ#14737 from bdunne/simplify_source_validation
Browse files Browse the repository at this point in the history
Simplify validation on #source
  • Loading branch information
gmcculloug authored Apr 12, 2017
2 parents d968839 + 1cab426 commit a308c60
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions app/models/miq_provision_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class MiqProvisionRequest < MiqRequest
validates_inclusion_of :request_state,
:in => %w(pending provisioned finished) + ACTIVE_STATES,
:message => "should be pending, #{ACTIVE_STATES.join(", ")}, provisioned, or finished"
validates_presence_of :source_id, :message => "must have valid template"
validate :must_have_valid_vm
validates :source, :presence => true
validate :must_have_user

default_value_for :options, :number_of_vms => 1
Expand All @@ -39,10 +38,6 @@ def self.new_request_task(attribs)
klass.new(attribs)
end

def must_have_valid_vm
errors.add(:vm_template, "must have valid VM (must be in vmdb)") if vm_template.nil?
end

def set_description(force = false)
prov_description = nil
if description.nil? || force == true
Expand Down

0 comments on commit a308c60

Please sign in to comment.