IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 12:45:24 PM (17 years ago)
Author:
eugene
Message:

update from mainline

Location:
branches/eam_branches/20090715
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715

  • branches/eam_branches/20090715/Nebulous/bin/neb-cull

    r16183 r25022  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($server, $volume);
     18my ($server, $volume, $one_only);
    1919
    2020$server = $ENV{'NEB_SERVER'} unless $server;
     
    2323    'server|s=s'    => \$server,
    2424    'volume|v=s'    => \$volume,
     25    'one_only|o'    => \$one_only,
    2526) || pod2usage( 2 );
    2627
     
    4041    unless defined $neb;
    4142
     43my @cull_args;   
     44push @cull_args, $key;
    4245if (defined $volume) {
    43     $neb->cull($key, $volume)
    44         or die "failed to replicate Nebulous key: $key";
     46    push @cull_args, $volume;
     47}
     48
     49if ($one_only) {
     50    my $status = $neb->there_can_be_only_one(@cull_args);
     51    if ($status == 0) {
     52        die "not enough instances of Nebulous key: $key";
     53    }
     54    if (not defined $status or $status < 1) {
     55        die "failed to cull Nebulous key: $key - " . $neb->err
     56            if defined $neb->err;
     57        die "failed to cull Nebulous key: $key";
     58    }
    4559} else {
    46     $neb->cull($key)
    47         or die "failed to replicate Nebulous key: $key";
     60    unless (defined $neb->cull(@cull_args)) {
     61        die "failed to cull Nebulous key: $key - " . $neb->err;
     62    }
    4863}
    4964
     
    5873=head1 SYNOPSIS
    5974
    60     neb-cull [--server <URL>] [--volume <volume name>] <key>
     75    neb-cull [--server <URL>] [--volume <volume name>] [--one_only] <key>
    6176
    6277=head1 DESCRIPTION
     
    7792
    7893Symbolic name of the volume to create the new instance on.
     94
     95Optional.
     96
     97=item * --one_only|-o
     98
     99Removes all but one instances of an object.  Any inaccessible instances are
     100removed.  If C<--volume> is specified, and an instance exists on that volume,
     101all instances but the one on that volume are removed.
    79102
    80103Optional.
     
    110133=head1 COPYRIGHT
    111134
    112 Copyright (C) 2007-2008  Joshua Hoblitt.  All rights reserved.
     135Copyright (C) 2007-2009  Joshua Hoblitt.  All rights reserved.
    113136
    114137This program is free software; you can redistribute it and/or modify it under
Note: See TracChangeset for help on using the changeset viewer.