HostInfo

Description

Sets the NAME, DOMAIN, ADDR4, and ADDR6 properties in the current project.

The NAME contains the host part of the canonical name of the host.
If the host is not found, the host will contain the name as provided to the task, or localhost if no host was provided, and no name for the local host was found.
The DOMAIN contains the domain part of the canonical name of the host.
If the host is not found, the domain will contain the domain as provided to the task, or localdomain if no host / domain was provided.
The ADDR4 contains the IPv4 address of the host with the widest meaning.
If no IPv4 address is found and a host has been provided the address 0.0.0.0 is returned, when no host was provided the address 127.0.0.1 is returned.
The ADDR6 contains the IPv6 address of the host with the widest meaning.
If no IPv6 address is found and a host has been provided the address :: is returned, when no host was provided the address ::1 is returned.

These properties can be used in the build-file, for instance, to create host-stamped filenames, or used to replace placeholder tags inside documents to indicate, for example, the host where the build was performed on. The best place for this task is probably in an initialization target.

Parameters

Attribute Description Required
prefix Prefix used for all properties set. No; defaults to no prefix
host The host to retrieve the information for. No; default is to retrieve information for the host the task is running on

Examples

Set the NAME, DOMAIN, ADDR4, and ADDR6 for the local host, using the most "global" address available.

<hostinfo/>

Set the properties remotehost.NAME to eos, remotehost.DOMAIN to apache.org, remotehost.ADDR4 to 140.211.11.130 and remotehost.ADDR6 to :: for the host with the name www.apache.org (provided the canonical name and IP addresses do not change).

<hostinfo prefix="remotehost" host="www.apache.org"/>