Skip to content

Commit

Permalink
Add target option for GAIA resource modules (#132)
Browse files Browse the repository at this point in the history
* ansible-lint bug fixes

* ansible-lint bug fixes

* R82 Resource Modules - part 1

* Delete plugins/modules/cp_mgmt_gaia_api.py

* Delete .idea/CheckPointAnsibleMgmtCollection.iml

* Add target option for running gaia resource modules
  • Loading branch information
chkp-edenbr authored Jul 3, 2024
1 parent 9627203 commit e6a65ad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins/httpapi/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
- The Cloud Management ID
vars:
- name: ansible_cloud_mgmt_id
target:
type: str
description:
- target gateway
vars:
- name: ansible_checkpoint_target
"""

import json
Expand Down Expand Up @@ -89,10 +95,14 @@ def get_session_uid(self):
return self.connection._session_uid

def send_request(self, path, body_params):
data = json.dumps(body_params) if body_params else "{}"
cp_cloud_mgmt_id = self.get_option("cloud_mgmt_id")
if cp_cloud_mgmt_id:
path = "/" + cp_cloud_mgmt_id + path
# we only replace gaia_ip/ with web_api/gaia-api/ if target is set and path contains gaia_ip/
if 'gaia_api/' in path and self.get_option("target"):
path = path.replace("gaia_api/", "web_api/gaia-api/")
body_params['target'] = self.get_option("target")
data = json.dumps(body_params) if body_params else '{}'
try:
self._display_request()
response, response_data = self.connection.send(
Expand Down

0 comments on commit e6a65ad

Please sign in to comment.