Skip to content

Commit

Permalink
Merge pull request #2 from jordiprats/master
Browse files Browse the repository at this point in the history
metadades
  • Loading branch information
jordiprats committed May 26, 2016
2 parents 7e19fa4 + 483c803 commit b003691
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Transform a boolean (it can also be a string) to **On** or **Off**. Other values

Transform a boolean (it can also be a string) to **yes** or **no**. Other values through.

#### bool2httpd

Same as **bool2onoff**, transform a boolean (it can also be a string) to **On** or **Off**. Other values through.

## Development

We are pushing to have acceptance testing in place, so any new feature should
Expand Down
35 changes: 35 additions & 0 deletions lib/puppet/parser/functions/bool2httpd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#shamesly stolen from: https://github.com/puppetlabs/puppetlabs-apache/blob/master/lib/puppet/parser/functions/bool2httpd.rb
#
#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(:bool2httpd, :type => :rvalue, :doc => <<-EOS
Transform a supposed boolean to On or Off. Pass all other values through.
Given a nil value (undef), bool2httpd will return 'Off'
Example:
$trace_enable = false
$server_signature = 'mail'
bool2httpd($trace_enable)
# => 'Off'
bool2httpd($server_signature)
# => 'mail'
bool2httpd(undef)
# => 'Off'
EOS
) do |args|
raise(Puppet::ParseError, "bool2httpd() wrong number of arguments. Given: #{args.size} for 1)") if args.size != 1

arg = args[0]

if arg.nil? or arg == false or arg =~ /false/i or arg == :undef
return 'Off'
elsif arg == true or arg =~ /true/i
return 'On'
end

return arg.to_s
end
39 changes: 24 additions & 15 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
{
"name": "eyp-eyplib",
"version": "0.1.1",
"version": "0.1.3",
"author": "eyp",
"summary": "Utility functions for puppet modules",
"license": "Apache-2.0",
"source": "https://github.com/AtlasIT-AM/eyp-eyplib",
"source": "https://github.com/NTTCom-MS/eyp-eyplib",
"project_page": null,
"issues_url": "https://github.com/AtlasIT-AM/eyp-eyplib/issues",
"issues_url": "https://github.com/NTTCom-MS/eyp-eyplib/issues",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [ "5", "6", "7" ]
"operatingsystem": "RedHat"
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [ "5", "6", "7" ]
"operatingsystem": "CloudLinux"
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [ "5", "6", "7" ]
"operatingsystem": "Amazon"
},
{
"operatingsystem": "OEL",
"operatingsystemrelease": [ "5", "6", "7" ]
"operatingsystem": "Debian"
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [ "5", "6", "7" ]
"operatingsystem": "CentOS"
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "14.04" ]
"operatingsystem": "Scientific"
},
{
"operatingsystem": "OEL"
},
{
"operatingsystem": "Ubuntu"
},
{
"operatingsystem": "SLES"
},
{
"operatingsystem": "Solaris"
},
{
"operatingsystem": "Gentoo"
}
],
"requirements": [
Expand Down

0 comments on commit b003691

Please sign in to comment.