vinted / chef-proxysql

Chef ProxySQL cookbook with auto loading and comprehensive configuration
MIT License
6 stars 9 forks source link

Multiple admin credentials feature fails in validation #46

Closed petracvv closed 5 years ago

petracvv commented 5 years ago

While the multiple admin credential feature was added in #41, that update did not include fixes for the validation function to support multiple credentials in the admin_credential attribute.

Looking at: https://github.com/vinted/chef-proxysql/blob/6b1150547c53e81d02c44964c459d49e8cef1ba8/libraries/proxysql_service.rb#L156-L163

you can see the if statement doesn't check for multiple credentials

Maybe something like:

if admin_credentials.split(';').first.split(':').size != 2

Though the above seems a bit ugly. Any other ideas?

ernestas-vinted commented 5 years ago

hey @petracvv, could you share how you are passing admin_credentials to chef-proxysql I want to reproduce it

you can see the if statement doesn't check for multiple credentials

it does not because mysq_cmd command uses only first occurrence of credentials as well as in validation

petracvv commented 5 years ago

Well, this may have been a mess up on my part after all. I tried to reproduce it again and realized that I had been using a comma to separate the credentials when this was failing. Changing to a semicolon as it should be and the recipe ran just fine.

This can be closed. Thanks!

If you are curious I was passing in the credentials via the proxysql_service resource:

proxysql_service 'default' do
  version '1.4.13'
  lock_version true
  mysql_servers cluster_hosts
  mysql_replication_hostgroups replication_groups
  admin_variables( 
    'admin_credentials' => "admin:#{proxysql_secrets['admin_pass']};radmin:#{proxysql_secrets['radmin_pass']}",
    'mysql_ifaces' => "0.0.0.0:6032"
  )
  mysql_variables(
    'interfaces' => "#{node['ipaddress']}:3306",
    'server_version' => '10.3.11-MariaDB-log MariaDB Server',
    'monitor_username' => mariadb_secrets['monitor_user'],
    'monitor_password' => mariadb_secrets['monitor_pass'],
    'monitor_writer_is_also_reader' => false
  )
end
ernestas-vinted commented 5 years ago

I tried to reproduce it again and realized that I had been using a comma to separate the credentials when this was failing. Changing to a semicolon as it should be and the recipe ran just fine.

Happens. Neat config ! :point_up: :+1: