Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> master : send hostname data via D-Bus to YaPI
  • From: Michal Zugec <mzugec@xxxxxxx>
  • Date: Fri, 11 Sep 2009 17:25:19 +0200
  • Message-id: <E1MnC7T-00047Y-F9@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 961eef71fe477af2a90d8476272dfcf067cacae2
Author: Michal Zugec <mzugec@xxxxxxx>
Date: Fri Sep 11 17:25:19 2009 +0200

send hostname data via D-Bus to YaPI
---
.../app/controllers/network/hostname_controller.rb | 11 +++++++----
plugins/network/app/models/hostname.rb | 5 +++--
plugins/network/app/models/route.rb | 3 ++-
3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/plugins/network/app/controllers/network/hostname_controller.rb
b/plugins/network/app/controllers/network/hostname_controller.rb
index a51ff50..b43ddfb 100644
--- a/plugins/network/app/controllers/network/hostname_controller.rb
+++ b/plugins/network/app/controllers/network/hostname_controller.rb
@@ -16,10 +16,13 @@ class Network::HostnameController < ApplicationController
end

@hostname = Hostname.new(root)
- @hostname.name = root[:name]
- @hostname.domain = root[:domain]
- @hostname.save
- render :show
+ respond_to do |format|
+ if @hostname.save
+ format.xml { head :ok }
+ else
+ format.xml { render :xml => @route.errors, :status =>
:unprocessable_entity }
+ end
+ end
end

# See update
diff --git a/plugins/network/app/models/hostname.rb
b/plugins/network/app/models/hostname.rb
index 3b61fed..5915924 100644
--- a/plugins/network/app/models/hostname.rb
+++ b/plugins/network/app/models/hostname.rb
@@ -21,7 +21,7 @@ class Hostname
# fills time instance with data from YaPI.
#
# +warn+: Doesn't take any parameters.
- def Hostname.find
+ def self.find
response = YastService.Call("YaPI::NETWORK::Read") # hostname: true
ret = Hostname.new(response["hostname"])
return ret
@@ -34,7 +34,8 @@ class Hostname
"name" => @name,
"domain" => @domain,
}
- YastService.Call("YaPI::NETWORK::Write",{"hostname" => settings})
+ vsettings = [ "a{ss}", settings ] # bnc#538050
+ YastService.Call("YaPI::NETWORK::Write",{"hostname" => vsettings})
# TODO success or not?
end

diff --git a/plugins/network/app/models/route.rb
b/plugins/network/app/models/route.rb
index 50f13b1..3934761 100644
--- a/plugins/network/app/models/route.rb
+++ b/plugins/network/app/models/route.rb
@@ -20,7 +20,7 @@ class Route
# fills route instance with data from YaPI.
#
# +warn+: YaPI implements default only.
- def Route.find( which )
+ def self.find( which )
response = YastService.Call("YaPI::NETWORK::Read")
routes_h = response["routes"]
if which == :all
@@ -37,6 +37,7 @@ class Route
# Saves data from model to system via YaPI. Saves only setted data,
# so it support partial safe (e.g. save only new timezone if rest of fields
is not set).
def save
+ @via="" if @via==nil
settings = {
@id => { 'via'=>@via },
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages