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

Add Data Types and remove deprecated parameters #406

Merged
merged 4 commits into from
Oct 21, 2017
Merged

Add Data Types and remove deprecated parameters #406

merged 4 commits into from
Oct 21, 2017

Conversation

wyardley
Copy link
Contributor

@wyardley wyardley commented Oct 20, 2017

First pass, may need to make some adjustments still.

  • Gets rid of all validate_* calls
  • Adds data types to most publicly accessible class params
  • Adds some basic class inclusion spec tests where they didn't exist before at @bastelfreak's suggestion.

For now, storage_engine is a string rather than enum, not sure if there's a small enough set of names to make this worth forcing.

@wyardley wyardley added this to the 2.0.0 milestone Oct 20, 2017
@wyardley wyardley mentioned this pull request Oct 20, 2017
8 tasks
@wyardley wyardley changed the title Add Data Types to most class parameters Add Data Types and remove deprecated parameters Oct 20, 2017
@@ -9,10 +9,10 @@
# is repository dependent.
#
class mongodb::client (
$ensure = $mongodb::params::package_ensure_client,
$package_name = $mongodb::params::client_package_name,
Variant[Boolean, String] $ensure = $mongodb::params::package_ensure_client,
Copy link
Member

Choose a reason for hiding this comment

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

Boolean?

Copy link
Member

Choose a reason for hiding this comment

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

Some use false. Do we have any convention in voxpupuli?

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 based this on params - package_ensure_client has both $version and true. This module uses some weird patterns. I think we may want to try and fix some of the weird design decisions (though some of them would require major structural work), but for this pass, I'm just trying to keep things working.

Copy link
Member

Choose a reason for hiding this comment

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

Boolean looks really wrong here. But as a first step we should keep the current behavior to make a migration to datatypes easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's where it's used https://github.com/voxpupuli/puppet-mongodb/blob/master/manifests/params.pp#L45-L61
I think this is also causing some quirks when installing versions, because of vendor release tags etc.

@@ -9,10 +9,10 @@
# is repository dependent.
#
class mongodb::client (
$ensure = $mongodb::params::package_ensure_client,
$package_name = $mongodb::params::client_package_name,
Variant[Boolean, String] $ensure = $mongodb::params::package_ensure_client,
Copy link
Member

Choose a reason for hiding this comment

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

Some use false. Do we have any convention in voxpupuli?

anchor { '::mongodb::client::start': }
-> class { '::mongodb::client::install': }
-> anchor { '::mongodb::client::end': }
anchor { 'mongodb::client::start': }
Copy link
Member

Choose a reason for hiding this comment

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

Maybe replace the anchor as well with a contain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I want to do the structural changes in another PR (if you want to start working on one, that would be great). But might be good to get the acceptance tests in a better place first? Right now they're a total disaster, maybe worse than when we started.

@@ -89,7 +85,6 @@
$noauth = true
}
if $keyfile and $key {
validate_string($key)
validate_re($key,'.{6}')
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean it should be String[6] or String[6, 6]?

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 think the key is longer than 6 characters, so maybe 6,? I didn't know you could specify the length of the string that way, but that makes sense, can work on replacing this one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think String[6] will do it. Updated.

README.md Outdated
class {'::mongodb::client': } ->
class {'::mongodb::server': }
class {'mongodb::client': } ->
class {'mongodb::server': }
Copy link
Member

Choose a reason for hiding this comment

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

can you move the arrow to the next line?

README.md Outdated
class {'::mongodb::server': }->
class {'::mongodb::client': }
class {'mongodb::server': }->
class {'mongodb::client': }
Copy link
Member

Choose a reason for hiding this comment

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

can you move the arrow to the next line?

README.md Outdated
class {'::mongodb::server': }->
class {'::mongodb::client': }
class {'mongodb::server': }->
class {'mongodb::client': }
Copy link
Member

Choose a reason for hiding this comment

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

please move the arrow

String $package_name = $mongodb::params::mongos_package_name,
Optional[Stdlib::Absolutepath] $unixsocketprefix = $mongodb::params::mongos_unixsocketprefix,
Optional[Stdlib::Absolutepath] $pidfilepath = $mongodb::params::mongos_pidfilepath,
Optional[Variant[Boolean, Stdlib::Absolutepath]] $logpath = $mongodb::params::mongos_logpath,
Copy link
Member

Choose a reason for hiding this comment

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

Having a boolean here looks interesting

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 think it's needed because there are cases where there are defaults in certain cases (from params), but users need to be able to suppress them? So in that case, passing undef will get the default, but false will work to suppress it. This is a quirk of Puppet that I don't particularly like, but other than adding an additional boolean parameter, I don't know if there's an easy fix.

Copy link
Member

Choose a reason for hiding this comment

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

One option is Variant[Enum[''], Stdlib::Absolutepath] (or 'unmanaged'). These are times I miss the explicit null rather than undef.

Optional[String] $admin_password = undef,
Boolean $handle_creds = $mongodb::params::handle_creds,
Boolean $store_creds = $mongodb::params::store_creds,
Array $admin_roles = ['userAdmin', 'readWrite', 'dbAdmin',
Copy link
Member

Choose a reason for hiding this comment

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

this is really long. should we move the data to params.pp?

@bastelfreak bastelfreak merged commit 23068c1 into voxpupuli:master Oct 21, 2017
apevec pushed a commit to redhat-openstack/rdoinfo that referenced this pull request Oct 23, 2017
voxpupuli/puppet-mongodb#406 has implemented
some backwards incompatible changes in data types. As we are in the
process of removing mongodb in RDO during queens cycle, i think there
is no point in fixing tripleo related manifest and we can pin it
to the last commit before the breaking change.

Change-Id: I115ce0daffbe99adb639f27e3a0eb93a43e4ab18
@wyardley wyardley deleted the data_types branch November 8, 2017 23:18
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