mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixing #46504
Trying to fix https://github.com/saltstack/salt/issues/46504 issue.
This commit is contained in:
parent
083846fe0e
commit
826a8d3099
1 changed files with 4 additions and 3 deletions
|
@ -49,8 +49,9 @@ def set_servers(*servers):
|
|||
|
||||
for cmd in server_cmd, reliable_cmd, update_cmd:
|
||||
ret = __salt__['cmd.run'](cmd, python_shell=False)
|
||||
if 'command completed successfully' not in ret:
|
||||
return False
|
||||
|
||||
if not sorted(list(servers)) == get_servers():
|
||||
return False
|
||||
|
||||
__salt__['service.restart'](service_name)
|
||||
return True
|
||||
|
@ -71,7 +72,7 @@ def get_servers():
|
|||
for line in lines:
|
||||
try:
|
||||
if line.startswith('NtpServer:'):
|
||||
_, ntpsvrs = line.rstrip(' (Local)').split(':', 1)
|
||||
_, ntpsvrs = line.rsplit(' (', 1)[0].split(':', 1)
|
||||
return sorted(ntpsvrs.split())
|
||||
except ValueError as e:
|
||||
return False
|
||||
|
|
Loading…
Add table
Reference in a new issue