[pmg-devel] [RFC pmg-api 2/4] PMG::Config: refactor dns info collection
Dominik Csapak
d.csapak at proxmox.com
Tue Nov 12 16:45:41 CET 2019
On 11/12/19 3:16 PM, Stoiko Ivanov wrote:
> Create a sub for gathering dns info of the current node (hostname, domainname,
> fqdn) - so we can reuse it.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> src/PMG/Config.pm | 30 +++++++++++++++++++++---------
> 1 file changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 4634bd5..4cbc520 100755
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -1175,13 +1175,31 @@ PVE::INotify::register_file('transport', $transport_map_filename,
>
> # config file generation using templates
>
> +sub get_host_dns_info {
> + my ($self) = @_;
> +
> + my $dnsinfo = {};
> + my $nodename = PVE::INotify::nodename();
> +
> + $dnsinfo->{hostname} = $nodename;
> + my $resolv = PVE::INotify::read_file('resolvconf');
> +
> + my $domain = $resolv->{search} // 'localdomain';
> + $dnsinfo->{domain} = $domain;
> +
> + $dnsinfo->{fqdn} = "$nodename.$domain";
> +
> + return $dnsinfo;
maybe it would make sense to use PVE::Tools::get_fqdn here?
(altough it has different semantics)
but we can do this later still..
More information about the pmg-devel
mailing list