Merge pull request #869 from HelenCampbell/passwordFix

(MODULES-3401) Fix for mysql version retrieval
This commit is contained in:
David Schmitt 2016-07-22 15:07:46 +01:00 committed by GitHub
commit 8482efcd2a
2 changed files with 2 additions and 9 deletions

View file

@ -31,10 +31,8 @@ class Puppet::Provider::Mysql < Puppet::Provider
end
def self.mysqld_version_string
# we cache the result ...
return @mysqld_version_string unless @mysqld_version_string.nil?
@mysqld_version_string = Facter.value(:mysqld_version)
return @mysqld_version_string
# As the possibility of the mysqld being remote we need to allow the version string to be overridden, this can be done by facter.value as seen below. In the case that it has not been set and the facter value is nil we use the mysql -v command to ensure we report the correct version of mysql for later use cases.
@mysqld_version_string ||= Facter.value(:mysqld_version) || mysqld('-V')
end
def mysqld_version_string

View file

@ -205,11 +205,6 @@ usvn_user@localhost
Facter.stubs(:value).with(:mysqld_version).returns('5.6.24')
expect(provider.mysqld_version).to eq '5.6.24'
end
it 'returns nil if the mysqld_version fact is absent' do
provider.class.instance_variable_set(:@mysqld_version_string, nil)
Facter.stubs(:value).with(:mysqld_version).returns(nil)
expect(provider.mysqld_version).to eq nil
end
it 'returns 5.7.6 for "mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))"' do
provider.class.instance_variable_set(:@mysqld_version_string, 'mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))')
expect(provider.mysqld_version).to eq '5.7.6'