module Hiera::Util

Public Instance Methods

common_appdata() click to toggle source
# File lib/hiera/util.rb, line 42
def common_appdata
  Dir::COMMON_APPDATA
end
config_dir() click to toggle source
# File lib/hiera/util.rb, line 22
def config_dir
  if microsoft_windows?
     File.join(common_appdata, 'PuppetLabs', 'hiera', 'etc')
  else
    '/etc'
  end
end
file_alt_separator() click to toggle source
# File lib/hiera/util.rb, line 38
def file_alt_separator
  File::ALT_SEPARATOR
end
microsoft_windows?() click to toggle source
# File lib/hiera/util.rb, line 10
def microsoft_windows?
  return false unless file_alt_separator
  
  begin
    require 'win32/dir'
    true
  rescue LoadError => err
    warn "Cannot run on Microsoft Windows without the win32-dir gem: #{err}"
    false
  end
end
posix?() click to toggle source
# File lib/hiera/util.rb, line 5
def posix?
  require 'etc'
  Etc.getpwuid(0) != nil
end
var_dir() click to toggle source
# File lib/hiera/util.rb, line 30
def var_dir
  if microsoft_windows?
    File.join(common_appdata, 'PuppetLabs', 'hiera', 'var')
  else
    '/var/lib/hiera'
  end
end