Fix issue where tests would fail if public DNS settings are not set (#38)

Signed-off-by: Seth Thoenen <seththoenen@gmail.com>
This commit is contained in:
Seth Thoenen 2017-10-08 16:08:23 -05:00 committed by Christoph Hartmann
parent 2a03c37bb7
commit fc43e87ee2

View file

@ -308,9 +308,14 @@ class AzureVm < Inspec.resource(1)
# Interrogate Azure for the NIC details
public_ip = helpers.network_mgmt.client.public_ipaddresses.get(public_ip_resource_group_name, public_ip_name)
# update the config with the information about the public IP
config['public_ipaddress']['domain_name_label'] = public_ip.dns_settings.domain_name_label
config['public_ipaddress']['dns_fqdn'] = public_ip.dns_settings.fqdn
# update the config with the information about the public IP if public dns settings are available
if !public_ip.dns_settings.nil?
config['public_ipaddress']['domain_name_label'] = public_ip.dns_settings.domain_name_label
config['public_ipaddress']['dns_fqdn'] = public_ip.dns_settings.fqdn
else
config['public_ipaddress']['domain_name_label'] = nil
config['public_ipaddress']['dns_fqdn'] = nil
end
end
# return object