[PUP-8491] Move essential functions from stdlib to puppet Created: 2018/02/26  Updated: 2018/12/06  Resolved: 2018/12/06

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Epic Priority: Normal
Reporter: Henrik Lindberg Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relates to BOLT-373 Update Puppet for new core functions Resolved
supports BOLT-333 Package task-modules content with bolt Resolved
Epic Name: stdlib to pup
QA Risk Assessment: Needs Assessment


The most essential functions in stdlib should be moved to puppet code base.

  • empty
  • keys
  • values
  • join
  • flatten
  • length (instead of deprecated 'size')

This is of particular value when running scripts.

Comment by R.I.Pienaar [ 2018/02/27 ]

I'd love to see these move too they seem like the most basic things one would want in a modern language

I think to_json and to_yaml would be great - perhaps with some changes so there's a optional flag to enable the pretty version of json. likewise loadjson and loadyaml (renamed for consistency I guess?)

The things like downcase, upcase, capitalize, lstrip, rstrip, strip, chop, chomp, reverse, camelcase and such basic string manipulation ones. Also min, max, round, flatten, sort, reject, keys, flatten, ceiling, abs and unique - these are unfortunately all v3 functions.

since we are managing machines dirname and basename

Comment by Michael Smith [ 2018/03/01 ]

I think string manipulation would make sense to be part of the String type. The math-related seem like potentially a library (following the pattern we'd like to use with types and providers, I think they'd make sense as a separate project that's included via packaging); same with filename manipulation like dirname and basename.

Comment by Henrik Lindberg [ 2018/03/01 ]

We have a ticket with proposed formats for all of the trim-this-that string operations. It is a bit less user friendly then the function names. Also not 100% backwards compatible. I otherwise have no objection against having modules with namespaced functions for String, Math etc. (for example math::min(), math::max()). The fuse of that is unfortunately a bit long... needs to make sure wanted namespaces are free, creation of the modules, and then packaging of them.

We could cheat and have them in namespaces but having them in puppet, would need to reserve namespsaces... (so not nice).

Yet another alternative is to add methods to the types - for example Numeric.max(x,y).

Comment by R.I.Pienaar [ 2018/03/01 ]

I personally like them in the types but its also quite a change and a long tail before people stop needing stdlib

stdlib is a tyre fire, moving these somewhere proper means a high % of people just wouldnt need to be exposed to stdlib mess, so the less code change required the most likely it is to go well

Comment by Michael Smith [ 2018/03/07 ]

Thanks! What's here is everything we initially planned for in Bolt.

Comment by Josh Cooper [ 2018/03/14 ]

Henrik Lindberg All of the commits for this epic landed in puppet#5.5.x. I assume this epic can be closed as soon as those tickets are resolved?

Comment by Henrik Lindberg [ 2018/03/15 ]

There are about 20 others that are reasonable to move and where I expect bolt users to eventually want them (see R.Is request). I planned to continue adding them in 5.5.z if that is ok – otherwise need a new epic and will continue with the rest for Puppet 6.0.0.

Comment by Henrik Lindberg [ 2018/05/26 ]

There are now 4 remaining tickets in status "Ready for CI" - when they have cleared this epic can be closed as done.

Comment by Henrik Lindberg [ 2018/12/06 ]

All done now. Closing.

Generated at Wed Apr 01 15:19:54 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.