Create a Post
Showing results for 
Search instead for 
Did you mean: 
Jump to solution

Connection' object has no attribute '_session_uid'


I implement a custom solution, which utilizes Ansible Checkpoint module to execute changes on objects in Checkpoint. Because we have two Checkpoint instances, one in Active and one in Standby (read-only) mode, I would like to ensure that solution connects to Active one automatically.

My idea for implementation is that, if solution connects to instance in Standby mode and executes a command which fails (e.g. host object update), the operation should be retried 3 times before switching over to 2nd Checkpoint instance (which should be in Active mode).

For implementing retry operation, I want to use generic Retries/Delay/Until task attributes of Ansible. However, I noticed that these attributes are completely ignored by Checkpoint module commands, in case when update operation is executed on instance in Standby mode. 

My code:

- name: add host {{ _host_name }}
      name: "{{ _host_name }}"
      ip_address: "{{ _host_ip }}"
      comments: "{{ _host_comments }}"
      groups: "{{ _host_hostlist }}"
      color: "{{ _host_zone_color }}"  
      auto_publish_session: true
    state: merged
  register: _add_host_result
  ignore_errors: true
  retries: 3
  delay: 5
  until: _add_host_result is not failed


Result after execute above task on Checkpoint instance in Standby mode:


TASK [add host host_4.4.4.4] ***************************************************
task path: /runner/project/playbooks/add_host_custom.yml:9
redirecting (type: connection) ansible.builtin.httpapi to ansible.netcommon.httpapi
<x.x.x.x> attempting to start connection
<x.x.x.x> using connection plugin ansible.netcommon.httpapi
Found ansible-connection at path /usr/bin/ansible-connection
<x.x.x.x> found existing local domain socket, using it!
<x.x.x.x> updating play_context for connection
<x.x.x.x> Loading collection ansible.builtin from
<x.x.x.x> local domain socket path is /home/runner/.ansible/pc/fc492a18ce
The full traceback is:
Traceback (most recent call last):
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/module_utils/", line 1858, in _httpapi_error_handle
result = self.api_call(
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/module_utils/", line 1769, in api_call
session_uid = connection.get_session_uid()
File "/usr/lib/python3.9/site-packages/ansible/module_utils/", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
ansible.module_utils.connection.ConnectionError: 'Connection' object has no attribute '_session_uid'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/ansible/executor/", line 165, in run
res = self._execute()
File "/usr/lib/python3.9/site-packages/ansible/executor/", line 656, in _execute
result =
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/action/", line 266, in run
) = self.configure_module_api(
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/action/", line 210, in configure_module_api
result =
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/module_utils/", line 1880, in post
return self._httpapi_error_handle(obj, state, **kwargs)
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/module_utils/", line 1869, in _httpapi_error_handle
raise _fail_json("connection error occurred: {0}".format(e))
File "/runner/requirements_collections/ansible_collections/check_point/mgmt/plugins/module_utils/", line 101, in _fail_json
raise Exception(msg)
Exception: connection error occurred: 'Connection' object has no attribute '_session_uid'
fatal: [localhost]: FAILED! => {
"msg": "Unexpected failure during module execution: connection error occurred: 'Connection' object has no attribute '_session_uid'",
"stdout": ""

I have masked IP address of Checkpoint instance to x.x.x.x in above log. Interesting is, that if I execute a command on Checkpoint instance running in Active mode, and try to simulate some error situation there, then Retries/Delay/Until attributes are not ignored. Please advice if this is a bug or if there is some better way to implements the connection retries to Checkpoint.




0 Kudos
1 Solution

Accepted Solutions

We have opened an official service request for this. Thank you. This thread can be closed.

View solution in original post

0 Kudos
2 Replies

I assume based on the Playbook and what you're trying to do, this is a Management HA configuration, correct?
What version/JHF is the management?

0 Kudos

We have opened an official service request for this. Thank you. This thread can be closed.

0 Kudos


Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events