Sha256: fb1abf2ea947fc53c44164f65d0ca0209275d0df935d84a7cb04dc0ae5779b9d

Contents?: true

Size: 940 Bytes

Versions: 71

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

# Represents the variables used in Ansible to parameterize playbooks
class AnsibleVariable < LookupKey
  belongs_to :ansible_role, :inverse_of => :ansible_variables
  validates :ansible_role_id, :presence => true
  before_validation :cast_default_value, :if => :override?
  validates :key, :uniqueness => { :scope => :ansible_role_id }
  scoped_search :on => :key, :aliases => [:name], :complete_value => true
  scoped_search :on => :imported, :complete_value => { :true => true, :false => false }
  scoped_search :relation => :ansible_role, :on => :name,
                :complete_value => true, :rename => :ansible_role

  def ansible?
    true
  end

  def self.humanize_class_name(options = nil)
    if options.present?
      super
    else
      "Ansible variable"
    end
  end

  def editable_by_user?
    AnsibleVariable.authorized(:edit_external_parameters).
      where(:id => id).exists?
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
foreman_ansible-4.0.3.4 app/models/ansible_variable.rb
foreman_ansible-4.0.3.3 app/models/ansible_variable.rb
foreman_ansible-4.0.3.2 app/models/ansible_variable.rb
foreman_ansible-5.0.1 app/models/ansible_variable.rb
foreman_ansible-4.0.5 app/models/ansible_variable.rb
foreman_ansible-4.0.3.1 app/models/ansible_variable.rb
foreman_ansible-4.0.4 app/models/ansible_variable.rb
foreman_ansible-5.0.0 app/models/ansible_variable.rb
foreman_ansible-4.0.3 app/models/ansible_variable.rb
foreman_ansible-4.0.2 app/models/ansible_variable.rb
foreman_ansible-4.0.0 app/models/ansible_variable.rb