Author: jdsn Date: Fri Oct 24 23:41:43 2008 New Revision: 52545 URL: http://svn.opensuse.org/viewcvs/yast?rev=52545&view=rev Log: - checking if registration runs on xen (bnc#418287) - more verbose logging - 2.17.9 Modified: trunk/registration/VERSION trunk/registration/package/yast2-registration.changes trunk/registration/src/clients/inst_suse_register.ycp trunk/registration/src/clients/suse_register_auto.ycp trunk/registration/src/dialogs/texts.ycp trunk/registration/src/modules/Register.ycp Modified: trunk/registration/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/VERSION?rev=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/VERSION (original) +++ trunk/registration/VERSION Fri Oct 24 23:41:43 2008 @@ -1 +1 @@ -2.17.8 +2.17.9 Modified: trunk/registration/package/yast2-registration.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/package/yast2-registration.changes?rev=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/package/yast2-registration.changes (original) +++ trunk/registration/package/yast2-registration.changes Fri Oct 24 23:41:43 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Oct 24 23:06:02 CEST 2008 - jdsn@suse.de + +- checking if registration runs on xen (bnc#418287) +- more verbose logging +- 2.17.9 + +------------------------------------------------------------------- Mon Oct 20 19:15:42 CEST 2008 - jdsn@suse.de - activate autorefresh for new services 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=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/src/clients/inst_suse_register.ycp (original) +++ trunk/registration/src/clients/inst_suse_register.ycp Fri Oct 24 23:41:43 2008 @@ -49,6 +49,7 @@ CommandLine::Run($["id" : "registration", "help" : cmdhelp ]); + y2milestone("Registration was called with help parameter."); return `auto; } @@ -56,32 +57,20 @@ symbol confRegSrv = Register::configureRegistrationServer(); if (confRegSrv == `conferror || confRegSrv == `notrust || confRegSrv == `silentskip) { - y2debug("Registration can not be run due to SMT configuration error."); + y2error("Registration can not be run due to SMT configuration error."); return `auto; } // no network - no suse_register - if (!Mode::normal()) + if (!Mode::normal() && !Internet::suse_register) { - if (!Internet::suse_register) - { - Internet::do_you = false; - return `auto; - } - } - - - 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) - { - y2milestone("/usr/bin/suse_register does not exist - skipping registration"); + y2error("The internet test failed or was skipped. So registration will not run."); Internet::do_you = false; return `auto; } + boolean IAMSLE = ( (integer) SCR::Execute(.target.bash, " [ -e /usr/share/applications/YaST2/customer_center.desktop ] ") == 0 ? true:false ); + // Register::initialize() is mandatory - never remove it Register::initialize(); @@ -140,11 +129,14 @@ /* strings for success popup */ string nccc_success_msg = _("Your configuration was successful."); string nccc_success_server_added = _("An update server has been added to your configuration."); + nccc_success_server_added = TXT["reposUpdated_old"]:""; string nccc_error_no_server_added = _("No update server could be added to your configuration."); string nccc_no_source_changes0 = _("No software repository needed to be changed."); string nccc_no_source_changes = _("Software repositories did not need to be changed."); /* caption for details view */ - string success_detail_label =_("New Update Server"); + string success_detail_label_old = _("New Update Server"); + string success_detail_label_new = _("Updated software repositories"); + string success_detail_label = success_detail_label_new; /* strings for manual interaction popup */ string mi_required = _("Manual Interaction Required"); @@ -424,6 +416,8 @@ // function to display an error message // and offer a detailled view of the error message + y2error("Registration is reporting an error to the user: %1", error_msg_details); + UI::OpenDialog(error_message); UI::SetFocus (`id (`skip )); symbol retry = nil; @@ -527,7 +521,10 @@ if ( textmode ) { cmd_ok = (integer) SCR::Execute(.target.bash, "test -x /usr/bin/w3m") == 0 ? true:false; - // screen is no longer needed as there is UI::RunInTerminal for textmode programs now (#367719) + if ( ! cmd_ok ) + { + y2error("Textmode installation requires w3m for interactive registration. w3m is missing."); + } bcmd = " w3m "; } else @@ -545,10 +542,21 @@ } } cmd_ok = (integer) SCR::Execute(.target.bash, "test -x /usr/bin/xulrunner") == 0 ? true:false; + + if ( ! cmd_ok ) + { + y2error("Graphical installation requires Mozilla-xulrunner for interactive registration. Mozilla-xulrunner is missing."); + } + bcmd = " MOZ_DISABLE_PANGO=1 /usr/bin/xulrunner /usr/share/YaST2/yastbrowser/application.ini -url "; } - if (! cmd_ok) return "nobrowser"; + if (! cmd_ok) + { + y2error("No browser found for interactive registration."); + return "nobrowser"; + } + // add url to browser command bcmd = bcmd + "'" + url + "'"; @@ -569,24 +577,34 @@ boolean launchBrowser(string url) { + y2milestone("Just about to start a browser for manual interaction in registration."); // check for valid url map parsed = URL::Parse(url); - if ( parsed == $[]) return false; + if ( parsed == $[]) + { + y2error("The URL to open in the registration browser has an invalid format: %1", parsed); + return false; + } // no rebuild of the url - parser seems to only parse one parameter in URL string uri = String::FirstChunk(url, "\n"); // (#167225) // get command to run correct browser and execute it string command = browser_command(uri); - if (command == "nobrowser") return false; + if (command == "nobrowser") + { + y2error("Could not find a browser to display the registration website."); + return false; + } - y2milestone("launching browser: %1", command); if (textmode) { + y2milestone("Launching textmode browser with: %1", command); UI::RunInTerminal(command); } else { + y2milestone("Launching graphical borwser with: %1", command); SCR::Execute(.target.bash, command ); } @@ -598,6 +616,7 @@ boolean registrationServerSettings() { + y2milestone("Asking the user for custom registration server settings."); string curRegURL = Register::smt_server; if (curRegURL == nil) curRegURL = "https://"; string curRegCert = Register::smt_server_cert; @@ -637,11 +656,11 @@ 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" ) { + y2error("The selected registration URL has an invalid format: %1", parsed); Popup::Message(TXT["urlHasToBeHttps"]:""); continue; } @@ -649,12 +668,12 @@ { Register::smt_server = curRegURL; Register::smt_server_cert = curRegCert; + y2milestone("New registration server: %1", curRegURL); + y2milestone("New registration server CA certificate location: %1", curRegCert); status=true; break; } - } - } UI::CloseDialog(); @@ -687,7 +706,7 @@ any ret = nil; integer SRstatus = nil; string manual_interaction_overview = ""; - + symbol xenType = nil; /* -------------------------------- PROGRAM LOGIC START ----------------------------------------------------------- */ @@ -715,7 +734,8 @@ Register::submit_hwdata = (boolean) UI::QueryWidget(`id(`hwinfo), `Value); Register::submit_optional= (boolean) UI::QueryWidget(`id(`optional), `Value); Register::force_registration = (boolean) UI::QueryWidget(`id(`forcereg), `Value); - Register::register_regularly = (boolean) UI::QueryWidget(`id(`regularly_run), `Value); + if ( IAMSLE ) + Register::register_regularly = (boolean) UI::QueryWidget(`id(`regularly_run), `Value); } else if (ret == `localRegistrationServer) { @@ -762,6 +782,60 @@ { if ( configure_status == true ) { + if ( IAMSLE && xenType == nil ) + { + // once checking for XEN (bnc#418287) + xenType = Register::xenType(); + + if ( xenType == `xen0 ) + { + string installPackage = "xen-tools"; + if ( ! Package::Installed(installPackage)) + { + y2milestone("Xen dom0 detected. Asking the user if the following packages should be installed: %1", installPackage); + Package::InstallMsg(installPackage, _("Xen Dom0 detected. The following package needs to be installed.")); + } + else + { + y2milestone("All needed packages are already installed: %1", installPackage); + } + } + else if ( xenType == `xenU ) + { + string installPackage = "xen-tools-domU"; + string removePackage = "xen-tools"; + + string xenDomU = _("Xen DomU detected."); + string installMsg = xenDomU + "\n" + _("The following package needs to be installed."); + string removeMsg = xenDomU + "\n" + + sformat(_("To count this installation correctly the package %1 needs to be installed."), installPackage ) + + "\n" + _("Therefore the following package needs to be removed first."); + + + Package::RemoveMsg(removePackage, removeMsg); + + if ( ! Package::Installed(removePackage) ) + { + if ( Package::InstallMsg(installPackage, installMsg ) ) + { y2milestone("Sucessfully installed: %1", installPackage); } + else + { y2error("Could not install: %1", installPackage); } + } + else + { + y2error("In a Xen DomU package %1 is installed rather than %2. Registration will continue nevertheless.", removePackage, installPackage); + Popup::Notify( xenDomU + "\n" + + sformat(_("The package %1 should have been installed and %2 removed."), installPackage, removePackage ) + + "\n" + _("Registration will continue now although the registration server may miscount this installation.") + ); + } + } + else if ( xenType == nil ) + { + y2error("Detecting XEN failed. Assuming XEN is disabled. Maybe the registration will not count this machine correctly."); + xenType = `unknown; + } + } // call suseRegister SRstatus = Register::suseRegister(nil); @@ -836,8 +910,8 @@ if (! browserrun ) { - // information_data = $["exit":"198", "stdout":"", "stderr":"" ]; - // FIXME - can this if clause be removed ?? + y2error("Registration can not finish with manual interaction because no webbrowser was found."); + Popup::Message(no_browser_msg); mi_loopend = true; } @@ -880,7 +954,7 @@ { string oldMessage = _("Setting up online update source..."); string newMessage = _("Updating software repositories..."); - UI::OpenDialog(`VBox(`Label( oldMessage ))); + UI::OpenDialog(`VBox(`Label( newMessage ))); // add/delete/change repositories repoSummary = Register::updateSoftwareRepositories(taskList, true); Modified: trunk/registration/src/clients/suse_register_auto.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/clients/suse_register_auto.ycp?rev=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/src/clients/suse_register_auto.ycp (original) +++ trunk/registration/src/clients/suse_register_auto.ycp Fri Oct 24 23:41:43 2008 @@ -112,7 +112,27 @@ map AutoPackages() { - return $[ "install":[], "remove":[] ]; + map retmap = $["install":[], "remove":[]]; + + symbol xenType = nil; + xenType = Register::xenType(); + + if ( xenType == `xen0 ) + { + retmap["install"] = add( retmap["install"]:[], "xen-tools" ); + } + else if ( xenType == `xenU ) + { + retmap["remove"] = add( retmap["remove"]:[], "xen-tools" ); + retmap["install"] = add( retmap["install"]:[], "xen-tools-domU" ); + } + else + { + y2milestone("XEN is disabled or could not be detected. No package changes will be applied."); + } + + y2milestone("Registration suggests the following package changes: %1", retmap); + return retmap; } Modified: trunk/registration/src/dialogs/texts.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/dialogs/texts.ycp?rev=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/src/dialogs/texts.ycp (original) +++ trunk/registration/src/dialogs/texts.ycp Fri Oct 24 23:41:43 2008 @@ -17,7 +17,9 @@ "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."), + "reposUpdated_old" : _("The software repositories have been updated.\nFind details in the Software Repositories module."), + "reposUpdated" : _("The software repositories have been updated."), + "findDetailsInRepoModule" : _("Find 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."), Modified: trunk/registration/src/modules/Register.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/registration/src/modules/Register.ycp?rev=52545&r1=52544&r2=52545&view=diff ============================================================================== --- trunk/registration/src/modules/Register.ycp (original) +++ trunk/registration/src/modules/Register.ycp Fri Oct 24 23:41:43 2008 @@ -26,6 +26,7 @@ import "SourceManager"; import "Installation"; import "RegisterCert"; +import "Arch"; // -------------------------------------------------------------- // START: Locally defined data @@ -232,6 +233,43 @@ } +/* + * setupRegistrationServer() + * + * write SMT server settings to (FATE #302966) + * @return symbol that says if we can perform the registration + * + */ +global symbol xenType() +{ + y2milestone("Checking if this machine is a XEN instance or host."); + + if ( Arch::is_xen() ) + { + y2milestone("XEN enabled. Now detecting type."); + + if ( Arch::is_xen0() ) + { + y2milestone("Detected XEN0."); + return `xen0; + } + else if ( Arch::is_xenU() ) + { + y2milestone("Detected XENU"); + return `xenU; + } + } + else + { + y2milestone("XEN is disabled."); + return `noXen; + } + + y2error("An error occurred while detecting XEN. Assuming: XEN is disabled."); + return `unknown; +} + + /* * setupRegistrationServer() @@ -851,8 +889,6 @@ { read_config(); iamroot = amIroot(); - - // FIXME: need to test for xen-hypervisor status and install xen-packages } @@ -997,8 +1033,8 @@ 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); + // log the sources for debugging purposes + // y2milestone("The current sources are: %1", currentSources); // outer foreach loop - loop over service names/aliases -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org