Sha256: 4e98acec0e24559c9a5c92448d743562d92b574c7417da52564f58a61e3fb324

Contents?: true

Size: 938 Bytes

Versions: 12

Compression:

Stored size: 938 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_ansible_variables).
      where(:id => id).exists?
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman_ansible-14.2.1 app/models/ansible_variable.rb
foreman_ansible-13.0.7 app/models/ansible_variable.rb
foreman_ansible-14.2.0 app/models/ansible_variable.rb
foreman_ansible-14.1.1 app/models/ansible_variable.rb
foreman_ansible-14.1.0 app/models/ansible_variable.rb
foreman_ansible-13.0.5 app/models/ansible_variable.rb
foreman_ansible-14.0.0 app/models/ansible_variable.rb
foreman_ansible-13.0.4 app/models/ansible_variable.rb
foreman_ansible-13.0.3 app/models/ansible_variable.rb
foreman_ansible-13.0.2 app/models/ansible_variable.rb
foreman_ansible-13.0.1 app/models/ansible_variable.rb
foreman_ansible-13.0.0 app/models/ansible_variable.rb