Skip to content

Nmap inventory plugin fails to run #7320

Open
@EnsuingRequiem

Description

Summary

When trying to run nmap inventory plugin with basic configuration, it fails to parse. It appears when the code was changed from _options subscripting to get_option method, the brackets were not converted to parenthesis.

Issue Type

Bug Report

Component Name

nmap

Ansible Version

$ ansible --version
ansible [core 2.15.4]
  config file = /tachy/ansible/ansible.cfg
  configured module search path = ['/home/levi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/levi/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
# /home/levi/.ansible/collections/ansible_collections
Collection        Version                                   ----------------- -------
community.general 7.4.0

# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 7.4.0

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /tachy/ansible/ansible.cfg                                                                                   DEFAULT_PRIVATE_KEY_FILE(/tachy/ansible/ansible.cfg) = /tachy/ansible/id_rsa
INVENTORY_ENABLED(/tachy/ansible/ansible.cfg) = ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml', 'nmap']

OS / Environment

Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Steps to Reproduce

plugin: community.general.nmap
address: 10.10.42.1

Expected Results

I expected the nmap inventory to run and return a list of hosts

Actual Results

[WARNING]:  * Failed to parse /tachy/ansible/inventory/nmap.yaml with auto plugin: 'method' object is not subscriptable
[WARNING]:  * Failed to parse /tachy/ansible/inventory/nmap.yaml with yaml plugin: Plugin configuration YAML file, not YAML
inventory
[WARNING]:  * Failed to parse /tachy/ansible/inventory/nmap.yaml with ini plugin: Invalid host pattern '---' supplied, '---'
is normally a sign this is a YAML file.
[WARNING]:  * Failed to parse /tachy/ansible/inventory/nmap.yaml with
ansible_collections.community.general.plugins.inventory.nmap plugin: 'method' object is not subscriptable
[WARNING]: Unable to parse /tachy/ansible/inventory/nmap.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bughas_prinventoryinventory pluginpluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions