Project

General

Profile

« Previous | Next » 

Revision 9bb4e25f

Added by Ohad Levy about 12 years ago

  • ID 9bb4e25f77db6771096a83185dc6ce41c8be9e7f

fixes #1600 - records are deleted even though host is not Managed

View differences:

app/models/host_common.rb
end
def puppetca?
return false if self.respond_to?(:managed?) and !managed?
!!(puppet_ca_proxy and puppet_ca_proxy.url.present?)
end
app/models/orchestration/dhcp.rb
module InstanceMethods
def dhcp?
!subnet.nil? and subnet.dhcp?
!subnet.nil? and subnet.dhcp? and managed?
end
def sp_dhcp?
app/models/orchestration/dns.rb
module InstanceMethods
def dns?
!domain.nil? and !domain.proxy.nil?
!domain.nil? and !domain.proxy.nil? and managed?
end
def dns_a_record
app/models/orchestration/tftp.rb
module InstanceMethods
def tftp?
!!(subnet and subnet.tftp?)
!!(subnet and subnet.tftp?) and managed?
end
def tftp
test/fixtures/hosts.yml
subnet: one
domain: mydomain
puppet_proxy: puppetmaster
managed: true
two:
name: temp.yourdomain.net
......
dhcp:
name: dhcp.mydomain.net
ip: "2.3.4.100"
ip: "2.3.4.110"
mac: da:bb:cc:dd:ee:ee
environment: production
architecture: x86_64
......
subnet: one
domain: mydomain
puppet_proxy: puppetmaster
managed: true
sp_dhcp:
name: sdhcp.mydomain.net
......
sp_mac: da:bb:cc:dd:ee:aa
domain: mydomain
puppet_proxy: puppetmaster
managed: true
test/unit/host_test.rb
test "should not save if IP is not in the right subnet" do
if unattended?
host = Host.create :name => "myfullhost", :mac => "aabbecddeeff", :ip => "123.05.02.03",
:domain => domains(:mydomain), :operatingsystem => Operatingsystem.first, :subnet => subnets(:one),
:domain => domains(:mydomain), :operatingsystem => Operatingsystem.first, :subnet => subnets(:one), :managed => true,
:architecture => Architecture.first, :environment => Environment.first, :ptable => Ptable.first, :puppet_proxy => smart_proxies(:puppetmaster)
assert !host.valid?
end

Also available in: Unified diff