Skip to content

Commit 873058e

Browse files
author
Gavin Williams
authored
Merge pull request #1088 from fatmcgav/add_es7_test_matrix
2 parents 82b5380 + 5d8f7f6 commit 873058e

File tree

14 files changed

+192
-212
lines changed

14 files changed

+192
-212
lines changed

.travis.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,87 @@ jobs:
5252
env:
5353
- BEAKER_PUPPET_COLLECTION=puppet6
5454
- TASK=beaker:amazonlinux-1-x64:acceptance
55+
- env:
56+
- BEAKER_PUPPET_COLLECTION=puppet6
57+
- TASK=beaker:amazonlinux-1-x64:acceptance[7.8.0]
5558
- env:
5659
- BEAKER_PUPPET_COLLECTION=puppet6
5760
- TASK=beaker:amazonlinux-2-x64:acceptance
61+
- env:
62+
- BEAKER_PUPPET_COLLECTION=puppet6
63+
- TASK=beaker:amazonlinux-2-x64:acceptance[7.8.0]
5864
- env:
5965
- BEAKER_PUPPET_COLLECTION=puppet6
6066
- TASK=beaker:centos-6-x64:acceptance
67+
- env:
68+
- BEAKER_PUPPET_COLLECTION=puppet6
69+
- TASK=beaker:centos-6-x64:acceptance[7.8.0]
6170
- env:
6271
- BEAKER_PUPPET_COLLECTION=puppet6
6372
- TASK=beaker:centos-7-x64:acceptance
73+
- env:
74+
- BEAKER_PUPPET_COLLECTION=puppet6
75+
- TASK=beaker:centos-7-x64:acceptance[7.8.0]
6476
- env:
6577
- BEAKER_PUPPET_COLLECTION=puppet6
6678
- TASK=beaker:centos-8-x64:acceptance
79+
- env:
80+
- BEAKER_PUPPET_COLLECTION=puppet6
81+
- TASK=beaker:centos-8-x64:acceptance[7.8.0]
6782
- env:
6883
- BEAKER_PUPPET_COLLECTION=puppet6
6984
- TASK=beaker:oracle-6-x64:acceptance
85+
- env:
86+
- BEAKER_PUPPET_COLLECTION=puppet6
87+
- TASK=beaker:oracle-6-x64:acceptance[7.8.0]
7088
- env:
7189
- BEAKER_PUPPET_COLLECTION=puppet6
7290
- TASK=beaker:oracle-7-x64:acceptance
91+
- env:
92+
- BEAKER_PUPPET_COLLECTION=puppet6
93+
- TASK=beaker:oracle-7-x64:acceptance[7.8.0]
7394
- env:
7495
- BEAKER_PUPPET_COLLECTION=puppet6
7596
- TASK=beaker:debian-8-x64:acceptance
97+
- env:
98+
- BEAKER_PUPPET_COLLECTION=puppet6
99+
- TASK=beaker:debian-8-x64:acceptance[7.8.0]
76100
- env:
77101
- BEAKER_PUPPET_COLLECTION=puppet6
78102
- TASK=beaker:debian-9-x64:acceptance
103+
- env:
104+
- BEAKER_PUPPET_COLLECTION=puppet6
105+
- TASK=beaker:debian-9-x64:acceptance[7.8.0]
79106
- env:
80107
- BEAKER_PUPPET_COLLECTION=puppet6
81108
- TASK=beaker:debian-10-x64:acceptance
109+
- env:
110+
- BEAKER_PUPPET_COLLECTION=puppet6
111+
- TASK=beaker:debian-10-x64:acceptance[7.8.0]
82112
- env:
83113
- BEAKER_PUPPET_COLLECTION=puppet6
84114
- TASK=beaker:ubuntu-server-1404-x64:acceptance
115+
- env:
116+
- BEAKER_PUPPET_COLLECTION=puppet6
117+
- TASK=beaker:ubuntu-server-1404-x64:acceptance[7.8.0]
85118
- env:
86119
- BEAKER_PUPPET_COLLECTION=puppet6
87120
- TASK=beaker:ubuntu-server-1604-x64:acceptance
121+
- env:
122+
- BEAKER_PUPPET_COLLECTION=puppet6
123+
- TASK=beaker:ubuntu-server-1604-x64:acceptance[7.8.0]
88124
- env:
89125
- BEAKER_PUPPET_COLLECTION=puppet6
90126
- TASK=beaker:ubuntu-server-1804-x64:acceptance
127+
- env:
128+
- BEAKER_PUPPET_COLLECTION=puppet6
129+
- TASK=beaker:ubuntu-server-1804-x64:acceptance[7.8.0]
130+
# - env:
131+
# - BEAKER_PUPPET_COLLECTION=puppet6
132+
# - TASK=beaker:ubuntu-server-2004-x64:acceptance
133+
# - env:
134+
# - BEAKER_PUPPET_COLLECTION=puppet6
135+
# - TASK=beaker:ubuntu-server-2004-x64:acceptance[7.8.0]
91136
- stage: snapshots
92137
env:
93138
- TASK=beaker:ubuntu-server-1404-x64:snapshot

manifests/config.pp

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
$elasticsearch::datadir:
4343
ensure => 'directory',
4444
group => $elasticsearch::elasticsearch_group,
45-
owner => $elasticsearch::elasticsearch_user;
45+
owner => $elasticsearch::elasticsearch_user,
46+
mode => '2750';
4647
$elasticsearch::logdir:
4748
ensure => 'directory',
4849
group => $elasticsearch::elasticsearch_group,
4950
owner => $elasticsearch::elasticsearch_user,
50-
mode => '0750';
51+
mode => '2750';
5152
$elasticsearch::real_plugindir:
5253
ensure => 'directory',
5354
group => $elasticsearch::elasticsearch_group,
@@ -60,60 +61,19 @@
6061
recurse => true;
6162
}
6263

63-
if $elasticsearch::pid_dir {
64-
file { $elasticsearch::pid_dir:
65-
ensure => 'directory',
66-
group => undef,
67-
owner => $elasticsearch::elasticsearch_user,
68-
recurse => true,
69-
}
70-
71-
if ($elasticsearch::service_provider == 'systemd') {
72-
$group = $elasticsearch::elasticsearch_group
73-
$user = $elasticsearch::elasticsearch_user
74-
$pid_dir = $elasticsearch::pid_dir
75-
76-
file { '/usr/lib/tmpfiles.d/elasticsearch.conf':
77-
ensure => 'file',
78-
content => template("${module_name}/usr/lib/tmpfiles.d/elasticsearch.conf.erb"),
79-
group => '0',
80-
owner => 'root',
81-
}
82-
}
83-
}
84-
85-
if $elasticsearch::defaults_location {
86-
augeas { "${elasticsearch::defaults_location}/elasticsearch":
87-
incl => "${elasticsearch::defaults_location}/elasticsearch",
88-
lens => 'Shellvars.lns',
89-
changes => [
90-
'rm CONF_FILE',
91-
'rm CONF_DIR',
92-
'rm ES_PATH_CONF',
93-
],
94-
}
95-
96-
file { "${elasticsearch::defaults_location}/elasticsearch":
97-
ensure => 'file',
98-
group => $elasticsearch::elasticsearch_group,
99-
owner => $elasticsearch::elasticsearch_user,
100-
mode => '0640';
101-
}
102-
}
103-
10464
# Defaults file, either from file source or from hash to augeas commands
10565
if ($elasticsearch::init_defaults_file != undef) {
10666
file { "${elasticsearch::defaults_location}/elasticsearch":
10767
ensure => $elasticsearch::ensure,
10868
source => $elasticsearch::init_defaults_file,
10969
owner => 'root',
110-
group => '0',
111-
mode => '0644',
70+
group => $elasticsearch::elasticsearch_group,
71+
mode => '0660',
11272
before => Service['elasticsearch'],
11373
notify => $elasticsearch::_notify_service,
11474
}
11575
} else {
116-
augeas { 'init_defaults':
76+
augeas { "${elasticsearch::defaults_location}/elasticsearch":
11777
incl => "${elasticsearch::defaults_location}/elasticsearch",
11878
lens => 'Shellvars.lns',
11979
changes => template("${module_name}/etc/sysconfig/defaults.erb"),
@@ -137,11 +97,24 @@
13797
$_keystore_path = $elasticsearch::keystore_path
13898
}
13999

140-
$_tls_config = {
141-
'xpack.security.transport.ssl.enabled' => true,
142-
'xpack.security.http.ssl.enabled' => true,
143-
'xpack.ssl.keystore.path' => $_keystore_path,
144-
'xpack.ssl.keystore.password' => $elasticsearch::keystore_password,
100+
# Set the correct xpack. settings based on ES version
101+
if (versioncmp($elasticsearch::version, '7') >= 0) {
102+
$_tls_config = {
103+
'xpack.security.http.ssl.enabled' => true,
104+
'xpack.security.http.ssl.keystore.path' => $_keystore_path,
105+
'xpack.security.http.ssl.keystore.password' => $elasticsearch::keystore_password,
106+
'xpack.security.transport.ssl.enabled' => true,
107+
'xpack.security.transport.ssl.keystore.path' => $_keystore_path,
108+
'xpack.security.transport.ssl.keystore.password' => $elasticsearch::keystore_password,
109+
}
110+
}
111+
else {
112+
$_tls_config = {
113+
'xpack.security.transport.ssl.enabled' => true,
114+
'xpack.security.http.ssl.enabled' => true,
115+
'xpack.ssl.keystore.path' => $_keystore_path,
116+
'xpack.ssl.keystore.password' => $elasticsearch::keystore_password,
117+
}
145118
}
146119

147120
# Trust CA Certificate
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
HOSTS:
2+
ubuntu-20-04:
3+
roles:
4+
- agent
5+
- master
6+
- database
7+
- dashboard
8+
platform: ubuntu-20.04-amd64
9+
image: ubuntu:20.04
10+
hypervisor: docker
11+
docker_cmd: ["/sbin/init"]
12+
docker_preserve_image: true
13+
docker_image_commands:
14+
- apt-get update
15+
- apt-get install -yq libssl-dev apt-transport-https openjdk-8-jdk iproute2
16+
CONFIG:
17+
log_level: warn

spec/classes/000_elasticsearch_init_spec.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,13 @@
5858

5959
# Varies depending on distro
6060
it { should contain_augeas("#{defaults_path}/elasticsearch") }
61-
it do
62-
should contain_file("#{defaults_path}/elasticsearch").with(
63-
:ensure => 'file',
64-
:group => 'elasticsearch',
65-
:owner => 'elasticsearch',
66-
:mode => '0640'
67-
)
68-
end
6961

7062
# Systemd-specific files
7163
if test_pid == true
7264
it { should contain_service('elasticsearch').with(
7365
:ensure => 'running',
7466
:enable => true
7567
) }
76-
it { should contain_file('/usr/lib/tmpfiles.d/elasticsearch.conf') }
7768
end
7869

7970
context 'java installation' do
@@ -226,8 +217,15 @@
226217
.with(:ensure => 'purged') }
227218
end
228219

220+
it { should contain_service('elasticsearch')
221+
.with(
222+
:ensure => 'stopped',
223+
:enable => 'false'
224+
) }
229225
it { should contain_file('/usr/share/elasticsearch/plugins')
230226
.with(:ensure => 'absent') }
227+
it { should contain_file("#{defaults_path}/elasticsearch")
228+
.with(:ensure => 'absent') }
231229
end
232230

233231
context 'When managing the repository' do
@@ -335,8 +333,6 @@
335333
.with(:owner => 'myesuser', :group => 'myesgroup') }
336334
it { should contain_file('/var/lib/elasticsearch')
337335
.with(:owner => 'myesuser', :group => 'myesgroup') }
338-
it { should contain_file('/var/run/elasticsearch')
339-
.with(:owner => 'myesuser') if facts[:os]['family'] == 'RedHat' }
340336
end
341337

342338
describe 'setting jvm_options' do

spec/classes/001_hiera_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
context 'config' do
5050
let(:facts) { facts.merge(:scenario => 'singleinstance') }
5151

52-
it { should contain_augeas('init_defaults') }
52+
it { should contain_augeas('/etc/sysconfig/elasticsearch') }
5353
it { should contain_file('/etc/elasticsearch/elasticsearch.yml') }
5454
it { should contain_datacat('/etc/elasticsearch/elasticsearch.yml') }
5555
it { should contain_datacat_fragment('main_config') }

spec/defines/004_elasticsearch_plugin_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class { "elasticsearch":
161161
'Service[elasticsearch]'
162162
)}
163163

164-
include_examples 'class', 'es-plugin', :sysv
164+
include_examples('class')
165165
end
166166

167167
context 'restart_plugin_change set to false (default)' do
@@ -179,7 +179,7 @@ class { "elasticsearch":
179179
'Service[elasticsearch]'
180180
)}
181181

182-
include_examples 'class', 'es-plugin', :sysv
182+
include_examples('class')
183183
end
184184

185185
context 'restart_plugin_change set to true' do
@@ -197,7 +197,7 @@ class { "elasticsearch":
197197
'Service[elasticsearch]'
198198
)}
199199

200-
include_examples 'class', 'es-plugin', :sysv
200+
include_examples('class')
201201
end
202202
end
203203

@@ -294,7 +294,7 @@ class { 'elasticsearch': }
294294
'Class[elasticsearch::config]'
295295
)}
296296

297-
include_examples 'class', :sysv
297+
include_examples('class')
298298
end
299299
end
300300
end

spec/fixtures/templates/post_6.0.json renamed to spec/fixtures/templates/6.x.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
}
5757
}
5858
}
59-
}
59+
}

spec/fixtures/templates/7.x.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"index_patterns": [ "logstash-*" ],
3+
"version": 123,
4+
"settings": {
5+
"index": {
6+
"refresh_interval": "5s",
7+
"analysis": {
8+
"analyzer": {
9+
"default": {
10+
"type": "standard",
11+
"stopwords": "_none_"
12+
}
13+
}
14+
}
15+
}
16+
},
17+
"mappings": {
18+
"dynamic_templates": [
19+
{
20+
"string_fields": {
21+
"match": "*",
22+
"match_mapping_type": "string",
23+
"mapping": {
24+
"type": "multi_field",
25+
"fields": {
26+
"{name}": {
27+
"type": "text",
28+
"index": "analyzed",
29+
"omit_norms": true
30+
},
31+
"raw": {
32+
"type ": "text",
33+
"index": "not_analyzed",
34+
"ignore_above": 256
35+
}
36+
}
37+
}
38+
}
39+
}
40+
]
41+
}
42+
}

0 commit comments

Comments
 (0)