Skip to content

Commit

Permalink
(IAC-1497) - Removal of unsupported translate dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
david22swan committed Mar 18, 2021
1 parent de945b8 commit 3c219fa
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 37 deletions.
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ fixtures:
forge_modules:
stdlib: 'puppetlabs-stdlib'
apt: 'puppetlabs-apt'
translate: 'puppetlabs-translate'
powershell: 'puppetlabs-powershell'
reboot: 'puppetlabs-reboot'
repositories:
Expand Down
10 changes: 5 additions & 5 deletions manifests/image.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,23 @@
)

if ($docker_file) and ($docker_tar) {
fail(translate('docker::image must not have both $docker_file and $docker_tar set'))
fail('docker::image must not have both $docker_file and $docker_tar set')
}

if ($docker_dir) and ($docker_tar) {
fail(translate('docker::image must not have both $docker_dir and $docker_tar set'))
fail('docker::image must not have both $docker_dir and $docker_tar set')
}

if ($image_digest) and ($docker_file) {
fail(translate('docker::image must not have both $image_digest and $docker_file set'))
fail('docker::image must not have both $image_digest and $docker_file set')
}

if ($image_digest) and ($docker_dir) {
fail(translate('docker::image must not have both $image_digest and $docker_dir set'))
fail('docker::image must not have both $image_digest and $docker_dir set')
}

if ($image_digest) and ($docker_tar) {
fail(translate('docker::image must not have both $image_digest and $docker_tar set'))
fail('docker::image must not have both $image_digest and $docker_tar set')
}

if $force {
Expand Down
32 changes: 16 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -481,83 +481,83 @@
) inherits docker::params {
if $facts['os']['family'] and ! $acknowledge_unsupported_os {
assert_type(Pattern[/^(Debian|RedHat|windows)$/], $facts['os']['family']) |$a, $b| {
fail(translate('This module only works on Debian, Red Hat or Windows based systems.'))
fail('This module only works on Debian, Red Hat or Windows based systems.')
}
}

if ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') < 0) {
fail(translate('This module only works on Red Hat based systems version 7 and higher.'))
fail('This module only works on Red Hat based systems version 7 and higher.')
}

if ($default_gateway) and (!$bridge) {
fail(translate('You must provide the $bridge parameter.'))
fail('You must provide the $bridge parameter.')
}

if $log_level {
assert_type(Pattern[/^(debug|info|warn|error|fatal)$/], $log_level) |$a, $b| {
fail(translate('log_level must be one of debug, info, warn, error or fatal'))
fail('log_level must be one of debug, info, warn, error or fatal')
}
}

if $log_driver {
if $facts['os']['family'] == 'windows' {
assert_type(Pattern[/^(none|json-file|syslog|gelf|fluentd|splunk|awslogs|etwlogs)$/], $log_driver) |$a, $b| {
fail(translate('log_driver must be one of none, json-file, syslog, gelf, fluentd, splunk, awslogs or etwlogs'))
fail('log_driver must be one of none, json-file, syslog, gelf, fluentd, splunk, awslogs or etwlogs')
}
} else {
assert_type(Pattern[/^(none|json-file|syslog|journald|gelf|fluentd|splunk|awslogs)$/], $log_driver) |$a, $b| {
fail(translate('log_driver must be one of none, json-file, syslog, journald, gelf, fluentd, splunk or awslogs'))
fail('log_driver must be one of none, json-file, syslog, journald, gelf, fluentd, splunk or awslogs')
}
}
}

if $storage_driver {
if $facts['os']['family'] == 'windows' {
assert_type(Pattern[/^(windowsfilter)$/], $storage_driver) |$a, $b| {
fail(translate('Valid values for storage_driver on windows are windowsfilter'))
fail('Valid values for storage_driver on windows are windowsfilter')
}
} else {
assert_type(Pattern[/^(aufs|devicemapper|btrfs|overlay|overlay2|vfs|zfs)$/], $storage_driver) |$a, $b| {
fail(translate('Valid values for storage_driver are aufs, devicemapper, btrfs, overlay, overlay2, vfs, zfs.'))
fail('Valid values for storage_driver are aufs, devicemapper, btrfs, overlay, overlay2, vfs, zfs.')
}
}
}

if ($bridge) and ($facts['os']['family'] == 'windows') {
assert_type(Pattern[/^(none|nat|transparent|overlay|l2bridge|l2tunnel)$/], $bridge) |$a, $b| {
fail(translate('bridge must be one of none, nat, transparent, overlay, l2bridge or l2tunnel on Windows.'))
fail('bridge must be one of none, nat, transparent, overlay, l2bridge or l2tunnel on Windows.')
}
}

if $dm_fs {
assert_type(Pattern[/^(ext4|xfs)$/], $dm_fs) |$a, $b| {
fail(translate('Only ext4 and xfs are supported currently for dm_fs.'))
fail('Only ext4 and xfs are supported currently for dm_fs.')
}
}

if ($dm_loopdatasize or $dm_loopmetadatasize) and ($dm_datadev or $dm_metadatadev) {
fail(translate('You should provide parameters only for loop lvm or direct lvm, not both.'))
fail('You should provide parameters only for loop lvm or direct lvm, not both.')
}

if ($dm_datadev or $dm_metadatadev) and $dm_thinpooldev {
fail(translate('You can use the $dm_thinpooldev parameter, or the $dm_datadev and $dm_metadatadev parameter pair, but you cannot use both.')) # lint:ignore:140chars
fail('You can use the $dm_thinpooldev parameter, or the $dm_datadev and $dm_metadatadev parameter pair, but you cannot use both.') # lint:ignore:140chars
}

if ($dm_datadev or $dm_metadatadev) {
notice('The $dm_datadev and $dm_metadatadev parameter pair are deprecated. The $dm_thinpooldev parameter should be used instead.')
}

if ($dm_datadev and !$dm_metadatadev) or (!$dm_datadev and $dm_metadatadev) {
fail(translate('You need to provide both $dm_datadev and $dm_metadatadev parameters for direct lvm.'))
fail('You need to provide both $dm_datadev and $dm_metadatadev parameters for direct lvm.')
}

if ($dm_basesize or $dm_fs or $dm_mkfsarg or $dm_mountopt or $dm_blocksize or $dm_loopdatasize or $dm_loopmetadatasize or $dm_datadev or $dm_metadatadev) and ($storage_driver != 'devicemapper') {
fail(translate('Values for dm_ variables will be ignored unless storage_driver is set to devicemapper.'))
fail('Values for dm_ variables will be ignored unless storage_driver is set to devicemapper.')
}

if($tls_enable) {
if(! $tcp_bind) {
fail(translate('You need to provide tcp bind parameter for TLS.'))
fail('You need to provide tcp bind parameter for TLS.')
}
}

Expand Down Expand Up @@ -586,7 +586,7 @@
$package_key_check_source = true
}
'windows': {
fail(translate('This module only work for Docker Enterprise Edition on Windows.'))
fail('This module only work for Docker Enterprise Edition on Windows.')
}
default: {
$package_location = $docker_package_location
Expand Down
4 changes: 2 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

if $facts['os']['family'] and ! $docker::acknowledge_unsupported_os {
assert_type(Pattern[/^(Debian|RedHat|windows)$/], $facts['os']['family']) |$a, $b| {
fail(translate('This module only works on Debian, RedHat or Windows.'))
fail('This module only works on Debian, RedHat or Windows.')
}
}
if $docker::version and $docker::ensure != 'absent' {
Expand All @@ -55,7 +55,7 @@
$pk_provider = 'yum'
}
'windows' : {
fail(translate('Custom package source is currently not implemented on windows.'))
fail('Custom package source is currently not implemented on windows.')
}
default : {
$pk_provider = undef
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
$docker_command = "${docker::params::docker_command} plugin"

if ($facts['os']['family'] == 'windows') {
fail(translate('Feature not implemented on windows.'))
fail('Feature not implemented on windows.')
}

if $ensure == 'present' {
Expand Down
8 changes: 4 additions & 4 deletions manifests/run.pp
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@
}

if ($remove_volume_on_start and !$remove_container_on_start) {
fail(translate("In order to remove the volume on start for ${title} you need to also remove the container"))
fail("In order to remove the volume on start for ${title} you need to also remove the container")
}

if ($remove_volume_on_stop and !$remove_container_on_stop) {
fail(translate("In order to remove the volume on stop for ${title} you need to also remove the container"))
fail("In order to remove the volume on stop for ${title} you need to also remove the container")
}

if $use_name {
Expand Down Expand Up @@ -497,10 +497,10 @@
}
default: {
if $facts['os']['family'] != 'windows' {
fail(translate('Docker needs a Debian or RedHat based system.'))
fail('Docker needs a Debian or RedHat based system.')
}
elsif $ensure == 'present' {
fail(translate('Restart parameter is required for Windows'))
fail('Restart parameter is required for Windows')
}

$hasstatus = $::docker::params::service_hasstatus
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
$root_dir_flag = $docker::root_dir_flag,
) {
unless $facts['os']['family'] =~ /(Debian|RedHat|windows)/ or $::docker::acknowledge_unsupported_os {
fail(translate('The docker::service class needs a Debian, Redhat or Windows based system.'))
fail('The docker::service class needs a Debian, Redhat or Windows based system.')
}

$dns_array = any2array($dns)
Expand Down
4 changes: 2 additions & 2 deletions manifests/services.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@

if $ensure == 'absent' {
if $update {
fail(translate('When removing a service you can not update it.'))
fail('When removing a service you can not update it.')
}

if $scale {
fail(translate('When removing a service you can not update it.'))
fail('When removing a service you can not update it.')
}
}

Expand Down
4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"name": "puppetlabs/apt",
"version_requirement": ">= 4.4.1 < 9.0.0"
},
{
"name": "puppetlabs/translate",
"version_requirement": ">= 0.0.1 < 3.0.0"
},
{
"name": "puppetlabs/powershell",
"version_requirement": ">= 2.1.4 < 6.0.0"
Expand Down
2 changes: 1 addition & 1 deletion spec/helper/get_values_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_values_init(_params, _facts)
package_key_source = _params['docker_ce_key_source']
package_key_check_source = true
# when 'windows'
# fail(translate('This module only work for Docker Enterprise Edition on Windows.'))
# fail('This module only work for Docker Enterprise Edition on Windows.')
else
package_location = _params['docker_package_location']
package_key_source = _params['docker_package_key_source']
Expand Down

0 comments on commit 3c219fa

Please sign in to comment.