Author: jdsn
Date: Wed Jan 13 18:59:53 2010
New Revision: 60352
URL: http://svn.opensuse.org/viewcvs/yast?rev=60352&view=rev
Log:
port changes from Code11 to Code11 SP1 (2.17.26-28)
* port webyast API to SLE11 - 2.17.26
* fix XML format for stateless registration API - 2.17.27
* fixes in REST API to prevent server error and loops (bnc#553244) 2.17.28
always reset registration server url (bnc#557194)
2.17.29
Added:
branches/SuSE-Code-11-SP1-Branch/registration/package/org.opensuse.yast.modules.ysr.policy
Modified:
branches/SuSE-Code-11-SP1-Branch/registration/VERSION
branches/SuSE-Code-11-SP1-Branch/registration/package/yast2-registration.changes
branches/SuSE-Code-11-SP1-Branch/registration/src/clients/inst_suse_register.ycp
branches/SuSE-Code-11-SP1-Branch/registration/src/modules/Register.ycp
branches/SuSE-Code-11-SP1-Branch/registration/src/modules/YSR.pm
branches/SuSE-Code-11-SP1-Branch/registration/yast2-registration.spec.in
Modified: branches/SuSE-Code-11-SP1-Branch/registration/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/VERSION?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/VERSION Wed Jan 13 18:59:53 2010
@@ -1 +1 @@
-2.17.25
+2.17.29
Added: branches/SuSE-Code-11-SP1-Branch/registration/package/org.opensuse.yast.modules.ysr.policy
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/package/org.opensuse.yast.modules.ysr.policy?rev=60352&view=auto
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/package/org.opensuse.yast.modules.ysr.policy (added)
+++ branches/SuSE-Code-11-SP1-Branch/registration/package/org.opensuse.yast.modules.ysr.policy Wed Jan 13 18:59:53 2010
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
+
+<policyconfig>
+ <vendor>Novell, Inc.</vendor>
+ http://www.novell.com
+
+ <action id="org.opensuse.yast.modules.ysr.statelessregister">
+ <description>Run a registration in stateless context.</description>
+ <message>Could not run YSR.stateless_register.</message>
+ <defaults>
+ no
+ no
+ auth_admin_keep_session
+ </defaults>
+ </action>
+
+ <action id="org.opensuse.yast.modules.ysr.getregistrationconfig">
+ <description>Get registration information.</description>
+ <message>Could not run YSR.get_registrationConfig.</message>
+ <defaults>
+ no
+ no
+ auth_admin_keep_session
+ </defaults>
+ </action>
+
+ <action id="org.opensuse.yast.modules.ysr.setregistrationconfig">
+ <description>Set registration information.</description>
+ <message>Could not run YSR.set_registrationConfig.</message>
+ <defaults>
+ no
+ no
+ auth_admin_keep_session
+ </defaults>
+ </action>
+
+</policyconfig>
+
Modified: branches/SuSE-Code-11-SP1-Branch/registration/package/yast2-registration.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/package/yast2-registration.changes?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/package/yast2-registration.changes (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/package/yast2-registration.changes Wed Jan 13 18:59:53 2010
@@ -1,4 +1,15 @@
-------------------------------------------------------------------
+Wed Jan 13 18:26:17 CET 2010 - jdsn@suse.de
+
+- port changes from Code11 to Code11 SP1 (2.17.26-28)
+ * port webyast API to SLE11 - 2.17.26
+ * fix XML format for stateless registration API - 2.17.27
+ * fixes in REST API to prevent server error and loops
+ (bnc#553244) - 2.17.28
+- always reset registration server url (bnc#557194)
+- 2.17.29
+
+-------------------------------------------------------------------
Thu Apr 23 21:14:23 CEST 2009 - jdsn@suse.de
- check boolean values also for nil to prevent crashes (bnc#516330)
Modified: branches/SuSE-Code-11-SP1-Branch/registration/src/clients/inst_suse_register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/src/clients/inst_suse_register.ycp?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/src/clients/inst_suse_register.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/src/clients/inst_suse_register.ycp Wed Jan 13 18:59:53 2010
@@ -673,6 +673,8 @@
Register::smt_server_cert = curRegCert;
y2milestone("New registration server: %1", curRegURL);
y2milestone("New registration server CA certificate location: %1", curRegCert);
+ // run setup again, make sure settings get reset (maybe registration was already initalized and an error occurred) (bnc#557194)
+ Register::setupRegistrationServer(nil);
status=true;
break;
}
Modified: branches/SuSE-Code-11-SP1-Branch/registration/src/modules/Register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/src/modules/Register.ycp?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/src/modules/Register.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/src/modules/Register.ycp Wed Jan 13 18:59:53 2010
@@ -280,6 +280,8 @@
*/
global symbol setupRegistrationServer(symbol mode)
{
+ // invalidate a previous registration initialization as now settings may change (bnc#557194)
+ isInitializedSR = false;
// in case smt_server is undefined nothing needs to be done
if (smt_server == nil || smt_server == "") return `ok;
Modified: branches/SuSE-Code-11-SP1-Branch/registration/src/modules/YSR.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/src/modules/YSR.pm?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/src/modules/YSR.pm (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/src/modules/YSR.pm Wed Jan 13 18:59:53 2010
@@ -2,7 +2,7 @@
# Copyright (c) 2008 SUSE LINUX Products GmbH. All rights reserved.
#
# Author: Michael Calmer , 2008
-# Editor: J. Daniel Schmidt , 2008
+# Editor: J. Daniel Schmidt , 2008,2009
#
# YSR.pm - interface for YaST to interact with SUSE::SuseRegister
#
@@ -12,6 +12,9 @@
use strict;
use SUSE::SuseRegister;
use Data::Dumper;
+use XML::Simple;
+
+use YaPI;
our %TYPEINFO;
@@ -120,11 +123,11 @@
{
if(defined $value && ref($value) eq "HASH" )
{
- $global_ctx->{args}->{key} = $value;
+ $global_ctx->{args}->{$key} = $value;
}
else
{
- delete $global_ctx->{args}->{key};
+ delete $global_ctx->{args}->{$key};
}
}
}
@@ -179,6 +182,559 @@
}
}
+
+BEGIN { $TYPEINFO{statelessregister} = ["function", [ "map", "string", "any"], ["map", "string", "any"], ["map", "string", "any"]]; }
+sub statelessregister
+{
+ my $self = shift;
+ my $ctx = shift;
+ my $arguments = shift;
+ my $SRregisterFlagFile = '/var/lib/yastws/registration_successful';
+
+ unless ( defined $ctx && ref($ctx) eq "HASH" )
+ {
+ return { 'error' => 'The context is missing or invalid.',
+ 'contexterror' => '1' };
+ }
+
+ # check if the system is still initialized - otherwise run init_ctx again
+ unless ( defined $global_ctx && ref($global_ctx) eq "HASH" && exists $global_ctx->{debug} )
+ {
+ # not initialized - need to reinitialize
+
+ # 1. proxy
+ if ( exists $ctx->{'proxy'} && ref($ctx->{'proxy'}) eq "HASH" )
+ {
+ my $http = $ctx->{'proxy'}{'http_proxy'} || undef;
+ my $https = $ctx->{'proxy'}{'https_proxy'} || undef;
+ $self->set_proxy($http, $https);
+ }
+
+ # 2. registration context
+ $self->init_ctx($ctx);
+ my $init_err = $self->get_errorcode();
+
+ unless ($init_err == 0)
+ {
+ # init failed
+ return { 'error' => 'The initialization of the registration failed.'
+ ,'initerror' => $init_err
+ ,'errorcode' => $init_err
+ };
+ }
+ }
+
+ # set arguments
+ # must be set one for one, otherwise other data would be overwritten
+ foreach my $key ( keys %{$arguments} )
+ {
+ ## $self->set_arg( $key, { flag => 'i', value => ${$arguments}{$key} , kind => 'mandatory' } );
+ ## $self->set_arg( $key, { value => ${$arguments}{$key} } );
+ $self->set_arg( $key, { 'value' => ${$arguments}{$key} } );
+ }
+
+ # run registration
+ my $exitcode = 1;
+ my $errorcode = 0;
+ my $readabletext = '';
+ my $tasklist = '';
+ my $manualurl = '';
+ my @log = [];
+
+ my $counter = 0;
+ do
+ {
+ $exitcode = $self->register();
+ $counter++;
+ } while ( $exitcode == 1 && $counter < 5 );
+
+ $errorcode = $self->get_errorcode();
+ $readabletext = $self->get_registerReadableText();
+ $manualurl = $self->get_manualURL();
+
+
+ my $regret = { 'exitcode' => $exitcode
+ ,'errorcode' => $errorcode
+ ,'readabletext' => $readabletext
+ ,'manualurl' => $manualurl
+ };
+
+ if ( $exitcode == 0 )
+ {
+ # successful registration, so we need to save the last ZMD config
+ $self->saveLastZmdConfig();
+ $tasklist = $self->getTaskList() || {};
+ my $ret = $self->changerepos($tasklist);
+
+ if ( ref($ret) eq 'HASH' )
+ {
+ my $rlog = ${$ret}{'log'} || [];
+ ${$regret}{'repochangeslog'} = XMLout( { 'log' => $rlog}, rootname => 'log' );
+
+ my $errcount = 0;
+ foreach my $logline ( @{$rlog} )
+ {
+ $errcount++ if $logline =~ /^ERROR:/;
+ }
+ ${$regret}{'repochangeerrors'} = $errcount if $errcount > 0;
+ }
+
+ ${$regret}{'success'} = 'Successfully ran registration';
+ # prepare the tasklist for XML conversion
+ foreach my $k (keys %{$tasklist})
+ {
+ if ( exists ${${$tasklist}{$k}}{'CATALOGS'} )
+ {
+ ${${$tasklist}{$k}}{'CATALOGS'} = { 'catalog' => ${${$tasklist}{$k}}{'CATALOGS'} };
+ }
+ }
+ ${$regret}{'tasklist'} = XMLout( {'item' => $tasklist}, rootname => 'tasklist', KeyAttr => { item => "+ALIAS", catalog => "+ALIAS" }, NoAttr => 1);
+
+ # write flagfile for successful registration
+ open(FLAGFILE, "> $SRregisterFlagFile");
+ print FLAGFILE localtime();
+ close FLAGFILE;
+
+ # to be on the safe side for a following registration request, we need to delete the context data
+ $self->del_ctx();
+ }
+ elsif ( $exitcode == 3 )
+ {
+ ${$regret}{'error'} = 'Conflicting registration data';
+ ${$regret}{'conflicterror'} = '1';
+ }
+ elsif ( $exitcode == 4 )
+ {
+ ${$regret}{'missinginfo'} = 'Missing Information';
+ my $margs = $self->get_args() || {};
+ ${$regret}{'missingarguments'} = XMLout($margs, rootname => 'missingarguments');
+ }
+ elsif ( $exitcode == 100 || $exitcode == 101 )
+ {
+ ${$regret}{'error'} = 'No products to register';
+ ${$regret}{'noproducterror'} = '1';
+ }
+ else
+ {
+ ${$regret}{'error'} = 'Registration was not successful';
+ }
+
+ return $regret;
+}
+
+
+BEGIN { $TYPEINFO{getregistrationconfig} = ["function", [ "map", "string", "any"] ]; }
+sub getregistrationconfig
+{
+ my $self = shift;
+ my $SRconf = '/etc/suseRegister.conf';
+ my $SRcert = '/etc/ssl/certs/registration-server.pem';
+ my $SRcredentials = '/etc/zypp/credentials.d/NCCcredentials';
+ my $SRregisterFlagFile = '/var/lib/yastws/registration_successful';
+
+ my $url = undef;
+ my $cert = undef;
+ my $guid = undef;
+
+ # read the registration server url
+ if ( -e $SRconf )
+ {
+ if (open(CNF, "< $SRconf") )
+ {
+ while(<CNF>)
+ {
+ next if($_ =~ /^\s*#/);
+
+ if($_ =~ /^url\s*=\s*(\S*)\s*/ && defined $1 && $1 ne '')
+ { $url = $1; }
+ }
+ close CNF;
+ }
+ }
+
+ #read the registration server ca certificate file
+ if ( -e $SRcert )
+ {
+ my $separator = $/;
+ local $/ = undef;
+ if ( open(CERT, "< $SRcert") )
+ {
+ $cert = <CERT>;
+ close CERT;
+ }
+ $/ = $separator;
+ }
+
+ # read the guid
+ if ( -e $SRcredentials && -e $SRregisterFlagFile )
+ {
+ if (open(CRED, "< $SRcredentials") )
+ {
+ while(<CRED>)
+ {
+ next if($_ =~ /^\s*#/);
+
+ if($_ =~ /^\s*username\s*=\s*(\S*)\s*/ && defined $1 && $1 ne '')
+ { $guid = $1; }
+ }
+ close CRED;
+ }
+ }
+
+ $url = '' unless defined $url;
+ $cert = '' unless defined $cert;
+ $guid = '' unless defined $guid;
+
+ # delete a flagfile that might be still there if no guid is found
+ unlink($SRregisterFlagFile) if $guid eq '';
+
+ return { "regserverurl" => $url,
+ "regserverca" => $cert,
+ "guid" => $guid };
+}
+
+
+BEGIN { $TYPEINFO{setregistrationconfig} = ["function", "integer", [ "map", "string", "string"] ]; }
+sub setregistrationconfig
+{
+ my $self = shift;
+ my $config = shift;
+
+ my $SRconf = '/etc/suseRegister.conf';
+ my $SRcertpath = '/etc/ssl/certs/';
+ my $SRcert = "$SRcertpath/registration-server.pem";
+ my $SRcertnew = "$SRcertpath/registration-server.pem_new";
+
+ my $url = ${$config}{'regserverurl'} || undef;
+ my $cert = ${$config}{'regserverca'} || undef;
+ my $newconfig = '';
+ my $success = 0;
+
+ # write the new registration server url to the suseRegister.conf file
+ if ($url && $url =~ /^https:\/\//)
+ {
+ if ( -e $SRconf )
+ {
+ if (open(CNFR, "< $SRconf") )
+ {
+ while(<CNFR>)
+ {
+ $_ =~ s/^url\s*=\s*(\S*)\s*/url = $url\n/;
+ $newconfig .= $_;
+ }
+ close CNFR;
+
+ if ( open(CNFW, "> $SRconf") )
+ {
+ print CNFW $newconfig;
+ close CNFW;
+ $success += 1;
+ }
+ }
+ }
+ }
+
+ # write the new certificate and rehash the directory
+ if ($cert)
+ {
+ if ( open(CERT, "> $SRcertnew") )
+ {
+ print CERT $cert;
+ close CERT;
+ # writing the file succeeded
+ $success += 2;
+
+ my @verifyargs = ('openssl', 'x509', '-in', "$SRcertnew", '-text');
+ if ( system( @verifyargs ) == 0 )
+ {
+ my @moveargs = ('mv', "$SRcertnew", "$SRcert" );
+ if ( system( @moveargs ) == 0 )
+ {
+ # certificate validation succeeded and it was moved to the real file name
+ $success += 4;
+
+ # rehash the certificate pool
+ my @rehashargs = ('c_rehash', '/etc/ssl/certs/');
+ if ( system( @rehashargs ) == 0 )
+ {
+ # c_rehashing of certificate pool succeeded
+ $success += 8;
+ }
+ }
+ }
+ else
+ {
+ # delete the *_new file
+ unlink( $SRcertnew );
+ # correct the success status
+ $success -= 2;
+ }
+ }
+ }
+
+ return $success;
+}
+
+#
+# check catalogs
+#
+# check catalogs of services and apply changes according to the CATALOGS-subhash of the getTaskList hash
+#
+sub checkcatalogs
+{
+ my $self = shift;
+ my $todo = shift;
+ my $pService = shift;
+
+ return ["Service name is undefined. Can not check the catalogs."] unless ( defined $pService );
+ return ["Catalog list is empty. No catalogs to check."] unless ( defined $todo && ref($todo) eq 'HASH' );
+
+ my @log = [];
+ my ($catalog, $pAny);
+
+ foreach $catalog (keys %{$todo})
+ {
+ $pAny = ${$todo}{$catalog};
+ if ( not defined $catalog || $catalog eq '' )
+ {
+ push @log, "A catalog returned by SuseRegister has no or an invalid name.";
+ }
+ elsif ( not defined $pAny || ref($pAny) ne 'HASH' )
+ {
+ push @log, "A catalog returned by SuseRegister did not contain any details: $catalog";
+ }
+ else
+ {
+ if ( not exists ${$pAny}{'ALIAS'} || not defined ${$pAny}{'ALIAS'} || ${$pAny}{'ALIAS'} eq '' )
+ {
+ push @log, "A catalog returned by SuseRegister has no or an invalid alias name.";
+ }
+ else
+ {
+ if ( not exists ${$pAny}{'TASK'} || not defined ${$pAny}{'TASK'} || ${$pAny}{'TASK'} eq '' )
+ {
+ push @log, "A catalog returned by SuseRegister has an invalid task: $catalog ($pService)";
+ }
+ elsif ( ${$pAny}{"TASK"} eq 'le' || ${$pAny}{"TASK"} eq 'ld')
+ {
+ push @log, "According to SuseRegister a catalog does not need to be changed: $catalog ($pService)";
+ }
+ elsif ( ${$pAny}{"TASK"} eq 'a' )
+ {
+ push @log, "According to SuseRegister a catalog has to be enabled: $catalog ($pService)";
+ my @zCMD = ('zypper', '--non-interactive', 'modifyrepo', '--enable', "${$pAny}{'ALIAS'}");
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Enabled catalog: ${$pAny}{'ALIAS'} ($pService)";
+ }
+ else
+ {
+ push @log, "ERROR: Could not enable catalog: ${$pAny}{'ALIAS'} ($pService)";
+ }
+ }
+ elsif ( ${$pAny}{"TASK"} eq 'd' )
+ {
+ push @log, "According to SuseRegister a service has to be disabled: $catalog ($pService)";
+ my @zCMD = ('zypper', '--non-interactive', 'modifyrepo', '--disable', ${$pAny}{'ALIAS'});
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Disabled catalog: ${$pAny}{'ALIAS'} ($pService)";
+ }
+ else
+ {
+ push @log, "ERROR: Could not enable catalog: ${$pAny}{'ALIAS'} ($pService)";
+ }
+ }
+ }
+ }
+ }
+
+ return @log;
+}
+
+
+#
+# change repos according to todo-list
+#
+# takes the resulting hash of getTaskList
+#
+BEGIN { $TYPEINFO{changerepos} = ["function", [ "map", "string", "any"], [ "map", "string", "any"] ]; }
+sub changerepos
+{
+ my $self = shift;
+ my $todo = shift;
+ my @log = [];
+
+ unless (defined $todo && ref($todo) eq "HASH" && keys %{$todo} > 0)
+ {
+ push @log, "No changes need to be done to the package system.";
+ return { 'log' => @log };
+ }
+
+ my ($pService, $pAny);
+ foreach $pService (keys %{$todo})
+ {
+ $pAny = ${$todo}{$pService};
+
+ if ( ref($pAny) ne 'HASH' )
+ {
+ push @log, "A service returned by SuseRegister did not contain any details: $pService";
+ }
+ elsif ( not defined $pService || $pService eq '')
+ {
+ push @log, "A service returned by SuseRegister has no or an invalid name.";
+ }
+ else
+ {
+ if ( defined ${$pAny}{'TYPE'} )
+ {
+ if ( ${$pAny}{'TYPE'} eq 'zypp' )
+ {
+ push @log, "Handling a service of the type zypp";
+
+ if ( not defined ${$pAny}{'TASK'} || ${$pAny}{'TASK'} eq '' )
+ {
+ push @log, "A service returned by SuseRegister has an invalid task: $pService";
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'le' )
+ {
+ push @log, "According to SuseRegister a service does not need to be changed: $pService";
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'a' )
+ {
+ push @log, "According to SuseRegister a service has to be added: $pService";
+ my @zCMD = ('zypper', '--non-interactive', 'addrepo', '--name', "${$pAny}{'NAME'}", '--refresh', "${$pAny}{'URL'}", "${$pAny}{'ALIAS'}" );
+ my @zCMDopt = ('zypper', '--non-interactive', 'modifyrepo', '--enable', '--refresh', '--priority', defined ${$pAny}{'URL'} ? ${$pAny}{'URL'} : 99 , "${$pAny}{'URL'}");
+ if ( system(@zCMD) == 0 && system(@zCMDopt) == 0 )
+ {
+ push @log, "Successfully added a new service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Adding a new service failed: $pService";
+ }
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'd' )
+ {
+ push @log, "According to SuseRegister a service has to be deleted: $pService";
+ my @zCMD = ('zypper', '--non-interactive', 'removerepo', "$pService");
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Successfully deleted a service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Could not delete a service: $pService";
+ }
+ }
+
+ }
+ elsif ( ${$pAny}{'TYPE'} eq 'nu' )
+ {
+ push @log, "Handling a service of the type nu";
+
+ if ( not defined ${$pAny}{'TASK'} || ${$pAny}{'TASK'} eq '' )
+ {
+ push @log, "A service returned by SuseRegister has an invalid task: $pService";
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'ld' )
+ {
+ push @log, "According to SuseRegister a service should be left disabled: $pService";
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'le' )
+ {
+ push @log, "According to SuseRegister a service should be left enabled: $pService";
+ push @log, "Now checking the catalogs of the service: $pService";
+
+ my @zCMD = ('zypper', '--non-interactive', 'refresh', '--services');
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Successfully refreshed service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Could not refresh service: $pService";
+ }
+ push @log, $self->checkcatalogs( ${$pAny}{'CATALOGS'}, $pService );
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'a' )
+ {
+ push @log, "According to SuseRegister a service has to be added: $pService";
+
+ my @zCMD = ('zypper', '--non-interactive', 'addservice', ${$pAny}{'URL'}."?credentials=NCCcredentials", ${$pAny}{'ALIAS'});
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Successfully added a new service: $pService";
+
+ my @zCMD = ('zypper', '--non-interactive', 'modifyservice', '--refresh', $pService);
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Successfully enabled refreshing for service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Could not enable refreshing of service: $pService";
+ }
+
+ push @log, "Now checking the catalogs of the service: $pService";
+
+ my @zrCMD = ('zypper', '--non-interactive', 'refresh', '--services');
+ if ( system(@zrCMD) == 0 )
+ {
+ push @log, "Successfully refreshed service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Could not refresh service: $pService";
+ }
+ push @log, $self->checkcatalogs( ${$pAny}{'CATALOGS'}, $pService );
+ }
+ else
+ {
+ push @log, "Adding a new service failed: $pService";
+ }
+ }
+ elsif ( ${$pAny}{'TASK'} eq 'd' )
+ {
+ push @log, "According to SuseRegister a service has to be deleted: $pService";
+
+ my @zCMD = ('zypper', '--non-interactive', 'removeservice', $pService);
+ if ( system(@zCMD) )
+ {
+ push @log, "Successfully deleted a service: $pService";
+ }
+ else
+ {
+ push @log, "ERROR: Could not delete a service: $pService";
+ }
+ }
+ }
+ else
+ {
+ push @log, "A service returned by SuseRegister has an unsupported type: $pService (${$pAny}{'TYPE'})";
+ }
+ } # end defined ${$pAny}{'TYPE'}
+ else
+ {
+ push @log, "A service returned by SuseRegister has an invalid type";
+ }
+ }
+ } # end foreach pService
+
+ my @zCMD = ('zypper', '--non-interactive', 'refresh', '--services');
+ if ( system(@zCMD) == 0 )
+ {
+ push @log, "Successfully refreshed all services";
+ }
+ else
+ {
+ push @log, "ERROR: Could not refresh all services";
+ }
+
+ return { 'log' => @log };
+}
+
+
1;
#############################################################################
Modified: branches/SuSE-Code-11-SP1-Branch/registration/yast2-registration.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/registration/yast2-registration.spec.in?rev=60352&r1=60351&r2=60352&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/registration/yast2-registration.spec.in (original)
+++ branches/SuSE-Code-11-SP1-Branch/registration/yast2-registration.spec.in Wed Jan 13 18:59:53 2010
@@ -1,4 +1,22 @@
-@HEADER-COMMENT@
+#
+# spec file for package yast2-registration
+#
+# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+# norootforbuild
+
@HEADER@
Requires: yast2 >= 2.17.0
@@ -20,6 +38,7 @@
BuildArchitectures: noarch
Summary: Configuration of registration
+Source1: org.opensuse.yast.modules.ysr.policy
%description
Performs the Registration
@@ -29,11 +48,10 @@
@BUILD@
@INSTALL@
-#%if %sles_version
-# rm $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/suse_register.desktop
-#%else
-# rm $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/customer_center.desktop
-#%endif
+
+mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy
+install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
+
@CLEAN@
@@ -88,6 +106,9 @@
@fillupdir@/sysconfig.suse_register-yast2-registration
@fillupdir@/sysconfig.automatic_online_update-yast2-registration
+# policy files
+%attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.modules.*.policy
+
%files branding-SLE
%defattr(-,root,root)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org