Author: rhafer
Date: Mon Oct 5 17:00:18 2009
New Revision: 58946
URL: http://svn.opensuse.org/viewcvs/yast?rev=58946&view=rev
Log:
initial write support for syncprov settings
Modified:
branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapDatabase.ycp
branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapServer.pm
branches/SuSE-Code-11-SP1-Branch/ldap-server/src/agent/SlapdConfigAgent.cc
branches/SuSE-Code-11-SP1-Branch/ldap-server/src/tree_structure.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapDatabase.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapDatabase.ycp?rev=58946&r1=58945&r2=58946&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapDatabase.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapDatabase.ycp Mon Oct 5 17:00:18 2009
@@ -1507,10 +1507,27 @@
return true;
}
- global boolean DbSyncWrite( integer index )
+ global map DbSyncWrite( integer index )
{
y2milestone("DbSyncWrite %1", index );
- return true;
+ map syncprov = $[];
+ if( UI::QueryWidget( `cb_synprov_enable, `Value ) == true )
+ {
+ integer cp_ops = (integer) UI::QueryWidget( `if_syncprov_checkpoint_ops, `Value );
+ integer cp_min = (integer) UI::QueryWidget( `if_syncprov_checkpoint_min, `Value );
+ integer slog = (integer) UI::QueryWidget( `if_syncprov_sessionlog, `Value );
+ syncprov = add(syncprov, "enabled", true );
+ if ( cp_ops != 0 || cp_min != 0 )
+ {
+ map cp = $[ "ops" : cp_ops, "min" : cp_min ];
+ syncprov = add( syncprov, "checkpoint", cp );
+ }
+ if ( slog > 0 )
+ {
+ syncprov = add( syncprov, "sessionlog", slog );
+ }
+ }
+ return syncprov;
}
define symbol DbPpolicy()
Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapServer.pm?rev=58946&r1=58945&r2=58946&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapServer.pm (original)
+++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/LdapServer.pm Mon Oct 5 17:00:18 2009
@@ -1821,6 +1821,32 @@
return YaST::YCP::Boolean(1);
}
+BEGIN { $TYPEINFO {WriteSyncProv} = ["function", "boolean" , "integer", ["map", "string", "any" ] ]; }
+sub WriteSyncProv
+{
+ my ( $self, $dbindex, $syncprov) = @_;
+ y2milestone("WriteSyncProv");
+ y2milestone("SyncProv: ".Data::Dumper->Dump([$syncprov]) );
+ if (defined $syncprov->{'checkpoint'} )
+ {
+ $syncprov->{'checkpoint'} = {
+ "ops" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'ops'}),
+ "min" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'min'})
+ }
+ }
+ if (defined $syncprov->{'sessionlog'} )
+ {
+ $syncprov->{'sessionlog'} = YaST::YCP::Integer( $syncprov->{'sessionlog'} );
+ }
+ if ( ! SCR->Write(".ldapserver.database.{".$dbindex."}.syncprov", $syncprov ) )
+ {
+ my $err = SCR->Error(".ldapserver");
+ $self->SetError( $err->{'summary'}, $err->{'description'} );
+ return YaST::YCP::Boolean(0);
+ }
+ return YaST::YCP::Boolean(1);
+}
+
BEGIN { $TYPEINFO {ReadSchemaList} = ["function", [ "list" , "string"] ]; }
sub ReadSchemaList
{
Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/agent/SlapdConfigAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/agent/SlapdConfigAgent.cc?rev=58946&r1=58945&r2=58946&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/agent/SlapdConfigAgent.cc Mon Oct 5 17:00:18 2009
@@ -1301,6 +1301,52 @@
}
ret = true;
}
+ else if ( dbComponent == "syncprov" )
+ {
+ OlcOverlayList overlays = (*i)->getOverlays();
+ OlcOverlayList::const_iterator j = overlays.begin();
+ for (; j != overlays.end(); j++ )
+ {
+ if ( (*j)->getType() == "syncprov" )
+ {
+ break;
+ }
+ }
+ YCPMap argMap = arg->asMap();
+ if ( j == overlays.end() && argMap.size() == 0 )
+ {
+ y2milestone("Empty overlay nothing to do");
+ }
+ boost::shared_ptr<OlcOverlay> syncprovOlc;
+ if ( j == overlays.end() )
+ {
+ boost::shared_ptr<OlcOverlay> tmp(new OlcOverlay("syncprov", (*i)->getUpdatedDn(), "olcSyncProvConfig") );
+ syncprovOlc = tmp;
+ syncprovOlc->setIndex(0);
+ (*i)->addOverlay(syncprovOlc);
+ }
+ else
+ {
+ syncprovOlc = *j;
+ }
+ if( argMap.size() == 0 )
+ {
+ syncprovOlc->clearChangedEntry();
+ }
+ else
+ {
+ if( ! argMap->value(YCPString("checkpoint")).isNull() )
+ {
+ YCPMap cpMap = argMap->value(YCPString("checkpoint"))->asMap();
+ int min = cpMap->value(YCPString("min"))->asInteger()->value();
+ int ops = cpMap->value(YCPString("ops"))->asInteger()->value();
+ std::ostringstream cpStream;
+ cpStream << ops << " " << min;
+ syncprovOlc->setStringValue("olcSpCheckpoint", cpStream.str());
+ }
+ }
+ ret = true;
+ }
else if ( dbComponent == "acl" )
{
YCPList argList = arg->asList();
Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/tree_structure.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/tree_structure.ycp?rev=58946&r1=58945&r2=58946&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/tree_structure.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/tree_structure.ycp Mon Oct 5 17:00:18 2009
@@ -859,10 +859,21 @@
define boolean cb_write_sync()
{
y2milestone("cb_write_sync()");
+ boolean result = false;
string treeItem = current_tree_item;
integer index = (integer)widget_map[current_tree_item,"index"]:nil;
- return LdapDatabase::DbSyncWrite( index );
+ map syncprov = LdapDatabase::DbSyncWrite( index );
+ if ( size(syncprov) > 0 )
+ {
+ result = LdapServer::WriteSyncProv(index, syncprov);
+ }
+ if ( ! result ) {
+ map err = LdapServer::ReadError();
+ callback_error = err["msg"]:"" + "\n" + err["details"]:"";
+ }
+ return result;
}
+
define boolean cb_input_ppolicy()
{
y2milestone("cb_input_ppolicy()");
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org