diff --git a/doc/source/modules/modules-ini.rst b/doc/source/modules/modules-ini.rst deleted file mode 100644 index 453bb62b4..000000000 --- a/doc/source/modules/modules-ini.rst +++ /dev/null @@ -1,15 +0,0 @@ -============ -Module - ini -============ - - -This module provides for the following ansible plugin: - - * ini - - -.. ansibleautoplugin:: - :module: library/ini.py - :documentation: true - :examples: true - diff --git a/doc/source/modules/modules-validations_read_ini.rst b/doc/source/modules/modules-validations_read_ini.rst new file mode 100644 index 000000000..0265395cd --- /dev/null +++ b/doc/source/modules/modules-validations_read_ini.rst @@ -0,0 +1,15 @@ +============================= +Module - validations_read_ini +============================= + + +This module provides for the following ansible plugin: + + * validations_read_ini + + +.. ansibleautoplugin:: + :module: library/validations_read_ini.py + :documentation: true + :examples: true + diff --git a/library/ini.py b/library/validations_read_ini.py similarity index 95% rename from library/ini.py rename to library/validations_read_ini.py index f763f7f1f..63cc4afbd 100644 --- a/library/ini.py +++ b/library/validations_read_ini.py @@ -16,7 +16,7 @@ # Ansible module to read a value from an Ini file. # Usage: -# - ini: path=/path/to/file.ini section=default key=something +# - validations_read_ini: path=/path/to/file.ini section=default key=something # register: my_ini # # This will read the `path/to/file.ini` file and read the `Hello!` value under: @@ -89,7 +89,7 @@ def get_result(path, section, key, default=None): DOCUMENTATION = ''' --- -module: ini +module: validations_read_ini short_description: Get data from an ini file description: - Get data from an ini file @@ -125,7 +125,7 @@ EXAMPLES = ''' - hosts: webservers tasks: - name: Lookup bar value - ini: path=config.ini section=foo key=bar ignore_missing_file=True + validations_read_ini: path=config.ini section=foo key=bar ignore_missing_file=True ''' diff --git a/roles/ceilometerdb-size/tasks/main.yml b/roles/ceilometerdb-size/tasks/main.yml index c04fcddf7..26340cdae 100644 --- a/roles/ceilometerdb-size/tasks/main.yml +++ b/roles/ceilometerdb-size/tasks/main.yml @@ -11,7 +11,7 @@ name: "tripleo_undercloud_conf_file" - name: Check if telemetry services are enabled - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: enable_telemetry @@ -24,7 +24,7 @@ - name: Get event ttl from panko configuration file become: true - ini: + validations_read_ini: path: "{{ panko_config_file }}" section: database key: "{{ event_ttl_check }}" diff --git a/roles/check-network-gateway/tasks/main.yml b/roles/check-network-gateway/tasks/main.yml index f3a13860a..e29db4230 100644 --- a/roles/check-network-gateway/tasks/main.yml +++ b/roles/check-network-gateway/tasks/main.yml @@ -6,7 +6,7 @@ - name: Get the local_subnet name from the undercloud_conf file become: True - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: local_subnet @@ -15,7 +15,7 @@ - name: Get gateway value from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: "{% if local_subnet.value %}{{ local_subnet.value }}{% else %}ctlplane-subnet{% endif %}" key: gateway @@ -24,7 +24,7 @@ - name: Get local_ip value from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: local_ip diff --git a/roles/container-status/tasks/main.yaml b/roles/container-status/tasks/main.yaml index 1a54e0f46..64271864c 100644 --- a/roles/container-status/tasks/main.yaml +++ b/roles/container-status/tasks/main.yaml @@ -16,7 +16,7 @@ name: "tripleo_undercloud_conf_file" - name: Get container client from undercloud.conf - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/roles/controller-token/tasks/main.yml b/roles/controller-token/tasks/main.yml index 590eca6e8..b01d82b1c 100644 --- a/roles/controller-token/tasks/main.yml +++ b/roles/controller-token/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Fetch token value become: true - ini: + validations_read_ini: path: "{{ keystone_conf_file }}" section: DEFAULT key: admin_token diff --git a/roles/ctlplane-ip-range/tasks/main.yml b/roles/ctlplane-ip-range/tasks/main.yml index 963acd7d9..4d0bfb8fe 100644 --- a/roles/ctlplane-ip-range/tasks/main.yml +++ b/roles/ctlplane-ip-range/tasks/main.yml @@ -6,7 +6,7 @@ - name: Get dhcp_start value from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: ctlplane-subnet key: dhcp_start @@ -16,7 +16,7 @@ - name: Get dhcp_end value from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: ctlplane-subnet key: dhcp_end diff --git a/roles/dhcp-validations/tasks/dhcp-introspection.yaml b/roles/dhcp-validations/tasks/dhcp-introspection.yaml index 90066efa2..37ac6df46 100644 --- a/roles/dhcp-validations/tasks/dhcp-introspection.yaml +++ b/roles/dhcp-validations/tasks/dhcp-introspection.yaml @@ -1,7 +1,7 @@ --- - name: Look up the introspection interface become: True - ini: + validations_read_ini: path: "{{ ironic_inspector_conf }}" section: iptables key: dnsmasq_interface @@ -9,7 +9,7 @@ - name: Look up the introspection interface from the deprecated option become: True - ini: + validations_read_ini: path: "{{ ironic_inspector_conf }}" section: firewall key: dnsmasq_interface diff --git a/roles/dhcp-validations/tasks/dhcp-provisioning.yaml b/roles/dhcp-validations/tasks/dhcp-provisioning.yaml index b8bb7bafe..c1addddae 100644 --- a/roles/dhcp-validations/tasks/dhcp-provisioning.yaml +++ b/roles/dhcp-validations/tasks/dhcp-provisioning.yaml @@ -3,7 +3,7 @@ hiera: name="tripleo_undercloud_conf_file" - name: Gather undercloud.conf values - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: local_interface diff --git a/roles/image-serve/tasks/main.yaml b/roles/image-serve/tasks/main.yaml index 11d717990..eeb52352b 100644 --- a/roles/image-serve/tasks/main.yaml +++ b/roles/image-serve/tasks/main.yaml @@ -6,7 +6,7 @@ - name: Get local_ip value from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: local_ip diff --git a/roles/neutron-sanity-check/tasks/main.yml b/roles/neutron-sanity-check/tasks/main.yml index 33e253aec..19081a17d 100644 --- a/roles/neutron-sanity-check/tasks/main.yml +++ b/roles/neutron-sanity-check/tasks/main.yml @@ -14,7 +14,7 @@ - name: Get the Container CLI from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/roles/no-op-firewall-nova-driver/tasks/main.yml b/roles/no-op-firewall-nova-driver/tasks/main.yml index 40cf1e522..15899cfba 100644 --- a/roles/no-op-firewall-nova-driver/tasks/main.yml +++ b/roles/no-op-firewall-nova-driver/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Read the `firewall_driver` value become: true - ini: + validations_read_ini: path: "{{ nova_conf_path }}" section: DEFAULT key: firewall_driver diff --git a/roles/node-disks/tasks/main.yml b/roles/node-disks/tasks/main.yml index 8aa9cc9ad..30f73291d 100644 --- a/roles/node-disks/tasks/main.yml +++ b/roles/node-disks/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Get Ironic Inspector swift auth_url become: true - ini: + validations_read_ini: path: "{{ ironic_conf_file }}" section: inspector key: auth_url @@ -9,7 +9,7 @@ - name: Get Ironic Inspector swift password become: true - ini: + validations_read_ini: path: "{{ ironic_conf_file }}" section: inspector key: password diff --git a/roles/nova-event-callback/tasks/main.yml b/roles/nova-event-callback/tasks/main.yml index 7108ef3b1..d2924cd8a 100644 --- a/roles/nova-event-callback/tasks/main.yml +++ b/roles/nova-event-callback/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Get VIF Plugging setting values from nova.conf become: True - ini: + validations_read_ini: path: "{{ nova_config_file }}" section: DEFAULT key: "{{ item }}" @@ -29,7 +29,7 @@ - name: Get auth_url value from neutron.conf become: True - ini: + validations_read_ini: path: "{{ neutron_config_file }}" section: nova key: auth_url @@ -46,7 +46,7 @@ - name: Get Notify Nova settings values from neutron.conf become: True - ini: + validations_read_ini: path: "{{ neutron_config_file }}" section: DEFAULT key: "{{ item }}" @@ -64,7 +64,7 @@ - name: Get Tenant Name setting value from neutron.conf become: True - ini: + validations_read_ini: path: "{{ neutron_config_file }}" section: nova key: "{{ tenant_name_check }}" diff --git a/roles/switch-vlans/tasks/main.yml b/roles/switch-vlans/tasks/main.yml index f80d2c214..bd8d8afad 100644 --- a/roles/switch-vlans/tasks/main.yml +++ b/roles/switch-vlans/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Get Ironic Inspector swift auth_url become: true - ini: + validations_read_ini: path: "{{ ironic_inspector_conf_file }}" section: swift key: auth_url @@ -9,7 +9,7 @@ - name: Get Ironic Inspector swift password become: true - ini: + validations_read_ini: path: "{{ ironic_inspector_conf_file }}" section: swift key: password diff --git a/roles/tls-everywhere/tasks/common.yaml b/roles/tls-everywhere/tasks/common.yaml index 8de49770a..fca236fb5 100644 --- a/roles/tls-everywhere/tasks/common.yaml +++ b/roles/tls-everywhere/tasks/common.yaml @@ -123,7 +123,7 @@ # running the playbook. We assume that all of the hosts are in the same realm, so # this is not a problem for now. - name: Set fact for IdM/FreeIPA realm - ini: + validations_read_ini: path: "/etc/ipa/default.conf" section: global key: realm diff --git a/roles/tls-everywhere/tasks/pre-deployment-containerized.yaml b/roles/tls-everywhere/tasks/pre-deployment-containerized.yaml index 3148aa996..51768c4fa 100644 --- a/roles/tls-everywhere/tasks/pre-deployment-containerized.yaml +++ b/roles/tls-everywhere/tasks/pre-deployment-containerized.yaml @@ -17,7 +17,7 @@ - name: Get novajoin keytab path from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: keytab @@ -27,7 +27,7 @@ - name: Get novajoin server port from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: join_listen_port @@ -37,7 +37,7 @@ - name: Get novajoin server host from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: join_listen diff --git a/roles/tls-everywhere/tasks/pre-deployment-non-containerized.yaml b/roles/tls-everywhere/tasks/pre-deployment-non-containerized.yaml index a59a695a5..549083e8b 100644 --- a/roles/tls-everywhere/tasks/pre-deployment-non-containerized.yaml +++ b/roles/tls-everywhere/tasks/pre-deployment-non-containerized.yaml @@ -16,7 +16,7 @@ - name: Get novajoin keytab path from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: keytab @@ -26,7 +26,7 @@ - name: Get novajoin server port from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: join_listen_port @@ -36,7 +36,7 @@ - name: Get novajoin server host from join.conf become: true - ini: + validations_read_ini: path: "{{ joinconf_location }}" section: DEFAULT key: join_listen diff --git a/roles/tls-everywhere/tasks/pre-deployment.yaml b/roles/tls-everywhere/tasks/pre-deployment.yaml index 56ec53bf3..e485a7b76 100644 --- a/roles/tls-everywhere/tasks/pre-deployment.yaml +++ b/roles/tls-everywhere/tasks/pre-deployment.yaml @@ -10,7 +10,7 @@ - name: Get the Container CLI from the undercloud.conf file (stein+) become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/roles/tls-everywhere/tasks/prep.yaml b/roles/tls-everywhere/tasks/prep.yaml index 182f5c463..d2e653e2d 100644 --- a/roles/tls-everywhere/tasks/prep.yaml +++ b/roles/tls-everywhere/tasks/prep.yaml @@ -7,7 +7,7 @@ - name: Verify that nameservers are set in undercloud.conf become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: undercloud_nameservers @@ -56,7 +56,7 @@ - name: Get domain as set in undercloud.conf become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: overcloud_domain_name @@ -92,7 +92,7 @@ - name: Get enable_novajoin flag from undercloud.conf become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: enable_novajoin diff --git a/roles/undercloud-debug/README.md b/roles/undercloud-debug/README.md index 39217d8c7..71a2be0df 100644 --- a/roles/undercloud-debug/README.md +++ b/roles/undercloud-debug/README.md @@ -18,7 +18,7 @@ Role Variables Dependencies ------------ -- 'ini' custom plugin +- 'validations_read_ini' custom plugin Example Playbook ---------------- diff --git a/roles/undercloud-debug/tasks/main.yml b/roles/undercloud-debug/tasks/main.yml index 43add3454..69e8cfcf1 100644 --- a/roles/undercloud-debug/tasks/main.yml +++ b/roles/undercloud-debug/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Check the services for debug flag become: True - ini: + validations_read_ini: path: "{{ item }}" section: DEFAULT key: debug diff --git a/roles/undercloud-heat-purge-deleted/tasks/main.yml b/roles/undercloud-heat-purge-deleted/tasks/main.yml index fba1b07c2..e340c9445 100644 --- a/roles/undercloud-heat-purge-deleted/tasks/main.yml +++ b/roles/undercloud-heat-purge-deleted/tasks/main.yml @@ -5,7 +5,7 @@ - name: Get the Container CLI from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/roles/undercloud-process-count/tasks/main.yml b/roles/undercloud-process-count/tasks/main.yml index 37e630ffb..690155e5c 100644 --- a/roles/undercloud-process-count/tasks/main.yml +++ b/roles/undercloud-process-count/tasks/main.yml @@ -6,7 +6,7 @@ - name: Get the Container CLI from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/roles/undercloud-tokenflush/tasks/main.yml b/roles/undercloud-tokenflush/tasks/main.yml index cf834f0ed..4db7c4580 100644 --- a/roles/undercloud-tokenflush/tasks/main.yml +++ b/roles/undercloud-tokenflush/tasks/main.yml @@ -5,7 +5,7 @@ - name: Get the Container CLI from the undercloud.conf file become: true - ini: + validations_read_ini: path: "{{ tripleo_undercloud_conf_file }}" section: DEFAULT key: container_cli diff --git a/tripleo_validations/tests/library/test_ini.py b/tripleo_validations/tests/library/test_validations_read_ini.py similarity index 87% rename from tripleo_validations/tests/library/test_ini.py rename to tripleo_validations/tests/library/test_validations_read_ini.py index d4d240612..ea6637015 100644 --- a/tripleo_validations/tests/library/test_ini.py +++ b/tripleo_validations/tests/library/test_validations_read_ini.py @@ -13,17 +13,17 @@ # under the License. """ -test_ini +test_validations_read_ini ---------------------------------- -Tests for `ini` module. +Tests for `validations_read_ini` module. """ import os import tempfile -import library.ini as validation +import library.validations_read_ini as validation from tripleo_validations.tests import base @@ -45,24 +45,24 @@ password=1234 ''' -class TestIni(base.TestCase): +class TestValidationsReadIni(base.TestCase): def test_check_file_invalid_path(self): - '''Test ini when path is invalid''' + '''Test validations_read_ini when path is invalid''' msg = validation.check_file('non/existing/path', False) self.assertEqual("Could not open the ini file: 'non/existing/path'", msg) def test_check_file_ignore_missing(self): - '''Test ini when ignoring missing files''' + '''Test validations_read_ini when ignoring missing files''' msg = validation.check_file('non/existing/path', True) self.assertEqual("Could not open the ini file: 'non/existing/path'", msg) def test_check_file_valid_path(self): - '''Test ini when path is valid''' + '''Test validations_read_ini when path is valid''' tmpfile = self.create_tmp_ini() tmp_name = os.path.relpath(tmpfile.name) @@ -72,7 +72,7 @@ class TestIni(base.TestCase): self.assertEqual('', msg) def test_get_result_invalid_format(self): - '''Test ini when file format is valid''' + '''Test validations_read_ini when file format is valid''' tmpfile = self.create_tmp_ini() tmp_name = os.path.relpath(tmpfile.name) @@ -87,7 +87,7 @@ class TestIni(base.TestCase): self.assertIsNone(value) def test_get_result_key_not_found(self): - '''Test ini when key is not found''' + '''Test validations_read_ini when key is not found''' tmpfile = self.create_tmp_ini() tmp_name = os.path.relpath(tmpfile.name) @@ -102,7 +102,7 @@ class TestIni(base.TestCase): self.assertIsNone(value) def test_get_result_key_not_found_with_default(self): - '''Test ini when key is not found but has a default''' + '''Test validations_read_ini when key is not found but has a default''' tmpfile = self.create_tmp_ini() tmp_name = os.path.relpath(tmpfile.name) @@ -119,7 +119,7 @@ class TestIni(base.TestCase): self.assertEqual(value, 'foo') def test_get_result_ok(self): - '''Test ini when key is not found''' + '''Test validations_read_ini when key is not found''' tmpfile = self.create_tmp_ini() tmp_name = os.path.relpath(tmpfile.name)