Fixed hiera command to output correct DB hostnames

hiera_cmd used to output internal node names like "node-$i"
even if there are user-defined hostnames set. This breaks
DB-related checks when hostnames are customized.
The fix is to return not "database_nodes" keys, but
the value of "name" key in each "database_nodes"
subhash.

Change-Id: I9fbcfc270ab17d6302ce0a785c96f5b44fc9e75d
Co-Authored-By: Omar Rivera <gr113x@att.com>
Closes-Bug: #1582800
This commit is contained in:
Dmitry Nikishov 2016-05-17 13:05:41 -05:00 committed by tatyana-leontovich
parent ef0eda085d
commit 43a58efbaf
1 changed files with 4 additions and 2 deletions

View File

@ -59,9 +59,11 @@ class BaseMysqlTest(BaseTestCase):
key_filename=key,
timeout=100)
hiera_cmd = ('ruby -e \'require "hiera";'
'db = Hiera.new().lookup("database_nodes", {}, {}).keys;'
hiera_cmd = ('ruby -e \'require "hiera"; '
'db_h = Hiera.new().lookup("database_nodes", {}, {}); '
'db = db_h.keys.map{|k| db_h[k]["name"]}; '
'if db != [] then puts db else puts "None" end\'')
database_nodes = ssh_client.exec_command(hiera_cmd)
# get online nodes
database_nodes = database_nodes.splitlines()