mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-02 20:24:23 -07:00
* Fix #9538 Inventory iocage fails when DHCP is enbled. * Add changelog fragment 9539-iocage-inventory-dhcp.yml * Keep iocage_ip4 a string. * Rename the variable iocage_ip4 to iocage_ip4_dict in _parse_ip4. * Update the changelog fragment. * Rename _parse_ip4 parameter ip4_addr to ip4. * Fix changelog frangment present tense. * If IP is not available set iocage_ip4='-' instead of the empty string. * Update changelogs/fragments/9539-iocage-inventory-dhcp.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
d325cfc343
commit
94d5256adb
28 changed files with 243 additions and 17 deletions
|
@ -5,6 +5,12 @@ all:
|
|||
test_101:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.101
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.101
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -157,6 +163,12 @@ all:
|
|||
test_102:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.102
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.102
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -309,6 +321,12 @@ all:
|
|||
test_103:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.103
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.103
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
|
@ -0,0 +1,9 @@
|
|||
+------+----------+------+-------+------+-----------------+---------------------+-----+----------------+----------+
|
||||
| JID | NAME | BOOT | STATE | TYPE | RELEASE | IP4 | IP6 | TEMPLATE | BASEJAIL |
|
||||
+======+==========+======+=======+======+=================+=====================+=====+================+==========+
|
||||
| - | test_101 | off | down | jail | 13.4-RELEASE-p2 | vnet0|10.1.0.101/24 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+-----+
|
||||
| - | test_102 | off | down | jail | 13.4-RELEASE-p2 | vnet0|10.1.0.102/24 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+-----+
|
||||
| - | test_103 | off | down | jail | 13.4-RELEASE-p2 | vnet0|10.1.0.103/24 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+-----+
|
|
@ -3,6 +3,12 @@ _meta:
|
|||
test_101:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.101
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.101
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -13,6 +19,12 @@ _meta:
|
|||
test_102:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.102
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.102
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -23,6 +35,12 @@ _meta:
|
|||
test_103:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.103
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.103
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
|
@ -0,0 +1,9 @@
|
|||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| JID | NAME | BOOT | STATE | TYPE | RELEASE | IP4 | IP6 | TEMPLATE | BASEJAIL |
|
||||
+======+================+======+=======+======+=================+====================+=====+================+==========+
|
||||
| 268 | test_111 | off | up | jail | 14.1-RELEASE-p6 | epair0b|10.1.0.174 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| 269 | test_112 | off | up | jail | 14.1-RELEASE-p6 | epair0b|10.1.0.147 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| 270 | test_113 | off | up | jail | 14.1-RELEASE-p6 | epair0b|10.1.0.231 | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
|
@ -0,0 +1,50 @@
|
|||
_meta:
|
||||
hostvars:
|
||||
test_111:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: epair0b
|
||||
ip: 10.1.0.174
|
||||
mask: '-'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.174
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '268'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: up
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
||||
test_112:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: epair0b
|
||||
ip: 10.1.0.147
|
||||
mask: '-'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.147
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '269'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: up
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
||||
test_113:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: epair0b
|
||||
ip: 10.1.0.231
|
||||
mask: '-'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.231
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '270'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: up
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
|
@ -0,0 +1,9 @@
|
|||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| JID | NAME | BOOT | STATE | TYPE | RELEASE | IP4 | IP6 | TEMPLATE | BASEJAIL |
|
||||
+======+================+======+=======+======+=================+====================+=====+================+==========+
|
||||
| None | test_111 | off | down | jail | 14.1-RELEASE-p6 | DHCP (not running) | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| None | test_112 | off | down | jail | 14.1-RELEASE-p6 | DHCP (not running) | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
||||
| None | test_113 | off | down | jail | 14.1-RELEASE-p6 | DHCP (not running) | - | ansible_client | yes |
|
||||
+------+----------------+------+-------+------+-----------------+--------------------+-----+----------------+----------+
|
|
@ -0,0 +1,41 @@
|
|||
_meta:
|
||||
hostvars:
|
||||
test_111:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4: []
|
||||
msg: 'DHCP (not running)'
|
||||
iocage_ip4: '-'
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: 'None'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: down
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
||||
test_112:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4: []
|
||||
msg: 'DHCP (not running)'
|
||||
iocage_ip4: '-'
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: 'None'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: down
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
||||
test_113:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4: []
|
||||
msg: 'DHCP (not running)'
|
||||
iocage_ip4: '-'
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: 'None'
|
||||
iocage_release: 14.1-RELEASE-p6
|
||||
iocage_state: down
|
||||
iocage_template: ansible_client
|
||||
iocage_type: jail
|
|
@ -3,6 +3,12 @@ _meta:
|
|||
test_101:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.101
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.101
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -155,6 +161,12 @@ _meta:
|
|||
test_102:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.102
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.102
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
||||
|
@ -307,6 +319,12 @@ _meta:
|
|||
test_103:
|
||||
iocage_basejail: 'yes'
|
||||
iocage_boot: 'off'
|
||||
iocage_ip4_dict:
|
||||
ip4:
|
||||
- ifc: vnet0
|
||||
ip: 10.1.0.103
|
||||
mask: '24'
|
||||
msg: ''
|
||||
iocage_ip4: 10.1.0.103
|
||||
iocage_ip6: '-'
|
||||
iocage_jid: '-'
|
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1,3 +0,0 @@
|
|||
- test_101 off down jail 13.4-RELEASE-p2 vnet0|10.1.0.101/24 - ansible_client yes
|
||||
- test_102 off down jail 13.4-RELEASE-p2 vnet0|10.1.0.102/24 - ansible_client yes
|
||||
- test_103 off down jail 13.4-RELEASE-p2 vnet0|10.1.0.103/24 - ansible_client yes
|
|
@ -20,14 +20,18 @@ def inventory():
|
|||
inv = InventoryModule()
|
||||
inv.inventory = InventoryData()
|
||||
inv.templar = Templar(None)
|
||||
inv.jails = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage_jails.txt')
|
||||
inv.js_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage_jails.yml')
|
||||
prpts_101 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage_properties_test_101.txt')
|
||||
prpts_102 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage_properties_test_102.txt')
|
||||
prpts_103 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage_properties_test_103.txt')
|
||||
inv.jails = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails.txt')
|
||||
inv.js_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails.yml')
|
||||
inv.jails_dhcp = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails_dhcp.txt')
|
||||
inv.js_dhcp_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails_dhcp.yml')
|
||||
inv.jails_dhcp_nr = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails_dhcp_not_running.txt')
|
||||
inv.js_dhcp_nr_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_jails_dhcp_not_running.yml')
|
||||
prpts_101 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_properties_test_101.txt')
|
||||
prpts_102 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_properties_test_102.txt')
|
||||
prpts_103 = load_txt_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_properties_test_103.txt')
|
||||
inv.prpts = {'test_101': prpts_101, 'test_102': prpts_102, 'test_103': prpts_103}
|
||||
inv.ps_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage_properties.yml')
|
||||
inv.ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage_inventory.yml')
|
||||
inv.ps_ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_properties.yml')
|
||||
inv.ok = load_yml_data('tests/unit/plugins/inventory/fixtures/iocage/iocage_inventory.yml')
|
||||
return inv
|
||||
|
||||
|
||||
|
@ -72,10 +76,22 @@ def test_verify_file(tmp_path, inventory):
|
|||
|
||||
|
||||
def test_get_jails(inventory):
|
||||
|
||||
# jails
|
||||
results = {'_meta': {'hostvars': {}}}
|
||||
inventory.get_jails(inventory.jails, results)
|
||||
assert results == inventory.js_ok
|
||||
|
||||
# jails_dhcp
|
||||
results = {'_meta': {'hostvars': {}}}
|
||||
inventory.get_jails(inventory.jails_dhcp, results)
|
||||
assert results == inventory.js_dhcp_ok
|
||||
|
||||
# jails_dhcp_not_running
|
||||
results = {'_meta': {'hostvars': {}}}
|
||||
inventory.get_jails(inventory.jails_dhcp_nr, results)
|
||||
assert results == inventory.js_dhcp_nr_ok
|
||||
|
||||
|
||||
def test_get_properties(inventory):
|
||||
results = {'_meta': {'hostvars': {}}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue