IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20143


Ignore:
Timestamp:
Oct 14, 2008, 10:13:17 AM (18 years ago)
Author:
jhoblitt
Message:

testing...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/neb-voladm

    r20089 r20143  
    11#!/usr/bin/env perl
    22
    3 # Copyright (C) 2005-2008  Joshua Hoblitt
     3# Copyright (C) 2008  Joshua Hoblitt
    44#
    5 # $Id: neb-voladm,v 1.1 2008-10-13 20:06:22 jhoblitt Exp $
     5# $Id: neb-voladm,v 1.2 2008-10-14 20:13:17 jhoblitt Exp $
    66
    77use strict;
     
    99
    1010use vars qw( $VERSION );
    11 $VERSION = '0.02';
     11$VERSION = '0.01';
    1212
    1313use DBI;
    1414use Nebulous::Server::SQL;
    1515use URI::file;
     16use SQL::Interp qw( sql_interp );
    1617use URI;
    1718
     
    1920use Pod::Usage qw( pod2usage );
    2021
    21 my ($db, $dbhost, $dbuser, $dbpass, $vname, $vhost, $uri);
     22my ($db, $dbhost, $dbuser, $dbpass, $vname, $vhost);
    2223
    2324$db     = $ENV{'NEB_DB'} unless $db;
     
    3132    'user|u=s'          => \$dbuser,
    3233    'pass|p=s'          => \$dbpass,
    33 #    'vname|n=s'         => \$vname,
    34 #    'vhost=s'           => \$vhost,
    35 #    'uri|u=s'           => \$uri,
     34    'vname|n=s'         => \$vname,
     35    'vhost=s'           => \$vhost,
    3636) || pod2usage( 2 );
    3737
    3838pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    39 pod2usage( -msg => "Required options: --db --user --pass --vname --vhost --uri", -exitval => 2 )
    40     unless $db && $dbuser && $dbpass && $vname && $vhost && $uri;
     39pod2usage( -msg => "Required options: --db --user --pass", -exitval => 2 )
     40    unless $db && $dbuser && $dbpass;
    4141
    4242my $dbh = DBI->connect(
     
    5353my $sql = Nebulous::Server::SQL->new();
    5454
    55 print "Checking URI...";
     55my %constraint;
     56$constraint{host} = $vhost if defined $vhost;
     57$constraint{name} = $vname if defined $vname;
    5658
    57 my $path = URI->new($uri)->path;
    58 unless (-d $path) {
    59     die "path: $path dirived from URI: $uri does not exist";
    60 }
     59my $select = sql_inerp($sql->get_volumes . " WHERE", \%constraint);
    6160
    62 print " OK\n";
    63 
    64 print "Adding volume...";
    65 
    66 my $query = $dbh->prepare( $sql->new_volume );
    67 $query->execute( $vname, $vhost, $path );
    68 
    69 print " OK\n";
     61my $query = $dbh->prepare($select);
     62$query->execute();
    7063
    7164__END__
Note: See TracChangeset for help on using the changeset viewer.