Skip to content

Add Data Types and remove deprecated parameters#406

Merged
bastelfreak merged 4 commits intovoxpupuli:masterfrom
wyardley:data_types
Oct 21, 2017
Merged

Add Data Types and remove deprecated parameters#406
bastelfreak merged 4 commits intovoxpupuli:masterfrom
wyardley:data_types

Conversation

@wyardley
Copy link
Copy Markdown
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
@wyardley wyardley added the backwards-incompatible This change will lead to a major version bump for the next release label Oct 20, 2017
@wyardley wyardley requested a review from bastelfreak October 21, 2017 00:34
Comment thread manifests/client.pp
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Boolean?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread manifests/client.pp
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
Copy Markdown
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?

Comment thread manifests/client.pp
anchor { '::mongodb::client::start': }
-> class { '::mongodb::client::install': }
-> anchor { '::mongodb::client::end': }
anchor { 'mongodb::client::start': }
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread manifests/server/config.pp Outdated
}
if $keyfile and $key {
validate_string($key)
validate_re($key,'.{6}')
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread README.md Outdated
class {'::mongodb::client': } ->
class {'::mongodb::server': }
class {'mongodb::client': } ->
class {'mongodb::server': }
Copy link
Copy Markdown
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?

Comment thread README.md Outdated
class {'::mongodb::server': }->
class {'::mongodb::client': }
class {'mongodb::server': }->
class {'mongodb::client': }
Copy link
Copy Markdown
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?

Comment thread README.md Outdated
class {'::mongodb::server': }->
class {'::mongodb::client': }
class {'mongodb::server': }->
class {'mongodb::client': }
Copy link
Copy Markdown
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

Comment thread manifests/mongos.pp
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread manifests/server.pp Outdated
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
Copy Markdown
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

Labels

backwards-incompatible This change will lead to a major version bump for the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants