Changeset 563


Ignore:
Timestamp:
12/17/09 14:43:52 (15 years ago)
Author:
nanardon
Message:
  • propagate state_dir to synchro object
Location:
LATMOS-Accounts/lib/LATMOS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts.pm

    r562 r563  
    180180    my $sync = LATMOS::Accounts::Synchro->new( 
    181181        $labfrom, [ @labto ], 
    182         state_file => ($self->val('_default_', 'state_dir') 
    183             ? $self->val('_default_', 'state_dir') . '/synchronisation.ini' 
    184             : undef), 
     182        state_dir => ($self->val('_default_', 'state_dir') || undef), 
    185183        %options, 
    186184        name => $name, 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Synchro.pm

    r541 r563  
    4242    my ($class, $from, $to, %options) = @_; 
    4343 
    44     if ($options{state_file} && ! -w $options{state_file}) { 
     44    my $state_file = $options{state_dir} 
     45        ? $options{state_dir} . '/synchronisation.ini' 
     46        : undef; 
     47    if ($state_file && ! -w $state_file) { 
    4548        # don't exists, we have to create it 
    46         open(my $handle, '>', $options{state_file}) or do { 
    47             la_log(LA_ERR, "Cannot open status file %s", $options{state_file}); 
     49        open(my $handle, '>', $state_file) or do { 
     50            la_log(LA_ERR, "Cannot open status file %s", $state_file); 
    4851            return; 
    4952        }; 
     
    5457    my $self = Config::IniFiles->new( 
    5558        $options{state_file} 
    56         ? (-file => $options{state_file}) 
     59        ? (-file => $state_file) 
    5760        : (), 
    5861    ); 
    5962 
    60     if ($options{state_file} && !$self->GetFileName) { 
    61         $self->SetFileName($options{state_file}); 
     63    if ($state_file && !$self->GetFileName) { 
     64        $self->SetFileName($state_file); 
    6265    } 
    6366     
     
    138141    $self->run_post_synchro; 
    139142} 
    140  
    141143 
    142144sub sync_object { 
Note: See TracChangeset for help on using the changeset viewer.