From 321be132c446193223e5177fa9182f3d60d61e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Tue, 13 Jul 2021 14:50:45 +0200 Subject: [PATCH 1/3] Fix comment --- lemonldap-ng-common/scripts/convertSessions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lemonldap-ng-common/scripts/convertSessions b/lemonldap-ng-common/scripts/convertSessions index 9ba895895..b5991ee30 100755 --- a/lemonldap-ng-common/scripts/convertSessions +++ b/lemonldap-ng-common/scripts/convertSessions @@ -16,12 +16,12 @@ use strict; use Getopt::Long; use Pod::Usage; -our $VERSION = "2.0.6"; +our $VERSION = "2.0.12"; # Options # -d: debug mode # -c: configuration file -# -r: configuration file +# -r: rename attributes # -i: ignore errors my $debug; From 67c8df09ad8b01c16dd79624c1777bbc2f8e112a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Tue, 13 Jul 2021 14:58:03 +0200 Subject: [PATCH 2/3] Possibility to exclude attributes in sessions conversion --- lemonldap-ng-common/scripts/convertSessions | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lemonldap-ng-common/scripts/convertSessions b/lemonldap-ng-common/scripts/convertSessions index b5991ee30..66e1465a4 100755 --- a/lemonldap-ng-common/scripts/convertSessions +++ b/lemonldap-ng-common/scripts/convertSessions @@ -23,11 +23,13 @@ our $VERSION = "2.0.12"; # -c: configuration file # -r: rename attributes # -i: ignore errors +# -x: exclude attributes my $debug; my $config_file; my $ignore_errors; my %rename; +my @exclude; my $help; my $nb_converted = 0; my $nb_error = 0; @@ -38,6 +40,7 @@ GetOptions( 'config|c=s' => \$config_file, 'ignore-errors|i' => \$ignore_errors, 'rename|r=s' => \%rename, + 'exclude|x=s' => \@exclude, ) or pod2usage(2); pod2usage( -exitval => 1, @@ -133,6 +136,16 @@ Lemonldap::NG::Common::Apache::Session->get_key_from_all_sessions( } } + if (@exclude) { + for my $excludekey (@exclude) { + if ( $entry->{$excludekey} ) { + print "Exclude $excludekey in session $id\n" + if $debug; + delete $entry->{$excludekey}; + } + } + } + print "Processing session $id\n" if $debug; my $s = Lemonldap::NG::Common::Session->new( { storageModule => $backendTo->{backend}, From 4414ed2bf85a74a8a8b1fea20148bec77b9849c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Tue, 13 Jul 2021 15:00:09 +0200 Subject: [PATCH 3/3] Documentation for key exclusion in sessions conversion script --- doc/sources/admin/changesessionbackend.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/sources/admin/changesessionbackend.rst b/doc/sources/admin/changesessionbackend.rst index d14c4e2f6..90c1e4e90 100644 --- a/doc/sources/admin/changesessionbackend.rst +++ b/doc/sources/admin/changesessionbackend.rst @@ -46,6 +46,7 @@ Options: - ``-c``: job configuration file (mandatory) - ``-r oldkey=newkey``: rename session keys during conversion (optional, can be given multiple times) +- ``-x key``: remove session keys during conversion (optional, can be given multiple times) - ``-i``: ignore errors. By default errors will stop the script execution - ``-d``: print debugging output