Skip to content

Commit

Permalink
ret2bool
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Apr 6, 2018
1 parent 5de4273 commit 2d44c7b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.1.15

* added **retcode2bool** function

## 0.1.14

* added **eypconf_projectid**
Expand Down
27 changes: 27 additions & 0 deletions lib/puppet/parser/functions/retcode2bool.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# shamesly stolen from: https://github.com/puppetlabs/puppetlabs-apache/blob/master/lib/puppet/parser/functions/bool2httpd.rb
# with minor changes
#
#
#Copyright (C) 2012 Puppet Labs Inc
#
#Puppet Labs can be contacted at: [email protected]
#
#Licensed under the Apache License, Version 2.0 (the "License");
#
#
Puppet::Parser::Functions::newfunction(:retcode2bool, :type => :rvalue, :doc => <<-EOS
Tranform a return code to a bool:
0: true
other return codes: false
EOS
) do |args|
raise(Puppet::ParseError, "retcode2bool() wrong number of arguments. #{args.size} vs 1)") if args.size != 1

arg = args[0]

if arg == 0
return true
else
return false
end
end
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-eyplib",
"version": "0.1.14",
"version": "0.1.15",
"author": "eyp",
"summary": "Utility functions for puppet modules",
"license": "Apache-2.0",
Expand Down

0 comments on commit 2d44c7b

Please sign in to comment.