MT#10639 [CARRIER] ngcp-sync-constants: add --no-grant-nodes option

This is useful on installation phase when the sp2 node is not yet
in sync with sp1, so the grants are not yet there and it will produce
errors in sync afterwards

Change-Id: I47f9ac682f4513d309a41d8c5bab181d6070ecf2
changes/36/636/3
Victor Seva 11 years ago
parent b68b1c487b
commit dc4093c589

@ -65,18 +65,20 @@ sub Usage {
==
$0 [options]
Options:
-help|-h|-? -- this help
-root|-r -- use mysql root user without password as DB credentials
-init-passwords|-i -- generate new passwords (constants.yml is updated)
-slave|-s -- sync repuser and replication on slave cluster instance
-test|-t -- test mode (no updates)
-verbose|-v -- verbose mode
-help|-h|-? -- this help
-root|-r -- use mysql root user without password as DB credentials
-init-passwords|-i -- generate new passwords (constants.yml is updated)
-slave|-s -- sync repuser and replication on slave cluster instance
-no-grant-nodes -- skip copy grants for external nodes
-test|-t -- test mode (no updates)
-verbose|-v -- verbose mode
USAGE
exit 0;
}
my $mysql_root = 0;
my $db_users = 'mysql';
my $skip_grant_nodes = 0;
my $slave = 0;
my $yml = {};
@ -90,6 +92,7 @@ GetOptions("h|?|help" => \&Usage,
"i|init-passwords" => \$init_passwords,
"r|root" => \$mysql_root,
"s|slave" => \$slave,
"no-grant-nodes" => \$skip_grant_nodes,
"t|test" => \$test_mode,
"v|verbose" => \$debug);
#----------------------------------------------------------------------
@ -575,7 +578,7 @@ sub get_slave_hosts {
return @hosts;
}
sub do_grant_slaves
sub do_grant_nodes
{
my $dbhost = $yml->[0]->{database}->{pair}->{dbhost} || "localhost";
my $dbport = $yml->[0]->{database}->{pair}->{dbport} || 3306;
@ -587,7 +590,7 @@ sub do_grant_slaves
return unless($hostname =~ '^db\d+[ab]$');
@hosts = get_slave_hosts($hostname);
if (not @hosts) {
print "skip do_grant_slaves\n";
print "skip do_grant_nodes\n";
return;
}
push @hosts, 'sp1';
@ -679,7 +682,7 @@ sub main {
return;
}
do_pair_sync();
do_grant_slaves();
do_grant_nodes() unless $skip_grant_nodes;
return unless $init_passwords;
copy_passwords();
@ -718,6 +721,9 @@ New passwords are generated (passwords for "mysql" is not generated to avoid rep
=item B<--slave>
Sync repuser and check replication of the read-only dbcluster instance (mysqld2)
=item B<--no-grant-nodes>
Skip creation of grants for external nodes. This is useful on installation phase at sp2
=item B<--test>
No real updates, only for checks

Loading…
Cancel
Save