Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> master : send route settings via D-bus to YaPI
  • From: Michal Zugec <mzugec@xxxxxxx>
  • Date: Thu, 10 Sep 2009 10:44:36 +0200
  • Message-id: <E1MnC7R-00045R-Pk@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit b77c738017aa4045a5d40d99bb4aea7a55eec30b
Author: Michal Zugec <mzugec@xxxxxxx>
Date: Thu Sep 10 10:44:36 2009 +0200

send route settings via D-bus to YaPI
---
.../app/controllers/network/routes_controller.rb | 12 ++--
plugins/network/app/models/network.rb | 65 --------------------
2 files changed, 5 insertions(+), 72 deletions(-)

diff --git a/plugins/network/app/controllers/network/routes_controller.rb
b/plugins/network/app/controllers/network/routes_controller.rb
index d66f0f8..e87c963 100644
--- a/plugins/network/app/controllers/network/routes_controller.rb
+++ b/plugins/network/app/controllers/network/routes_controller.rb
@@ -13,19 +13,17 @@ class Network::RoutesController < ApplicationController
if root == nil
render ErrorResult.error(404, 2, "format or internal error") and return
end
-
- @routing = Route.new(root)
- @routing.save
+ @route = Route.find(root[:id])
+ @route.via = root[:via]
+ @route.save
render :show
+# show
end

- # See update
- def create
- update
- end

# Shows route settings. Requires read permission for network YaPI.
def show
+ yapi_perm_check "network.read"
@route = Route.find(params[:id])

respond_to do |format|
diff --git a/plugins/network/app/models/network.rb
b/plugins/network/app/models/network.rb
deleted file mode 100644
index c893a2e..0000000
--- a/plugins/network/app/models/network.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-class Network
- require "scr"
-
- attr_accessor :network,
- :id,
- :name,
- :description,
- :mac,
- :dev_name,
- :startup
-
-
- def to_json(options = {})
- hash = Hash.from_xml(to_xml())
- return hash.to_json
- end
-
- def initialize
- @scr = Scr.instance
- end
-
-
- def Network.find_all()
- ret = Scr.instance.execute(["/sbin/yast2", "lan", "list"])
- lines = ret[:stderr].split "\n"
- devices = []
- lines.each do |s|
- dev = Network.new
- dev.id = s.split("\t")[0]
- dev.name = s.split("\t")[1]
- devices << dev
- end
- return devices
- end
-
-
- def to_xml( options = {} )
- return nil if @id.nil?
-
- xml = options[:builder] ||= Builder::XmlMarkup.new(options)
- xml.instruct! unless options[:skip_instruct]
-
- xml.device do
- xml.tag!(:id, @id)
- xml.tag!(:name, @name) unless @name.nil?
- xml.tag!(:description, @description) unless @description.nil?
- xml.tag!(:mac, @mac) unless @mac.nil?
- xml.tag!(:dev_name, @dev_name) unless @dev_name.nil?
- xml.tag!(:startup, @startup) unless @startup.nil?
-
- unless @parameters.blank?
- @parameters.each do |key,value|
- xml.parameters {
- xml.tag!(:name, key)
- xml.tag!(:value, value)
- }
- end
- end
- end
- end
-
-
-end
-
-
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages