Skip to content

Commit db94724

Browse files
authored
Merge pull request #475 from bwitt/nodeid-falback
Fall back to hostname if fqdn is too long
2 parents e6580f1 + bbbee16 commit db94724

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

spec/classes/jira_config_spec.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,54 @@ def self.clear_cache
11891189
end
11901190
end
11911191

1192+
context 'enable clustering with short fqdn' do
1193+
let(:params) do
1194+
super().merge(
1195+
datacenter: true,
1196+
shared_homedir: '/mnt/jira_shared_home_dir'
1197+
)
1198+
end
1199+
1200+
let(:facts) do
1201+
super().merge(
1202+
networking: {
1203+
'fqdn' => 'short-hostname.example.com',
1204+
'hostname' => 'short-hostname'
1205+
}
1206+
)
1207+
end
1208+
1209+
it do
1210+
is_expected.to contain_file(FILENAME_CLUSTER_PROPS).
1211+
with_content(%r{jira.node.id = short-hostname.example.com}).
1212+
with_content(%r{jira.shared.home = /mnt/jira_shared_home_dir})
1213+
end
1214+
end
1215+
1216+
context 'enable clustering with long fqdn exceeding 60 characters' do
1217+
let(:params) do
1218+
super().merge(
1219+
datacenter: true,
1220+
shared_homedir: '/mnt/jira_shared_home_dir'
1221+
)
1222+
end
1223+
1224+
let(:facts) do
1225+
super().merge(
1226+
networking: {
1227+
'fqdn' => 'this-is-a-very-long-hostname-that-exceeds-sixty-characters.example.com',
1228+
'hostname' => 'long-hostname'
1229+
}
1230+
)
1231+
end
1232+
1233+
it do
1234+
is_expected.to contain_file(FILENAME_CLUSTER_PROPS).
1235+
with_content(%r{jira.node.id = long-hostname}).
1236+
with_content(%r{jira.shared.home = /mnt/jira_shared_home_dir})
1237+
end
1238+
end
1239+
11921240
context 'OpenJDK jvm params' do
11931241
let(:params) do
11941242
super().merge(

templates/cluster.properties.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This ID must be unique across the cluster
2-
jira.node.id = <%= $facts['networking']['fqdn'] %>
2+
jira.node.id = <%= $facts['networking']['fqdn'].length > 60 ? { true => $facts['networking']['hostname'], false => $facts['networking']['fqdn'] } %>
33
# The location of the shared home directory for all JIRA nodes
44
jira.shared.home = <%= $jira::shared_homedir %>
55
<% if $jira::ehcache_listener_host { -%>

0 commit comments

Comments
 (0)