Project

General

Profile

« Previous | Next » 

Revision 43c4bd72

Added by Marek Hulán over 9 years ago

Fixes #7456 - Extract primary interface from host

Contributions from:

All host must have at least one primary interface and one provision (can
be the same interface). Primary interface gives host a name so even
unamanaged host have primary interface (we skip validations of other
attributes for unamanged hosts though).

Host still have name attribute which is a cache of primary interface name.
Therefore we can use the host name in SQL queries, as a friendly_id etc.

- realm moved to the primary tab
- fqdn in nics table
- flags in nics table
- checkboxes for provision and primary flags
- modal resize fix
- original fields for primary NIC removed
- skipping validation for new resources
- warnings before switching flags and table update
- host name and primary interface name connected
- host domain name in the page title
- nics on host show page
- clearing modal window on cancel
- fixed domain validation in NIC::Base
- ip suggestion for all interfaces
- flags switchable from the overview table
- use icons instead of text for primary/provision on NICs overview tab
- attempt to fix sending NIC template
- fix fqdn algorithm
- ip addres in the overview table
- fix for class name collision
- better behavior of host name <-> primary name sync
- fix for subnet combobox values
- fix for modal poping up on form submission
- network partial for CRs moved from VM tab to modal
- fix ip suggestion race for ipam=db

View differences:

test/unit/parameter_test.rb
setup do
User.current = users :admin
end
test "names may me reused in different parameter groups" do
test "names may be reused in different parameter groups" do
host = FactoryGirl.create(:host)
p1 = HostParameter.new :name => "param", :value => "value1", :reference_id => host.id
assert p1.save
......
test "parameters are hierarchically applied" do
CommonParameter.create :name => "animal", :value => "cat"
organization = taxonomies(:organization1)
location = taxonomies(:location1)
domain = Domain.find_or_create_by_name("company.com")
hostgroup = Hostgroup.find_or_create_by_name "Common"
host = Host.create :name => "myfullhost", :mac => "aabbecddeeff", :ip => "123.05.02.03",
:domain => domain, :operatingsystem => Operatingsystem.first, :hostgroup => hostgroup,
:architecture => Architecture.first, :environment => Environment.first, :disk => "empty partition",
:root_pass => "xybxa6JUkz63w", :location => location, :organization => organization
host = FactoryGirl.create(:host, :with_hostgroup, :managed)
organization = host.organization
location = host.location
domain = host.domain
hostgroup = host.hostgroup
CommonParameter.create :name => "animal", :value => "cat"
assert_equal "cat", host.host_params["animal"]
organization.organization_parameters << OrganizationParameter.create(:name => "animal", :value => "tiger")
host.clear_host_parameters_cache!
assert_equal "tiger", host.host_params["animal"]
location.location_parameters << LocationParameter.create(:name => "animal", :value => "lion")
host.clear_host_parameters_cache!
assert_equal "lion", host.host_params["animal"]
domain.domain_parameters << DomainParameter.create(:name => "animal", :value => "dog")
host.clear_host_parameters_cache!
assert_equal "dog", host.host_params["animal"]
hostgroup.group_parameters << GroupParameter.create(:name => "animal",:value => "cow")
host.clear_host_parameters_cache!
assert_equal "cow", host.host_params["animal"]
host.host_parameters << HostParameter.create(:name => "animal", :value => "pig")
host.clear_host_parameters_cache!
assert_equal "pig", host.host_params["animal"]
end
end

Also available in: Unified diff