Skip to content
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

Replaced 'DROP USER' with 'DROP USER IF EXISTS' #942

Merged
merged 1 commit into from
May 21, 2018

Conversation

xelmido
Copy link

@xelmido xelmido commented Mar 31, 2017

No description provided.

@tphoney
Copy link
Contributor

tphoney commented Jul 3, 2017

@libertamohamed this looks like a sensible change, however could you look at the failing tests that this new functionality has introduced.

@xelmido
Copy link
Author

xelmido commented Jul 4, 2017

@tphoney the test is failing because of the MySQL version. It's running on 5.5.

https://dev.mysql.com/doc/refman/5.7/en/drop-user.html

@tphoney
Copy link
Contributor

tphoney commented Jul 4, 2017

@libertamohamed can you pin the tests around this version ?

@igalic
Copy link
Contributor

igalic commented Jul 4, 2017

shouldn't we add version checking, rather than pinning??

@xelmido
Copy link
Author

xelmido commented Jul 6, 2017

@tphoney i am little confused by meaning "pin the tests around this version".

So what @igalic ment, sounds better? Check for mysqld_version >= 5.7?

@tphoney
Copy link
Contributor

tphoney commented Jul 6, 2017

even though english is my first language. my usage resembles this http://vignette2.wikia.nocookie.net/familyguy/images/e/e4/Wacky_Waving_Inflatable_Arm_Flailing_Tube_Man.gif/revision/latest?cb=20120930090058

apologies for that.

@igalic is correct.

@igalic
Copy link
Contributor

igalic commented Jul 6, 2017

mysql has internal version checking, or you can just use our mysqld_version fact, @libertamohamed !

@david22swan
Copy link
Member

@libertamohamed Is there any movement on this PR?

@david22swan
Copy link
Member

@libertamohamed I apologize but due to the lack of movement on this PR and your lack of response when prompted I feel that we must know close this PR. I apologize if this is inconvenient for you and if in the future you wish to reopen it then we will be more than happy to once again review it.
Best Wishes

@david22swan david22swan closed this Mar 5, 2018
@xelmido
Copy link
Author

xelmido commented Mar 5, 2018

@david22swan

Sorry for my lack of response. I was on a sabbatical and didn't hand over this PR to one of my colleagues. Just created a to-do in our team for this. Will start a new PR if it's ready.

@david22swan
Copy link
Member

@libertamohamed I apologize for jumping the gun then. I can reopen this PR now if you want?

@xelmido
Copy link
Author

xelmido commented Mar 5, 2018

@david22swan, sure if you can re- open it will be great. It's a small fix, but need to make time for it. More pressure is good, haha!

@david22swan
Copy link
Member

@libertamohamed Here you go, once again sorry for jumping the gun on closing it.

@david22swan david22swan reopened this Mar 5, 2018
@@ -96,7 +96,9 @@ def create

def destroy
merged_name = @resource[:name].sub('@', "'@'")
self.class.mysql_caller("DROP USER '#{merged_name}'", 'system')
if_exists = mysqld_version >= '5.7' ? 'IF EXISTS' : ''
Copy link
Contributor

Choose a reason for hiding this comment

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

please use Puppet::Util::Package.versioncmp() for comparing version numbers. see L17 for an example usage.

provider.class.expects(:mysql_caller).with("DROP USER 'joe'@'localhost'", 'system')
if_exists = mysqld_version >= '5.7' ? 'IF EXISTS' : ''

provider.class.expects(:mysql_caller).with("DROP USER #{if_exists} 'joe'@'localhost'", 'system')
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll still want to test the original query, so adding another test case would be most helpful here. there is also a pattern near the top of this file for setting the version number in the class.
e.g.

it 'removes a user using IF EXISTS' do
  {set version to 5.7.1 or something}
  provider.class.expects(:mysql_caller).with("DROP USER IF EXISTS 'joe'@'localhost'", 'system')
   ...
end

@igalic
Copy link
Contributor

igalic commented Mar 30, 2018

could it be that this whole thing is in really bad need of a rebase?

@xelmido
Copy link
Author

xelmido commented Mar 30, 2018

I did a rebase before commiting. Made some changes based on the review of @eputnam. Tests are passing. Just waiting to be accepted.

@hunner
Copy link
Contributor

hunner commented Apr 4, 2018

@libertamohamed It has 216 commits currently from many different authors. An easy way to tell if a rebase worked is if the PR only has a few commits (or even only one commit) and all from you.

The diff also shows ~5,000 lines being changed in 87 files, so checking that is another way to check if the changes being made by the PR are the ones you expected.

@xelmido
Copy link
Author

xelmido commented May 18, 2018

@hunner,

Sorry for the late response. I did a new rebase now. Could you check it?

@eputnam eputnam merged commit 82f7f55 into puppetlabs:master May 21, 2018
@@ -96,7 +96,9 @@ def create

def destroy
merged_name = @resource[:name].sub('@', "'@'")
self.class.mysql_caller("DROP USER '#{merged_name}'", 'system')
if_exists = (Puppet::Util::Package.versioncmp(mysqld_version, '5.7') >= 0) ? 'IF EXISTS ' : ''
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

6 participants