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

When typing a function return as say Integer[500,1000] is not range is not respected. #9541

Open
traylenator opened this issue Jan 27, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@traylenator
Copy link
Contributor

Describe the Bug

Typing of function return as say Integer[500,1000] is not respected. It seems you can return any Integer quite happily.

Expected Behavior

A function signature with a return value in a range should work

function myfunc() >> Integer[5000,80000] {
    return 300
}

This function should always fail however it always returns 300.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a puppet manifest test.pp.
function myfunc() >> Integer[5000,80000] {
    return 300
}

$a = myfunc()
notify{"a is ${a}":}
  1. Run puppet apply file.pp.

This results in:

env PUPPET_VERSION="~>8" bundle exec puppet --version
8.10.0

env PUPPET_VERSION="~>8" bundle exec puppet apply /tmp/test.pp
Notice: Compiled catalog for node.example.org in environment production in 0.01 seconds
Notice: a is 300
Notice: /Stage[main]/Main/Notify[a is 300]/message: defined 'message' as 'a is 300'
Notice: Applied catalog in 0.01 seconds

Environment

  • Version 8.10.0
  • Platform ruby 3.2 rbenv install on RHEL9.

Additional Context

Returning a string does fail since not an integer.

@traylenator traylenator added the bug Something isn't working label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant