Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

[Deployment] Check duplicate hostname #2403

Merged
merged 5 commits into from
Apr 8, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deployment/clusterObjectModel/mainParser/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ def __init__(self, layout_configuration):

def validation_pre(self):
# TODO

# validate unique hostname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a unit test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

host_list = [host["hostname"] for host in self.layout_configuration["machine-list"]]
duplicate_host_list = set([host for host in host_list if host_list.count(host) > 1])
if duplicate_host_list:
return False, "duplicate hostname [{}] in kubernetes-configuration".format(", ".join(duplicate_host_list))

return True, None


Expand Down