diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-01-26 13:04:42 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-01-26 13:04:42 -0200 |
commit | ce9a3a152fc180e2de297367ea1a87477eae9338 (patch) | |
tree | 967ac44bab63a89f07c3ce5b09f721e6befaa718 /lib | |
parent | e51113be291e2c30088d9b25e9e279d9f3a675e1 (diff) | |
download | puppet-mysql-ce9a3a152fc180e2de297367ea1a87477eae9338.tar.gz puppet-mysql-ce9a3a152fc180e2de297367ea1a87477eae9338.tar.bz2 |
More lib updates
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/mysql.rb | 8 | ||||
-rw-r--r-- | lib/facter/mysql_exists.rb | 5 | ||||
-rw-r--r-- | lib/facter/mysql_version.rb | 6 | ||||
-rw-r--r-- | lib/puppet/provider/mysql_user/mysql.rb | 4 | ||||
-rw-r--r-- | lib/puppet/type/mysql_database.rb | 3 | ||||
-rw-r--r-- | lib/puppet/type/mysql_user.rb | 3 |
6 files changed, 19 insertions, 10 deletions
diff --git a/lib/facter/mysql.rb b/lib/facter/mysql.rb deleted file mode 100644 index e262ec1..0000000 --- a/lib/facter/mysql.rb +++ /dev/null @@ -1,8 +0,0 @@ -Facter.add("mysql_exists") do - ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" - - setcode do - mysqlexists = system "which mysql > /dev/null 2>&1" - ($?.exitstatus == 0) - end -end diff --git a/lib/facter/mysql_exists.rb b/lib/facter/mysql_exists.rb new file mode 100644 index 0000000..d08dabe --- /dev/null +++ b/lib/facter/mysql_exists.rb @@ -0,0 +1,5 @@ +Facter.add("mysql_exists") do + setcode do + File.exist? '/usr/bin/mysql' + end +end diff --git a/lib/facter/mysql_version.rb b/lib/facter/mysql_version.rb new file mode 100644 index 0000000..ba3dc36 --- /dev/null +++ b/lib/facter/mysql_version.rb @@ -0,0 +1,6 @@ +Facter.add("mysql_version") do + confine :mysql_exists => true + setcode do + Facter::Util::Resolution.exec('mysql --version').chomp.split(' ')[4].split(',').first + end +end diff --git a/lib/puppet/provider/mysql_user/mysql.rb b/lib/puppet/provider/mysql_user/mysql.rb index e04d7e6..3051681 100644 --- a/lib/puppet/provider/mysql_user/mysql.rb +++ b/lib/puppet/provider/mysql_user/mysql.rb @@ -1,8 +1,8 @@ require 'puppet/provider/package' Puppet::Type.type(:mysql_user).provide(:mysql, - # T'is funny business, this code is quite generic - :parent => Puppet::Provider::Package) do + # T'is funny business, this code is quite generic + :parent => Puppet::Provider::Package) do desc "Use mysql as database." commands :mysql => '/usr/bin/mysql' diff --git a/lib/puppet/type/mysql_database.rb b/lib/puppet/type/mysql_database.rb index b01bb83..0ba929f 100644 --- a/lib/puppet/type/mysql_database.rb +++ b/lib/puppet/type/mysql_database.rb @@ -1,7 +1,10 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_database) do @doc = "Manage a database." + ensurable + autorequire(:service) { 'mysql' } + newparam(:name) do desc "The name of the database." diff --git a/lib/puppet/type/mysql_user.rb b/lib/puppet/type/mysql_user.rb index 55d97b6..0b7e9af 100644 --- a/lib/puppet/type/mysql_user.rb +++ b/lib/puppet/type/mysql_user.rb @@ -1,7 +1,10 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_user) do @doc = "Manage a database user." + ensurable + autorequire(:service) { 'mysqld' } + newparam(:name) do desc "The name of the user. This uses the 'username@hostname' form." |