Skip to content

Commit

Permalink
remote/exporter: Add option to default to fqdn for hostname
Browse files Browse the repository at this point in the history
In distributed setups, the coordinator may point to exporters/places
in different subnets. In order for clients to resolve resources behind
the exporter, they need to know its FQDN instead of just the hostname.

Using an option to change the default avoids conflicts for configs which
rely on the hostname only.

Signed-off-by: Andreas Naumann <[email protected]>
  • Loading branch information
legraps committed Nov 15, 2023
1 parent d08687c commit 6fb3fa2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion labgrid/remote/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,12 @@ def main():
default=None,
help='hostname (or IP) published for accessing resources (defaults to the system hostname)'
)
parser.add_argument(
'--fqdn',
action='store_true',
default=False,
help='Use fully qualified domain name as default for hostname'
)
parser.add_argument(
'-d',
'--debug',
Expand Down Expand Up @@ -943,7 +949,7 @@ def main():

extra = {
'name': args.name or gethostname(),
'hostname': args.hostname or gethostname(),
'hostname': args.hostname or getfqdn() if args.fqdn else gethostname(),
'resources': args.resources,
'isolated': args.isolated
}
Expand Down
8 changes: 8 additions & 0 deletions man/labgrid-exporter.1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ the public name of the exporter
.B \-\-hostname
hostname (or IP) published for accessing resources
.TP
.B \-\-fqdn
use fully qualified domain name as default for hostname
.TP
.B \-d\fP,\fB \-\-debug
enable debug mode
.UNINDENT
Expand All @@ -83,6 +86,11 @@ exporter needs to provide a host name to set the exported value of the \(dqhost\
key.
If the system hostname is not resolvable via DNS, this option can be used to
override this default with another name (or an IP address).
.SS \-\-fqdn
.sp
In some networks the fully qualified domain name may be needed to reach resources
on an exporter. This option changes the default to fqdn when no \-\-hostname is
explicitly set.
.SH CONFIGURATION
.sp
The exporter uses a YAML configuration file which defines groups of related
Expand Down
8 changes: 8 additions & 0 deletions man/labgrid-exporter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ OPTIONS
the public name of the exporter
--hostname
hostname (or IP) published for accessing resources
--fqdn
use fully qualified domain name as default for hostname
-d, --debug
enable debug mode

Expand Down Expand Up @@ -73,6 +75,12 @@ key.
If the system hostname is not resolvable via DNS, this option can be used to
override this default with another name (or an IP address).

--fqdn
~~~~~~
In some networks the fully qualified domain name may be needed to reach resources
on an exporter. This option changes the default to fqdn when no --hostname is
explicitly set.

CONFIGURATION
-------------
The exporter uses a YAML configuration file which defines groups of related
Expand Down

0 comments on commit 6fb3fa2

Please sign in to comment.