From e6a65adf1283c5a0aa3f507c81fdb69858a281d4 Mon Sep 17 00:00:00 2001 From: chkp-edenbr <94056191+chkp-edenbr@users.noreply.github.com> Date: Wed, 3 Jul 2024 16:00:12 +0300 Subject: [PATCH] Add target option for GAIA resource modules (#132) * 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 --- plugins/httpapi/checkpoint.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/httpapi/checkpoint.py b/plugins/httpapi/checkpoint.py index 606af77..6e8f45e 100644 --- a/plugins/httpapi/checkpoint.py +++ b/plugins/httpapi/checkpoint.py @@ -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 @@ -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(