Method: Puppet::Modulebuilder::Builder#validate_path_encoding!

Defined in:
lib/puppet/modulebuilder/builder.rb

#validate_path_encoding!(path) ⇒ nil

Checks if the path contains any non-ASCII characters.

Java will throw an error when it encounters a path containing characters that are not supported by the hosts locale. In order to maximise compatibility we limit the paths to contain only ASCII characters, which should be part of any locale character set.

Parameters:

  • path (String)

    the relative path to be added to the tar file.

Returns:

  • (nil)

Raises:

  • (ArgumentError)

    if the path contains non-ASCII characters.



198
199
200
201
202
203
# File 'lib/puppet/modulebuilder/builder.rb', line 198

def validate_path_encoding!(path)
  return unless /[^\x00-\x7F]/.match?(path)

  raise ArgumentError, format("'%<path>s' can only include ASCII characters in its path or " \
                              'filename in order to be compatible with a wide range of hosts.', path: path)
end