Sha256: 8273e4e2e41259f89a0c18eb9232c93b8ec32303e98e0475a347d885c42c92bb

Contents?: true

Size: 817 Bytes

Versions: 11

Compression:

Stored size: 817 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
  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

11 entries across 11 versions & 1 rubygems

Version Path
foreman_ansible-3.0.6 app/models/ansible_variable.rb
foreman_ansible-3.0.5 app/models/ansible_variable.rb
foreman_ansible-3.0.4 app/models/ansible_variable.rb
foreman_ansible-3.0.3 app/models/ansible_variable.rb
foreman_ansible-2.3.6 app/models/ansible_variable.rb
foreman_ansible-2.3.5 app/models/ansible_variable.rb
foreman_ansible-2.3.4 app/models/ansible_variable.rb
foreman_ansible-3.0.2 app/models/ansible_variable.rb
foreman_ansible-3.0.1 app/models/ansible_variable.rb
foreman_ansible-3.0.0 app/models/ansible_variable.rb
foreman_ansible-2.3.3 app/models/ansible_variable.rb