Feature #1361 » foreman-4.0-subnet-values-in-provisioning-templates.patch
app/helpers/unattended_helper.rb | ||
---|---|---|
@host.root_pass
|
||
end
|
||
def subnet
|
||
subnet = Subnet.find(@host.subnet_id)
|
||
{:gateway => subnet.gateway , :mask => subnet.mask,
|
||
:dns_primary => subnet.dns_primary, :dns_secondary => subnet.dns_secondary }
|
||
end
|
||
end
|
app/models/subnet.rb | ||
---|---|---|
belongs_to :dhcp, :class_name => "SmartProxy"
|
||
belongs_to :tftp, :class_name => "SmartProxy"
|
||
belongs_to :domain
|
||
validates_presence_of :network, :mask, :domain_id, :name
|
||
validates_presence_of :network, :mask, :gateway, :dns_primary, :dns_secondary, :domain_id, :name
|
||
validates_uniqueness_of :network
|
||
validates_format_of :network, :with => Net::Validations::IP_REGEXP
|
||
validates_format_of :mask, :with => Net::Validations::IP_REGEXP
|
||
validates_format_of :gateway, :with => Net::Validations::IP_REGEXP
|
||
validates_format_of :dns_primary, :with => Net::Validations::IP_REGEXP
|
||
validates_format_of :dns_secondary, :with => Net::Validations::IP_REGEXP
|
||
validates_uniqueness_of :name, :scope => :domain_id
|
||
default_scope :order => 'priority'
|
||
before_destroy Ensure_not_used_by.new(:hosts, :sps)
|
||
scoped_search :on => [:name, :network, :mask], :complete_value => true
|
||
scoped_search :on => [:name, :network, :mask, :gateway, :dns_primary, :dns_secondary], :complete_value => true
|
||
scoped_search :in => :domain, :on => :name, :rename => :domain, :complete_value => true
|
||
# Subnets are displayed in the form of their network network/network mask
|
app/views/subnets/_fields.html.erb | ||
---|---|---|
:help_inline => "Domains in which this subnet is part" %>
|
||
<%= text_f f, :network %>
|
||
<%= text_f f, :mask, :help_inline => "Netmask for this subnet", :label => "Netmask" %>
|
||
<%= text_f f, :gateway, :help_inline => "Gateway for this subnet", :label => "Gateway" %>
|
||
<%= text_f f, :dns_primary, :help_inline => "Primary DNS for this subnet", :label => "Primary DNS" %>
|
||
<%= text_f f, :dns_secondary, :help_inline => "Secondary DNS for this subnet", :label => "Secondary DNS" %>
|
||
<%= select_f f, :dhcp_id, Feature.find_by_name("DHCP").smart_proxies, :id, :name, :include_blank => "None",
|
||
:help_inline => "DHCP Proxy to use within this subnet", :label => "DHCP Proxy" %>
|
db/schema.rb | ||
---|---|---|
#
|
||
# It's strongly recommended to check this file into your version control system.
|
||
ActiveRecord::Schema.define(:version => 20110803114134) do
|
||
ActiveRecord::Schema.define(:version => 20111205231500) do
|
||
create_table "architectures", :force => true do |t|
|
||
t.string "name", :limit => 10, :default => "x86_64", :null => false
|
||
... | ... | |
t.datetime "updated_at"
|
||
t.integer "dhcp_id"
|
||
t.integer "tftp_id"
|
||
t.string "gateway", :limit => 15
|
||
t.string "dns_primary", :limit => 15
|
||
t.string "dns_secondary", :limit => 15
|
||
end
|
||
create_table "template_combinations", :force => true do |t|
|
lib/foreman/renderer.rb | ||
---|---|---|
end
|
||
def unattended_render template
|
||
allowed_helpers = [ :foreman_url, :grub_pass, :snippet, :snippets, :ks_console, :root_pass, :multiboot, :jumpstart_path, :install_path,
|
||
allowed_helpers = [ :foreman_url, :grub_pass, :snippet, :snippets, :ks_console, :root_pass, :subnet, :multiboot, :jumpstart_path, :install_path,
|
||
:miniroot, :media_path]
|
||
allowed_variables = ({:arch => @arch, :host => @host, :osver => @osver, :mediapath => @mediapath, :static => @static,
|
||
:yumrepo => @yumrepo, :dynamic => @dynamic, :epel => @epel, :kernel => @kernel, :initrd => @initrd,
|
migrate/20111205231500_add_gateway_and_dns_to_subnets.rb | ||
---|---|---|
class AddGatewayAndDnsToSubnets < ActiveRecord::Migration
|
||
def self.up
|
||
add_column :subnets, :gateway, :string, :limit => 15
|
||
add_column :subnets, :dns_primary, :string, :limit => 15
|
||
add_column :subnets, :dns_secondary, :string, :limit => 15
|
||
end
|
||
def self.down
|
||
remove_column :subnets, :gateway
|
||
remove_column :subnets, :dns_primary
|
||
remove_column :subnets, :dns_secondary
|
||
end
|
||
end
|
- « Previous
- 1
- 2
- Next »