MT#8117 Swtich defaults from 127.0.0.1 to localhost

We have a regression here for CE during the upgrade mr3.4->trunk:
> Removing proj-data ...
> ...
> Synchronizing data from /etc/ngcp-config/constants.yml
> DBI connect('database=mysql;host=127.0.0.1;port=3306','sipwise',...) failed:
> Can't connect to MySQL server on '127.0.0.1' (111) 
> at /usr/sbin/ngcp-sync-constants line 131
> Can't connect to MySQL database mysql: Can't connect to MySQL server on
> '127.0.0.1' (111) at /usr/sbin/ngcp-sync-constants line 131.

It happens because MySQL listens Unix sockets only (due to "skip_networking" in my.cnf)
It doesn't affect newly installed CE trunk, 
because it has defaults in /etc/ngcp-config/config.yml:
> database:
>   central:
>     dbhost: localhost
>   pair:
>     dbhost: localhost

While upgraded system not yet received those options 
(ngcp-upgrade-cfg-schema will be called later).
So, we need to change defaults here to localhost. 
MySQL always uses unix sockets for 'localhost'.

Change-Id: I0f07c43ea68ed47b653242cd87ed74e7351dcc1c
changes/59/59/3
Alexander Lutay 12 years ago
parent 0f9a116c7b
commit 6c74dde2bf

@ -515,7 +515,7 @@ sub copy_passwords {
}
sub do_pair_sync {
my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "127.0.0.1";
my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "localhost";
my $dbport = $config->[0]->{database}->{pair}->{dbport} || 3306;
system("/usr/share/ngcp-ngcpcfg/helper/check-for-mysql");
@ -556,7 +556,7 @@ sub get_slave_hosts {
sub do_grant_slaves
{
my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "127.0.0.1";
my $dbhost = $config->[0]->{database}->{pair}->{dbhost} || "localhost";
my $dbport = $config->[0]->{database}->{pair}->{dbport} || 3306;
my $user = $yml->[0]->{mysql}->{repuser};
my $pwd = $yml->[0]->{mysql}->{reppassword};
@ -595,7 +595,7 @@ sub do_slave_sync
{
my $dbhost = $yml->[0]->{database}->{dbhost};
my $dbport = $yml->[0]->{database}->{dbport};
my $mhost = $config->[0]->{database}->{central}->{dbhost} || "127.0.0.1";
my $mhost = $config->[0]->{database}->{central}->{dbhost} || "localhost";
my $mport = $config->[0]->{database}->{central}->{dbport} || 3306;
my $user = $yml->[0]->{mysql}->{repuser};
my $pass = $yml->[0]->{mysql}->{reppassword};

Loading…
Cancel
Save