Author: jdsn Date: Thu Oct 8 18:00:11 2009 New Revision: 58981 URL: http://svn.opensuse.org/viewcvs/yast?rev=58981&view=rev Log: new config functions for webyast access to registration backend Modified: trunk/registration/src/modules/YSR.pm_web Modified: trunk/registration/src/modules/YSR.pm_web URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/YSR.pm_web?rev=58981&r1=58980&r2=58981&view=diff ============================================================================== --- trunk/registration/src/modules/YSR.pm_web (original) +++ trunk/registration/src/modules/YSR.pm_web Thu Oct 8 18:00:11 2009 @@ -235,7 +235,57 @@ return { 'success' => { 'msg' => 'This is the return string.' } }; -} +} + + +BEGIN { $TYPEINFO{get_registrationConfig} = ["function", [ "map", "string", "any"] ]; } +sub getRegistrationDetails +{ + my $self = shift; + my $SRconf = '/etc/suseRegister.conf' + my $SRcert = '/etc/ssl/certs/registration-server.pem' + + my $url = undef; + my $cert = undef; + + if ( -e $SRconf ) + { + open(CNF, "< $SRconf") || $url = undef; + while(<CNF>) + { + next if($_ =~ /^\s*#/); + + if($_ =~ /^url\s*=\s*(\S*)\s*/ && defined $1 && $1 ne '') + { $url = $1; } + } + close CNF; + } + + if ( -e $SRcert ) + { + my $separator = $/; + local $/ = undef; + open(CERT, "< $SRcert") || $cert = undef; + $cert = <CERT>; + close CERT; + $/ = $separator; + } + + return { "url" => $url, + "certificate" => $cert }; +} + + +BEGIN { $TYPEINFO{set_registrationConfig} = ["function", "void", [ "map", "string", "any"] ]; } +sub setRegistrationConfig +{ + my $self = shift; + # TODO: write the config and write the certificate file + + return { "url" => "foobar", + "certificate" => "barfoo" }; +} + 1; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org