You can actually use `bool2num` function which is part of the puppet stdlib:

https://forge.puppetlabs.com/puppetlabs/stdlib