Project

General

Profile

« Previous | Next » 

Revision 9afa092e

Added by Ohad Levy almost 13 years ago

  • ID 9afa092efc9434bb5f3662ee519da994058efcbb

fixes #322 Ability to add custom variables and multiple values resovled
in a dynamic Hierarchally order

This commits introduces the ability to define variables per puppet
class.

additionally, each class can have multiple values, depends on the host
which is requesting that variable.
each variable, can have validations rules (such as regexp, pre definiend
list etc).
Each value is then evalutated against a matcher role, if not found, the
default value is returned.

as a follow up tickets, we would allow to edit values in the host form
( and host group, domain os etc)

an additional foreman setting was added, to define the default lookup
order (which can be overwritten per variable).

View differences:

app/models/hostgroup.rb
include HostCommon
has_and_belongs_to_many :puppetclasses
has_and_belongs_to_many :users, :join_table => "user_hostgroups"
validates_uniqueness_of :name, :scope => :ancestry
validates_uniqueness_of :name, :scope => :ancestry, :case_sensitive => false
validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => "can't be blank or contain trailing white spaces."
has_many :group_parameters, :dependent => :destroy, :foreign_key => :reference_id
accepts_nested_attributes_for :group_parameters, :reject_if => lambda { |a| a[:value].blank? }, :allow_destroy => true
......
def to_label
return unless name
"/" + ancestors.map{|a| a.name + "/"}.join + name
ancestors.map{|a| a.name + "/"}.join + name
end
def as_json(options={})

Also available in: Unified diff