F5Networks / f5-ansible-bigip

Declarative Ansible collection for managing F5 BIG-IP/BIG-IQ.
37 stars 17 forks source link

bigip_fast_application: Failure when API returns pending state #67

Closed simonkowallik closed 1 year ago

simonkowallik commented 1 year ago
COMPONENT NAME

bigip_fast_application version 2.1.0.

Environment

ANSIBLE VERSION
2.14.2
BIGIP VERSION
16.1.3.4
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

When the iControl REST API returns a pending state for the task, the module will return an error.

Relevant code:

https://github.com/F5Networks/f5-ansible-bigip/blob/df5d60134cd8f280eb1ed78182b44b28f744f9be/ansible_collections/f5networks/f5_bigip/plugins/modules/bigip_fast_application.py#L395-L407

Possible solution:

    def wait_for_task(self, path, interval, period):
        for x in range(0, period):
            task = self._check_task_on_device(path)
            if task['code'] != 200:
                if task['message'] not in ['in progress', 'pending']:
                    raise F5ModuleError(task['message'])
            if task['message'] not in ['in progress', 'pending']:
                return task
            time.sleep(interval)
        raise F5ModuleError(
            "Module timeout reached, state change is unknown, "
            "please increase the timeout parameter for long lived actions."
        )
STEPS TO REPRODUCE

Try creating 150 FAST applications using a loop multiple times and eventually the API will return a pending state at some point. This will lead to an immediate failure of the task.

EXPECTED RESULTS

The module waits for configured timeout (or default timeout of 300 seconds) in the hope that the pending state resolves.

ACTUAL RESULTS

The module fails.

G-gonzalezjimenez commented 1 year ago

Tracking internally with 1182

wojtek0806 commented 1 year ago

fixed in next release