From 64d47ed9d7946c3f8e802b42615730ce93282cd5 Mon Sep 17 00:00:00 2001 From: Adam Byczkowski Date: Tue, 15 Mar 2022 16:09:02 -0500 Subject: [PATCH 1/3] Updated to grab 'host' from primary IP --- plugins/inventory/gql_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inventory/gql_inventory.py b/plugins/inventory/gql_inventory.py index 4746072a..660a0433 100644 --- a/plugins/inventory/gql_inventory.py +++ b/plugins/inventory/gql_inventory.py @@ -177,7 +177,7 @@ def add_variable(self, host: str, var: str, var_type: str): def add_ipv4_address(self, device): """Add primary IPv4 address to host.""" if device["primary_ip4"]: - self.add_variable(device["name"], device["primary_ip4"]["address"], "ansible_host") + self.add_variable(device["name"], device["primary_ip4"]["host"], "ansible_host") else: self.add_variable(device["name"], device["name"], "ansible_host") From 82e81f073c210e00fd780609480449a764c223d7 Mon Sep 17 00:00:00 2001 From: Adam Byczkowski Date: Tue, 15 Mar 2022 16:14:14 -0500 Subject: [PATCH 2/3] Updated test --- tests/unit/inventory/test_graphql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/inventory/test_graphql.py b/tests/unit/inventory/test_graphql.py index 9ea8f3dc..84b8cf1b 100644 --- a/tests/unit/inventory/test_graphql.py +++ b/tests/unit/inventory/test_graphql.py @@ -133,7 +133,7 @@ def test_add_ipv4(inventory_fixture, device_data): inventory_fixture.create_groups(device_data) inventory_fixture.add_ipv4_address(device_data) mydevice_host = inventory_fixture.inventory.get_host("mydevice") - assert mydevice_host.vars.get("ansible_host") == "10.10.10.10/32" + assert mydevice_host.vars.get("ansible_host") == "10.10.10.10" def test_ansible_platform(inventory_fixture, device_data): From 7716203014a5e305b5aec5ffa0b4742e3620b181 Mon Sep 17 00:00:00 2001 From: Adam Byczkowski Date: Wed, 16 Mar 2022 01:02:32 -0500 Subject: [PATCH 3/3] Fixed test and bumped patch version --- plugins/templates/graphql_default_query.j2 | 2 +- pyproject.toml | 2 +- tests/unit/inventory/test_data/graphql_groups/device_data.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/templates/graphql_default_query.j2 b/plugins/templates/graphql_default_query.j2 index 7df9c06c..34405e80 100644 --- a/plugins/templates/graphql_default_query.j2 +++ b/plugins/templates/graphql_default_query.j2 @@ -7,7 +7,7 @@ devices {% include "graphql_filters.j2" %} { name } primary_ip4 { - address + host } device_role { name diff --git a/pyproject.toml b/pyproject.toml index 8bbc5d96..b4ef7c4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nautobot_ansible_modules" -version = "3.3.1" +version = "3.3.2" description = "Ansible collection to interact with Nautobot's API" authors = ["Network to Code