From 251af699a0f3d05e2e78eb0c85370a27e78e6502 Mon Sep 17 00:00:00 2001 From: Paul Kelly Date: Mon, 4 Oct 2010 12:37:09 +0100 Subject: [PATCH] I cannot handle engines --- README | 8 ++++ app/helpers/application_helper.rb | 33 ++++++++++++++++ app/views/hosts/_unattended.html.erb | 56 ++++++++++++++++++++++++++++ lib/netdb_manager.rb | 11 ++++++ 4 files changed, 108 insertions(+) create mode 100644 app/helpers/application_helper.rb create mode 100644 app/views/hosts/_unattended.html.erb diff --git a/README b/README index ba1e81d..b091b5a 100644 --- a/README +++ b/README @@ -36,6 +36,14 @@ config.cache_store = :mem_cache_store to the initializer block in config/environment.rb and then editing config/initializers/session_store.rb and setting the store type to :mem_cache_store +At this point you need to create the subnets that your hosts will be installed on. So jump to the subnets page +and create the reuqired entries. + +Your hosts now require a subnet and you must run +rake subnets:assign + +repeatedly until all your hosts have been assigned a subnet + Example ======= diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..ee686da --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,33 @@ +module ApplicationHelper + def settings_dropdown + choices = [ + ['Additional Settings', ""], + ['Architectures', architectures_url], + ['Domains', domains_url], + ['Environments', environments_url], + ["External Variables", lookup_keys_url], + ['Global Parameters', common_parameters_url], + ['Hardware Models', models_url], + ['Host Groups', hostgroups_url], + ['Installation Medias', medias_url], + ['LDAP Authentication', auth_source_ldaps_url], + ['Operating Systems', operatingsystems_url], + ['Partition Tables', ptables_url], + ['Puppet Classes', puppetclasses_url], + ['Subnets', subnets_url] + ] + choices += [ + ['Users', users_url], + ['Usergroups', usergroups_url] + ] if SETTINGS[:login] + + concat( + content_tag(:select, :id => "settings_dropdown") do + options_for_select choices, :selected => @controller.request.url + end + ) + concat( + observe_field('settings_dropdown', :function => "window.location.href = value;") + ) + end +end diff --git a/app/views/hosts/_unattended.html.erb b/app/views/hosts/_unattended.html.erb new file mode 100644 index 0000000..b3cfe9b --- /dev/null +++ b/app/views/hosts/_unattended.html.erb @@ -0,0 +1,56 @@ +<% field_set_tag 'Unattended settings', :id => "unattended" do -%> + <% field_set_tag 'Network settings', :id => "network" do -%> + + + + + + + + + + + +
Domain<%= f.collection_select :domain_id, Domain.all, :id, :to_label %>Subnet<%= f.collection_select :subnet_id, Subnet.all, :id, :to_label %>IP<%= f.text_field :ip, :size => 16 %>MAC<%= f.text_field :mac, :size => 17 %>
+ <% end -%> + + <% field_set_tag 'Operating system settings', :id => "operatingsystem" do -%> + + + + + + + + + + + + +
+ + Architecture + <%= f.collection_select :architecture_id, Architecture.all, :id, :to_label, :include_blank => true %> + + <% if @architecture -%> + <%= render "architecture" -%> + <% end -%> + + +
Root password<%= f.password_field :root_pass %>Model<%= f.collection_select :model_id, Model.all, :id, :to_label, :include_blank => true %>Serial<%= f.select :serial, ["","0,9600n8","0,19200n8","1,9600n8","1,19200n8"] %>
+ <%= link_to_function "Switch to custom disk layout", toggle_div("custom_disk") %>
+ ;"> + <%= f.text_area :disk, :size => "80x10", :title => 'Use custom Disk layout' %>
+ What ever text you use in here, would be used as your OS disk layout options
+ If you want to use the partition table option, delete all of the text from this field +
+
+ <% end -%> + +<% end -%> + +<%= observe_field(:host_architecture_id, + :url => { :action => :architecture_selected, :id => @host.id }, + :update => :host_os, + :with => :architecture_id) +%> diff --git a/lib/netdb_manager.rb b/lib/netdb_manager.rb index 20f63ca..8b02472 100644 --- a/lib/netdb_manager.rb +++ b/lib/netdb_manager.rb @@ -1,2 +1,13 @@ +ActiveSupport::Dependencies.load_once_paths.delete File.dirname(__FILE__) +# Patch the host with a transactional update facility that we use to hook our update code require 'netdb_manager/host_ext' +# Rails Engines works against us in some ways as it ensures that the last loaded module overrides the first. +# As the application's version of application_helper.rb is loaded last it overrides our overrides. +# Never mind, just load our overrides again, as the last loaded module. Maybe I should drop engines. . . . +require_or_load File.join(File.dirname(__FILE__), '..',"app", "helpers", "application_helper.rb") + +#HostsController.prepend_view_path(File.join(File.dirname(__FILE__), '..', 'app', 'views')) + +# If we define a view then this is the one we should use. +Engines.disable_application_view_loading = true