module documentation

Utility functions for manipulating /etc/hosts.

Function AddHostToEtcHosts Wrapper around SetEtcHostsEntry.
Function RemoveEtcHostsEntry Removes a hostname from /etc/hosts.
Function RemoveHostFromEtcHosts Wrapper around RemoveEtcHostsEntry.
Function SetEtcHostsEntry Sets the name of an IP address and hostname in /etc/hosts.
def AddHostToEtcHosts(hostname, ip):

Wrapper around SetEtcHostsEntry.

Parameters
hostname:stra hostname that will be resolved and added to pathutils.ETC_HOSTS
ip:strThe ip address of the host
def RemoveEtcHostsEntry(file_name, hostname):

Removes a hostname from /etc/hosts.

IP addresses without names are removed from the file.

Parameters
file_name:strpath to the file to modify (usually /etc/hosts)
hostname:strthe hostname to be removed
def RemoveHostFromEtcHosts(hostname):

Wrapper around RemoveEtcHostsEntry.

Parameters
hostname:strhostname that will be resolved and its full and shot name will be removed from pathutils.ETC_HOSTS
def SetEtcHostsEntry(file_name, ip, hostname, aliases):

Sets the name of an IP address and hostname in /etc/hosts.

Parameters
file_name:strpath to the file to modify (usually /etc/hosts)
ip:strthe IP address
hostname:strthe hostname to be added
aliases:listthe list of aliases to add for the hostname