source: trunk/LATMOS-Accounts/bin/la-sql-exchange-ip @ 1254

Last change on this file since 1254 was 1044, checked in by nanardon, 12 years ago

Kill redundant LATMOS::Account::default_base()

Use $LA->base(undef) to get default base instead

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use Getopt::Long;
7use Pod::Usage;
8
9=head1 NAME
10
11    la-exchange-ip - Exchange IP between two host
12
13=head1 SYNOPSIS
14
15    la-exchange-ip ip1 ip2
16
17Example : la-rename-host foo bar
18
19=cut
20
21GetOptions(
22    'c|config=s'        => \my $config,
23    'b|base=s'          => \my $base,
24    'no-cname'          => \my $nocname,
25    'help'              => sub { pod2usage(0) },
26) or pod2usage();
27
28=head1 OPTIONS
29
30=over 4
31
32=item -c|--config configdir
33
34Use this configuration directory instead of the default one.
35
36=item -b|--base basename
37
38Query this specific base instead of the default one.
39
40=back
41
42=cut
43
44my $LA = LATMOS::Accounts->new($config, noacl => 1);
45my $labase = $LA->base($base);
46$labase && $labase->load or die "Cannot load base";
47
48$labase->unexported(1);
49
50my ($from, $to) = @ARGV or pod2usage();
51
52if ($labase->nethost_exchange_ip($from, $to)) {
53    $labase->commit;
54    print "IP succesfully exchange between $from and $to\n";
55    exit(0);
56} else {
57    warn "Error while exchanging ip\n";
58    exit(1);
59}
Note: See TracBrowser for help on using the repository browser.