Open

Description
- Module version: 5.2, 5.3 and current master
- Puppet version: 4.7.0
- OS and version: CentOS Linux release 7.2.1511 (Core)
Bug description
Usecase
I'm building a elk stack logging cluster where the elasticsearch version is pinned to version 5.4.0.
Pinning this version made me discover a bug in the module.
In the file manifests/init.pp
(rule 590 in master) there is an if
statement that forces package versions to use iterations on Linux.
if ($version != false) {
case $::osfamily {
'RedHat', 'Linux', 'Suse': {
if ($version =~ /.+-\d/) {
$pkg_version = $version
} else {
$pkg_version = "${version}-1"
}
}
default: {
$pkg_version = $version
}
}
}
The problem is that Elastic is not using iterations in their packages.
Error during puppet run
Error: Could not update: Execution of '/bin/yum -d 0 -e 0 -y install elasticsearch-5.4.0-1' returned 1: Error: Nothing to do
Error: /Stage[main]/Elasticsearch::Package/Package[elasticsearch]/ensure: change from purged to 5.4.0-1 failed: Could not update: Execution of '/bin/yum -d 0 -e 0 -y install elasticsearch-5.4.0-1' returned 1: Error: Nothing to do
Puppet profile
$katellorepositoryserver = hiera('katellorepositoryserver'),
$esversion = hiera('esversion','5.4.0'), #Is empty in hieradata
$esclusterrole = hiera('esclusterrole','logcentral'),
$esnodes = hiera_array('esnodes', ['127.0.0.1:9300']),
$esconfighiera = hiera_hash('elasticsearch_config', {}),
$eslicense = hiera('elasticsearch_license', undef),
){
profile::linux::repos::yumrepo{ 'elastic':
descr => 'elastic-5.x',
baseurl => "http://${katellorepositoryserver}/pulp/repos/Default_Organization/${::env}/elastic-5_x/custom/Elastic/elastic-5_x",
enabled => 1,
gpgcheck => 0,
}
#ES_HEAP_SIZE = 50% of memorysize
$esheapsize=abs($::memorysize_mb/2)
$esconfig_defaults = {
'ES_HEAP_SIZE' => $esheapsize,
'path.logs' => '/var/log/elasticsearch',
'cluster.name' => "${esclusterrole}-${::env}",
'transport.host' => $::networking['interfaces'][$svc_interface]['ip'],
'discovery.zen.ping.multicast.enabled' => false,
'discovery.zen.ping.unicast.hosts' => join($esnodes, ','),
'discovery.zen.minimum_master_nodes' => '2',
'node.name' => $::hostname,
'node.master' => true,
'node.data' => false,
'node.ingest' => false,
}
# 2nd hash has prio over 1st hash
$esconfig = deep_merge($esconfig_defaults, $esconfighiera)
class { '::elasticsearch':
manage_repo => false,
java_install => true,
autoupgrade => false,
version => $esversion,
config => $esconfig,
#datadir => $datadir,
require => Yumrepo['elastic'],
}
}
Could you please fix the if statement that forces the iteration? Since you do not use iterations.