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

Commit

Permalink
EOS24097-Error message not proper (#496)
Browse files Browse the repository at this point in the history
* EOS24097-Error message not proper

* EOS24097-Adding validation on bind-base-dn

* Removed bind_base_dn and kept it fixed cn=admin
  • Loading branch information
shalakadharap committed Sep 3, 2021
1 parent 90d497a commit 4248ca8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions py-utils/src/utils/setup/openldap/openldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,22 @@ def _key_value_verify(self, key: str, phase: str):
if ((Conf.get(self.prov, 'CONFIG>OPENLDAP_BASE_DN') == key) and (not bool(re.match("^dc=[a-zA-Z0-9]+(,dc=[a-zA-Z0-9]+)+[a-zA-Z0-9]$", value)))):
Log.debug("Validation failed for %s in %s phase" % (key ,phase))
raise Exception("Validation failed for %s in %s phase" % (key ,phase))
if ((Conf.get(self.prov, 'CONFIG>OPENLDAP_BIND_BASE_DN') == key) and (not bool(re.match("^cn=[a-zA-Z0-9]+(,dc=[a-zA-Z0-9]+)+[a-zA-Z0-9]$", value)))):
Log.debug("Validation failed for %s in %s phase" % (key ,phase))
raise Exception("Validation failed for %s in %s phase" % (key ,phase))
if (key.endswith("server_nodes")):
elif (key.endswith("hostname")):
try:
NetworkV().validate('connectivity',[value])
except Exception:
Log.debug("Validation failed for %s in %s phase" % (key, phase))
raise Exception("Validation failed for %s in %s phase" % (key, phase))
elif (key.endswith("server_nodes")):
if type(value) is str:
value = literal_eval(value)
for node_machine_id in value:
host_name = Conf.get(self.index, f'server_node>{node_machine_id}>hostname')
try:
NetworkV().validate('connectivity',[host_name])
except Exception:
Log.debug("Validation failed for %s>%s>%s in %s phase" % (key, node_machine_id, host_name, phase))
raise Exception("Validation failed for %s>%s>%s in %s phase" % (key, node_machine_id, host_name, phase))
Log.debug("Validation failed for %s in %s phase" % (key, phase))
raise Exception("Validation failed for %s in %s phase" % (key, phase))

def _get_list_of_phases_to_validate(self, phase_name: str):
"""Get list of all the phases which follow hierarchy pattern."""
Expand Down

0 comments on commit 4248ca8

Please sign in to comment.