Mercurial > repos > other > Puppet
annotate modules/stdlib/lib/puppet/parser/functions/unix2dos.rb @ 272:c42fb28cff86
Update to a newer Python module
This also pulls in an EPEL module (which we don't use) and a newer
stdlib version.
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 03 Jan 2020 19:56:04 +0000 |
parents | |
children | d9352a684e62 |
rev | line source |
---|---|
272 | 1 # Custom Puppet function to convert unix to dos format |
2 module Puppet::Parser::Functions | |
3 newfunction(:unix2dos, :type => :rvalue, :arity => 1, :doc => <<-DOC | |
4 Returns the DOS version of the given string. | |
5 Takes a single string argument. | |
6 DOC | |
7 ) do |arguments| | |
8 | |
9 unless arguments[0].is_a?(String) | |
10 raise(Puppet::ParseError, 'unix2dos(): Requires string as argument') | |
11 end | |
12 | |
13 arguments[0].gsub(%r{\r*\n}, "\r\n") | |
14 end | |
15 end |