Updated method to index hosts for Grafana Dashboard creation
Updated the hosts_to_dictionary function to check to see if the last digit of the overcloud host name is a digit. If so, it uses a regex to isolate the all of the digits at the end of the hostname, and proceeds to use that as the dictionary index. This change allows for alternate overcloud host naming schemes that do not have a hyphen preceding the server number. Change-Id: Ief10b2100b5d7c55a940ab4186ce2e31c109420c Closes-Bug: #1612787
This commit is contained in:
parent
6efffa4f53
commit
b339831ca5
@ -9,6 +9,7 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import re
|
||||
|
||||
def dict_remove(the_dict, item):
|
||||
"""Remove an item from a dictionary."""
|
||||
@ -24,9 +25,8 @@ def hosts_to_dictionary(arg):
|
||||
dictionary = {}
|
||||
nonindex = 1000000
|
||||
for item in arg:
|
||||
if '-' in item:
|
||||
idx = item.rindex('-')
|
||||
dictionary[int(item[idx + 1:])] = item
|
||||
if item[(len(item)-1)].isdigit():
|
||||
dictionary[int(re.sub('.*[^0-9][^0-9]*', '', item))] = item
|
||||
else:
|
||||
nonindex += 1
|
||||
dictionary[nonindex] = item
|
||||
|
Loading…
Reference in New Issue
Block a user