Commit 3dcf66b
committed
(PUP-4698) Change fqdn_rand's return type to Integer
Before this, fqdn_rand always returned a String. That is not the best
choice for a numeric value now that the evaluator is aware of different
data types as comparissons will typically be wrong (since '2' > '19'
when compared leicographically).
This fix adds a utility method that returns an integer version while the
old utility method producing a string is retained for those that use
Puppet as an API. The function now uses the integer version of this
utility method.
A test is added that asserts that an Integer is produced.
At some point it would be beneficial to reimplement the function using
the 4.x function API as it will simply raise a generic error if given
input of the wrong type. It will also magically change a floating point
input value to integer.1 parent 4de4750 commit 3dcf66b
File tree
3 files changed
+15
-6
lines changed- lib/puppet
- parser/functions
- spec/unit/parser/functions
3 files changed
+15
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
457 | 462 | | |
458 | | - | |
| 463 | + | |
459 | 464 | | |
460 | 465 | | |
461 | | - | |
| 466 | + | |
462 | 467 | | |
463 | 468 | | |
464 | 469 | | |
465 | 470 | | |
466 | | - | |
| 471 | + | |
467 | 472 | | |
468 | 473 | | |
469 | 474 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
0 commit comments