Created
December 3, 2013 20:50
-
-
Save domcleal/7777250 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def require_ip_validation? | |
# if it's not managed there's nowhere to specify an IP anyway | |
return false unless managed? | |
# if the CR will provide an IP, then don't validate yet | |
return false if compute? && compute_resource.provided_attributes.keys.include?(:ip) | |
ip_for_dns = (subnet.present? && subnet.dns_id.present?) || (domain.present? && domain.dns_id.present?) | |
ip_for_dhcp = subnet.present? && subnet.dhcp_id.present? | |
ip_for_token = Setting[:token_duration] == 0 && !capabilities.include?(:image) | |
# Any of these conditions will require an IP, so chain with OR | |
ip_for_dns or ip_for_dhcp or ip_for_token | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment