Skip to content

Commit

Permalink
Merge pull request #47 from vinted/fix/handle_multiple_admin_mysql_in…
Browse files Browse the repository at this point in the history
…terfaces

Handle multiple admin mysql interfaces
  • Loading branch information
ernestas-poskus authored Mar 27, 2019
2 parents 6b11505 + 85eae58 commit 70a2cd3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
ProxySQL is a high performance, high availability, protocol aware proxy
for MySQL and forks (like Percona Server and MariaDB).

> Note: due to rapid ProxySQL development, locked ProxySQL version may not be available, therefore one might need to bump version `node['proxysql']['version']`.
[![Build Status](https://travis-ci.org/vinted/chef-proxysql.svg?branch=master)](https://travis-ci.org/vinted/chef-proxysql)
[![Cookbook Version](https://img.shields.io/cookbook/v/proxysql.svg)](https://supermarket.chef.io/cookbooks/proxysql)

Expand Down
17 changes: 3 additions & 14 deletions attributes/repository.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
default['percona']['repository']['name'] = 'percona-release.repo'
default['percona']['repository']['version'] = '0.1-4'
default['percona']['repository']['name'] = 'percona-original-release.repo'

case node['platform']
when 'rhel', 'centos'
default['proxysql']['package_release'] = "1.1.el#{node['platform_version'].to_i}"

default['percona']['repository']['url'] = 'http://www.percona.com/'\
'downloads/percona-release/redhat/'\
"#{node['percona']['repository']['version']}/"\
"percona-release-#{node['percona']['repository']['version']}.noarch.rpm"
default['percona']['repository']['url'] = 'http://repo.percona.com/yum/percona-release-latest.noarch.rpm'
when 'debian', 'ubuntu'
lsb_release = Mixlib::ShellOut.new('lsb_release -sc')
lsb_release.run_command
lsb_release.error!
lsb_release = lsb_release.stdout.chomp

default['proxysql']['package_release'] = "1.1.#{lsb_release}"

default['percona']['repository']['url'] =
'http://repo.percona.com/apt/percona-release_'\
"#{node['percona']['repository']['version']}."\
"#{lsb_release}_all.deb"
default['percona']['repository']['url'] = "http://repo.percona.com/apt/percona-release_latest.#{lsb_release}_all.deb"
end
10 changes: 6 additions & 4 deletions libraries/proxysql_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ def admin_mysql_ifaces
end

def mysql_cmd
connection = if admin_mysql_ifaces =~ /\.sock/
iface = admin_mysql_ifaces.split(';').select { |inf| inf =~ /\.sock/ }
"--socket #{iface.first}"
admin_ifaces = admin_mysql_ifaces.split(';').map(&:strip)
socket_iface = admin_ifaces.select { |i| i =~ /\.sock/ }.first

connection = if socket_iface
"--socket #{socket_iface}"
else
host, port = admin_mysql_ifaces.split(':')
host, port = admin_ifaces.first.split(':')
"--host #{host} --port #{port}"
end
user, pass = admin_credentials.split(':')
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
issues_url 'https://github.com/vinted/chef-proxysql/issues'
source_url 'https://github.com/vinted/chef-proxysql'
chef_version '>= 12.1' if respond_to?(:chef_version)
version '3.4.0'
version '3.4.1'

supports 'redhat'
supports 'centos'
Expand Down
2 changes: 1 addition & 1 deletion test/integration/roles/admin_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"config": {
"admin_variables": {
"admin_credentials": "admin:admin",
"mysql_ifaces": "127.0.0.1:6033"
"mysql_ifaces": "127.0.0.1:6033;127.0.0.1:29029;127.0.0.1:39099;"
}
}
}
Expand Down

0 comments on commit 70a2cd3

Please sign in to comment.