Sha256: ad2f859c8c2f27a0be4824151e2ba0ca8194926f5b43221bda8dd11580a44206
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
class RemoteExecutionFeature < ActiveRecord::Base attr_accessible :label, :name, :provided_input_names, :description, :job_template_id validate :label, :name, :presence => true, :unique => true belongs_to :job_template extend FriendlyId friendly_id :label def provided_input_names self.provided_inputs.to_s.split(',').map(&:strip) end def provided_input_names=(values) self.provided_inputs = Array(values).join(',') end def self.feature(label) self.find_by_label(label) || raise(::Foreman::Exception.new(N_('Unknown remote execution feature %s'), label)) end def self.register(label, name, options = {}) return false unless RemoteExecutionFeature.table_exists? options.assert_valid_keys(:provided_inputs, :description) feature = self.find_by_label(label) if feature.nil? feature = self.create!(:label => label, :name => name, :provided_input_names => options[:provided_inputs], :description => options[:description]) else feature.update_attributes!(:name => name, :provided_input_names => options[:provided_inputs], :description => options[:description]) end return feature end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_remote_execution-0.3.1 | app/models/remote_execution_feature.rb |
foreman_remote_execution-0.3.0 | app/models/remote_execution_feature.rb |