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

Use Puppet v4's data types #682

Closed
ghoneycutt opened this issue Jun 26, 2017 · 4 comments
Closed

Use Puppet v4's data types #682

ghoneycutt opened this issue Jun 26, 2017 · 4 comments
Assignees

Comments

@ghoneycutt
Copy link
Collaborator

This will get rid of the deprecation notices and allow us to use the improvement in Puppet v4.

https://docs.puppet.com/puppet/4.10/lang_data_type.html

@alvagante
Copy link
Collaborator

I can tackle this one.
Wondering if, besides using Puppet 4 data types for parameters validation, you want to use also Puppet 4.9 (4.10) data in module.
This would make the module backwards incompatible with Puppet < 4.9 , which is probably not wanted.

@ghoneycutt
Copy link
Collaborator Author

We want to maintain support for 4.9. Check out the platform list in .travis.yml.

alvagante added a commit to alvagante/sensu-puppet that referenced this issue Jul 17, 2017
Converted init.pp

Converted contact.pp

Converted extension.pp

Converted filter.pp

Converted handler.pp

Converted plugin.pp

Converted plugins_dir.pp

Converted subscription.pp

Converted plugins_dir.pp

Converted subscription.pp

Converted check.pp

Added other minor classes

Added missed conversions

Chasing spec tests: client_port and windows

Fix for:
     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Resource Statement, Class[Sensu]:
         parameter 'client_port' expects an Integer value, got String
         parameter 'windows_log_number' expects an Integer value, got String at line 1:1 on node testing-docker-ac071449-363b-497c-8ac8-216c94bab189.ec2.internal

Chasing specs: An approach to Integers as strings

Chasing specs: More allowed integers as strings

Quick approach to unmatching error messages

Chasing specs one after one

Chasing specs, almost there

Readded check on command precence on sensu::check

Test old messages. Spec failures expected.

Added stardard Puppet::PreformattedError messages

With the current test structure it's not possible to add test messages
for all the combinations. Check for errors in
https://travis-ci.org/sensu/sensu-puppet/jobs/254349761

  26) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid {"ha"=>"sh"} (as Hash) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...'], got Struct at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

  27) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid 3 (as Fixnum) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...], got Integer at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

  28) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid 2.42 (as Float) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...n'], got Float at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

and so on. For each sample entry a different massage, according to its
data type.

Soe cosmetic alignments

Lint

Fixed regexps broken by mass f/r

Remove another rogue space
alvagante added a commit to alvagante/sensu-puppet that referenced this issue Jul 17, 2017
Converted init.pp

Converted contact.pp

Converted extension.pp

Converted filter.pp

Converted handler.pp

Converted plugin.pp

Converted plugins_dir.pp

Converted subscription.pp

Converted plugins_dir.pp

Converted subscription.pp

Converted check.pp

Added other minor classes

Added missed conversions

Chasing spec tests: client_port and windows

Fix for:
     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Resource Statement, Class[Sensu]:
         parameter 'client_port' expects an Integer value, got String
         parameter 'windows_log_number' expects an Integer value, got String at line 1:1 on node testing-docker-ac071449-363b-497c-8ac8-216c94bab189.ec2.internal

Chasing specs: An approach to Integers as strings

Chasing specs: More allowed integers as strings

Quick approach to unmatching error messages

Chasing specs one after one

Chasing specs, almost there

Readded check on command precence on sensu::check

Test old messages. Spec failures expected.

Added stardard Puppet::PreformattedError messages

With the current test structure it's not possible to add test messages
for all the combinations. Check for errors in
https://travis-ci.org/sensu/sensu-puppet/jobs/254349761

  26) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid {"ha"=>"sh"} (as Hash) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...'], got Struct at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

  27) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid 3 (as Fixnum) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...], got Integer at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

  28) sensu variable type and content validations when log_level (validate_re log_level) is set to invalid 2.42 (as Float) should fail
      Failure/Error: expect { should contain_class(subject) }.to raise_error(Puppet::PreformattedError, /#{var[:message]}/)

        expected Puppet::PreformattedError with message matching /validate_re()/, got #<Puppet::PreformattedError: Evaluation Error: Error while evaluating a Resource Statement, Class[Sen...n'], got Float at line 1:1 on node testing-docker-890e06b4-758a-456f-9b4c-71d753fe62dd.ec2.internal> with backtrace:

and so on. For each sample entry a different massage, according to its
data type.

Soe cosmetic alignments

Lint

Fixed regexps broken by mass f/r

Remove another rogue space

Fixed path validation
ghoneycutt added a commit to ghoneycutt/sensu-puppet that referenced this issue Jul 19, 2017
Without this patch, the following warning is issued.

Warning: This method is deprecated, please use match expressions with
Stdlib::Compat::Bool instead. They are described at
https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.
at
["/etc/puppetlabs/code/environments/production/modules/sensu/manifests/init.pp",
615]:
@ghoneycutt
Copy link
Collaborator Author

Testing against all vagrant instances and making additions in PR #761

ghoneycutt pushed a commit to ghoneycutt/sensu-puppet that referenced this issue Jul 19, 2017
ghoneycutt added a commit to ghoneycutt/sensu-puppet that referenced this issue Jul 19, 2017
Without this patch, the following warning is issued.

Warning: This method is deprecated, please use match expressions with
Stdlib::Compat::Bool instead. They are described at
https://docs.puppet.com/puppet/latest/reference/lang_data_type.html#match-expressions.
at
["/etc/puppetlabs/code/environments/production/modules/sensu/manifests/init.pp",
615]:
@ghoneycutt
Copy link
Collaborator Author

Released in v2.26.0

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

No branches or pull requests

4 participants