Manager and CLI can now start with an empty configuration (#LEMONDAP-702)

environments/ppa-mbqj77/deployments/1
Clément Oudot 11 years ago
parent f14fa43167
commit a42f455ccc
  1. 3
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf.pm
  2. 7
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Attributes.pm
  3. 6
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
  4. 15
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Uploader.pm

@ -357,7 +357,8 @@ sub available {
# Call lastCfg() from the $self->{type} package. # Call lastCfg() from the $self->{type} package.
# @return Number of the last configuration available # @return Number of the last configuration available
sub lastCfg { sub lastCfg {
return &{ $_[0]->{type} . '::lastCfg' }(@_); my $result = &{ $_[0]->{type} . '::lastCfg' }(@_) || "0";
return $result;
} }
## @method boolean lock() ## @method boolean lock()

@ -125,6 +125,13 @@ has 'cda' => (
documentation => 'Enable Cross Domain Authentication', documentation => 'Enable Cross Domain Authentication',
); );
has 'cfgNum' => (
is => 'rw',
isa => 'Int',
default => '0',
documentation => 'Configuration number',
);
has 'checkXSS' => ( has 'checkXSS' => (
is => 'rw', is => 'rw',
isa => 'Bool', isa => 'Bool',

@ -104,10 +104,8 @@ sub new {
# Else load conf # Else load conf
require Lemonldap::NG::Manager::Downloader; #inherits require Lemonldap::NG::Manager::Downloader; #inherits
$self->{cfgNum} = $self->{cfgNum} = $self->param('cfgNum')
$self->param('cfgNum') || $self->confObj->lastCfg();
|| $self->confObj->lastCfg()
|| 'UNAVAILABLE';
if ( my $p = $self->param('node') ) { if ( my $p = $self->param('node') ) {

@ -52,11 +52,10 @@ sub confUpload {
->documentElement(); ->documentElement();
# 1.2 Get configuration number # 1.2 Get configuration number
unless ( $self->{cfgNum} = $self->{cfgNum} =
$result->getChildrenByTagName('conf')->[0]->getAttribute('value') ) $result->getChildrenByTagName('conf')->[0]->getAttribute('value');
{ die "No configuration number found" unless defined $self->{cfgNum};
die "No configuration number found";
}
my $newConf = { cfgNum => $self->{cfgNum} }; my $newConf = { cfgNum => $self->{cfgNum} };
my $errors = {}; my $errors = {};
@ -332,7 +331,11 @@ s/^(samlSPMetaDataXML|samlSPMetaDataExportedAttributes|samlSPMetaDataOptions)\/(
$self->setKeyToH( $self->setKeyToH(
$newConf, $confKey, $newConf, $confKey,
$test->{keyTest} $test->{keyTest}
? ( ( $id !~ /\// or $test->{'*'} ) ? {} : ( $name => $value ) ) ? (
( $id !~ /\// or $test->{'*'} )
? {}
: ( $name => $value )
)
: $value : $value
); );
} }

Loading…
Cancel
Save