From 7d8eac9b122b197882758d81c1d71462312b1253 Mon Sep 17 00:00:00 2001
From: Paul Kelly
<%= f.label :dns_id %>
- <%= f.collection_select :dns_id, Netdb.servertype_name_is("DNS"), :id, :name %>
+ <%= f.collection_select :dns_id, Netsvc.servertype_name_is("DNS"), :id, :name %>
<%= f.label :name %>
diff --git a/app/views/netdbs/edit.html.erb b/app/views/netdbs/edit.html.erb
index 66b40e1..dc767de 100644
--- a/app/views/netdbs/edit.html.erb
+++ b/app/views/netdbs/edit.html.erb
@@ -2,5 +2,5 @@
<%= render :partial => 'form' %>
-
<%= link_to "View all network databases", netdbs_path %>
+<%= link_to "View all network databases", netsvcs_path %>
diff --git a/app/views/netdbs/index.html.erb b/app/views/netdbs/index.html.erb index 6e291e3..3f2e512 100644 --- a/app/views/netdbs/index.html.erb +++ b/app/views/netdbs/index.html.erb @@ -1,4 +1,4 @@ -<% title "Network databases" %> +<% title "Network services" %>Service | ||||||||
---|---|---|---|---|---|---|---|---|
<%=link_to h(netdb.name), edit_netdb_path(netdb)%> | -<%=netdb.address%> | -<%=netdb.vendor.name%> | -<%=netdb.servertype.name%> | +<%=link_to h(netsvc.name), edit_netsvc_path(netsvc)%> | +<%=netsvc.address%> | +<%=netsvc.vendor.name%> | +<%=netsvc.servertype.name%> | - <%= link_to "Destroy", netdb, :confirm => "Delete #{netdb.name}?", :method => :delete %> + <%= link_to "Destroy", netsvc, :confirm => "Delete #{netsvc.name}?", :method => :delete %> |
<%= link_to "New network database", new_netdb_path %>
+<%= link_to "New network service", new_netsvc_path %>
diff --git a/app/views/netdbs/new.html.erb b/app/views/netdbs/new.html.erb index e4e5ec9..3a0dd4c 100644 --- a/app/views/netdbs/new.html.erb +++ b/app/views/netdbs/new.html.erb @@ -1,5 +1,5 @@ -<% title "New network database" %> +<% title "New network service" %> <%= render :partial => 'form' %> -<%= link_to "Back to List", netdbs_path %>
+<%= link_to "Back to List", netsvcs_path %>
diff --git a/app/views/subnets/_form.html.erb b/app/views/subnets/_form.html.erb index f5d2f3a..3d5d320 100644 --- a/app/views/subnets/_form.html.erb +++ b/app/views/subnets/_form.html.erb @@ -22,7 +22,7 @@
<%= f.label :dhcp_id %>
- <%= f.collection_select :dhcp_id, Netdb.servertype_name_is("DHCP"), :id, :name %>
+ <%= f.collection_select :dhcp_id, Netsvc.servertype_name_is("DHCP"), :id, :name %>
<%= f.label :vlanid %>
diff --git a/config/routes.rb b/config/routes.rb
index bf7352b..cf5187b 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,4 @@
ActionController::Routing::Routes.draw do |map|
map.resources :subnets
- map.resources :netdbs
+ map.resources :netsvcs
end
diff --git a/db/migrate/20091212110059_create_netdbs.rb b/db/migrate/20091212110059_create_netdbs.rb
index cb6724c..8af9705 100644
--- a/db/migrate/20091212110059_create_netdbs.rb
+++ b/db/migrate/20091212110059_create_netdbs.rb
@@ -1,6 +1,6 @@
-class CreateNetdbs < ActiveRecord::Migration
+class CreateNetsvcs < ActiveRecord::Migration
def self.up
- create_table :netdbs do |t|
+ create_table :netsvcs do |t|
t.string :name, :limit => 32, :null => false
t.string :address, :limit => 32, :null => false
t.integer :servertype_id, :null => false
@@ -29,7 +29,7 @@ def self.up
end
def self.down
- drop_table :netdbs
+ drop_table :netsvcs
remove_column :subnets, :dhcp_id
end
end
diff --git a/init.rb b/init.rb
index 51d35ab..2a4739d 100644
--- a/init.rb
+++ b/init.rb
@@ -1,3 +1,3 @@
#require_dependency File.join(File.dirname(__FILE__), "..", "..", "..", "config", "initializers", "foreman")
-require_dependency 'netdb_manager'
+require_dependency 'netsvc_manager'
ActiveSupport::Dependencies.load_once_paths.delete lib_path
\ No newline at end of file
diff --git a/install.rb b/install.rb
index 17b1c2b..13503d0 100755
--- a/install.rb
+++ b/install.rb
@@ -15,7 +15,7 @@
File.open(routes, "r") do |src|
File.open(new_routes, "w") do |dst|
line = src.readline
- dst.write("map.NetdbManagers") if line.match(/Routes.draw/)
+ dst.write("map.NetsvcManagers") if line.match(/Routes.draw/)
dst.write line
end
end
diff --git a/lib/netdb_manager.rb b/lib/netdb_manager.rb
index 94fad07..b27cac1 100644
--- a/lib/netdb_manager.rb
+++ b/lib/netdb_manager.rb
@@ -1,5 +1,5 @@
# Patch the ActionController with a alias_method_chain that loads our modifications to the models
-require_dependency 'netdb_manager/action_controller_ext'
+require_dependency 'netsvc_manager/action_controller_ext'
ActionController::Base.prepend_view_path(File.join(File.dirname(__FILE__), '..', 'app', 'views'))
diff --git a/lib/netdb_manager/action_controller_ext.rb b/lib/netdb_manager/action_controller_ext.rb
index 86cbee0..f0cb675 100644
--- a/lib/netdb_manager/action_controller_ext.rb
+++ b/lib/netdb_manager/action_controller_ext.rb
@@ -1,4 +1,4 @@
-module NetdbManager
+module NetsvcManager
mattr_accessor :dhcp_servers, :dhcp, :user_data
module ActionControllerExtensions
@@ -8,21 +8,21 @@ def self.included(base) #:nodoc:
base.send :include, InstanceMethods
base.class_eval do
- alias_method_chain :process, :netdb_support
+ alias_method_chain :process, :netsvc_support
end
end
module InstanceMethods
- def process_with_netdb_support *args
- require_dependency 'netdb_manager/host_ext'
- require_dependency 'netdb_manager/user_ext'
- require_dependency 'netdb_manager/subnet_ext'
- require_dependency 'netdb_manager/domain_ext'
- require_dependency 'netdb_manager/application_controller_ext'
- require_dependency 'netdb_manager/hosts_controller_ext'
- process_without_netdb_support *args
+ def process_with_netsvc_support *args
+ require_dependency 'netsvc_manager/host_ext'
+ require_dependency 'netsvc_manager/user_ext'
+ require_dependency 'netsvc_manager/subnet_ext'
+ require_dependency 'netsvc_manager/domain_ext'
+ require_dependency 'netsvc_manager/application_controller_ext'
+ require_dependency 'netsvc_manager/hosts_controller_ext'
+ process_without_netsvc_support *args
end
end
end
end
-ActionController::Base.send :include, NetdbManager::ActionControllerExtensions
+ActionController::Base.send :include, NetsvcManager::ActionControllerExtensions
diff --git a/lib/netdb_manager/application_controller_ext.rb b/lib/netdb_manager/application_controller_ext.rb
index c6736a2..1a072fe 100644
--- a/lib/netdb_manager/application_controller_ext.rb
+++ b/lib/netdb_manager/application_controller_ext.rb
@@ -1,4 +1,4 @@
-module NetdbManager
+module NetsvcManager
module ApplicationControllerExtensions
NET_TTL = 7200
@@ -6,19 +6,19 @@ def self.included(base) #:nodoc:
base.send :include, InstanceMethods
base.class_eval do
# Setting the filter chain here will not work as it is too late. Set it in each controller individually.
- #before_filter :load_netdb_caches
+ #before_filter :load_netsvc_caches
end
true
end
module InstanceMethods
- def load_netdb_caches
+ def load_netsvc_caches
raise RuntimeError "Unable to determine the user for this operation " unless @user
return true if SETTINGS[:unattended] and SETTINGS[:unattended] == false
# Fetch the user data mecache. This holds per-user data dependant on the server implementation
- NetdbManager.user_data = Rails.cache.fetch("user_data", :expires_in => NET_TTL){{}}.dup
- raise RuntimeError, "Unable to create user data cache storage" unless NetdbManager.user_data
+ NetsvcManager.user_data = Rails.cache.fetch("user_data", :expires_in => NET_TTL){{}}.dup
+ raise RuntimeError, "Unable to create user data cache storage" unless NetsvcManager.user_data
true
end
@@ -26,4 +26,4 @@ def load_netdb_caches
end
end
end
-ApplicationController.send :include, NetdbManager::ApplicationControllerExtensions
+ApplicationController.send :include, NetsvcManager::ApplicationControllerExtensions
diff --git a/lib/netdb_manager/domain_ext.rb b/lib/netdb_manager/domain_ext.rb
index 2d10e13..3ada14a 100644
--- a/lib/netdb_manager/domain_ext.rb
+++ b/lib/netdb_manager/domain_ext.rb
@@ -1,10 +1,10 @@
-module NetdbManager
+module NetsvcManager
module DomainExtensions
def self.included(base) #:nodoc:
base.extend ClassMethods
base.send :include, InstanceMethods
base.class_eval do
- belongs_to :dns, :class_name => 'Netdb'
+ belongs_to :dns, :class_name => 'Netsvc'
end
end
@@ -17,4 +17,4 @@ module ClassMethods
end
end
end
-Domain.send :include, NetdbManager::DomainExtensions
+Domain.send :include, NetsvcManager::DomainExtensions
diff --git a/lib/netdb_manager/host_ext.rb b/lib/netdb_manager/host_ext.rb
index a67571a..945e8cc 100644
--- a/lib/netdb_manager/host_ext.rb
+++ b/lib/netdb_manager/host_ext.rb
@@ -1,4 +1,4 @@
-module NetdbManager
+module NetsvcManager
module HostExtensions
def self.included(base)
# This implementation requires memcache
@@ -21,10 +21,10 @@ def self.included(base)
base.send :include, InstanceMethods
base.class_eval do
attr_accessor :dns, :dhcp
- before_create :initialize_proxies, :check_netdbs
- after_create :create_netdbs, :initialize_tftp
- after_update :initialize_proxies, :update_netdbs
- after_destroy :initialize_proxies, :destroy_netdbs
+ before_create :initialize_proxies, :check_netsvcs
+ after_create :create_netsvcs, :initialize_tftp
+ after_update :initialize_proxies, :update_netsvcs
+ after_destroy :initialize_proxies, :destroy_netsvcs
end
true
end
@@ -36,7 +36,7 @@ def initialize_tftp
end
# Checks whether DNS or DHCP entries already exist
# Returns: Boolean true if no entries exists
- def check_netdbs
+ def check_netsvcs
continue = true
if (address = @resolver.getaddress(name) rescue false)
errors.add_to_base "#{name} is already in DNS with an address of #{address}"
@@ -141,7 +141,7 @@ def initialize_proxies
@resolver = Resolv::DNS.new :search => domain.name, :nameserver => domain.dns.address
end
- def destroy_netdbs
+ def destroy_netsvcs
return true if RAILS_ENV == "test"
# We do not care about entries not being present when we delete them but comms errors, etc, must be reported
@@ -163,10 +163,10 @@ def destroy_netdbs
false
end
- def create_netdbs
+ def create_netsvcs
return true if RAILS_ENV == "test"
- # We have just tested the validity of the DNS operation in check_netdbs, so if the operation fails it is not due to a conflict
+ # We have just tested the validity of the DNS operation in check_netsvcs, so if the operation fails it is not due to a conflict
# Therefore the operation failed because the write failed and therefore we do not need to rollback the DNS operation
if setDNS
unless setDHCP
@@ -182,7 +182,7 @@ def create_netdbs
false
end
- def update_netdbs
+ def update_netsvcs
old = clone
for key in (changed_attributes.keys - ["updated_at"])
old.send "#{key}=", changed_attributes[key]
@@ -232,4 +232,4 @@ module ClassMethods
end
end
-Host.send :include, NetdbManager::HostExtensions
+Host.send :include, NetsvcManager::HostExtensions
diff --git a/lib/netdb_manager/hosts_controller_ext.rb b/lib/netdb_manager/hosts_controller_ext.rb
index bfcb939..72ddbf7 100644
--- a/lib/netdb_manager/hosts_controller_ext.rb
+++ b/lib/netdb_manager/hosts_controller_ext.rb
@@ -1,4 +1,4 @@
-module NetdbManager
+module NetsvcManager
module HostsControllerExtensions
def self.included(base) #:nodoc:
base.send :include, InstanceMethods
@@ -11,4 +11,4 @@ module InstanceMethods
end
end
end
-HostsController.send :include, NetdbManager::HostsControllerExtensions
+HostsController.send :include, NetsvcManager::HostsControllerExtensions
diff --git a/lib/netdb_manager/subnet_ext.rb b/lib/netdb_manager/subnet_ext.rb
index 28a6af6..1143260 100644
--- a/lib/netdb_manager/subnet_ext.rb
+++ b/lib/netdb_manager/subnet_ext.rb
@@ -1,10 +1,10 @@
-module NetdbManager
+module NetsvcManager
module SubnetExtensions
def self.included(base) #:nodoc:
base.extend ClassMethods
base.send :include, InstanceMethods
base.class_eval do
- belongs_to :dhcp, :class_name => 'Netdb'
+ belongs_to :dhcp, :class_name => 'Netsvc'
validate_on_create :must_be_unique_per_site
end
@@ -27,4 +27,4 @@ module ClassMethods
end
end
end
-Subnet.send :include, NetdbManager::SubnetExtensions
+Subnet.send :include, NetsvcManager::SubnetExtensions
diff --git a/lib/netdb_manager/user_ext.rb b/lib/netdb_manager/user_ext.rb
index 3f948b7..a1a156b 100644
--- a/lib/netdb_manager/user_ext.rb
+++ b/lib/netdb_manager/user_ext.rb
@@ -1,4 +1,4 @@
-module NetdbManager
+module NetsvcManager
module UserExtensions
NET_TTL = 7200
def self.included(base) #:nodoc:
@@ -6,7 +6,7 @@ def self.included(base) #:nodoc:
base.send :include, InstanceMethods
base.class_eval do
class << self
- alias_method_chain :try_to_login, :netdb_support
+ alias_method_chain :try_to_login, :netsvc_support
end
end
end
@@ -16,8 +16,8 @@ module InstanceMethods
module ClassMethods
- def try_to_login_with_netdb_support(login, password)
- if user = self.try_to_login_without_netdb_support(login, password)
+ def try_to_login_with_netsvc_support(login, password)
+ if user = self.try_to_login_without_netsvc_support(login, password)
User.capture_user_data user
end
user
@@ -33,4 +33,4 @@ def capture_user_data user
end
end
end
-User.send :include, NetdbManager::UserExtensions
+User.send :include, NetsvcManager::UserExtensions
diff --git a/tasks/netdb_manager_tasks.rake b/tasks/netdb_manager_tasks.rake
index a33b692..6642696 100644
--- a/tasks/netdb_manager_tasks.rake
+++ b/tasks/netdb_manager_tasks.rake
@@ -1,4 +1,4 @@
# desc "Explaining what the task does"
-# task :netdb_manager do
+# task :netsvc_manager do
# # Task goes here
# end
diff --git a/test/netdb_manager_test.rb b/test/netdb_manager_test.rb
index 05857b0..245f210 100644
--- a/test/netdb_manager_test.rb
+++ b/test/netdb_manager_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class NetdbManagerTest < ActiveSupport::TestCase
+class NetsvcManagerTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true