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

WIP: database_user and database refactoring #248

Merged
merged 7 commits into from
Sep 6, 2013
Merged

WIP: database_user and database refactoring #248

merged 7 commits into from
Sep 6, 2013

Conversation

apenney
Copy link
Contributor

@apenney apenney commented Aug 18, 2013

WIP WIP WIP DON'T MERGE:

This PR refactors the providers to rename them from database_X to mysql_X and attempts to bring in several improvements, from better instances to prefetch support.

@@ -9,6 +9,8 @@ group :development, :test do
gem 'rspec-system-serverspec', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'pry', :require => false
Copy link
Contributor

Choose a reason for hiding this comment

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

No.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually it's in the development section... why not.

@hunner
Copy link
Contributor

hunner commented Aug 27, 2013

Could we do one PR for the renaming, and other PRs for the feature-adds? Just so the history is a little more clear.

@apenney
Copy link
Contributor Author

apenney commented Aug 27, 2013

I could try and seperate them out but it would be tricky at this point. Not impossible, I'm just terrible at git so I have to look it up.

@blkperl
Copy link
Contributor

blkperl commented Aug 28, 2013

Is there a reason for the rename? Its going to break a lot of modules..

@apenney
Copy link
Contributor Author

apenney commented Aug 28, 2013

It is going to break other modules but I think that's something we're going to just accept and move past. They were overly broad as it stands and absolutely unsuited to be generic types/providers. The long term plan is that we'll have mysql__, postgres__ types (and possibly others, sqlite, mongo etc) and then a new generic set of database_* types that call out to the other types for generic behavior that we can generalize across database providers.

These were badly named from the start and I'd rather just bite the bullet on the pain of remaining them. I mean database_user{} is completely defined in terms of what mysql can do and any attempt to make them generic would remove half the features we support in the mysql types.

Hopefully this longwinded ramble made sense. We can always try and improve the deprecation warnings to actually try and call the new names where possible, I just thought that was more risky than informing users. For the most part it's going to be a s/database/mysql_database/g for users so fixing modules won't take long.

@blkperl
Copy link
Contributor

blkperl commented Aug 28, 2013

Wouldn't it be better to leave the old ones and add deprecation warnings. The new ones and old ones can live side by side for a while unless I'm mistaken?

This is a fairly popular module and people are slow to upgrade.

@apenney
Copy link
Contributor Author

apenney commented Aug 28, 2013

That could be done but the general idea is we bump the major version and if people don't want to deal with breaking changes they continue using a bugfix branch of the older version. I dunno, we haven't clearly defined exactly what our backwards compatibility is. I'm pretty OK with the idea of just keeping the old ones and providing an additional warning to each for a major version or so but I'm not OK with the idea of constantly trying to deal with never changing backwards functionality between major versions.

I think I tend to be less conservative and more "Well, if you jump a major version fix your stuff", otherwise we stagnant.

@blkperl
Copy link
Contributor

blkperl commented Aug 28, 2013

The problem is when you have two external modules that depend on different versions of the mysql module.

@apenney
Copy link
Contributor Author

apenney commented Aug 28, 2013

Whyyyyyyy

Ashley Penney added 6 commits August 28, 2013 18:11
Add collate as a new managable parameter, and extend self.instances to
add in all parameters when checking existing databases.  It also adds
self.prefetch in order to speed up Puppet runs.

Provider is also switched to using mk_resource_methods to generate
all the resource readers, and exists? and other methods now use the
property_hash where appropriate.

Tests rewritten to handle changes and extend code coverage.
This work adds max_connections_per_hour, max_queries_per_hour, and
max_updates_per_hour support to the provider and extends self.instances to add
in the new parameters when checking existing users.  It also adds
self.prefetch in order to speed up Puppet runs.

Provider is also switched to using mk_resource_methods to generate
all the resource readers, and exists? and other methods now use the
property_hash where appropriate.

Tests rewritten to handle changes and extend code coverage.
Modify manifests and tests to handle the renamed providers.
@apenney
Copy link
Contributor Author

apenney commented Aug 28, 2013

OK, original types back with deprecation warnings.

@@ -6,6 +6,10 @@

newparam(:name, :namevar=>true) do
desc 'The name of the database.'
validate do |value|
Puppet.warning("database has been deprecated in favor of mysql_database.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats the difference between Puppet.warning and Puppet.deprecation_warning ? Should you be using the latter?

Copy link
Contributor

Choose a reason for hiding this comment

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

Aha, Puppet.warning doesn't attempt to give an incorrect line number :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would pretend that was intentional but I hadn't come across .deprecation_warning, so I had no idea it even existed.

This provider has undergone the largest set of changes and currently
just accepts a full SQL grant string as the name and then applies it,
making things easier for DBAs and removes the awkward attempts at
modelling grants into Puppet.
apenney pushed a commit that referenced this pull request Sep 6, 2013
WIP: database_user and database refactoring
@apenney apenney merged commit 52fb70e into puppetlabs:master Sep 6, 2013
@apenney apenney deleted the providers2 branch February 26, 2014 15:50
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.

4 participants