Skip to content

bigip_device_info - Subset AS3 not working properly #2506

@sharpy3232

Description

@sharpy3232
COMPONENT NAME

bigip_device_info (AS3 subset)

Environment

ANSIBLE VERSION

ansible [core 2.18.4]

BIGIP VERSION

BIG-IP 17.5.1.3

CONFIGURATION

Default ansible.cfg
No specific ANSIBLE_* environment variables set.

OS / ENVIRONMENT

Control node: Linux Ubuntu
Managed node: F5 BIG-IP

SUMMARY

The as3 subset of the bigip_device_info module always returns an empty
as3_config, even when AS3 is installed, used and properly configured on the BIG-IP.

STEPS TO REPRODUCE

Run the following playbook against:

  • a BIG-IP with AS3 installed
  • a BIG-IP without AS3 installed

The result is identical in both cases.
``

  • name: Gather AS3 information
    hosts: localhost
    gather_facts: no
    collections:
    • f5networks.f5_modules
      tasks:

    • name: Get BIG-IP AS3 configuration
      bigip_device_info:
      provider:
      server: "{{ server }}"
      user: admin
      password: "{{ password }}"
      validate_certs: no
      gather_subset:

      • as3
        register: result
    • debug:
      var: result.as3_config
      ``

EXPECTED RESULTS
  • When AS3 is installed, as3_config should contain the AS3 declaration
    retrieved from /mgmt/shared/appsvcs/declare.
  • When AS3 is not installed, as3_config should be an empty list.
ACTUAL RESULTS

as3_config is always an empty list ([]), regardless of whether AS3 is
installed or not.
"as3_config": []

ROOT CAUSE ANALYSIS

In As3FactManager.__init__(), installed_packages is evaluated before
calling BaseManager.__init__():

self.installed_packages = packages_installed(self.client)
super(As3FactManager, self).init(**kwargs)

At this stage, the client is not fully initialized, causing
packages_installed() to return an empty list.

As a result, the following condition always evaluates to true:

if 'as3' not in self.installed_packages:
return []

PROPOSED FIX

Move the packages_installed(self.client) call after
super().__init__() so the client is fully initialized:

def init(self, *args, **kwargs):
self.client = kwargs.get('client', None)
self.module = kwargs.get('module', None)
super(As3FactManager, self).init(**kwargs)
self.installed_packages = packages_installed(self.client)

This change correctly detects AS3 when installed and restores expected behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues that are related to bugs in the Ansible modulesuntriagedissue that needs an initial response from the developers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions