IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26333


Ignore:
Timestamp:
Dec 3, 2009, 3:31:01 PM (16 years ago)
Author:
watersc1
Message:

Changes to implement delete-invalid. Probably not 100% production ready.

Location:
trunk/Nebulous
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/bin/neb-rm

    r24864 r26333  
    1919    $force,
    2020    $move,
     21    $invalid,
    2122    $server,
    2223);
     
    2728    'force|f'       => \$force,
    2829    'move|m'        => \$move,
     30    'invalid|i'     => \$invalid,
    2931    'server|s=s'    => \$server,
    3032) || pod2usage( 2 );
     
    4244foreach my $key (@ARGV) {
    4345    unless (defined $move) {
    44         $neb->delete($key, $force) or warn "failed to delete key: $key";
     46        $neb->delete($key, $force,$invalid) or warn "failed to delete key: $key";
    4547    } else {
    4648        $neb->move($key, "${key}.rm") or warn "failed to move key: $key";
     
    8082When set, this flag causes C<<key>> to be renamed to C<<key>.rm> instead of
    8183being deleted.
     84
     85Optional.
     86
     87=item * --invalid|-i
     88
     89When set, unavailable instances of C<<key>> will be removed from the nebulous database.
    8290
    8391Optional.
  • trunk/Nebulous/lib/Nebulous/Client.pm

    r26292 r26333  
    755755            optional    => 1,
    756756        },
     757        {
     758            #find_invalid
     759            type        => SCALAR|UNDEF,
     760            optional    => 1,
     761        },
    757762    );
    758763
     
    951956    my $self = shift;
    952957
    953     my ($key, $force) = validate_pos( @_,
     958    my ($key, $force, $invalid) = validate_pos( @_,
    954959        {
    955960            type        => SCALAR,
     
    965970            },
    966971        },
    967     );
    968 
    969     $log->debug( "entered - @_" );
    970 
    971     my $locations = $self->find_instances( $key, 'any' );
     972        {
     973            type        => BOOLEAN,
     974            optional    => 1,
     975            default     => undef,
     976            callbacks   => {
     977                'is boolean' => sub {
     978                    $_[0] == 0 or $_[0] == 1 or $_[0] == undef;
     979                },
     980            },
     981        },
     982    );
     983
     984    $log->debug( "entered - @_" );
     985
     986
     987    my $locations;
     988    if ($invalid) {
     989        $locations = $self->find_instances( $key, 'any', 'find them all');
     990    }
     991    else {
     992        $locations = $self->find_instances( $key, 'any' );
     993    }
    972994
    973995    return undef unless $locations;
Note: See TracChangeset for help on using the changeset viewer.