ref: refs/heads/registration
commit c6c85811dd73c2f217a5a0ed12db733f9de2127c
Author: J. Daniel Schmidt
Date: Thu Oct 8 20:19:28 2009 +0200
add debug output and context default
---
.../app/controllers/configuration_controller.rb | 3 +-
.../app/controllers/registration_controller.rb | 13 +++++----
plugins/registration/app/models/registration.rb | 27 +++++++++++++++----
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/plugins/registration/app/controllers/configuration_controller.rb b/plugins/registration/app/controllers/configuration_controller.rb
index 765c709..77315bb 100644
--- a/plugins/registration/app/controllers/configuration_controller.rb
+++ b/plugins/registration/app/controllers/configuration_controller.rb
@@ -1,17 +1,16 @@
# = RegistrationConfiguration controller
# Provides access to the configuration of the registration system
+#class Registration::ConfigurationController < ApplicationController
class ConfigurationController < ApplicationController
before_filter :login_required
-
def update
# PUT
# setRegistrationServerDetails
@registration = "PUT to /registration/configuration"
end
-
def show
@registration = Registration.new( { } )
# do not run registration
diff --git a/plugins/registration/app/controllers/registration_controller.rb b/plugins/registration/app/controllers/registration_controller.rb
index 56cb2f1..0362770 100644
--- a/plugins/registration/app/controllers/registration_controller.rb
+++ b/plugins/registration/app/controllers/registration_controller.rb
@@ -5,20 +5,21 @@ class RegistrationController < ApplicationController
before_filter :login_required
- # @registration = Registration.new( { :doo => :daa } )
-
-
def update
end
def create
+ puts "-> REGISTRATION CREATE"
# POST to registration => run registration
@registration = Registration.new({})
-
+ puts "-> NEW registration"
+ puts @registration.inspect
# TODO: parse post data and set context data
#@registration.set_context( { } )
- @registration.register
-
+ ret = @registration.register
+ puts "-> RAN register"
+ puts ret.inspect
+ puts "-> PUT inpect ^"
end
def show
diff --git a/plugins/registration/app/models/registration.rb b/plugins/registration/app/models/registration.rb
index 772e154..44e0133 100644
--- a/plugins/registration/app/models/registration.rb
+++ b/plugins/registration/app/models/registration.rb
@@ -12,8 +12,18 @@ class Registration
@reg = ''
def initialize(hash)
+ # set context defaults
+ @context = { 'yastcall' => 1,
+ 'norefresh' => 1,
+ 'restoreRepos' => 1,
+ 'forcereg' => 0,
+ 'nohwdata' => 1,
+ 'nooptional' => 1,
+ 'logfile' => '/root/.suse_register.log' }
+
+ # merge custom context data
if hash.class.to_s == 'Hash'
- @context = hash
+ @context.merge hash
else
raise "Invalid or missing registration initialization context data."
end
@@ -32,15 +42,20 @@ class Registration
end
def register
- @reg = YastService.Call("YSR::stateless_register", @context )
+ puts "-> called registration.register"
+ @reg = YastService.Call("YSR::stateless_register", { 'ctx' => @context, 'arguments' => @arguments } )
+ puts "-> YSR::stateless_register was called"
+ puts @reg.inspect
+ return @reg.inspect
end
- def get_registration_server_details
- @reg = "get-reg-srv-det"
+ def get_registration_config
+ return @reg.inspect
end
- def set_registration_server_details(url, ca)
- @reg = "you want to set URL: #{ url }"
+ def set_registration_config(url, ca)
+ # TODO: write registration config
+ return @reg.inspect
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org