end
Puppet::Type.type(:apt_key).provide(:apt_key) do
+ desc 'apt-key provider for apt_key resource'
+
confine osfamily: :debian
defaultfor osfamily: :debian
commands apt_key: 'apt-key'
def source_to_file(value)
parsed_value = URI.parse(value)
if parsed_value.scheme.nil?
- raise("The file #{value} does not exist") unless File.exist?(value)
+ raise(_('The file %{_value} does not exist') % { _value: value }) unless File.exist?(value)
# Because the tempfile method has to return a live object to prevent GC
# of the underlying file from occuring too early, we also have to return
# a file object here. The caller can still call the #path method on the
key = open(parsed_value, http_basic_authentication: user_pass).read
end
rescue OpenURI::HTTPError, Net::FTPPermError => e
- raise("#{e.message} for #{resource[:source]}")
+ raise(_('%{_e} for %{_resource}') % { _e: e.message, _resource: resource[:source] })
rescue SocketError
- raise("could not resolve #{resource[:source]}")
+ raise(_('could not resolve %{_resource}') % { _resource: resource[:source] })
else
tempfile(key)
end
end
end
unless found_match
- raise("The id in your manifest #{resource[:name]} and the fingerprint from content/source don't match. Check for an error in the id and content/source is legitimate.")
+ raise(_('The id in your manifest %{_resource} and the fingerprint from content/source don\'t match. Check for an error in the id and content/source is legitimate.') % { _name: resource[:name] }) # rubocop:disable Metrics/LineLength
end
else
warning('/usr/bin/gpg cannot be found for verification of the id.')
command.push('add', key_file.path)
# In case we really screwed up, better safe than sorry.
else
- raise("an unexpected condition occurred while trying to add the key: #{resource[:id]}")
+ raise(_('an unexpected condition occurred while trying to add the key: %{_resource}') % { _resource: resource[:id] })
end
apt_key(command)
@property_hash[:ensure] = :present
end
def read_only(_value)
- raise('This is a read-only property.')
+ raise(_('This is a read-only property.'))
end
mk_resource_methods
by apt to perform package validation. Apt has it's own GPG keyring that can
be manipulated through the `apt-key` command.
- apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
- source => 'http://apt.puppetlabs.com/pubkey.gpg'
- }
+ @example Basic usage
+ apt_key { '6F6B15509CF8E59E6E469F327F438280EF8D349F':
+ source => 'http://apt.puppetlabs.com/pubkey.gpg'
+ }
- **Autorequires**:
+ **Autorequires**
If Puppet is given the location of a key file which looks like an absolute
path this type will autorequire that file.
+
+ @api private
MANIFEST
ensurable
validate do
if self[:content] && self[:source]
- raise('The properties content and source are mutually exclusive.')
+ raise(_('The properties content and source are mutually exclusive.'))
end
if self[:id].length < 40
- warning('The id should be a full fingerprint (40 characters), see README.')
+ warning(_('The id should be a full fingerprint (40 characters), see README.'))
end
end
- # Defining backports for the apt class
+ # @summary Manages backports.
+ #
+ # @example Set up a backport for linuxmint qiana
+ # apt::backports { 'qiana':
+ # location => 'http://us.archive.ubuntu.com/ubuntu',
+ # release => 'trusty-backports',
+ # repos => 'main universe multiverse restricted',
+ # key => {
+ # id => '630239CC130E1A7FD81A27B140976EAF437D05B5',
+ # server => 'hkps.pool.sks-keyservers.net',
+ # },
+ # }
+ #
+ # @param location
+ # Specifies an Apt repository containing the backports to manage. Valid options: a string containing a URL. Default value for Debian and
+ # Ubuntu varies:
+ #
+ # - Debian: 'http://deb.debian.org/debian'
+ #
+ # - Ubuntu: 'http://archive.ubuntu.com/ubuntu'
+ #
+ # @param release
+ # Specifies a distribution of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
+ # Default: on Debian and Ubuntu, '${lsbdistcodename}-backports'. We recommend keeping this default, except on other operating
+ # systems.
+ #
+ # @param repos
+ # Specifies a component of the Apt repository containing the backports to manage. Used in populating the `source.list` configuration file.
+ # Default value for Debian and Ubuntu varies:
+ #
+ # - Debian: 'main contrib non-free'
+ #
+ # - Ubuntu: 'main universe multiverse restricted'
+ #
+ # @param key
+ # Specifies a key to authenticate the backports. Valid options: a string to be passed to the id parameter of the apt::key defined type, or a
+ # hash of parameter => value pairs to be passed to apt::key's id, server, content, source, and/or options parameters. Default value
+ # for Debian and Ubuntu varies:
+ #
+ # - Debian: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553'
+ #
+ # - Ubuntu: '630239CC130E1A7FD81A27B140976EAF437D05B5'
+ #
+ # @param pin
+ # Specifies a pin priority for the backports. Valid options: a number or string to be passed to the `id` parameter of the `apt::pin` defined
+ # type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters.
+ #
class apt::backports (
Optional[String] $location = undef,
Optional[String] $release = undef,
}
} else {
unless $location and $release and $repos and $key {
- fail('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key')
+ fail(translate('If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key'))
}
}
'release' => $_release,
}
} else {
- fail('pin must be either a string, number or hash')
+ fail(translate('pin must be either a string, number or hash'))
}
apt::source { 'backports':
- # Defining apt config
+ # @summary Specifies a custom Apt configuration file.
+ #
+ # @param content
+ # Required unless `ensure` is set to 'absent'. Directly supplies content for the configuration file.
+ #
+ # @param ensure
+ # Specifies whether the configuration file should exist. Valid options: 'present' and 'absent'.
+ #
+ # @param priority
+ # Determines the order in which Apt processes the configuration file. Files with lower priority numbers are loaded first.
+ # Valid options: a string containing an integer or an integer.
+ #
+ # @param notify_update
+ # Specifies whether to trigger an `apt-get update` run.
+ #
define apt::conf (
Optional[String] $content = undef,
Enum['present', 'absent'] $ensure = present,
unless $ensure == 'absent' {
unless $content {
- fail('Need to pass in content parameter')
+ fail(translate('Need to pass in content parameter'))
}
}
- # == Class: apt
+ # @summary Main class, includes all other classes.
#
- # Manage APT (Advanced Packaging Tool)
+ # @see https://docs.puppetlabs.com/references/latest/function.html#createresources for the create resource function
+ #
+ # @param provider
+ # Specifies the provider that should be used by apt::update.
+ #
+ # @param keyserver
+ # Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or
+ # hkp://).
+ #
+ # @param ppa_options
+ # Supplies options to be passed to the `add-apt-repository` command.
+ #
+ # @param ppa_package
+ # Names the package that provides the `apt-add-repository` command.
+ #
+ # @param backports
+ # Specifies some of the default parameters used by apt::backports. Valid options: a hash made up from the following keys:
+ #
+ # @option backports [String] :location
+ # See apt::backports for documentation.
+ #
+ # @option backports [String] :repos
+ # See apt::backports for documentation.
+ #
+ # @option backports [String] :key
+ # See apt::backports for documentation.
+ #
+ # @param confs
+ # Creates new `apt::conf` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param update
+ # Configures various update settings. Valid options: a hash made up from the following keys:
+ #
+ # @option update [String] :frequency
+ # Specifies how often to run `apt-get update`. If the exec resource `apt_update` is notified, `apt-get update` runs regardless of this value.
+ # Valid options: 'always' (at every Puppet run); 'daily' (if the value of `apt_update_last_success` is less than current epoch time minus 86400);
+ # 'weekly' (if the value of `apt_update_last_success` is less than current epoch time minus 604800); and 'reluctantly' (only if the exec resource
+ # `apt_update` is notified). Default: 'reluctantly'.
+ #
+ # @option update [Integer] :loglevel
+ # Specifies the log level of logs outputted to the console. Default: undef.
+ #
+ # @option update [Integer] :timeout
+ # Specifies how long to wait for the update to complete before canceling it. Valid options: an integer, in seconds. Default: undef.
+ #
+ # @option update [Integer] :tries
+ # Specifies how many times to retry the update after receiving a DNS or HTTP error. Default: undef.
+ #
+ # @param purge
+ # Specifies whether to purge any existing settings that aren't managed by Puppet. Valid options: a hash made up from the following keys:
+ #
+ # @option purge [Boolean] :sources.list
+ # Specifies whether to purge any unmanaged entries from sources.list. Default false.
+ #
+ # @option purge [Boolean] :sources.list.d
+ # Specifies whether to purge any unmanaged entries from sources.list.d. Default false.
+ #
+ # @option purge [Boolean] :preferences
+ # Specifies whether to purge any unmanaged entries from preferences. Default false.
+ #
+ # @option purge [Boolean] :preferences.d.
+ # Specifies whether to purge any unmanaged entries from preferences.d. Default false.
+ #
+ # @param proxy
+ # Configures Apt to connect to a proxy server. Valid options: a hash matching the locally defined type apt::proxy.
+ #
+ # @param sources
+ # Creates new `apt::source` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param keys
+ # Creates new `apt::key` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param ppas
+ # Creates new `apt::ppa` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param pins
+ # Creates new `apt::pin` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param settings
+ # Creates new `apt::setting` resources. Valid options: a hash to be passed to the create_resources function linked above.
+ #
+ # @param auth_conf_entries
+ # An optional array of login configuration settings (hashes) that are recorded in the file /etc/apt/auth.conf. This file has a netrc-like
+ # format (similar to what curl uses) and contains the login configuration for APT sources and proxies that require authentication. See
+ # https://manpages.debian.org/testing/apt/apt_auth.conf.5.en.html for details. If specified each hash must contain the keys machine, login and
+ # password and no others.
+ #
+ # @param root
+ # Specifies root directory of Apt executable.
+ #
+ # @param sources_list
+ # Specifies the path of the sources_list file to use.
+ #
+ # @param sources_list_d
+ # Specifies the path of the sources_list.d file to use.
+ #
+ # @param conf_d
+ # Specifies the path of the conf.d file to use.
+ #
+ # @param preferences
+ # Specifies the path of the preferences file to use.
+ #
+ # @param preferences_d
+ # Specifies the path of the preferences.d file to use.
+ #
+ # @param config_files
+ # A hash made up of the various configuration files used by Apt.
#
class apt (
Hash $update_defaults = $apt::params::update_defaults,
String $preferences = $apt::params::preferences,
String $preferences_d = $apt::params::preferences_d,
Hash $config_files = $apt::params::config_files,
- Hash $source_key_defaults = $apt::params::source_key_defaults
+ Hash $source_key_defaults = $apt::params::source_key_defaults,
) inherits apt::params {
if $facts['osfamily'] != 'Debian' {
- fail('This module only works on Debian or derivatives like Ubuntu')
+ fail(translate('This module only works on Debian or derivatives like Ubuntu'))
}
if $update['frequency'] {
- # == Define: apt::key
+ # @summary Manages the GPG keys that Apt uses to authenticate packages.
+ #
+ # @note
+ # The apt::key defined type makes use of the apt_key type, but includes extra functionality to help prevent duplicate keys.
+ #
+ # @example Declare Apt key for apt.puppetlabs.com source
+ # apt::key { 'puppetlabs':
+ # id => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
+ # server => 'hkps.pool.sks-keyservers.net',
+ # options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"',
+ # }
+ #
+ # @param id
+ # Specifies a GPG key to authenticate Apt package signatures. Valid options: a string containing a key ID (8 or 16 hexadecimal
+ # characters, optionally prefixed with "0x") or a full key fingerprint (40 hexadecimal characters).
+ #
+ # @param ensure
+ # Specifies whether the key should exist. Valid options: 'present' and 'absent'.
+ #
+ # @param content
+ # Supplies the entire GPG key. Useful in case the key can't be fetched from a remote location and using a file resource is inconvenient.
+ #
+ # @param source
+ # Specifies the location of an existing GPG key file to copy. Valid options: a string containing a URL (ftp://, http://, or https://) or
+ # an absolute path.
+ #
+ # @param server
+ # Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://, or
+ # hkp://).
+ #
+ # @param options
+ # Passes additional options to `apt-key adv --keyserver-options`.
+ #
define apt::key (
- String $id = $title,
- Enum['present', 'absent'] $ensure = present,
- Optional[String] $content = undef,
- Optional[String] $source = undef,
- String $server = $::apt::keyserver,
- Optional[String] $options = undef,
- ) {
-
- assert_type(
- Pattern[
- /\A(0x)?[0-9a-fA-F]{8}\Z/,
- /\A(0x)?[0-9a-fA-F]{16}\Z/,
- /\A(0x)?[0-9a-fA-F]{40}\Z/,
- ], $id)
-
- if $source {
- assert_type(Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/], $source)
- }
-
- if $server {
- assert_type(Pattern[/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/], $server)
- }
+ Pattern[/\A(0x)?[0-9a-fA-F]{8}\Z/, /\A(0x)?[0-9a-fA-F]{16}\Z/, /\A(0x)?[0-9a-fA-F]{40}\Z/] $id = $title,
+ Enum['present', 'absent'] $ensure = present,
+ Optional[String] $content = undef,
+ Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source = undef,
+ Pattern[/\A((hkp|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?$/] $server = $::apt::keyserver,
+ Optional[String] $options = undef,
+ ) {
case $ensure {
present: {
if defined(Anchor["apt_key ${id} absent"]){
- fail("key with id ${id} already ensured as absent")
+ fail(translate('key with id %{_id} already ensured as absent'),{'_id' => id})
}
if !defined(Anchor["apt_key ${id} present"]) {
absent: {
if defined(Anchor["apt_key ${id} present"]){
- fail("key with id ${id} already ensured as present")
+ fail(translate('key with id %{_id} already ensured as present', {'_id' => id}))
}
if !defined(Anchor["apt_key ${id} absent"]){
}
default: {
- fail "Invalid 'ensure' value '${ensure}' for apt::key"
+ fail translate('Invalid \'ensure\' value \'%{_ensure}\' for apt::key', {'_ensure' => ensure})
}
}
}
- # Setting params for the module
+ # @summary Provides defaults for the Apt module parameters.
+ #
+ # @api private
+ #
class apt::params {
if $::osfamily != 'Debian' {
- fail('This module only works on Debian or derivatives like Ubuntu')
+ fail(translate('This module only works on Debian or derivatives like Ubuntu'))
}
$root = '/etc/apt'
$ppa_package = 'software-properties-common'
}
undef: {
- fail('Unable to determine value for fact os["name"]')
+ fail(translate('Unable to determine value for fact os[\"name\"]'))
}
default: {
$ppa_options = undef
- # pin.pp
- # pin a release in apt, useful for unstable repositories
-
+ # @summary Manages Apt pins. Does not trigger an apt-get update run.
+ #
+ # @see http://linux.die.net/man/5/apt_preferences for context on these parameters
+ #
+ # @param ensure
+ # Specifies whether the pin should exist. Valid options: 'file', 'present', and 'absent'.
+ #
+ # @param explanation
+ # Supplies a comment to explain the pin. Default: "${caller_module_name}: ${name}".
+ #
+ # @param order
+ # Determines the order in which Apt processes the pin file. Files with lower order numbers are loaded first.
+ #
+ # @param packages
+ # Specifies which package(s) to pin.
+ #
+ # @param priority
+ # Sets the priority of the package. If multiple versions of a given package are available, `apt-get` installs the one with the highest
+ # priority number (subject to dependency constraints). Valid options: an integer.
+ #
+ # @param release
+ # Tells APT to prefer packages that support the specified release. Typical values include 'stable', 'testing', and 'unstable'.
+ #
+ # @param release_version
+ # Tells APT to prefer packages that support the specified operating system release version (such as Debian release version 7).
+ #
+ # @param component
+ # Names the licensing component associated with the packages in the directory tree of the Release file.
+ #
+ # @param originator
+ # Names the originator of the packages in the directory tree of the Release file.
+ #
+ # @param label
+ # Names the label of the packages in the directory tree of the Release file.
+ #
define apt::pin(
Optional[Enum['file', 'present', 'absent']] $ensure = present,
Optional[String] $explanation = undef,
if $packages_string != '*' { # specific form
if ( $pin_release != '' and ( $origin != '' or $version != '' )) or
( $version != '' and ( $pin_release != '' or $origin != '' )) {
- fail('parameters release, origin, and version are mutually exclusive')
+ fail(translate('parameters release, origin, and version are mutually exclusive'))
}
} else { # general form
if $version != '' {
- fail('parameter version cannot be used in general form')
+ fail(translate('parameter version cannot be used in general form'))
}
if ( $pin_release != '' and $origin != '' ) {
- fail('parameters release and origin are mutually exclusive')
+ fail(translate('parameters release and origin are mutually exclusive'))
}
}
- # ppa.pp
+ # @summary Manages PPA repositories using `add-apt-repository`. Not supported on Debian.
+ #
+ # @example Example declaration of an Apt PPA
+ # apt::ppa{ 'ppa:openstack-ppa/bleeding-edge': }
+ #
+ # @param ensure
+ # Specifies whether the PPA should exist. Valid options: 'present' and 'absent'.
+ #
+ # @param options
+ # Supplies options to be passed to the `add-apt-repository` command. Default: '-y'.
+ #
+ # @param release
+ # Optional if lsb-release is installed (unless you're using a different release than indicated by lsb-release, e.g., Linux Mint).
+ # Specifies the operating system of your node. Valid options: a string containing a valid LSB distribution codename.
+ #
+ # @param package_name
+ # Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'.
+ #
+ # @param package_manage
+ # Specifies whether Puppet should manage the package that provides `apt-add-repository`.
+ #
define apt::ppa(
String $ensure = 'present',
Optional[String] $options = $::apt::ppa_options,
Boolean $package_manage = false,
) {
unless $release {
- fail('lsbdistcodename fact not available: release parameter required')
+ fail(translate('lsbdistcodename fact not available: release parameter required'))
}
if $facts['lsbdistid'] == 'Debian' {
- fail('apt::ppa is not currently supported on Debian.')
+ fail(translate('apt::ppa is not currently supported on Debian.'))
}
if versioncmp($facts['lsbdistrelease'], '14.10') >= 0 {
- # Defining apt settings
+ # @summary Manages Apt configuration files.
+ #
+ # @see https://docs.puppetlabs.com/references/latest/type.html#file-attributes for more information on source and content parameters
+ #
+ # @param priority
+ # Determines the order in which Apt processes the configuration file. Files with higher priority numbers are loaded first.
+ #
+ # @param ensure
+ # Specifies whether the file should exist. Valid options: 'present', 'absent', and 'file'.
+ #
+ # @param source
+ # Required, unless `content` is set. Specifies a source file to supply the content of the configuration file. Cannot be used in combination
+ # with `content`. Valid options: see link above for Puppet's native file type source attribute.
+ #
+ # @param content
+ # Required, unless `source` is set. Directly supplies content for the configuration file. Cannot be used in combination with `source`. Valid
+ # options: see link above for Puppet's native file type content attribute.
+ #
+ # @param notify_update
+ # Specifies whether to trigger an `apt-get update` run.
+ #
define apt::setting (
Variant[String, Integer, Array] $priority = 50,
Optional[Enum['file', 'present', 'absent']] $ensure = file,
) {
if $content and $source {
- fail('apt::setting cannot have both content and source')
+ fail(translate('apt::setting cannot have both content and source'))
}
if !$content and !$source {
- fail('apt::setting needs either of content or source')
+ fail(translate('apt::setting needs either of content or source'))
}
$title_array = split($title, '-')
$base_name = join(delete_at($title_array, 0), '-')
assert_type(Pattern[/\Aconf\z/, /\Apref\z/, /\Alist\z/], $setting_type) |$a, $b| {
- fail("apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
+ fail(translate("apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'"))
}
if $priority !~ Integer {
# need this to allow zero-padded priority.
assert_type(Pattern[/^\d+$/], $priority) |$a, $b| {
- fail('apt::setting priority must be an integer or a zero-padded integer')
+ fail(translate('apt::setting priority must be an integer or a zero-padded integer'))
}
}
- # source.pp
- # add an apt source
+ # @summary Manages the Apt sources in /etc/apt/sources.list.d/.
+ #
+ # @example Install the puppetlabs apt source
+ # apt::source { 'puppetlabs':
+ # location => 'http://apt.puppetlabs.com',
+ # repos => 'main',
+ # key => {
+ # id => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
+ # server => 'hkps.pool.sks-keyservers.net',
+ # },
+ # }
+ #
+ # @param location
+ # Required, unless ensure is set to 'absent'. Specifies an Apt repository. Valid options: a string containing a repository URL.
+ #
+ # @param comment
+ # Supplies a comment for adding to the Apt source file.
+ #
+ # @param ensure
+ # Specifies whether the Apt source file should exist. Valid options: 'present' and 'absent'.
+ #
+ # @param release
+ # Specifies a distribution of the Apt repository.
+ #
+ # @param repos
+ # Specifies a component of the Apt repository.
+ #
+ # @param include
+ # Configures include options. Valid options: a hash of available keys.
+ #
+ # @option include [Boolean] :deb
+ # Specifies whether to request the distribution's compiled binaries. Default true.
+ #
+ # @option include [Boolean] :src
+ # Specifies whether to request the distribution's uncompiled source code. Default false.
+ #
+ # @param key
+ # Creates a declaration of the apt::key defined type. Valid options: a string to be passed to the `id` parameter of the `apt::key`
+ # defined type, or a hash of `parameter => value` pairs to be passed to `apt::key`'s `id`, `server`, `content`, `source`, and/or
+ # `options` parameters.
+ #
+ # @param pin
+ # Creates a declaration of the apt::pin defined type. Valid options: a number or string to be passed to the `id` parameter of the
+ # `apt::pin` defined type, or a hash of `parameter => value` pairs to be passed to `apt::pin`'s corresponding parameters.
+ #
+ # @param architecture
+ # Tells Apt to only download information for specified architectures. Valid options: a string containing one or more architecture names,
+ # separated by commas (e.g., 'i386' or 'i386,alpha,powerpc'). Default: undef (if unspecified, Apt downloads information for all architectures
+ # defined in the Apt::Architectures option).
+ #
+ # @param allow_unsigned
+ # Specifies whether to authenticate packages from this release, even if the Release file is not signed or the signature can't be checked.
+ #
+ # @param notify_update
+ # Specifies whether to trigger an `apt-get update` run.
+ #
define apt::source(
Optional[String] $location = undef,
String $comment = $name,
if $facts['lsbdistcodename'] {
$_release = $facts['lsbdistcodename']
} else {
- fail('lsbdistcodename fact not available: release parameter required')
+ fail(translate('lsbdistcodename fact not available: release parameter required'))
}
} else {
$_release = $release
if $ensure == 'present' {
if ! $location {
- fail('cannot create a source entry without specifying a location')
+ fail(translate('cannot create a source entry without specifying a location'))
}
# Newer oses, do not need the package for HTTPS transport.
$_transport_https_releases = [ 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial' ]
if $key {
if $key =~ Hash {
unless $key['id'] {
- fail('key hash must contain at least an id entry')
+ fail(translate('key hash must contain at least an id entry'))
}
$_key = merge($::apt::source_key_defaults, $key)
} else {
'origin' => $host,
}
} else {
- fail('Received invalid value for pin parameter')
+ fail(translate('Received invalid value for pin parameter'))
}
create_resources('apt::pin', { "${name}" => $_pin })
}
def install_key(key)
retry_on_error_matching do
- shell("apt-key adv --keyserver hkps.pool.sks-keyservers.net --recv-keys #{key}")
+ shell("apt-key adv --keyserver pgp.mit.edu --recv-keys #{key}")
end
end
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
ensure => 'present',
- server => 'hkps.pool.sks-keyservers.net',
+ server => 'pgp.mit.edu',
}
MANIFEST
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}',
ensure => 'present',
- server => 'hkp://hkps.pool.sks-keyservers.net:80',
+ server => 'hkp://pgp.mit.edu:80',
}
MANIFEST
end
describe 'server =>' do
- context 'with hkps.pool.sks-keyservers.net' do
+ context 'with pgp.mit.edu' do
it 'works' do
# Apply the manifest (Retry if timeout error is received from key pool)
retry_on_error_matching do
end
end
- context 'with hkp://hkps.pool.sks-keyservers.net:80' do
+ context 'with hkp://pgp.mit.edu:80' do
it 'works' do
retry_on_error_matching do
apply_manifest(hkp_pool_pp, catch_failures: true)
expect(r.stderr).to match(%r{could not resolve})
end
end
+
+ it 'fails with a socket error - i18n' do
+ hosts.each do |host|
+ on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
+ change_locale_on(host, 'ja_JP.utf-8')
+ end
+
+ apply_manifest(socket_error_pp, expect_failures: true) do |r|
+ expect(r.stderr).to match(%r{ƈǿŭŀḓ ƞǿŧ řḗşǿŀṽḗ})
+ end
+
+ hosts.each do |host|
+ on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
+ change_locale_on(host, 'en_US')
+ end
+ end
end
# disabled when running in travis, security issues prevent FTP
expect(r.stderr).to match(%r{could not resolve})
end
end
+
+ it 'fails with a socket error - i18n' do
+ hosts.each do |host|
+ on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
+ change_locale_on(host, 'ja_JP.utf-8')
+ end
+
+ apply_manifest(ftp_socket_error_pp, expect_failures: true) do |r|
+ expect(r.stderr).to match(%r{ƈǿŭŀḓ ƞǿŧ řḗşǿŀṽḗ})
+ end
+
+ hosts.each do |host|
+ on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
+ change_locale_on(host, 'en_US')
+ end
+ end
end
context 'with https://' do
expect(r.stderr).to match(%r{could not resolve})
end
end
+
+ it 'fails with a socket error - i18n' do
+ hosts.each do |host|
+ on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
+ change_locale_on(host, 'ja_JP.utf-8')
+ end
+
+ apply_manifest(https_socket_error_pp, expect_failures: true) do |r|
+ expect(r.stderr).to match(%r{ƈǿŭŀḓ ƞǿŧ řḗşǿŀṽḗ})
+ end
+
+ hosts.each do |host|
+ on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
+ change_locale_on(host, 'en_US')
+ end
+ end
end
context 'with /path/that/exists' do