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

Migrate to puppet4 datatypes #1621

Merged
merged 23 commits into from
Jul 14, 2017
Merged

Migrate to puppet4 datatypes #1621

merged 23 commits into from
Jul 14, 2017

Conversation

bastelfreak
Copy link
Collaborator

goal of this is to get rid of all the legacy valida_* function calls, and not to provide perfect datatypes for all parameters.

@bastelfreak bastelfreak changed the title Introduce Puppet 4 datatypes [WIP]Introduce Puppet 4 datatypes May 11, 2017
@bastelfreak bastelfreak force-pushed the puppet4 branch 6 times, most recently from 4484ca0 to e1c657f Compare May 11, 2017 23:44
$default_type = 'none',
$dev_packages = $::apache::params::dev_packages,
$ip = undef,
Boolean$service_enable = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing space

$verify_server_cert = true,
$verifyServerCert = undef,
$package_name = undef,
Boolean$verify_server_cert = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing space

@@ -1,10 +1,8 @@
class apache::mod::dumpio(
$dump_io_input = 'Off',
$dump_io_output = 'Off',
Enum['Off', 'On'] $dump_io_input = 'Off',
Copy link
Contributor

Choose a reason for hiding this comment

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

Lowercase versions are also allowed

::apache::mod { 'ldap':
package => $package_name,
package => $package_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

??

$passenger_max_instances_per_app = undef,
$passenger_use_global_queue = undef,
$passenger_app_env = undef,
Optional[Stdlib::AbsolutAbsoluteppath] $passenger_log_file = undef,
Copy link
Contributor

Choose a reason for hiding this comment

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

Type typo?

) inherits apache::params {
include ::apache
$mod = "php${php_version}"
$mod = "php${php_version}"
Copy link
Contributor

Choose a reason for hiding this comment

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

??

$apache_version = undef,
$status_path = '/server-status',
Array $allow_from = ['127.0.0.1','::1'],
Enum['On', 'Off'] $extended_status = 'On',
Copy link
Contributor

Choose a reason for hiding this comment

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

Lowercase is currently allowed too

case $service_ensure {
true, false, 'running', 'stopped': {
$_service_ensure = $service_ensure
$_service_ensure = $service_ensure
Copy link
Contributor

Choose a reason for hiding this comment

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

??

}
default: {
$_service_ensure = undef
$_service_ensure = undef
Copy link
Contributor

Choose a reason for hiding this comment

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

??

$modsec_audit_log_file = undef,
$modsec_audit_log_pipe = undef,
$error_documents = [],
Variant[Stdlib::Absolutepath, Enum['disabled']] $fallbackresource = undef,
Copy link
Contributor

Choose a reason for hiding this comment

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

Also 'Optional'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@@ -107,10 +99,6 @@
validate_re($mpm_module, $valid_mpms_re)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would assert_type(Pattern[$valid_mpms_re], $mpm_module) be better here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, updated

$passenger_max_instances_per_app = undef,
$passenger_use_global_queue = undef,
$passenger_app_env = undef,
Optional[Stdlib::Absoluteppath] $passenger_log_file = undef,
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo in ppath

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

metadata.json Outdated
{"name":"puppetlabs/stdlib","version_requirement":">= 4.2.0 < 5.0.0"},
{"name":"puppetlabs/concat","version_requirement":">= 1.1.1 < 3.0.0"}
{"name":"puppetlabs/stdlib","version_requirement":">= 4.13.1 < 5.0.0"},
{"name":"puppetlabs/concat","version_requirement":">= 2.2.1 < 3.0.0"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work with version 4.0.0 as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

stdlib 4.0? No. 4.13.1 was the first useable version with the pupept4 types uses here

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant concat. It's now pinned to < 3.0.0 but I think it can be < 5.0.0 so it can use Puppet 4 types there as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah right. the apache module + concat4 works fine on my environment. But I'm not sure if bumping it should be part of this PR.

@bastelfreak bastelfreak force-pushed the puppet4 branch 5 times, most recently from f4f30d7 to b0ef81e Compare May 21, 2017 10:56
@bastelfreak bastelfreak changed the title [WIP]Introduce Puppet 4 datatypes Migrate to puppet4 datatypes May 21, 2017

if $allow_encoded_slashes {
validate_re($allow_encoded_slashes, '(^on$|^off$|^nodecode$)', "${allow_encoded_slashes} is not permitted for allow_encoded_slashes. Allowed values are 'on', 'off' or 'nodecode'.")
assert_type(Pattern[$valid_mpms_re], $mpm_module)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this could be rewritten to an Enum. That's most likely an easier to read error.

$apache_version = undef,
$package_name = undef,
$ldap_trusted_global_cert_file = undef,
Optional[String] $ldap_trusted_global_cert_type = 'CA_BASE64',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given there's a default value, does the Optional part even make sense?


validate_array($ssl_proxy_protocol)
validate_string($ssl_sessioncache)

if is_bool($ssl_honorcipherorder) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this can be one big switch statement that includes true and false because I believe is_bool also emits a deprecation warning.

) {

# The base class must be included first because parameter defaults depend on it
if ! defined(Class['apache::params']) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can be removed if you use the String[1] type for $service_name.

@bastelfreak bastelfreak force-pushed the puppet4 branch 2 times, most recently from 5b19458 to b285987 Compare July 12, 2017 16:14
@eputnam eputnam merged commit 500ccf9 into puppetlabs:master Jul 14, 2017
@bastelfreak bastelfreak deleted the puppet4 branch July 15, 2017 07:30
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.

5 participants