Trying to fix https://github.com/saltstack/salt/issues/46504 issue.
This commit is contained in:
jfoboss 2018-03-14 16:48:45 +03:00 committed by GitHub
parent 083846fe0e
commit 826a8d3099
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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