Fix auth_url

This patch fixes aut_url to work with v3 natively.
Also unhardcode options in ilo section

Change-Id: Ie7da01acb39bb9bc75d1bbd8b659ea020d962b72
diff --git a/ironic/files/ocata/ironic.conf b/ironic/files/ocata/ironic.conf
index 0509bad..2910ed2 100644
--- a/ironic/files/ocata/ironic.conf
+++ b/ironic/files/ocata/ironic.conf
@@ -1494,7 +1494,7 @@
 
 # Authentication URL (string value)
 {%- if conductor.get('glance', {}).get('auth_strategy') == 'keystone' %}
-auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}/identity
+auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}
 {%- if conductor.identity.protocol == 'https' %}
 cafile={{ conductor.identity.get('cacert_file', conductor.cacert_file) }}
 {%- endif %}
@@ -1761,19 +1761,36 @@
 #
 
 # Timeout (in seconds) for iLO operations (integer value)
+{%- if conductor.get('ilo', {}).get('client_timeout') %}
+client_timeout = {{ conductor.ilo.client_timeout }}
+{%- else %}
 #client_timeout = 60
+{%- endif %}
 
 # Port to be used for iLO operations (port value)
 # Minimum value: 0
 # Maximum value: 65535
+{%- if conductor.get('ilo', {}).get('client_port') %}
+client_port = {{ conductor.ilo.client_port }}
+{%- else %}
 #client_port = 443
+{%- endif %}
+
 
 # The Swift iLO container to store data. (string value)
+{%- if conductor.get('ilo', {}).get('swift_ilo_container') %}
+swift_ilo_container = {{ conductor.ilo.swift_ilo_container }}
+{%- else %}
 #swift_ilo_container = ironic_ilo_container
+{%- endif %}
 
 # Amount of time in seconds for Swift objects to auto-expire.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('swift_object_expiry_timeout') %}
+swift_object_expiry_timeout = {{ conductor.ilo.swift_object_expiry_timeout }}
+{%- else %}
 #swift_object_expiry_timeout = 900
+{%- endif %}
 
 # Set this to True to use http web server to host floppy
 # images and generated boot ISO. This requires http_root and
@@ -1781,7 +1798,11 @@
 # config file. If this is set to False, then Ironic will use
 # Swift to host the floppy images and generated boot_iso.
 # (boolean value)
+{%- if conductor.get('ilo', {}).get('use_web_server_for_images') %}
+use_web_server_for_images = {{ conductor.ilo.use_web_server_for_images }}
+{%- else %}
 #use_web_server_for_images = false
+{%- endif %}
 
 # DEPRECATED: Priority for erase devices clean step. If unset,
 # it defaults to 10. If set to 0, the step will be disabled
@@ -1790,40 +1811,77 @@
 # Its value may be silently ignored in the future.
 # Reason: This configuration option is duplicated by [deploy]
 # erase_devices_priority, please use that instead.
+{%- if conductor.get('ilo', {}).get('clean_priority_erase_devices') %}
+clean_priority_erase_devices = {{ conductor.ilo.clean_priority_erase_devices }}
+{%- else %}
 #clean_priority_erase_devices = <None>
+{%- endif %}
 
 # Priority for reset_ilo clean step. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo') %}
+clean_priority_reset_ilo = {{ conductor.ilo.clean_priority_reset_ilo }}
+{%- else %}
 #clean_priority_reset_ilo = 0
+{%- endif %}
 
 # Priority for reset_bios_to_default clean step. (integer
 # value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_bios_to_default') %}
+clean_priority_reset_bios_to_default = {{ conductor.ilo.clean_priority_reset_bios_to_default }}
+{%- else %}
 #clean_priority_reset_bios_to_default = 10
+{%- endif %}
 
 # Priority for reset_secure_boot_keys clean step. This step
 # will reset the secure boot keys to manufacturing defaults.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_secure_boot_keys_to_default') %}
+clean_priority_reset_secure_boot_keys_to_default = {{ conductor.ilo.clean_priority_reset_secure_boot_keys_to_default }}
+{%- else %}
 #clean_priority_reset_secure_boot_keys_to_default = 20
+{%- endif %}
 
 # Priority for clear_secure_boot_keys clean step. This step is
 # not enabled by default. It can be enabled to clear all
 # secure boot keys enrolled with iLO. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_clear_secure_boot_keys') %}
+clean_priority_clear_secure_boot_keys = {{ conductor.ilo.clean_priority_clear_secure_boot_keys }}
+{%- else %}
 #clean_priority_clear_secure_boot_keys = 0
+{%- endif %}
+
 
 # Priority for reset_ilo_credential clean step. This step
 # requires "ilo_change_password" parameter to be updated in
 # nodes's driver_info with the new password. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo_credential') %}
+clean_priority_reset_ilo_credential = {{ conductor.ilo.clean_priority_reset_ilo_credential }}
+{%- else %}
 #clean_priority_reset_ilo_credential = 30
+{%- endif %}
 
 # Number of times a power operation needs to be retried
 # (integer value)
+{%- if conductor.get('ilo', {}).get('power_retry') %}
+power_retry = {{ conductor.ilo.power_retry }}
+{%- else %}
 #power_retry = 6
+{%- endif %}
 
 # Amount of time in seconds to wait in between power
 # operations (integer value)
+{%- if conductor.get('ilo', {}).get('power_wait') %}
+power_wait = {{ conductor.ilo.power_wait }}
+{%- else %}
 #power_wait = 2
+{%- endif %}
 
 # CA certificate file to validate iLO. (string value)
+{%- if conductor.get('ilo', {}).get('ca_file') %}
+ca_file = {{ conductor.ilo.ca_file }}
+{%- else %}
 #ca_file = <None>
+{%- endif %}
 
 # Default boot mode to be used in provisioning when
 # "boot_mode" capability is not provided in the
@@ -1832,7 +1890,11 @@
 # default boot mode will be selected based on boot mode
 # settings on the system. (string value)
 # Allowed values: auto, bios, uefi
+{%- if conductor.get('ilo', {}).get('default_boot_mode') %}
+default_boot_mode = {{ conductor.ilo.default_boot_mode }}
+{%- else %}
 #default_boot_mode = auto
+{%- endif %}
 
 
 [inspector]
@@ -2069,7 +2131,7 @@
 
 # Authentication URL (string value)
 {%- if ironic.get('identity', {}).get('engine') == 'keystone' %}
-auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}/identity
+auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}
 {%- if ironic.identity.protocol == 'https' %}
 cafile={{ ironic.identity.get('cacert_file', ironic.cacert_file) }}
 {%- endif %}
@@ -2536,7 +2598,7 @@
 
 # Authentication URL (string value)
 {%- if conductor.get('neutron', {}).get('auth_strategy') == 'keystone' %}
-auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}/identity
+auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}
 {%- if conductor.identity.protocol == 'https' %}
 cafile={{ conductor.identity.get('cacert_file', conductor.cacert_file) }}
 {%- endif %}
@@ -3697,7 +3759,7 @@
 
 # Authentication URL (string value)
 {%- if ironic.get('identity', {}).get('engine') == 'keystone' %}
-auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}/identity
+auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}
 {%- if ironic.identity.protocol == 'https' %}
 cafile={{ ironic.identity.get('cacert_file', ironic.cacert_file) }}
 {%- endif %}
diff --git a/ironic/files/pike/ironic.conf b/ironic/files/pike/ironic.conf
index 6ae4419..abd8737 100644
--- a/ironic/files/pike/ironic.conf
+++ b/ironic/files/pike/ironic.conf
@@ -1657,7 +1657,7 @@
 
 # Authentication URL (string value)
 {%- if conductor.get('glance', {}).get('auth_strategy') == 'keystone' %}
-auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}/identity
+auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}
 {%- if conductor.identity.protocol == 'https' %}
 cafile={{ conductor.identity.get('cacert_file', conductor.cacert_file) }}
 {%- endif %}
@@ -1924,19 +1924,35 @@
 #
 
 # Timeout (in seconds) for iLO operations (integer value)
+{%- if conductor.get('ilo', {}).get('client_timeout') %}
+client_timeout = {{ conductor.ilo.client_timeout }}
+{%- else %}
 #client_timeout = 60
+{%- endif %}
 
 # Port to be used for iLO operations (port value)
 # Minimum value: 0
 # Maximum value: 65535
+{%- if conductor.get('ilo', {}).get('client_port') %}
+client_port = {{ conductor.ilo.client_port }}
+{%- else %}
 #client_port = 443
+{%- endif %}
 
 # The Swift iLO container to store data. (string value)
+{%- if conductor.get('ilo', {}).get('swift_ilo_container') %}
+swift_ilo_container = {{ conductor.ilo.swift_ilo_container }}
+{%- else %}
 #swift_ilo_container = ironic_ilo_container
+{%- endif %}
 
 # Amount of time in seconds for Swift objects to auto-expire.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('swift_object_expiry_timeout') %}
+swift_object_expiry_timeout = {{ conductor.ilo.swift_object_expiry_timeout }}
+{%- else %}
 #swift_object_expiry_timeout = 900
+{%- endif %}
 
 # Set this to True to use http web server to host floppy
 # images and generated boot ISO. This requires http_root and
@@ -1944,7 +1960,11 @@
 # config file. If this is set to False, then Ironic will use
 # Swift to host the floppy images and generated boot_iso.
 # (boolean value)
+{%- if conductor.get('ilo', {}).get('use_web_server_for_images') %}
+use_web_server_for_images = {{ conductor.ilo.use_web_server_for_images }}
+{%- else %}
 #use_web_server_for_images = false
+{%- endif %}
 
 # DEPRECATED: Priority for erase devices clean step. If unset,
 # it defaults to 10. If set to 0, the step will be disabled
@@ -1953,40 +1973,76 @@
 # Its value may be silently ignored in the future.
 # Reason: This configuration option is duplicated by [deploy]
 # erase_devices_priority, please use that instead.
+{%- if conductor.get('ilo', {}).get('clean_priority_erase_devices') %}
+clean_priority_erase_devices = {{ conductor.ilo.clean_priority_erase_devices }}
+{%- else %}
 #clean_priority_erase_devices = <None>
+{%- endif %}
 
 # Priority for reset_ilo clean step. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo') %}
+clean_priority_reset_ilo = {{ conductor.ilo.clean_priority_reset_ilo }}
+{%- else %}
 #clean_priority_reset_ilo = 0
+{%- endif %}
 
 # Priority for reset_bios_to_default clean step. (integer
 # value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_bios_to_default') %}
+clean_priority_reset_bios_to_default = {{ conductor.ilo.clean_priority_reset_bios_to_default }}
+{%- else %}
 #clean_priority_reset_bios_to_default = 10
+{%- endif %}
 
 # Priority for reset_secure_boot_keys clean step. This step
 # will reset the secure boot keys to manufacturing defaults.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_secure_boot_keys_to_default') %}
+clean_priority_reset_secure_boot_keys_to_default = {{ conductor.ilo.clean_priority_reset_secure_boot_keys_to_default }}
+{%- else %}
 #clean_priority_reset_secure_boot_keys_to_default = 20
+{%- endif %}
 
 # Priority for clear_secure_boot_keys clean step. This step is
 # not enabled by default. It can be enabled to clear all
 # secure boot keys enrolled with iLO. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_clear_secure_boot_keys') %}
+clean_priority_clear_secure_boot_keys = {{ conductor.ilo.clean_priority_clear_secure_boot_keys }}
+{%- else %}
 #clean_priority_clear_secure_boot_keys = 0
+{%- endif %}
 
 # Priority for reset_ilo_credential clean step. This step
 # requires "ilo_change_password" parameter to be updated in
 # nodes's driver_info with the new password. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo_credential') %}
+clean_priority_reset_ilo_credential = {{ conductor.ilo.clean_priority_reset_ilo_credential }}
+{%- else %}
 #clean_priority_reset_ilo_credential = 30
+{%- endif %}
 
 # Number of times a power operation needs to be retried
 # (integer value)
+{%- if conductor.get('ilo', {}).get('power_retry') %}
+power_retry = {{ conductor.ilo.power_retry }}
+{%- else %}
 #power_retry = 6
+{%- endif %}
 
 # Amount of time in seconds to wait in between power
 # operations (integer value)
+{%- if conductor.get('ilo', {}).get('power_wait') %}
+power_wait = {{ conductor.ilo.power_wait }}
+{%- else %}
 #power_wait = 2
+{%- endif %}
 
 # CA certificate file to validate iLO. (string value)
+{%- if conductor.get('ilo', {}).get('ca_file') %}
+ca_file = {{ conductor.ilo.ca_file }}
+{%- else %}
 #ca_file = <None>
+{%- endif %}
 
 # Default boot mode to be used in provisioning when
 # "boot_mode" capability is not provided in the
@@ -1995,7 +2051,11 @@
 # default boot mode will be selected based on boot mode
 # settings on the system. (string value)
 # Allowed values: auto, bios, uefi
+{%- if conductor.get('ilo', {}).get('default_boot_mode') %}
+default_boot_mode = {{ conductor.ilo.default_boot_mode }}
+{%- else %}
 #default_boot_mode = auto
+{%- endif %}
 
 
 [inspector]
@@ -2232,7 +2292,7 @@
 
 # Authentication URL (string value)
 {%- if ironic.get('identity', {}).get('engine') == 'keystone' %}
-auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}/identity
+auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}
 {%- if ironic.identity.protocol == 'https' %}
 cafile={{ ironic.identity.get('cacert_file', ironic.cacert_file) }}
 {%- endif %}
@@ -2699,7 +2759,7 @@
 
 # Authentication URL (string value)
 {%- if conductor.get('neutron', {}).get('auth_strategy') == 'keystone' %}
-auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}/identity
+auth_url = {{ conductor.identity.protocol }}://{{ conductor.identity.host }}:{{ conductor.identity.port }}
 {%- if conductor.identity.protocol == 'https' %}
 cafile={{ conductor.identity.get('cacert_file', conductor.cacert_file) }}
 {%- endif %}
@@ -3825,11 +3885,10 @@
 {%- endif %}
 
 # Bootfile DHCP parameter for UEFI boot mode. (string value)
+#uefi_pxe_bootfile_name = bootx64.efi
 {%- if ironic.uefi.enabled %}
 {%- if ironic.uefi.pxe_bootfile_name is defined %}
 uefi_pxe_bootfile_name={{ ironic.uefi.pxe_bootfile_name }}
-{%- else %}
-#uefi_pxe_bootfile_name = bootx64.efi
 {%- endif %}
 {%- endif %}
 
@@ -3873,7 +3932,7 @@
 
 # Authentication URL (string value)
 {%- if ironic.get('identity', {}).get('engine') == 'keystone' %}
-auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}/identity
+auth_url = {{ ironic.identity.protocol }}://{{ ironic.identity.host }}:{{ ironic.identity.port }}
 {%- if ironic.identity.protocol == 'https' %}
 cafile={{ ironic.identity.get('cacert_file', ironic.cacert_file) }}
 {%- endif %}
diff --git a/ironic/files/queens/ironic.conf b/ironic/files/queens/ironic.conf
index 0d03817..8a7a949 100644
--- a/ironic/files/queens/ironic.conf
+++ b/ironic/files/queens/ironic.conf
@@ -1586,19 +1586,36 @@
 #
 
 # Timeout (in seconds) for iLO operations (integer value)
+{%- if conductor.get('ilo', {}).get('client_timeout') %}
+client_timeout = {{ conductor.ilo.client_timeout }}
+{%- else %}
 #client_timeout = 60
+{%- endif %}
 
 # Port to be used for iLO operations (port value)
 # Minimum value: 0
 # Maximum value: 65535
+{%- if conductor.get('ilo', {}).get('client_port') %}
+client_port = {{ conductor.ilo.client_port }}
+{%- else %}
 #client_port = 443
+{%- endif %}
+
 
 # The Swift iLO container to store data. (string value)
+{%- if conductor.get('ilo', {}).get('swift_ilo_container') %}
+swift_ilo_container = {{ conductor.ilo.swift_ilo_container }}
+{%- else %}
 #swift_ilo_container = ironic_ilo_container
+{%- endif %}
 
 # Amount of time in seconds for Swift objects to auto-expire.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('swift_object_expiry_timeout') %}
+swift_object_expiry_timeout = {{ conductor.ilo.swift_object_expiry_timeout }}
+{%- else %}
 #swift_object_expiry_timeout = 900
+{%- endif %}
 
 # Set this to True to use http web server to host floppy
 # images and generated boot ISO. This requires http_root and
@@ -1606,40 +1623,78 @@
 # config file. If this is set to False, then Ironic will use
 # Swift to host the floppy images and generated boot_iso.
 # (boolean value)
+{%- if conductor.get('ilo', {}).get('use_web_server_for_images') %}
+use_web_server_for_images = {{ conductor.ilo.use_web_server_for_images }}
+{%- else %}
 #use_web_server_for_images = false
+{%- endif %}
 
 # Priority for reset_ilo clean step. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo') %}
+clean_priority_reset_ilo = {{ conductor.ilo.clean_priority_reset_ilo }}
+{%- else %}
 #clean_priority_reset_ilo = 0
+{%- endif %}
+
 
 # Priority for reset_bios_to_default clean step. (integer
 # value)
 #clean_priority_reset_bios_to_default = 10
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_bios_to_default') %}
+clean_priority_reset_bios_to_default = {{ conductor.ilo.clean_priority_reset_bios_to_default }}
+{%- else %}
+#clean_priority_reset_bios_to_default = 10
+{%- endif %}
 
 # Priority for reset_secure_boot_keys clean step. This step
 # will reset the secure boot keys to manufacturing defaults.
 # (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_secure_boot_keys_to_default') %}
+clean_priority_reset_secure_boot_keys_to_default = {{ conductor.ilo.clean_priority_reset_secure_boot_keys_to_default }}
+{%- else %}
 #clean_priority_reset_secure_boot_keys_to_default = 20
+{%- endif %}
 
 # Priority for clear_secure_boot_keys clean step. This step is
 # not enabled by default. It can be enabled to clear all
 # secure boot keys enrolled with iLO. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_clear_secure_boot_keys') %}
+clean_priority_clear_secure_boot_keys = {{ conductor.ilo.clean_priority_clear_secure_boot_keys }}
+{%- else %}
 #clean_priority_clear_secure_boot_keys = 0
+{%- endif %}
 
 # Priority for reset_ilo_credential clean step. This step
 # requires "ilo_change_password" parameter to be updated in
 # nodes's driver_info with the new password. (integer value)
+{%- if conductor.get('ilo', {}).get('clean_priority_reset_ilo_credential') %}
+clean_priority_reset_ilo_credential = {{ conductor.ilo.clean_priority_reset_ilo_credential }}
+{%- else %}
 #clean_priority_reset_ilo_credential = 30
+{%- endif %}
 
 # Number of times a power operation needs to be retried
 # (integer value)
+{%- if conductor.get('ilo', {}).get('power_retry') %}
+power_retry = {{ conductor.ilo.power_retry }}
+{%- else %}
 #power_retry = 6
+{%- endif %}
 
 # Amount of time in seconds to wait in between power
 # operations (integer value)
+{%- if conductor.get('ilo', {}).get('power_wait') %}
+power_wait = {{ conductor.ilo.power_wait }}
+{%- else %}
 #power_wait = 2
+{%- endif %}
 
 # CA certificate file to validate iLO. (string value)
+{%- if conductor.get('ilo', {}).get('ca_file') %}
+ca_file = {{ conductor.ilo.ca_file }}
+{%- else %}
 #ca_file = <None>
+{%- endif %}
 
 # Default boot mode to be used in provisioning when
 # "boot_mode" capability is not provided in the
@@ -1651,7 +1706,11 @@
 # auto - <No description provided>
 # bios - <No description provided>
 # uefi - <No description provided>
+{%- if conductor.get('ilo', {}).get('default_boot_mode') %}
+default_boot_mode = {{ conductor.ilo.default_boot_mode }}
+{%- else %}
 #default_boot_mode = auto
+{%- endif %}
 
 
 [inspector]
@@ -2363,11 +2422,10 @@
 {%- endif %}
 
 # Bootfile DHCP parameter for UEFI boot mode. (string value)
+#uefi_pxe_bootfile_name = bootx64.efi
 {%- if ironic.uefi.enabled %}
 {%- if ironic.uefi.pxe_bootfile_name is defined %}
 uefi_pxe_bootfile_name={{ ironic.uefi.pxe_bootfile_name }}
-{%- else %}
-#uefi_pxe_bootfile_name = bootx64.efi
 {%- endif %}
 {%- endif %}