-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RabbitMQ upgrade issue with using long names (#1977)
* Set rabbitmq_use_longname to AUTOCONFIGURED * Disable long node names before starting service * Adjust automated tests * Improve get_zookeeper_admin_server_port
- Loading branch information
Showing
5 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
12 changes: 11 additions & 1 deletion
12
core/src/epicli/data/common/ansible/playbooks/roles/rabbitmq/templates/rabbitmq-env.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
RABBITMQ_USE_LONGNAME={{ specification.rabbitmq_use_longname }} | ||
# {{ ansible_managed }} | ||
|
||
{% if specification.rabbitmq_use_longname|lower == 'autoconfigured' %} | ||
{% if ansible_nodename == ansible_hostname %} | ||
RABBITMQ_USE_LONGNAME=false | ||
{% else %} | ||
RABBITMQ_USE_LONGNAME=true | ||
{% endif %} | ||
{% else %} | ||
RABBITMQ_USE_LONGNAME={{ specification.rabbitmq_use_longname | lower }} | ||
{% endif %} | ||
|
||
# Specifies new style config file location | ||
CONFIG_FILE=/etc/rabbitmq/rabbitmq.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 6 additions & 8 deletions
14
core/src/epicli/data/common/tests/spec/zookeeper/zookeeper_helpers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
require 'net/ssh' | ||
|
||
def get_zookeeper_admin_server_port | ||
default_port = 8080 | ||
config_file = "/opt/zookeeper/conf/zoo.cfg" | ||
grep_cmd = "sudo -u zookeeper grep -Po '(?<=^admin\\.serverPort=)\\d+' #{config_file}" | ||
port = "" | ||
|
||
Net::SSH.start(ENV['TARGET_HOST'], ENV['user'], keys: [ENV['keypath']], :keys_only => true) do |ssh| | ||
ssh.exec!(grep_cmd) do |channel, stream, data| | ||
port << data if stream == :stdout && /^[0-9]+$/.match(data) | ||
end | ||
result = Specinfra.backend.run_command(grep_cmd) | ||
if /^[0-9]+$/.match?(result.stdout) | ||
port = result.stdout.chomp.to_i | ||
else | ||
port = default_port | ||
end | ||
|
||
return port.empty? ? default_port : port.to_i | ||
return port | ||
end |