Revision d9c02ca6 lib/utils.py
b/lib/utils.py | ||
---|---|---|
781 | 781 |
raise |
782 | 782 |
|
783 | 783 |
|
784 |
def AddHostToEtcHosts(hostname): |
|
785 |
"""Wrapper around SetEtcHostsEntry. |
|
786 |
|
|
787 |
""" |
|
788 |
hi = HostInfo(name=hostname) |
|
789 |
SetEtcHostsEntry(constants.ETC_HOSTS, hi.ip, hi.name, [hi.ShortName()]) |
|
790 |
|
|
791 |
|
|
784 | 792 |
def RemoveEtcHostsEntry(file_name, hostname): |
785 | 793 |
"""Removes a hostname from /etc/hosts. |
786 | 794 |
|
... | ... | |
817 | 825 |
raise |
818 | 826 |
|
819 | 827 |
|
828 |
def RemoveHostFromEtcHosts(hostname): |
|
829 |
"""Wrapper around RemoveEtcHostsEntry. |
|
830 |
|
|
831 |
""" |
|
832 |
hi = HostInfo(name=hostname) |
|
833 |
RemoveEtcHostsEntry(constants.ETC_HOSTS, hi.name) |
|
834 |
RemoveEtcHostsEntry(constants.ETC_HOSTS, hi.ShortName()) |
|
835 |
|
|
836 |
|
|
820 | 837 |
def CreateBackup(file_name): |
821 | 838 |
"""Creates a backup of a file. |
822 | 839 |
|
Also available in: Unified diff