Skip to content

(MODULES-2767) allow to check if table exists before grant #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2015
Merged

(MODULES-2767) allow to check if table exists before grant #776

merged 2 commits into from
Nov 9, 2015

Conversation

agadelshin
Copy link
Contributor

No description provided.

end
else
raise(Puppet::ParseError, 'mysql_table_exists() accept 1 argument - table string like \'database_name.table_name\'')
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should revert this whole thing for early returns:

return raise(Puppet::ParseError, "mysql_table_exists() accept 1 argument - table string like 'database_name.table_name'") unless match = args[0].match(/(.*)\.(.*)/)
db_name, table_name = match.captures
return true if (db_name.eql?('*') or table_name.eql?('*')) # this is actually not true
query = "SELECT TABLE_NAME FROM information_schema, tables WHERE TABLE_NAME etc.."
%x{mysql etc..}

@agadelshin
Copy link
Contributor Author

@igalic thank you for pointing this out! Fixed

igalic added a commit that referenced this pull request Nov 9, 2015
(MODULES-2767) allow to check if table exists before grant
@igalic igalic merged commit 63e0768 into puppetlabs:master Nov 9, 2015
@igalic
Copy link
Contributor

igalic commented Nov 9, 2015

thank you @pondohva!

@agadelshin agadelshin deleted the mysql_table_exists branch November 9, 2015 12:29
@agadelshin
Copy link
Contributor Author

thank you, @igalic . Now we have problem with rspec test - https://travis-ci.org/puppetlabs/puppetlabs-mysql/builds/90054252 (it's my fault, sorry), and I've forgotten check for args.size in function body.
I'll create PR to fix this ASAP :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants