Skip to content

Commit

Permalink
I cannot handle engines
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Kelly committed Oct 4, 2010
1 parent 9282caa commit 251af69
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======

Expand Down
33 changes: 33 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions app/views/hosts/_unattended.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<% field_set_tag 'Unattended settings', :id => "unattended" do -%>
<% field_set_tag 'Network settings', :id => "network" do -%>
<table>
<tr>
<td>Domain</td>
<td><%= f.collection_select :domain_id, Domain.all, :id, :to_label %></td>
<td>Subnet</td>
<td><%= f.collection_select :subnet_id, Subnet.all, :id, :to_label %></td>
<td>IP</td>
<td><%= f.text_field :ip, :size => 16 %></td>
<td>MAC</td>
<td><%= f.text_field :mac, :size => 17 %></td>
</tr>
</table>
<% end -%>

<% field_set_tag 'Operating system settings', :id => "operatingsystem" do -%>
<table>
<tr>
<td colspan="6">
<span id="architecture">
Architecture
<%= f.collection_select :architecture_id, Architecture.all, :id, :to_label, :include_blank => true %>
<span id="host_os">
<% if @architecture -%>
<%= render "architecture" -%>
<% end -%>
</span>
</span>
</td>
</tr>
<tr>
<td>Root password</td>
<td><%= f.password_field :root_pass %></td>
<td>Model</td>
<td><%= f.collection_select :model_id, Model.all, :id, :to_label, :include_blank => true %></td>
<td>Serial</td>
<td><%= f.select :serial, ["","0,9600n8","0,19200n8","1,9600n8","1,19200n8"] %></td>
</tr>
</table>
<%= link_to_function "Switch to custom disk layout", toggle_div("custom_disk") %> <br/>
<span id="custom_disk" style="display:<%= @host.disk.empty? ? "none" : "inline" %>;">
<%= f.text_area :disk, :size => "80x10", :title => 'Use custom Disk layout' %><br/>
<small>What ever text you use in here, would be used as your OS disk layout options<br/>
If you want to use the partition table option, delete all of the text from this field
</small>
</span>
<% end -%>

<% end -%>

<%= observe_field(:host_architecture_id,
:url => { :action => :architecture_selected, :id => @host.id },
:update => :host_os,
:with => :architecture_id)
%>
11 changes: 11 additions & 0 deletions lib/netdb_manager.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 251af69

Please sign in to comment.