mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Remove host entry if it is the last alias
This commit is contained in:
parent
782574b58e
commit
b0fe7c8647
1 changed files with 4 additions and 1 deletions
|
@ -122,7 +122,10 @@ def rm_host(ip, alias):
|
|||
if existing == alias:
|
||||
continue
|
||||
newline += '\t' + existing
|
||||
lines[ind] = newline
|
||||
if newline.strip() == ip:
|
||||
lines[ind] = ''
|
||||
else:
|
||||
lines[ind] = newline
|
||||
open(hfn, 'w+').writelines(lines)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue