Author: jdsn
Date: Mon Oct 13 13:01:17 2008
New Revision: 52114
URL: http://svn.opensuse.org/viewcvs/yast?rev=52114&view=rev
Log:
- use new suse_register backend (bnc#430896)
- change registration server in UI
- 2.17.1
Added:
trunk/registration/src/dialogs/texts.ycp
trunk/registration/src/modules/YSR.pm
Modified:
trunk/registration/VERSION
trunk/registration/package/yast2-registration.changes
trunk/registration/src/clients/inst_suse_register.ycp
trunk/registration/src/dialogs/Makefile.am
trunk/registration/src/modules/Makefile.am
trunk/registration/src/modules/Register.ycp
trunk/registration/yast2-registration.spec.in
Modified: trunk/registration/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/VERSION?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/VERSION (original)
+++ trunk/registration/VERSION Mon Oct 13 13:01:17 2008
@@ -1 +1 @@
-2.17.0
+2.17.1
Modified: trunk/registration/package/yast2-registration.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/package/yast2-registration.changes?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/package/yast2-registration.changes (original)
+++ trunk/registration/package/yast2-registration.changes Mon Oct 13 13:01:17 2008
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Oct 8 23:39:11 CEST 2008 - jdsn@suse.de
+
+- use new suse_register backend (bnc#430896)
+- change registration server in UI
+- 2.17.1
+
+-------------------------------------------------------------------
Fri Sep 12 14:57:48 CEST 2008 - jdsn@suse.de
- new module for online update configuration (fate#303458)
Modified: trunk/registration/src/clients/inst_suse_register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/clients/inst_suse_register.ycp?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/src/clients/inst_suse_register.ycp (original)
+++ trunk/registration/src/clients/inst_suse_register.ycp Mon Oct 13 13:01:17 2008
@@ -29,11 +29,29 @@
import "Label";
import "Internet";
import "Register";
+ import "YSR";
import "SourceManager";
import "Package";
import "PackageCallbacks";
+ import "CommandLine";
+ include "registration/texts.ycp";
+ // support basic command-line output (bnc#430859)
+ list wfm_args = WFM::Args();
+ y2milestone ("ARGS: %1", wfm_args);
+ if ( (size (wfm_args) > 0) &&
+ (contains (wfm_args, "help") || contains (wfm_args, "longhelp") || contains (wfm_args, "xmlhelp") ) )
+ {
+ string cmdhelp = _("Registration Module Help");
+ Mode::SetUI ("commandline");
+ // TRANSLATORS: commandline help
+ CommandLine::Run($["id" : "registration",
+ "help" : cmdhelp
+ ]);
+ return `auto;
+ }
+
// this operation MUST be first and run in any case, even if registration should be skipped (FATE #302966)
symbol confRegSrv = Register::configureRegistrationServer();
if (confRegSrv == `conferror || confRegSrv == `notrust || confRegSrv == `silentskip)
@@ -42,7 +60,6 @@
return `auto;
}
-
// no network - no suse_register
if (!Mode::normal())
{
@@ -53,6 +70,9 @@
}
}
+
+ boolean IAMSLE = ( (integer) SCR::Execute(.target.bash, " [ -e /usr/share/applications/YaST2/customer_center.desktop ] ") == 0 ? true:false );
+
// error handling - skip if suseRegister is missing
integer sr_exist = (integer) SCR::Execute(.target.bash, "test -x /usr/bin/suse_register");
if (sr_exist != 0)
@@ -67,7 +87,6 @@
map ui = UI::GetDisplayInfo();
boolean textmode = (boolean) ui["TextMode"]:nil;
- boolean interactive = ! (textmode && Register::disable_w3m);
/* strings for main (wizard) layout */
@@ -96,7 +115,7 @@
string nccc_heading = "";
// if we are SLES then switch to NCCC title (#294454)
- if ( (integer) SCR::Execute(.target.bash, " [ -e /usr/share/applications/YaST2/customer_center.desktop ] ") == 0 ? true:false )
+ if ( IAMSLE )
{
title = title_nccc;
nccc_heading = nccc_top;
@@ -213,6 +232,7 @@
if (! Mode::normal()) help = help + help_para6;
+help = help + HELP["localRegistrationChapter1"]:"" + HELP["localRegistrationChapter2"]:"";
/* further strings */
string checking = _("Checking...");
@@ -223,16 +243,21 @@
string starting_browser = _("Starting browser...");
/* other string variables */
- map information_data = nil;
string information_text = "";
-
+ string error_msg_details = "";
// default is true, see statement in layout term
boolean configure_status = true;
- /* vv MAIN (WIZARD) LAYOUT vv */
+
+
+ /* -- MAIN (WIZARD) LAYOUT -- */
term sr_layout=nil;
+ list<term> expertMenu = [ `item(`id(`localRegistrationServer), TXT["localRegistrationServer"]:"" )
+ ];
+
+
sr_layout = `HVSquash(
`VBox(
`Label( nccc_heading ),
@@ -252,10 +277,13 @@
`Left( `CheckBox(`id(`optional), `opt(`notify), nccc_sub_optional, Register::submit_optional ) ),
Register::display_forcereg ? `Left( `CheckBox(`id(`forcereg), `opt(`notify), nccc_forcereg, false ) ):`Empty(),
`VSpacing(0.5),
- // active in SLE products only - merged here for consistency
- //`VSpacing(0.5),
- //`Left( `CheckBox(`id(`regularly_run), `opt(`notify), title_regularly_run, Register::register_regularly ) ),
- `Right( `PushButton(`id(`showinfo), nccc_sub_showbtn ) )
+ // active in SLE products only
+ IAMSLE ? `Left( `CheckBox(`id(`regularly_run), `opt(`notify), title_regularly_run, Register::register_regularly ) ):`Empty(),
+ `Right(
+ `HBox( `PushButton(`id(`showinfo), nccc_sub_showbtn ),
+ IAMSLE ? `MenuButton( _("Advanced"), expertMenu ):`Empty()
+ )
+ )
)
)
)
@@ -264,13 +292,12 @@
));
-
term contents = `VBox ( `VSpacing (0.5), sr_layout, `VSpacing (0.5));
- /* ^^ END MAIN LAYOUT ^^ */
- /* vv SHOW INFO POPUP vv */
+
+ /* -- SHOW INFO POPUP -- */
term showinformation = `HBox( `HSpacing(0.5),
`MinSize( 75, 22 ,`VBox(
`Label( transmit_info ),
@@ -279,13 +306,13 @@
),
`HSpacing(0.5)
);
- /* ^^ END SHOW INFO ^^ */
- /* vv MANUAL INTERACTION POPUP vv */
+
+ /* -- MANUAL INTERACTION POPUP -- */
term manual_interaction = //`HBox(
`MinSize( 70, 25, `HBox( `VBox(
`Left( `Label( `opt(`boldFont), mi_required ) ) ,
@@ -300,11 +327,11 @@
)
))
);
- /* ^^ END MANUAL INTERACTION ^^ */
- /* vv CCC CONFLICT POPUP vv */
+
+ /* -- CCC CONFLICT POPUP -- */
term ccc_conflict=
`VBox(
`Left( `Label( `opt(`boldFont), title ) ),
@@ -312,10 +339,10 @@
`Left( `Label( conflict_need_info ) ),
`PushButton(`id(`ok), Label::OKButton())
);
- /* ^^ END CCC CONFLICT ^^ */
- /* vv CCC ERROR POPUP vv */
+
+ /* -- CCC ERROR POPUP -- */
term error_message=
`VBox(
`Left( `Label( `opt(`boldFont), error ) ),
@@ -330,10 +357,10 @@
`HWeight(1, `PushButton(`id(`err_detail), details ) )
)
);
- /* ^^ END CCC ERROR ^^ */
- /* vv CCC ERROR POPUP vv */
+
+ /* -- CCC ERROR POPUP -- */
term error_message_details=
`MinSize( 60, 20, `VBox(
`Left( `Label( `opt(`boldFont), error_msg ) ),
@@ -341,10 +368,10 @@
`RichText(`id(`errordetail), "" ),
`PushButton(`id(`ok), Label::OKButton())
));
- /* ^^ END CCC ERROR ^^ */
- /* vv CCC ERROR POPUP PLAINTEXT vv */
+
+ /* -- CCC ERROR POPUP PLAINTEXT -- */
term error_message_details_pt=
`MinSize( 60, 20, `VBox(
`Left( `Label( `opt(`boldFont), error_msg ) ),
@@ -352,11 +379,11 @@
`RichText(`id(`errordetail), `opt(`plainText), "" ),
`PushButton(`id(`ok), Label::OKButton())
));
- /* ^^ END CCC ERROR PLAINTEXT ^^ */
- /* vv SUCCESS MESSAGE vv */
+
+ /* -- SUCCESS MESSAGE -- */
term nccc_success=
`VBox(
`Left( `Label( `opt(`boldFont), title ) ),
@@ -369,11 +396,11 @@
`HWeight(1, `PushButton(`id(`success_detail), details ) )
)
);
- /* ^^ SUCCESS MESSAGE END ^^ */
- /* vv SUCCESS DETAILS vv */
+
+ /* -- SUCCESS DETAILS -- */
term nccc_success_detail=
`MinSize( 60, 7, `VBox(
`Left( `Label( `opt(`boldFont), success_detail_label ) ),
@@ -381,7 +408,7 @@
`RichText(`id(`success_detail_richtext), `opt(`plainText) , "" ),
`PushButton(`id(`ok), Label::OKButton())
));
- /* ^^ SUCCESS DETAILS END ^^ */
+
/* ---------------------------------- LOCAL FUNCTIONS ------------------------------------------------------------ */
@@ -404,7 +431,6 @@
else if (retry == `err_detail)
{
// switch to plaintext if error output is one or two lines (#239570)
- string error_msg_details = (string)information_data["stderr"]:"no error message available";
if ( contains( [0,1], size(splitstring(error_msg_details,"\n")) ) )
UI::OpenDialog(error_message_details);
else
@@ -413,9 +439,10 @@
UI::UserInput();
UI::CloseDialog();
}
- } until ( retry != `err_detail );
+ } until ( contains([`skip, `back, `abort, `cancel], retry) );
UI::CloseDialog();
+ return true;
}
@@ -553,11 +580,78 @@
}
UI::RedrawScreen();
-
return true;
}
+
+boolean registrationServerSettings()
+{
+ string curRegURL = Register::smt_server;
+ if (curRegURL == nil) curRegURL = "https://";
+ string curRegCert = Register::smt_server_cert;
+ if (curRegCert == nil) curRegCert = "";
+
+ term askForRegSettings = `VBox(
+ `VSpacing(0.5),
+ `Label( TXT["localRegistrationServer"]:"" ),
+ `VSpacing(1.5),
+ `InputField(`id(`newRegistrationServer), TXT["registrationServer"]:"", curRegURL ),
+ `VSpacing(0.5),
+ `InputField(`id(`newRegistrationServerCert), TXT["serverCACertificateLocation"]:"", curRegCert ),
+ `VSpacing(1),
+ `HBox(
+ `PushButton(`id(`okButton), Label::OKButton() ),
+ `PushButton(`id(`cancel), Label::CancelButton() )
+ )
+
+ );
+
+ UI::OpenDialog(askForRegSettings);
+
+ any ret = nil;
+ boolean status=false;
+
+ while (true)
+ {
+ ret = UI::UserInput();
+
+ if (ret == `cancel || ret == `abort)
+ {
+ status=false;
+ break;
+ }
+ else if (ret == `okButton)
+ {
+ curRegURL = (string) UI::QueryWidget(`id(`newRegistrationServer), `Value);
+ curRegCert = (string) UI::QueryWidget(`id(`newRegistrationServerCert), `Value);
+
+ // FIXME TODO
+ // check urls for sanity
+ map parsed = URL::Parse(curRegURL);
+ if (parsed == nil || parsed == $[] || parsed["scheme"]:"" != "https" )
+ {
+ Popup::Message(TXT["urlHasToBeHttps"]:"");
+ continue;
+ }
+ else
+ {
+ Register::smt_server = curRegURL;
+ Register::smt_server_cert = curRegCert;
+ status=true;
+ break;
+ }
+
+ }
+
+ }
+
+ UI::CloseDialog();
+ return status;
+}
+
+
+
/* ----------------------------------- END FUNCTIONS ------------------------------------------------------------- */
@@ -572,24 +666,22 @@
//y2debug ("%1", UI::DumpWidgetTree());
- // check if we are running as nonroot
if ( !Register::iamroot )
{ // do not run as non-root: #170736
return `auto;
- // SL (box) has the following warning
- //if ( !Popup::ContinueCancelHeadline( nonroot_title, nonroot_message ) )
- // return `cancel;
}
boolean loopend = false;
any ret = nil;
+ integer SRstatus = nil;
+ string manual_interaction_overview = "";
/* -------------------------------- PROGRAM LOGIC START ----------------------------------------------------------- */
// #170113, the lock is needed around everything that may end up in ZMD
- SourceManager::Lock ();
+// SourceManager::Lock ();
repeat {
ret = Wizard::UserInput();
@@ -614,13 +706,25 @@
Register::force_registration = (boolean) UI::QueryWidget(`id(`forcereg), `Value);
Register::register_regularly = (boolean) UI::QueryWidget(`id(`regularly_run), `Value);
}
+ else if (ret == `localRegistrationServer)
+ {
+ if (registrationServerSettings() )
+ { // overwrite smt settings if it returns true
+ Register::force_new_reg_url = true;
+ if ( Register::setupRegistrationServer(nil) != `ok )
+ {
+ configure_status = false;
+ }
+ Register::force_new_reg_url = false;
+ }
+
+ }
else if (ret == `showinfo)
{
- information_data = Register::suseRegister(`p);
+ information_text = Register::suseRegisterListParams();
- if ( information_data["exit"]:"99" == "0" )
+ if ( information_text != "" )
{
- information_text = information_data["stdout"]:"";
UI::OpenDialog( showinformation );
UI::ChangeWidget(`id(`information_text), `Value, information_text );
any info_ret = nil;
@@ -634,12 +738,12 @@
UI::CloseDialog();
}
+
else
{
- if (! ( information_data["exit"]:"99" == "199" &&
- information_data["stdout"]:"aborted" == "aborted" &&
- information_data["stderr"]:"aborted" == "aborted" ) )
+ error_msg_details = YSR::get_errormsg();
report_error();
+ error_msg_details = "";
}
}
@@ -647,26 +751,18 @@
{
if ( configure_status == true )
{
- if (Mode::normal())
- { // (bnc#395333)
- Pkg::SourceRestore();
- y2milestone ("Current sources: %1", Pkg::SourceGetCurrent (true));
- }
- // remove the zmd flag file (requested by mvidner)
- SCR::Execute(.target.bash, " rm -f /var/lib/zypp/zmd_updated_the_sources " );
- /* run suse_register to see if we need manual interaction */
- information_data = Register::suseRegister(nil);
+ // call suseRegister
+ SRstatus = Register::suseRegister(nil);
- // error code 1: needinfo
- // manual interaction is requiered
- // this case MUST be first
- // ... because during manual interaction further suse_register calls change the error code
- if (information_data["exit"]:"99" == "1" && interactive)
+ // error code 1: needinfo - manual interaction
+ if ( SRstatus == 1 )
{
+ // get the details overview
+ manual_interaction_overview = Register::suseRegisterListParams();
UI::OpenDialog( manual_interaction );
UI::SetFocus (`id (`start_browser ));
- UI::ChangeWidget( `id(`needinfo), `Value, information_data["stderr"]:data_invalid );
+ UI::ChangeWidget( `id(`needinfo), `Value, manual_interaction_overview );
any mi_ret =nil;
boolean mi_loopend = false;
boolean recheck = true;
@@ -680,10 +776,10 @@
{
// now we launch the browser
UI::ChangeWidget( `id(`needinfo), `Value, starting_browser );
- browserrun = launchBrowser(information_data["stdout"]:"http://www.opensuse.org");
+ string browserURL = YSR::get_manualURL();
+ browserrun = launchBrowser( browserURL );
// deactivate force_registration after each suse_register call (#bugNo.)
Register::force_registration = false;
-
}
else if ( mi_ret == `cancel )
{
@@ -703,18 +799,19 @@
// show the user, that we are doing something
UI::ChangeWidget( `id(`needinfo), `Value, checking );
- information_data = Register::suseRegister(nil);
+ SRstatus = Register::suseRegister(nil);
- if (information_data["exit"]:"99" == "0" || information_data["exit"]:"99" == "3" )
+ if ( SRstatus == 0 || SRstatus == 3 )
{
// error 0: everything is done, quit
// error 3: madatory data conflict - handle outside of manual interaction
mi_loopend = true;
}
- else if (information_data["exit"]:"99" == "1")
+ else if ( SRstatus == 1 )
{
// still needinfo, change displayed information and stay in manual interaction
- UI::ChangeWidget( `id(`needinfo), `Value, information_data["stderr"]:retrieve_error );
+ manual_interaction_overview = Register::suseRegisterListParams();
+ UI::ChangeWidget( `id(`needinfo), `Value, manual_interaction_overview );
}
else
{
@@ -726,7 +823,8 @@
if (! browserrun )
{
- information_data = $["exit":"198", "stdout":"", "stderr":"" ];
+ // information_data = $["exit":"198", "stdout":"", "stderr":"" ];
+ // FIXME - can this if clause be removed ??
mi_loopend = true;
}
@@ -737,20 +835,15 @@
if (mi_ret == `cancel) configure_status = false;
}
- else if (information_data["exit"]:"99" == "1" && ! interactive)
- {
- // w3m disabled - show message
- Popup::Message(no_w3m_msg);
- loopend = true;
- ret = `skip;
- }
- // during error code 1 information_data may be changed by a suse_register call
+
+
// no NO MORE suse_register calls below this line !!
+ // ---------------------------------------------------------------------------------
/* handle error codes from FIRST suse_register call AND from manual interaction */
- if (information_data["exit"]:"99" == "3")
+ if ( SRstatus == 3)
{
// error code 3 means:
// conflict between transmitted data and data to be transmit according to customer contract
@@ -762,66 +855,76 @@
Register::submit_hwdata = true;
}
+
// error code 0 means: everything is OK
- // no more interaction requiered - ZMD is configuered by suse_register
- if (information_data["exit"]:"99" == "0")
+ if ( SRstatus == 0 )
{
- // add update source
- UI::OpenDialog(`VBox(`Label(_("Setting up online update source..."))));
- list<string> added = Register::add_update_sources();
- // #186978
- added = maplist (string u, added, ``(
- InstURL::HidePassword (u) ));
- UI::CloseDialog();
+ // get the taskList
+ map taskList = YSR::getTaskList();
+ list<string> repoSummary = [];
- // and then show success message
- symbol sret=nil;
-
- // (#261239) show success popup only on success else error message
- if (added != nil && size(added) != 0)
+ if ( taskList != $[] )
{
- UI::OpenDialog( nccc_success );
- repeat
+ // add/delete/change repositories
+
+ string oldMessage = _("Setting up online update source...");
+ string newMessage = _("Updating software repositories...");
+ UI::OpenDialog(`VBox(`Label( oldMessage )));
+
+ repoSummary = Register::updateSoftwareRepositories(taskList);
+
+ // #186978 - hide the passwords of the urls in the status window
+ // now obsolete - the summary created by "updateSoftwareRepositories" will not contain passwords of URLs
+
+ UI::CloseDialog();
+
+ // and then show success message
+ symbol sret=nil;
+
+ // (#261239) show success popup only on success else error message
+ if (repoSummary != nil && size(repoSummary) != 0)
{
- sret = (symbol) UI::UserInput();
- if (sret == `success_detail)
+ UI::OpenDialog( nccc_success );
+ repeat
{
- string text = mergestring (added, "\n");
- // Show the URLs that were added as update sources.
- // Not STDERR of suse_register output, we may have
- // declined some unsigned ones, #180820#c26.
- UI::OpenDialog( nccc_success_detail );
- UI::SetFocus(`id(`ok));
- UI::ChangeWidget(`id(`success_detail_richtext), `Value, text );
- UI::UserInput();
- UI::CloseDialog();
- }
- } until (sret == `ok );
- UI::CloseDialog();
- }
- else
- {
- Popup::Error(nccc_error_no_server_added);
+ sret = (symbol) UI::UserInput();
+ if (sret == `success_detail)
+ {
+ string text = mergestring (repoSummary, "\n");
+ // Show the URLs that were added as update sources.
+ // Not STDERR of suse_register output, we may have
+ // declined some unsigned ones, #180820#c26.
+ UI::OpenDialog( nccc_success_detail );
+ UI::SetFocus(`id(`ok));
+ UI::ChangeWidget(`id(`success_detail_richtext), `Value, text );
+ UI::UserInput();
+ UI::CloseDialog();
+ }
+ } until (sret == `ok );
+ UI::CloseDialog();
+ }
+ else
+ {
+ Popup::Error(nccc_error_no_server_added);
+ }
}
- // we are done, end of loop
+ // we are done - finally
loopend = true;
}
-
// show a message when there are no products to register
- if (information_data["exit"]:"99" == "101")
+ if ( SRstatus == 101 )
{
Popup::Message(no_product_msg);
loopend = true;
}
-
// error handling - no browser available for interactive mode
- if (information_data["exit"]:"99" == "198")
+ if ( SRstatus == 198 )
{
Popup::Message(no_browser_msg);
loopend = true;
@@ -829,24 +932,12 @@
// handle any other error codes
- if (
- (
- information_data["exit"]:"" != "0" &&
- information_data["exit"]:"" != "1" &&
- information_data["exit"]:"" != "3" &&
- information_data["exit"]:"" != "101" &&
- information_data["exit"]:"" != "198"
- ) &&
- !(
- // if return value says that suse_register was aborted by user
- information_data["exit"]:"99" == "199" &&
- information_data["stdout"]:"aborted" == "aborted" &&
- information_data["stderr"]:"aborted" == "aborted"
- )
- )
+ if ( contains([0, 1, 3, 101, 198, 199], SRstatus) == false )
{
// display error message
+ error_msg_details = YSR::get_errormsg();
report_error();
+ error_msg_details = "";
}
}
@@ -871,14 +962,15 @@
} until ( loopend || ret == `back );
- SourceManager::Unlock ();
+
if (Mode::normal())
- { // (bnc#395333)
- y2milestone ("Current sources: %1", Pkg::SourceGetCurrent (true));
+ {
+ // (bnc#395333)
+// y2milestone ("Current sources: %1", Pkg::SourceGetCurrent (true));
// #172665
- Pkg::SourceSaveAll();
- Pkg::TargetFinish ();
+// Pkg::SourceSaveAll();
+// Pkg::TargetFinish ();
Wizard::CloseDialog();
}
else
Modified: trunk/registration/src/dialogs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/dialogs/Makefile.am?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/src/dialogs/Makefile.am (original)
+++ trunk/registration/src/dialogs/Makefile.am Mon Oct 13 13:01:17 2008
@@ -1,5 +1,5 @@
yncludedir = @yncludedir@/registration
-ynclude_DATA = OUCDialogs.ycp
+ynclude_DATA = OUCDialogs.ycp texts.ycp
EXTRA_DIST = $(ynclude_DATA)
Added: trunk/registration/src/dialogs/texts.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/dialogs/texts.ycp?rev=52114&view=auto
==============================================================================
--- trunk/registration/src/dialogs/texts.ycp (added)
+++ trunk/registration/src/dialogs/texts.ycp Mon Oct 13 13:01:17 2008
@@ -0,0 +1,56 @@
+/**
+ * File: registration/src/clients/texts.ycp
+ * Module: registration
+ * Summary: hold strings for use in the registration module
+ * Authors: J. Daniel Schmidt
+ *
+ *
+ * $Id: texts.ycp 1 2008-09-23 11:20:02Z jdsn $
+ */
+{
+
+textdomain "registration";
+
+
+map TXT = $[
+ "contactingServer" : _("Contacting server..."),
+ "mayTakeAWhile" : _("This may take a while"),
+ "pleaseWait" : _("Please wait..."),
+ "updatingSoftwareRepos" : _("Updating software repositories"),
+ "reposUpdated" : _("The software repositories have been updated.\nFind details in the Software Repositories module."),
+ "noReposUpdated" : _("No software repositories have been updated."),
+ "registrationWasSuccessful" : _("Registration was successful."),
+ "defaultUpdateRepoRestored" : _("The default update repository has been restored."),
+ "defaultUpdateRepoAdded" : _("The default update repository has been added."),
+ "needToRegister" : _("In order to add the default update repository\nyou have to register this product."),
+ "runRegistrationNow" : _("Do you want to perform the registration now?"),
+ "canRegister" : _("You can register for installation support."),
+ "startingRegistration" : _("Starting registration..."),
+ "advanced" : _("Advanced"),
+ "useLocalRegistrationServer" : _("Use local registration server"),
+ "useCustomRegistrationServer" : _("Use custom registration server "),
+ "registrationServer" : _("Registration server:"),
+ "serverCACertificate" : _("Server CA certificate:"),
+ "serverCACertificateLocation" : _("Server CA certificate location:"),
+ "localRegistrationServer" : _("Local Registration Server"),
+ "customRegistrationServer" : _("Custom Registration Server"),
+ "urlInvalid" : _("URL invalid"),
+ "urlHasToBeHttps" : _("The registration server URL has to start with https://"),
+ "serverCACrtificateInvalid" : _("Server CA certificate location is invalid.\nFor details please see the help text."),
+ "addRegistrationData" : _("Add custom registration data"),
+ "addKeyValuePairs" : _("Add key value pairs:"),
+ "seeHelpForDetails" : _("Please see the help for details."),
+ // translators: "key" as in "key value pair"
+ "key" : _("Key"),
+ // translators: "value" as in "key value pair"
+ "value" : _("Value")
+ ];
+
+
+map HELP = $[
+ "localRegistrationChapter1" : _("<p>To register this installation at a local registration server please configure the URL and optionally the server's CA certificate via the <b>Advanced</b> menu.</p>"),
+ "localRegistrationChapter2" : _("<p>The registration server URL has to start with <i>https://</i> whereas the location of its CA certificate may be a URL of the format <i>http://</i>, <i>https://</i> or <i>ftp://</i>. Furthermore valid locations are <i>/path/on/local/disk</i>, <b>floppy</b><i>/path/on/floppy-disk</i> and the keyword <i>done</i>. The latter indicates that no CA certificate handling needs to be done in order to trust the registration server.</p>")
+ ];
+
+
+}
Modified: trunk/registration/src/modules/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/Makefile.am?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/src/modules/Makefile.am (original)
+++ trunk/registration/src/modules/Makefile.am Mon Oct 13 13:01:17 2008
@@ -2,7 +2,7 @@
# Makefile.am for registration/modules
#
-module_DATA = Register.ycp RegisterCert.pm OnlineUpdateConfiguration.ycp
+module_DATA = Register.ycp RegisterCert.pm OnlineUpdateConfiguration.ycp YSR.pm
EXTRA_DIST = $(module_DATA)
Modified: trunk/registration/src/modules/Register.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/Register.ycp?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/src/modules/Register.ycp (original)
+++ trunk/registration/src/modules/Register.ycp Mon Oct 13 13:01:17 2008
@@ -21,6 +21,7 @@
import "Popup";
import "URL";
import "Linuxrc";
+import "YSR";
import "ProductFeatures";
import "SourceManager";
@@ -30,7 +31,10 @@
// --------------------------------------------------------------
string services_file = sformat ("%1/update_services", SCR::Read (.target.tmpdir));
-
+boolean isInitializedSR = false;
+map contextDataSR = nil;
+map > argsDataSR = nil;
+integer initialSRstatus = nil;
// ------------------------------------------------------------------
// END: Locally defined data
// ------------------------------------------------------------------
@@ -54,6 +58,7 @@
global string https_proxy = "";
global string smt_server = ""; // (FATE #302966)
global string smt_server_cert = ""; // (FATE #302966)
+global boolean force_new_reg_url = false;
global map registration_data = $[];
@@ -200,6 +205,8 @@
// in case the smt server was already changed do not change it again (to support mobile PCs in different environments)
string mod = (string) SCR::Read(.temporary_suseregister_agent.smturlmodified);
+ if (force_new_reg_url) mod = "false";
+
if ( mod == "true" )
{
url = nil;
@@ -229,7 +236,7 @@
* @return symbol that says if we can perform the registration
*
*/
-symbol setupRegistrationServer(symbol mode)
+global symbol setupRegistrationServer(symbol mode)
{
// in case smt_server is undefined nothing needs to be done
if (smt_server == nil || smt_server == "") return `ok;
@@ -252,11 +259,14 @@
y2milestone("The string '%1' could not be parsed and validated as URL to be used as SMT server.", smt_server);
if (ay) return `conferror;
- string no_smt_server = sformat( _("The SMT server URL could not be validated as URL.
-Registration can not be performed. Please modify /etc/suseRegister.conf and run Registration manually.
-The SMT server URL that was configured was
-%1"), smt_server);
- Popup::Message(no_smt_server);
+ string no_smt1 = _("The registration server URL could not be validated as URL.");
+ string no_smt2 = _("Registration can not be performed.");
+ string no_smt3 = _("Please change the URL and retry.");
+ string no_smt_current = sformat( _("The current registration server URL is\n%1"), smt_server);
+
+ string no_smt_server = sformat("%1\n%2\n%3\n\n%4", no_smt1, no_smt2, no_smt3, no_smt_current);
+
+ Popup::Error(no_smt_server);
return `conferror;
}
@@ -277,7 +287,7 @@
if ( regexpmatch(smt_server_parsed["host"]:"", ".+\.novell\.com$"))
{
y2milestone("Registration detected a *.novell.com domain. For security reasons, there will be no certificate handling in this case.");
- y2milestone("In order to register against a *.novell.com domain, please make sure your registration server uses a trusted certificate and set regcert=done.");
+ y2milestone("In order to register at a *.novell.com domain, please make sure your registration server uses a trusted certificate and set regcert=done.");
// allow override with regcert="done" (bnc#413231)
if (smt_server_cert == "done") { certmode = `done; }
else { certmode = `none; }
@@ -416,7 +426,7 @@
{
// try to copy cert if valid path, else ask // copy
- string cp2tmp = sformat("/bin/cp -a %1 %2 ", smt_server_cert, certTmpFile );
+ string cp2tmp = sformat(" [ -f %1 ] && /bin/cp -a %1 %2 ", smt_server_cert, certTmpFile );
if ( SCR::Execute(.target.bash, cp2tmp ) != 0 )
{
y2error("Could not copy local SMT certificate file");
@@ -467,6 +477,10 @@
y2milestone("User selected to cancel manual certificate dialog and thereby skip registration");
return `conferror;
}
+ else
+ {
+ continue;
+ }
}
string cp2tmp = sformat("/bin/cp -a %1 %2 ", certFile , certTmpFile );
@@ -688,6 +702,81 @@
// ------------------------------------------------------------------
+/*
+ * initialize
+ *
+ * Initialize booleans: submit_optional, submit_hwdata and iamroot
+ *
+ */
+integer suseRegisterOnce()
+{
+ // (#164794)
+ // on behalf of hmuelle and shorn
+ UI::OpenDialog(`VBox(
+ // translators: busy popup while registering the system
+ `Left( `Heading( _("Contacting server...")) ),
+ // translators: Text for a busy-process-indicator while registering the system
+ `BusyIndicator(`id(`busyContactingServer), _("This may take a while"), 300000 )
+ ) );
+ // Bug #171061 - Busy cursor during "Contacting server..."
+ UI::BusyCursor();
+
+ integer ret = YSR::register();
+
+ // Bug #171061 - Changing back to normal cursor
+ UI::NormalCursor();
+ UI::CloseDialog();
+
+ if(YSR::get_errorcode() != 0)
+ {
+ // error
+ y2error("Register call failed (%1): %2", YSR::get_errorcode(), YSR::get_errormsg());
+ return 111;
+ }
+
+ return ret;
+}
+
+
+
+/*
+ * getSrcIdFromSrcMap
+ *
+ * get a SrcID from a sources list
+ * takes a name of a source and the sources list<map> from Pkg::SourceEditGet()
+ * @return: id of the found source, else nil
+ */
+
+integer getSrcIdFromSrcList(string name, list<map> allSrc)
+{
+ if ( name == nil || name == "" )
+ {
+ y2error("Can not find a source with an empty or invalid name.");
+ return nil;
+ }
+ else if ( allSrc == nil || allSrc == [] )
+ {
+ y2error("Can not find a source in an empty sources list.");
+ return nil;
+ }
+
+ integer foundSrc = nil;
+
+ foreach(map srcMap, allSrc, {
+ if ( is(srcMap["name"]:"", string) )
+ if ( (string) srcMap["name"]:"" == name )
+ if ( is(srcMap["SrcId"]:nil, integer) )
+ foundSrc = (integer) srcMap["SrcId"]:nil;
+ });
+
+ if ( foundSrc == nil )
+ y2error("Could not find a source ID for the source with the name: %1", name);
+ else
+ y2milestone("Found a source id for a source: %1 (%2)", name, foundSrc);
+
+ return foundSrc;
+}
+
// ---------------------------------------------------------------------------------------
// START: Globally defined functions
// ---------------------------------------------------------------------------------------
@@ -742,117 +831,349 @@
/*
+ * updateSoftwareRepositories
+ *
+ * takes a "taskList"-map from SuseRegister and updates the repositories
+ * @return a list with a small summary (added/deleted/enabled/disabled repos)
+ */
+global list<string> updateSoftwareRepositories(map taskList)
+{
+ // see if there are actions to perform
+ if (taskList == $[])
+ {
+ return [];
+ }
+
+ list<string> summary = [];
+
+ list<map> currentSources = Pkg::SourceEditGet();
+ // log the sources for debugging purposes - FIXME - to be removed soon
+ y2milestone("The current sources are: %1", currentSources);
+
+
+ // outer foreach loop - loop over service names/aliases
+ foreach( string pService, any pAny, taskList, {
+
+ if ( ! is(pAny, map) )
+ {
+ y2error("A service returned by SuseRegister did not contain any details: %1", pService);
+ }
+ else if ( pService == nil || pService == "" )
+ {
+ y2error("A service returned by SuseRegister has no or an invalid name.");
+ }
+ else
+ {
+ if ( ! is( ((map) pAny)["TYPE"]:"", string) )
+ {
+ y2error("A service returned by SuseRegister has an invalid type: %1 (%2)", pService, ((map) pAny)["TYPE"]:"");
+ }
+ if ( ((map) pAny)["TYPE"]:"" == "zypp" )
+ {
+ y2milestone("Handling a service of the type zypp");
+ if ( ! is( ((map) pAny)["TASK"]:"", string) )
+ {
+ y2error("A service returned by SuseRegister has an invalid task: %1 (%2)", pService, ((map) pAny)["TASK"]:"" );
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "le" || ((map) pAny)["TASK"]:"" == "ld" )
+ {
+ y2milestone("According to SuseRegister a service does not need to be changed: %1", pService);
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "a" )
+ {
+ // SourceAdd
+ y2milestone("According to SuseRegister a service has to be added: %1", pService);
+
+ // create map for new source
+ map newSrcMap = $[ "enabled" : true,
+ "autorefresh" : true,
+ "name" : (string) ((map) pAny)["NAME"]:"",
+ "alias" : (string) ((map) pAny)["ALIAS"]:"",
+ "base_urls" : [ (string) ((map) pAny)["URL"]:"" ],
+ "priority" : ((map) pAny)["PRIORITY"]:99,
+ // ?? "prod_dir" : ((map) pAny)["PROD_DIR"]:"",
+ "type" : (string) ((map) pAny)["TYPE"]:""
+ ];
+
+ integer newSrcID = Pkg::RepositoryAdd( newSrcMap );
+
+ if ( newSrcID == nil )
+ {
+ y2error("Adding a new service failed: %1", pService );
+ }
+ else
+ {
+ y2milestone("Successfully added a new service: %1 (%2)", pService, newSrcID);
+ summary = add(summary, sformat(_("Added Source: %1"), pService ));
+ }
+
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "d" )
+ {
+ // SourceDelete
+ y2milestone("According to SuseRegister a service has to be deleted: %1", pService);
+
+ integer srcID = getSrcIdFromSrcList(pService, currentSources);
+ if ( srcID == nil )
+ {
+ y2error("A service that should be deleted can not be found: %1", pService);
+ }
+ else
+ {
+ if ( Pkg::SourceDelete(srcID) )
+ {
+ y2milestone("Successfully deleted a service: %1 (%2)", pService, srcID);
+ summary = add(summary, sformat(_("Deleted Source: %1"), pService));
+ }
+ else
+ {
+ y2error("Could not delete a service: %1 (%2)", pService, srcID);
+ }
+ }
+ }
+ else
+ {
+ y2error("A service returned by SuseRegister has an unsupported task: %1 (%2)", pService, ((map) pAny)["TASK"]:"" );
+ }
+
+ }
+ else if ( ((map) pAny)["TYPE"]:"" == "nu" )
+ {
+ y2milestone("Handling a service of the type nu");
+
+ if ( ! is( ((map) pAny)["TASK"]:"", string) )
+ {
+ y2error("A service returned by SuseRegister has an invalid task: %1 (%2)", pService, ((map) pAny)["TASK"]:"" );
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "ld" )
+ {
+ y2milestone("According to SuseRegister a service should be left disabled: %1", pService);
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "le" )
+ {
+ y2milestone("According to SuseRegister a service should be left enabled: %1", pService);
+ y2milestone("Now checking the catalogs of the service: %1", pService );
+
+// ------------------->>>>> FIXME check catalogs!!!!!!!!
+ // --> just iterate over catalogs
+ // TODO
+
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "a" )
+ {
+ // ServiceAdd
+ y2milestone("According to SuseRegister a service has to be added: %1", pService);
+
+ if ( Pkg::ServiceAdd( ((map) pAny)["ALIAS"]:"", ((map) pAny)["URL"]:"" ) )
+ {
+ y2milestone("Successfully added a new service: %1", pService);
+ y2milestone("Now checking the catalogs of the service: %1", pService);
+ summary = add(summary, sformat(_("Added Service: %1"), pService ));
+
+// ------------------->>>>> FIXME check catalogs!!!!!!!!
+ // need to save service to the system first -- is this be done with Pkg::SourceSaveAll() ?? service != source ??
+
+ if ( Pkg::SourceSaveAll() )
+ {
+ y2milestone("Successfully saved all sources.");
+ }
+ else
+ {
+ y2error("Could not save all sources.");
+ }
+
+ // then need to call Pkg::ServiceRefresh()
+/*
+ if ( Pkg::ServiceRefresh(pService) )
+ {
+ y2milestone("Successfully refreshed service: %1", pService);
+ }
+ else
+ {
+ y2error("Could not refresh service: %1", pService);
+ }
+*/
+ // then iterate over catalogs
+ // TODO
+
+ }
+ else
+ {
+ y2error("Adding a new service failed: %1", pService);
+ }
+
+ }
+ else if ( ((map) pAny)["TASK"]:"" == "d" )
+ {
+ // ServiceDelete
+ y2milestone("According to SuseRegister a service has to be deleted: %1", pService);
+
+ if ( Pkg::ServiceDelete(pService) )
+ {
+ y2milestone("Successfully deleted a service: %1", pService);
+ summary = add(summary, sformat(_("Deleted Service: %1"), pService ));
+ }
+ else
+ {
+ y2error("Could not delete a service: %1", pService);
+ }
+ }
+ else
+ {
+ y2error("A service returned by SuseRegister has an unsupported task: %1 (%2)", pService, ((map) pAny)["TASK"]:"" );
+ }
+ }
+ else
+ {
+ y2error("A service returned by SuseRegister has an unsupported type: %1 (%2)", pService, ((map) pAny)["TYPE"]:"" );
+ }
+
+ }
+ });
+
+
+ return summary;
+}
+
+
+/*
* suseRegister()
- * the returned map is transformed to map
+ * return the error code of SuseRegister (via YSR.pm) as integer
*/
-global map suseRegister(symbol parameter)
+global integer suseRegister(symbol parameter)
{
- // handle parameters
- // -y beautifies the output for usage in yast
- // -L log file
- // --nozypp do not add zypp and yum sources to zmd, #180820
- // -p list parameters (no dumpfile with -p)
- // --restore-repos brings back repos that have been deleted by accident (#309231)
-
- // always log, beautify and restore repos! (#309231)
- string params = " -y -L ~/.suse_register.log --nozypp --restore-repos ";
- if (parameter == `p) params = params + " -p ";
- else params = params + sformat(" --dumpfile=%1 ", services_file);
-
- // (bnc#392072)
- string pre_sr = " umask 0022; ";
- if (Register::use_proxy)
- { // (#165891)
- pre_sr = pre_sr + " http_proxy='" + Register::http_proxy + "' ";
- pre_sr = pre_sr + " https_proxy='" + Register::https_proxy + "' ";
- }
-
- if ( force_registration ) params = params + " --force-registration ";
- if ( !submit_hwdata ) params = params + " --no-hw-data ";
- if ( !submit_optional ) params = params + " --no-optional ";
-
- // run suse_register
- string sr_bash_cmd = sformat(" %1 /usr/bin/suse_register %2", pre_sr, params);
- y2milestone ("Calling suse_register with command: %1", sr_bash_cmd);
+ // FIXME -- THERE __MUST__ BE A SOURCE REFREH BEFORE INITIALIZING SUSEREGISTER
- map response = $[];
+ map contextData = $[
+ "debug" : 0,
+ "nooptional" : (submit_optional ? 0:1),
+ "nohwdata" : (submit_hwdata ? 0:1),
+ "forceregistration" : (force_registration ? 1:0),
+ "yastcall" : 1,
+ "logfile" : "/root/.suse_register.log"
+ ];
+ y2milestone("Basic initialization data for SuseRegister (custom registration data is suppressed for security reasons): %1", contextData);
- if (parameter == `autoyast)
+ // add data to the context from autoyast profile or from manual input
+ if ( registration_data != $[] )
{
- // do not log sensitive data to the log (#195624)
- // append values from map to the suse_register call
- string params_sensitive = " ";
+ // append sensitive data to the context map
foreach (string key, string val, registration_data, {
key = String::CutRegexMatch(key, "[^A-Za-z0-9_-]+", true );
- params_sensitive = params_sensitive + sformat(" -a %1='%2' ", key, String::Quote(val) );
+ contextData[key] = sformat("%1", String::Quote(val));
});
- sr_bash_cmd = sformat(" %1 %2 ", sr_bash_cmd, params_sensitive);
- y2milestone ("called from autoyast - added sensitive registration data to suse_register call");
-
- map info = (map) SCR::Execute(.target.bash_output, sr_bash_cmd );
- string exitcode = sformat("%1", info["exit"]:99);
- y2milestone ("/usr/bin/suse_register returned %1", exitcode);
-
- // add update sources in autoyast mode as well, no matter what exit code suse_register returned (#181183)
- Register::add_update_sources();
-
- // transform to map
- response = $[ "exit" :exitcode ,
- "stdout":info["stdout"]:"",
- "stderr":info["stderr"]:"" ];
+ // do not log sensitive data to the log (#195624)
+ y2milestone ("Added sensitive registration data to suse_register call - this data is not logged");
}
- else
- { // (#164794)
- boolean started = (boolean) SCR::Execute(.background.run_output_err, sr_bash_cmd );
- // translators: busy popup while registering the system
- string fixme_get_this_out_of_here_ASAP = _("This may take a while");
- UI::OpenDialog(`VBox( `Left( `Label( _("Contacting server...")) ),
- `Left( `Label( fixme_get_this_out_of_here_ASAP )), // (hmuelle, shorn)
- `PushButton(`id(`abort), Label::AbortButton() )
- ) );
-
- // Bug #171061 - Busy cursor during "Contacting server..."
- UI::BusyCursor();
+ if (! isInitializedSR || contextData != contextDataSR )
+ {
+ // initialize SuseRegister
+ contextDataSR = contextData;
+ y2milestone("Initializing SuseRegister with this context data: %1", contextDataSR);
+ YSR::init_ctx(contextDataSR);
+ isInitializedSR = true;
- symbol poll_ret = nil;
- repeat
+ // setting up proxy for SuseRegister
+ if (Register::use_proxy)
{
- poll_ret = (symbol) UI::TimeoutUserInput(200);
+ if (Register::http_proxy != nil && Register::https_proxy != nil)
+ {
+ y2milestone("Setting up proxy for SuseRegister. http_proxy: %1 -- https_proxy: %2", Register::http_proxy, Register::https_proxy);
+ YSR::set_proxy(Register::http_proxy, Register::https_proxy);
+ }
+ else
+ {
+ y2error("Proxy settings are broken and could not be applied to SuseRegister.");
+ }
+ }
+ }
- // check if process still running ... and check status
- if (! (boolean) SCR::Read(.background.isrunning))
- poll_ret = `finish;
- } until (poll_ret == `abort || poll_ret == `finish);
+ // ----==== handle modes for suseRegister ====----
- // Bug #171061 - Changing back to normal cursor
- UI::NormalCursor();
- if (poll_ret == `finish)
+ // special mode for list-params
+ // only makes sure registration is initialized
+ if (parameter == `listparams)
+ {
+ y2milestone("Making sure suseregister is initialized for listparams");
+ return 0;
+ }
+
+
+ // do the initial registration call if not done yet
+ if ( initialSRstatus == nil )
+ {
+ integer retval = suseRegisterOnce();
+ initialSRstatus = retval;
+ if ( retval == 111 )
{
- // create return hash
- response = $[ "exit": sformat("%1", SCR::Read(.background.status)) ,
- "stdout": mergestring( (list<string>) SCR::Read(.background.newout), "\n") ,
- "stderr": mergestring( (list<string>) SCR::Read(.background.newerr), "\n") ];
+ y2error("Initial register call failed (%1): %2", YSR::get_errorcode(), YSR::get_errormsg());
+ y2error("Registration is not complete!");
+ return 111;
}
- else
+ }
+
+
+ // we are in needinfo mode
+ if ( initialSRstatus == 1 )
+ {
+ // send all data that can be gathered automatically by calling suseRegisterOnce again
+ integer retval = suseRegisterOnce();
+ if (retval == 111)
{
- // kill background process
- if (! (boolean)SCR::Execute(.background.kill))
- {
- sleep(300);
- SCR::Execute(.background.kill);
- }
- response = $["exit":"199", "stdout":"aborted", "stderr":"aborted"];
+ y2error("Register call failed in first needinfo state (%1): %2", YSR::get_errorcode(), YSR::get_errormsg());
+ return 111;
}
- UI::CloseDialog();
+
+ // we are done - update the initial status variable
+ y2milestone("After fist needinfo suseRegister returned with status: %1", retval);
+ initialSRstatus = retval;
}
- y2milestone ("Server response: %1", response);
- return response;
+ // everything fine - nothing to be done
+ if ( initialSRstatus == 0 )
+ {
+ y2milestone("SuseRegister returned with status: %1", initialSRstatus);
+ }
+
+
+ if ( parameter == `autoyast )
+ {
+ string foo="bar";
+ // TODO
+ // call the function to sync the sources from here or from the Write function
+ }
+
+ y2milestone("SuseRegister status: %1", initialSRstatus);
+ return initialSRstatus;
}
+
+
+/*
+ * suseRegisterListParams()
+ * returns the text to display as details in the registration module
+*/
+global string suseRegisterListParams()
+{
+ y2milestone("User requested the args map. Collecting registration data details.");
+
+ // make sure the suseRegister is initialized and the args map contains information
+ integer retval = suseRegister(`listparams);
+ if (retval == 0)
+ {
+ y2milestone("Registration data details map: %1", argsDataSR);
+ return YSR::listParams();
+ }
+
+ y2error("Error occurred when collecting registration data details. The exit code was: %1", retval);
+ return _("Error: Could not retrieve data.");
+}
+
+
+
// ------------------------------------------------------------------
// END: Globally defined functions
// ------------------------------------------------------------------
Added: trunk/registration/src/modules/YSR.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/YSR.pm?rev=52114&view=auto
==============================================================================
--- trunk/registration/src/modules/YSR.pm (added)
+++ trunk/registration/src/modules/YSR.pm Mon Oct 13 13:01:17 2008
@@ -0,0 +1,238 @@
+#
+# Copyright (c) 2008 SUSE LINUX Products GmbH. All rights reserved.
+#
+# Author: Michael Calmer , 2008
+# Editor: J. Daniel Schmidt , 2008
+#
+# YSR.pm - interface for YaST to interact with SUSE::SuseRegister
+#
+
+package YSR;
+
+use strict;
+use SUSE::SuseRegister;
+use Data::Dumper;
+
+our %TYPEINFO;
+
+my $global_ctx = {};
+
+
+BEGIN { $TYPEINFO{init_ctx} = ["function", "void", [ "map", "string", "any"]]; }
+sub init_ctx
+{
+ my $self = shift;
+ my $data = shift;
+
+ $global_ctx = SUSE::SuseRegister::init_ctx($data);
+}
+
+BEGIN { $TYPEINFO{del_ctx} = ["function", "void"]; }
+sub del_ctx
+{
+ my $self = shift;
+
+ SUSE::SuseRegister::del_ctx($global_ctx);
+ $global_ctx = {};
+}
+
+BEGIN { $TYPEINFO{get_errorcode} = [ "function", "integer"]; }
+sub get_errorcode
+{
+ my $self = shift;
+
+ return $global_ctx->{errorcode};
+}
+
+BEGIN { $TYPEINFO{get_errormsg} = [ "function", "string"]; }
+sub get_errormsg
+{
+ my $self = shift;
+
+ return $global_ctx->{errormsg};
+}
+
+BEGIN { $TYPEINFO{listParams} = ["function", "string"]; }
+sub listParams
+{
+ my $self = shift;
+
+ return SUSE::SuseRegister::listParams($global_ctx);
+}
+
+BEGIN { $TYPEINFO{register} = ["function", "integer"]; }
+sub register
+{
+ my $self = shift;
+
+ my $ret = SUSE::SuseRegister::register($global_ctx);
+
+ return $ret;
+}
+
+BEGIN { $TYPEINFO{getTaskList} = ["function", [ "map", "string", "any"] ]; }
+sub getTaskList
+{
+ my $self = shift;
+
+ return SUSE::SuseRegister::getTaskList($global_ctx);
+}
+
+BEGIN { $TYPEINFO{get_args} = [ "function", [ "map", "string", ["map", "string", "string"]]]; }
+sub get_args
+{
+ my $self = shift;
+
+ return $global_ctx->{args};
+}
+
+BEGIN { $TYPEINFO{set_args} = [ "function", "void", [ "map", "string", ["map", "string", "string"]]]; }
+sub set_args
+{
+ my $self = shift;
+ my $args = shift;
+
+ if(defined $args && ref($args) eq "HASH")
+ {
+ $global_ctx->{args} = $args;
+ }
+}
+
+BEGIN { $TYPEINFO{set_arg} = [ "function", "void", "string", [ "map", "string", "string"]]; }
+sub set_arg
+{
+ my $self = shift;
+ my $key = shift;
+ my $value = shift;
+
+ if(defined $key && $key ne "")
+ {
+ if(defined $value && ref($value) eq "HASH" )
+ {
+ $global_ctx->{args}->{key} = $value;
+ }
+ else
+ {
+ delete $global_ctx->{args}->{key};
+ }
+ }
+}
+
+BEGIN { $TYPEINFO{get_manualURL} = [ "function", "string"]; }
+sub get_manualURL
+{
+ my $self = shift;
+
+ return $global_ctx->{registerManuallyURL};
+}
+
+BEGIN { $TYPEINFO{get_registerReadableText} = [ "function", "string"]; }
+sub get_registerReadableText
+{
+ my $self = shift;
+
+ return $global_ctx->{registerReadableText};
+}
+
+BEGIN { $TYPEINFO{get_registerPrivPol} = [ "function", "string"]; }
+sub get_registerPrivPol
+{
+ my $self = shift;
+
+ return $global_ctx->{registerPrivPol};
+}
+
+BEGIN { $TYPEINFO{saveLastZmdConfig} = [ "function", ["list", "any"]]; }
+sub saveLastZmdConfig
+{
+ my $self = shift;
+
+ return SUSE::SuseRegister::saveLastZmdConfig($global_ctx);
+}
+
+BEGIN { $TYPEINFO{set_proxy} = ["function", "void", "string", "string"]; }
+sub set_proxy
+{
+ my $self = shift;
+ my $http_proxy = shift;
+ my $https_proxy = shift;
+
+ if(defined $http_proxy && $http_proxy =~ /^http/)
+ {
+ $ENV{http_proxy} = $http_proxy;
+ }
+
+ if(defined $https_proxy && $https_proxy =~ /^http/)
+ {
+ $ENV{https_proxy} = $https_proxy;
+ }
+}
+
+
+#############################################################################
+#############################################################################
+#
+# internal functions that should not be used directly by YaST (to prevent zypp deadlocks)
+# they are here for documentation purposes or future use
+#
+
+# BEGIN { $TYPEINFO{get_ctx} = ["function", [ "map", "string", "any"]]; }
+# sub get_ctx
+# {
+# my $self = shift;
+
+# return $global_ctx;
+# }
+
+# BEGIN { $TYPEINFO{manageUpdateSources} = ["function", "void", [ "map", "string", "any"] ]; }
+# sub manageUpdateSources
+# {
+# my $self = shift;
+
+# return SUSE::SuseRegister::manageUpdateSources($global_ctx);
+# }
+
+
+# BEGIN { $TYPEINFO{addService} = ["function", ["list", "any"], [ "map", "string", "any"], [ "map", "string", "any"]]; }
+# sub addService
+# {
+# my $self = shift;
+# $global_ctx = shift;
+# my $service = shift || undef;
+
+# return SUSE::SuseRegister::addService($global_ctx, $service);
+# }
+
+
+# BEGIN { $TYPEINFO{enableCatalog} = ["function", ["list", "any"], [ "map", "string", "any"], "string", [ "map", "string", "string"]]; }
+# sub enableCatalog
+# {
+# my $self = shift;
+# $global_ctx = shift;
+# my $name = shift || undef;
+# my $catalog = shift || undef;
+
+# return SUSE::SuseRegister::enableCatalog($global_ctx, $name, $catalog);
+# }
+
+# BEGIN { $TYPEINFO{deleteService} = ["function", ["list", "any"], [ "map", "string", "any"], [ "map", "string", "any"]]; }
+# sub deleteService
+# {
+# my $self = shift;
+# $global_ctx = shift;
+# my $service = shift || undef;
+
+# return SUSE::SuseRegister::deleteService($global_ctx, $service);
+# }
+
+# BEGIN { $TYPEINFO{disableCatalog} = ["function", ["list", "any"], [ "map", "string", "any"], "string", [ "map", "string", "string"]]; }
+# sub disableCatalog
+# {
+# my $self = shift;
+# $global_ctx = shift;
+# my $name = shift || undef;
+# my $catalog = shift || undef;
+
+# return SUSE::SuseRegister::disableCatalog($global_ctx, $name, $catalog);
+# }
+
Modified: trunk/registration/yast2-registration.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/yast2-registration.spec.in?rev=52114&r1=52113&r2=52114&view=diff
==============================================================================
--- trunk/registration/yast2-registration.spec.in (original)
+++ trunk/registration/yast2-registration.spec.in Mon Oct 13 13:01:17 2008
@@ -15,6 +15,7 @@
BuildRequires: perl-XML-Writer update-desktop-files yast2-devtools yast2-testsuite yast2-packager
# Internet YCP module
BuildRequires: yast2 >= 2.16.6
+BuildRequires: suseRegister sles-release perl-libwww-perl perl-URI perl-Crypt-SSLeay
BuildArchitectures: noarch
@@ -61,8 +62,6 @@
@schemadir@/autoyast/rnc/automatic_online_update.rnc
/usr/lib/YaST2/bin/online_update
/usr/share/YaST2/yastbrowser
-%dir /usr/share/YaST2/control
-/usr/share/YaST2/control/*.xml
# agents
@scrconfdir@/cfg_suse_register.scr
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org