Skip to content

Commit

Permalink
Validate the IP addresses when generating a CNF
Browse files Browse the repository at this point in the history
Before adding IP addresses to the CNF validate the entry is an IP
address using the `ipaddr` filter.

Change-Id: I9151b8118b92991b394c0fa7d81d407439f0f3c1
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
  • Loading branch information
cloudnull committed Jan 26, 2019
1 parent 926695f commit 78221b1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ subjectAltName = @alt_names
{% set _skydive_ip = hostvars[node]['skydive_bind_address'] | default(hostvars[node]["ansible_" ~ _ansible_interface_name]['ipv4']['address']) %}
{% set _skydive_ansible_domain = hostvars[node]['ansible_fqdn'] | default(hostvars[node]['ansible_hostname'] ) %}
{% set _skydive_dns_name = ((_skydive_ansible_domain | length) > 0) | ternary(_skydive_ansible_domain, hostvars[node]['ansible_hostname']) %}
{% set _ = ips.append(_skydive_ip) %}
{% if _skydive_ip | ipaddr %}
{% set _ = ips.append(_skydive_ip) %}
{% endif %}
{% set _ = hostnames.append(_skydive_dns_name) %}
{% if _skydive_ip | ipaddr %}
IP.{{ loop.index }} = {{ _skydive_ip }}
{% endif %}
DNS.{{ loop.index }} = {{ _skydive_dns_name }}
{% endif %}
{% endfor %}
Expand Down

0 comments on commit 78221b1

Please sign in to comment.