Class ChefConfig::Config
In: lib/chef-config/config.rb
Parent: Object

Methods

Constants

USER = Addressable::URI::CharacterClasses::UNRESERVED + Addressable::URI::CharacterClasses::SUB_DELIMS   Character classes for Addressable See www.ietf.org/rfc/rfc3986.txt 3.2.1 The user part may not have a : in it
PASSWORD = USER + "\\:"   The password part may have any valid USERINFO characters

Public Class methods

Path to this file in the current install.

If installed via an omnibus installer, this gives the path to the "embedded" directory which contains all of the software packaged with omnibus. This is used to locate the cacert.pem file on windows.

Set fips mode in openssl. Do any patching necessary to make sure Chef runs do not crash. @api private

This provides a hook which rspec can stub so that we can avoid twiddling global state in tests.

Public method that users should call to export proxies to the appropriate environment variables. This method should be called after the config file is parsed and loaded. TODO add some post-file-parsing logic that automatically calls this so users don‘t have to

Builds a proxy uri and exports it to the appropriate environment variables. Examples:

  http://username:password@hostname:port
  https://username@hostname:port
  ftp://hostname:port

when

  scheme = "http", "https", or "ftp"
  hostport = hostname:port or scheme://hostname:port
  user = username
  pass = password

@api private

Evaluates the given string as config.

filename is used for context in stacktraces, but doesn‘t need to be the name of an actual file.

Chef requires an English-language UTF-8 locale to function properly. We attempt to use the ‘locale -a’ command and search through a list of preferences until we find one that we can use. On Ubuntu systems we should find ‘C.UTF-8’ and be able to use that even if there is no English locale on the server, but Mac, Solaris, AIX, etc do not have that locale. We then try to find an English locale and fall back to ‘C’ if we do not. The choice of fallback is pick-your-poison. If we try to do the work to return a non-US UTF-8 locale then we fail inside of providers when things like ‘svn info’ return Japanese and we can‘t parse them. OTOH, if we pick ‘C’ then we will blow up on UTF-8 characters. Between the warn we throw and the Encoding exception that ruby will throw it is more obvious what is broken if we drop UTF-8 by default rather than drop English.

If there is no ‘locale -a’ then we return ‘en_US.UTF-8’ since that is the most commonly available English UTF-8 locale. However, all modern POSIXen should support ‘locale -a’.

Initialize openssl

Returns true only if the path exists and is readable and writeable for the user.

given a *nix style config path return the platform specific path to that same config file @example client.pem path on Windows

  platform_specific_path("/etc/chef/client.pem") #=> "C:\\chef\\client.pem"

@param path [String] The unix path to convert to a platform specific path @return [String] a platform specific path

Given a scheme, host, and port, return the correct proxy URI based on the set environment variables, unless exluded by no_proxy, in which case nil is returned

the drive where Chef is installed on a windows host. This is determined either by the drive containing the current file or by the SYSTEMDRIVE ENV variable

@return [String] the drive letter

[Validate]