[yast-commit] r49552 - in /trunk/ldap-server/src: LdapServer.pm complex.ycp dialogs.ycp wizards.ycp

Author: rhafer Date: Thu Jul 31 17:15:22 2008 New Revision: 49552 URL: http://svn.opensuse.org/viewcvs/yast?rev=49552&view=rev Log: Improved workflow in situation where slapd is not running/disabled Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/complex.ycp trunk/ldap-server/src/dialogs.ycp trunk/ldap-server/src/wizards.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev... ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Thu Jul 31 17:15:22 2008 @@ -310,6 +310,62 @@ } return 1; } + + +## + # Write all service-related settings (sysconfig, init.d) + # @return true on success + # +BEGIN { $TYPEINFO{WriteServiceSettings} = ["function", "boolean"]; } +sub WriteServiceSettings { + my $self = shift; + y2milestone("LdapServer::Write"); + my $ret = 1; + # these changes might require a restart of slapd + if ( $use_ldap_listener ) + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAP', 'yes'); + } + else + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAP', 'no'); + } + if ( $use_ldapi_listener ) + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAPI', 'yes'); + } + else + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAPI', 'no'); + } + if ( $use_ldaps_listener ) + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAPS', 'yes'); + } + else + { + SCR->Write('.sysconfig.openldap.OPENLDAP_START_LDAPS', 'no'); + } + + my $wasEnabled = Service->Enabled("ldap"); + if ( !$wasEnabled && $serviceEnabled ) + { + # service was disabled during this session, just disable the service + # in the system, stop it and ignore any configuration changes. + my $progressItems = [ _("Enabling LDAP Server"), + _("Starting LDAP Server") + ]; + Progress->New(_("Activating OpenLDAP Server"), "", 2, $progressItems, $progressItems, ""); + Progress->NextStage(); + Service->Enable("ldap"); + Progress->NextStage(); + Service->Start("ldap"); + Progress->Finish(); + return 0; + } + return 1; +} + ## # Write all ldap-server settings # @return true on success Modified: trunk/ldap-server/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/complex.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/complex.ycp (original) +++ trunk/ldap-server/src/complex.ycp Thu Jul 31 17:15:22 2008 @@ -153,6 +153,9 @@ } boolean hasBackconfig = LdapServer::IsUsingBackconfig(); boolean configModified = LdapServer::SlapdConfChanged(); //original shipped slapd.conf? + + boolean serviceEnabled = LdapServer::ReadServiceEnabled(); + boolean serviceRunning = LdapServer::ReadServiceRunning(); boolean switchToBackConfig = false; boolean convert = false; @@ -181,6 +184,25 @@ LdapServer::InitDbDefaults(); return `initial; } + else if ( !serviceEnabled || !serviceRunning ) + { + symbol ret = Popup::AnyQuestion3( _("You have an existing configuration but the LDAP Server is not running currently."), _("Do you want to start it now to re-read its configuration data or do you want to create a new configuration from scratch?"), _("Restart"), _("New Configuration"), Label::AbortButton(), `focus_yes ); + if ( ret == `yes ) + { + LdapServer::SetServiceEnabled( true ); + return `reread; + } + else if (ret == `no ) + { + // Start new config wizward + LdapServer::InitDbDefaults(); + return `initial; + } + else if ( ret == `retry ) + { + return `abort; + } + } } return `next; @@ -406,6 +428,19 @@ LdapServer::Read(); return `next; } + +/** + * Write service settings dialog. This dialog writes only the service + * settings (sysconfig and init.d stuff) + * @return `reread if configuration needs to be reread and `next otherwise + */ +symbol WriteServiceDialog() { + Wizard::RestoreHelp(HELPS["write"]:""); + // LdapServer::AbortFunction = PollAbort; + boolean ret = LdapServer::WriteServiceSettings(); + return ret ? `next : `reread; +} + /** * Write settings dialog * @return `abort if aborted and `next otherwise Modified: trunk/ldap-server/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/dialogs.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/dialogs.ycp (original) +++ trunk/ldap-server/src/dialogs.ycp Thu Jul 31 17:15:22 2008 @@ -110,13 +110,32 @@ { //create new item term widget = nil; - if ( !LdapServer::ReadServiceEnabled() || !LdapServer::ReadServiceRunning() ) + if ( !LdapServer::ReadServiceEnabled() ) { if ( name != "daemon" ) { Popup::Error( _("The LDAP Server is disabled currently, no configuration changes possible.") ); name = "daemon"; } } + else if ( !LdapServer::ReadServiceRunning() ) + { + if ( name != "daemon" ) { + symbol ret = Popup::AnyQuestion3( _("The LDAP Server is not running."), _("Do you want to start it now to re-read its configuration data or do you want to creat a new configuration from scratch?"), _("Restart"), _("New Configuration"), Label::AbortButton(), `focus_yes ); + name = "daemon"; + if ( ret == `yes ) + { + return "__reread__"; + } + else if ( ret == `no ) + { + return "__empty__"; + } + else if ( ret == `retry ) + { + return name; + } + } + } widget = (term)widget_map[name,"widget"]:`Label( "Loading widget for item '"+name+"' failed." ); //get helps page @@ -450,6 +469,16 @@ } current_tree_item = showTreeDialog( new_item, (ret == `wizardTree) ? true : false ); + if ( current_tree_item == "__reread__" ) + { + ret = `reread; + break; + } + if ( current_tree_item == "__empty__" ) + { + ret = `empty; + break; + } Wizard::SelectTreeItem( current_tree_item ); callHandler( current_tree_item, "cb_read" ); Modified: trunk/ldap-server/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/wizards.ycp?rev=4... ============================================================================== --- trunk/ldap-server/src/wizards.ycp (original) +++ trunk/ldap-server/src/wizards.ycp Thu Jul 31 17:15:22 2008 @@ -25,7 +25,8 @@ /* FIXME: adapt to your needs */ map aliases = $[ - "tree" : ``( TreeDialog() ) + "tree" : ``( TreeDialog() ), + "writeservice" : ``( WriteServiceDialog() ) ]; map sequence = $[ @@ -34,7 +35,12 @@ `abort : `abort, `back : `abort, `cancel : `abort, - `next : `next + `next : `next, + `reread : "writeservice", + `empty : `empty + ], + "writeservice" : $[ + `reread : `reread ] ]; @@ -155,7 +161,8 @@ "read" : ``( ReadDialog() ), "migrate" : ``( MigrateSequence() ), "propose" : ``( ProposalSequence() ), - "main" : ``( MainSequence() ), + "main" : ``( MainSequence() ), + "writeservice" : ``( WriteServiceDialog() ), "write" : ``( WriteDialog() ) ]; @@ -165,7 +172,8 @@ `abort : `abort, `initial : "propose", `migrate : "migrate", - `next : "main" + `next : "main", + `reread : "writeservice" ], "migrate" : $[ `abort : `abort, @@ -178,8 +186,12 @@ ], "main" : $[ `abort : `abort, - `next : "write" + `next : "write", + `reread : "read" ], + "writeservice" : $[ + `reread : "read" + ], "write" : $[ `abort : `abort, `next : `next -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rhafer@svn.opensuse.org