Revision 3e1cdf9f lib/utils.py
b/lib/utils.py | ||
---|---|---|
753 | 753 |
|
754 | 754 |
|
755 | 755 |
def AddEtcHostsEntry(file_name, hostname, ip): |
756 |
""" |
|
756 |
"""Adds an IP address and hostname to /etc/hosts.
|
|
757 | 757 |
|
758 | 758 |
""" |
759 | 759 |
f = open(file_name, 'a+') |
... | ... | |
779 | 779 |
|
780 | 780 |
|
781 | 781 |
def RemoveEtcHostsEntry(file_name, hostname): |
782 |
""" |
|
782 |
"""Removes a hostname from /etc/hosts.
|
|
783 | 783 |
|
784 |
IP addresses without hostnames are removed from the file. |
|
784 | 785 |
""" |
785 | 786 |
fd, tmpname = tempfile.mkstemp(dir=os.path.dirname(file_name)) |
786 | 787 |
try: |
Also available in: Unified diff