MT#9579 ngcp-sync-constants: check host on replication

Error if host has changed

Change-Id: Ic2b6e79a8b3bb6c179ce5d7dfcb6f32f826c2ca7
changes/62/362/3
Victor Seva 11 years ago
parent 872ded0c1d
commit 2cabdf530a

@ -81,6 +81,7 @@ my $password_length = 20;
my $init_passwords = 0;
my $debug = 0;
my $test_mode = 0;
my $error = 0;
GetOptions("h|?|help" => \&Usage,
"i|init-passwords" => \$init_passwords,
@ -214,10 +215,16 @@ sub sync_repuser {
my $mfh;
unless(open $mfh, '<', $minfo) {
print STDERR "Failed to open $minfo for syncing, replication not synced!\n";
next;
$error = 1;
return;
}
my @minfo_content = <$mfh>;
close $mfh;
unless(grep {/^${mhost}\s*$/}@minfo_content) {
print STDERR "${mhost} not found at $minfo. Fix replication manually";
$error = 2;
return;
}
unless(grep {/^${pass}\s*$/} @minfo_content) {
set_master_pass(
dbh => $dbh,
@ -673,13 +680,11 @@ sub main {
print "Writing new passwords into ".CONSTANTS_YML." ... ";
$yml->write(CONSTANTS_YML);
print "Done\n";
# print Data::Dumper->Dumpxs([$yml]),"\n";
}
#----------------------------------------------------------------------
main();
exit 0;
exit $error;
__END__

Loading…
Cancel
Save