-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Kelly
committed
Oct 31, 2010
1 parent
37198b1
commit 7d8eac9
Showing
29 changed files
with
92 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
class NetdbsController < ApplicationController | ||
class NetsvcsController < ApplicationController | ||
def index | ||
@search = Netdb.search params[:search] | ||
@netdbs = @search.paginate(:page => params[:page]) | ||
@search = Netsvc.search params[:search] | ||
@netsvcs = @search.paginate(:page => params[:page]) | ||
end | ||
|
||
def new | ||
@netdb = Netdb.new | ||
@netsvc = Netsvc.new | ||
end | ||
|
||
def create | ||
@netdb = Netdb.new(params[:netdb]) | ||
if @netdb.save | ||
@netsvc = Netsvc.new(params[:netsvc]) | ||
if @netsvc.save | ||
flash[:foreman_notice] = "Successfully created network database" | ||
redirect_to netdbs_url | ||
redirect_to netsvcs_url | ||
else | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@netdb = Netdb.find(params[:id]) | ||
@netsvc = Netsvc.find(params[:id]) | ||
end | ||
|
||
def update | ||
@netdb = Netdb.find(params[:id]) | ||
if @netdb.update_attributes(params[:netdb]) | ||
@netsvc = Netsvc.find(params[:id]) | ||
if @netsvc.update_attributes(params[:netsvc]) | ||
flash[:foreman_notice] = "Successfully updated network database" | ||
redirect_to netdbs_url | ||
redirect_to netsvcs_url | ||
else | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@netdb = Netdb.find(params[:id]) | ||
@netdb.destroy | ||
@netsvc = Netsvc.find(params[:id]) | ||
@netsvc.destroy | ||
flash[:foreman_notice] = "Successfully destroyed network database" | ||
redirect_to netdbs_url | ||
redirect_to netsvcs_url | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module NetdbsHelper | ||
module NetsvcsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<% title "New network database" %> | ||
<% title "New network service" %> | ||
|
||
<%= render :partial => 'form' %> | ||
|
||
<p><%= link_to "Back to List", netdbs_path %></p> | ||
<p><%= link_to "Back to List", netsvcs_path %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ActionController::Routing::Routes.draw do |map| | ||
map.resources :subnets | ||
map.resources :netdbs | ||
map.resources :netsvcs | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
module NetdbManager | ||
module NetsvcManager | ||
module ApplicationControllerExtensions | ||
NET_TTL = 7200 | ||
|
||
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 | ||
|
||
end | ||
end | ||
end | ||
ApplicationController.send :include, NetdbManager::ApplicationControllerExtensions | ||
ApplicationController.send :include, NetsvcManager::ApplicationControllerExtensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.