Skip to content

Commit

Permalink
Merge pull request #181 from jadestorm/newer_proxysql_support
Browse files Browse the repository at this point in the history
Newer proxysql support
  • Loading branch information
ekohl committed Apr 28, 2022
2 parents e828aad + 8263196 commit fba3231
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/type/proxy_mysql_query_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@

newproperty(:match_pattern) do
desc 'regular expression that matches the query text'
newvalue(%r{\w+})
newvalue(%r{.*})
end

newproperty(:replace_pattern) do
desc 'this is the pattern with which to replace the matched pattern.'
newvalue(%r{\w+})
newvalue(%r{.*})
end

newproperty(:negate_match_pattern) do
Expand Down
54 changes: 54 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,36 @@
'server' => 'keyserver.ubuntu.com',
},
}
$repo21 = {
comment => 'ProxySQL 2.1.x APT repository',
location => "http://repo.proxysql.com/ProxySQL/proxysql-2.1.x/${facts['os']['distro']['codename']}/",
release => './',
repos => '',
key => {
'id' => '1448BF693CA600C799EB935804A562FB79953B49',
'server' => 'keyserver.ubuntu.com',
},
}
$repo22 = {
comment => 'ProxySQL 2.2.x APT repository',
location => "http://repo.proxysql.com/ProxySQL/proxysql-2.2.x/${facts['os']['distro']['codename']}/",
release => './',
repos => '',
key => {
'id' => '1448BF693CA600C799EB935804A562FB79953B49',
'server' => 'keyserver.ubuntu.com',
},
}
$repo23 = {
comment => 'ProxySQL 2.3.x APT repository',
location => "http://repo.proxysql.com/ProxySQL/proxysql-2.3.x/${facts['os']['distro']['codename']}/",
release => './',
repos => '',
key => {
'id' => '1448BF693CA600C799EB935804A562FB79953B49',
'server' => 'keyserver.ubuntu.com',
},
}
}
'RedHat': {
$package_provider = 'rpm'
Expand All @@ -60,6 +90,30 @@
gpgcheck => true,
gpgkey => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
}
$repo21 = {
name => 'proxysql_2_1',
descr => 'ProxySQL 2.1.x YUM repository',
baseurl => "http://repo.proxysql.com/ProxySQL/proxysql-2.1.x/centos/${repo_os_major_version}",
enabled => true,
gpgcheck => true,
gpgkey => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
}
$repo22 = {
name => 'proxysql_2_2',
descr => 'ProxySQL 2.2.x YUM repository',
baseurl => "http://repo.proxysql.com/ProxySQL/proxysql-2.2.x/centos/${repo_os_major_version}",
enabled => true,
gpgcheck => true,
gpgkey => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
}
$repo23 = {
name => 'proxysql_2_3',
descr => 'ProxySQL 2.3.x YUM repository',
baseurl => "http://repo.proxysql.com/ProxySQL/proxysql-2.3.x/centos/${repo_os_major_version}",
enabled => true,
gpgcheck => true,
gpgkey => 'http://repo.proxysql.com/ProxySQL/repo_pub_key',
}
}
default: {
fail("osfamily ${facts['os']['family']} is not supported")
Expand Down
34 changes: 30 additions & 4 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

if $proxysql::manage_repo and !$proxysql::package_source {
$repo = $proxysql::version ? {
/^2\.3\./ => $proxysql::params::repo23,
/^2\.2\./ => $proxysql::params::repo22,
/^2\.1\./ => $proxysql::params::repo21,
/^2\.0\./ => $proxysql::params::repo20,
/^1\.4\./ => $proxysql::params::repo14,
default => fail("Unsupported `proxysql::version` ${proxysql::version}")
Expand All @@ -22,11 +25,34 @@
* => $repo,
}

$purge_repo = $proxysql::version ? {
/^2\.0\./ => $proxysql::params::repo14['name'],
/^1\.4\./ => $proxysql::params::repo20['name'],
# Purge old/unnecessary repos.
if ($proxysql::version !~ /^2\.3\./) {
yumrepo { $proxysql::params::repo23['name']:
ensure => absent,
}
}
yumrepo { ['proxysql_repo', $purge_repo]:
if ($proxysql::version !~ /^2\.2\./) {
yumrepo { $proxysql::params::repo22['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.1\./) {
yumrepo { $proxysql::params::repo21['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^2\.0\./) {
yumrepo { $proxysql::params::repo20['name']:
ensure => absent,
}
}
if ($proxysql::version !~ /^1\.4\./) {
yumrepo { $proxysql::params::repo14['name']:
ensure => absent,
}
}

yumrepo { 'proxysql_repo':
ensure => absent,
}
}
Expand Down

0 comments on commit fba3231

Please sign in to comment.