Revision 43c4bd72
Added by Marek Hulán over 9 years ago
app/controllers/hosts_controller.rb | ||
---|---|---|
before_filter :ajax_request, :only => AJAX_REQUESTS
|
||
before_filter :find_resource, :only => [:show, :clone, :edit, :update, :destroy, :puppetrun, :review_before_build,
|
||
:setBuild, :cancelBuild, :power, :overview, :bmc, :vm,
|
||
:runtime, :resources, :templates, :ipmi_boot, :console,
|
||
:runtime, :resources, :templates, :nics, :ipmi_boot, :console,
|
||
:toggle_manage, :pxe_config, :storeconfig_klasses, :disassociate]
|
||
|
||
before_filter :taxonomy_scope, :only => [:new, :edit] + AJAX_REQUESTS
|
||
... | ... | |
load_vars_for_ajax
|
||
flash[:warning] = _("The marked fields will need reviewing")
|
||
@host.valid?
|
||
render :action => :new
|
||
end
|
||
|
||
def create
|
||
... | ... | |
end
|
||
end
|
||
|
||
def interfaces
|
||
@host = Host.new params[:host]
|
||
render :partial => "interfaces_tab"
|
||
end
|
||
|
||
def hostgroup_or_environment_selected
|
||
Taxonomy.as_taxonomy @organization, @location do
|
||
if params['host']['environment_id'].present? || params['host']['hostgroup_id'].present?
|
||
... | ... | |
process_ajax_error exception, 'fetch templates information'
|
||
end
|
||
|
||
def nics
|
||
render :partial => 'nics'
|
||
rescue ActionView::Template::Error => exception
|
||
process_ajax_error exception, 'fetch interfaces information'
|
||
end
|
||
|
||
def ipmi_boot
|
||
device = params[:ipmi_device]
|
||
device_id = BOOT_DEVICES.stringify_keys[device.downcase] || device
|
||
... | ... | |
|
||
def action_permission
|
||
case params[:action]
|
||
when 'clone', 'externalNodes', 'overview', 'bmc', 'vm', 'runtime', 'resources', 'templates',
|
||
when 'clone', 'externalNodes', 'overview', 'bmc', 'vm', 'runtime', 'resources', 'templates', 'nics',
|
||
'pxe_config', 'storeconfig_klasses', 'active', 'errors', 'out_of_sync', 'pending', 'disabled'
|
||
:view
|
||
when 'puppetrun', 'multiple_puppetrun', 'update_multiple_puppetrun'
|
Also available in: Unified diff
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