## Account for variations and abbreviations
$thing = standardize_name($thing);
- ## These do return due to recursion, so we must exit afterwards
- (update_customcode() or exit 1) if $thing eq 'customcode';
- ## We do not update customname or customcols
- ## The dbgroup must be checked before the database (dbg vs db)
- (update_database(@nouns) or exit 1) if $thing eq 'database';
- (update_dbgroup(@nouns) or exit 1) if $thing eq 'dbgroup';
- (update_herd(@nouns) or exit 1) if $thing eq 'herd';
- (update_sync(@nouns) or exit 1) if $thing eq 'sync';
- (update_table(@nouns) or exit 1) if $thing eq 'table' or $thing eq 'sequence';
-
- ## If we got this far, we have an unknown thing
- warn "$usage\n";
- exit 1;
-
+ my $code = $thing eq 'customcode' ? \&update_customcode
+ : $thing eq 'database' ? \&update_database
+ : $thing eq 'dbgroup' ? \&update_dbgroup
+ : $thing eq 'herd' ? \&update_herd
+ : $thing eq 'sync' ? \&update_sync
+ : $thing eq 'table' ? \&update_table
+ : $thing eq 'sequence' ? \&update_table
+ : do { warn "$usage\n"; exit 1; };
+
+ ## The update function returns, due to recursion, so we must exit.
+ $code->(@nouns);
+ exit 0;
} ## end of update_item
=item B<activate>
- bucardo syncname [syncname2 syncname3 ...] [timeout]
+ bucardo activate syncname [syncname2 syncname3 ...] [timeout]
Activates one or more named syncs. If given a timeout argument, it will wait until it has received
confirmation from Bucardo that each sync has been successfully activated.
=item B<deactivate>
- bucardo syncname [syncname2 syncname3 ...] [timeout]
+ bucardo deactivate syncname [syncname2 syncname3 ...] [timeout]
Deactivates one or more named syncs. If given a timeout argument, it will wait until it has received
confirmation from Bucardo that the sync has been successfully deactivated.
is_deeply($res, [[1]], $t);
## Switch to a 2 source sync
-$bct->ctl('bucardo update sync pgtest1 status=inactive');
-$bct->ctl('bucardo update sync pgtest5 status=active');
-$bct->ctl('bucardo deactivate sync pgtest1');
-$bct->ctl('bucardo activate sync pgtest5 0');
+is $bct->ctl('bucardo update sync pgtest1 status=inactive'), '', 'Set pgtest1 status=inactive';
+is $bct->ctl('bucardo update sync pgtest5 status=active'), '', 'Set pgtest5 status=active';
+is $bct->ctl('bucardo deactivate pgtest1'), "Deactivating sync pgtest1\n",
+ 'Deactivate pgtest1';
+is $bct->ctl('bucardo activate pgtest5 0'), "Activating sync pgtest5...OK\n",
+ 'Activate pgtest5';
## Add some rows to both masters, make sure it goes everywhere
$bct->add_row_to_database('A', 3);
$bct->add_row_to_database('B', 4);
## Kick off the sync.
$bct->ctl('bucardo kick sync pgtest5 0');
-## All rows should be on A, B, C, and D
+## All rows should be on A and B.
my $expected = [[1],[3],[4]];
$bct->check_for_row($expected, [qw/A B/]);