- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: Checkpoint Python SDK
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Checkpoint Python SDK
Hello,
Can the Checkpoint python sdk for the management api be installed or references on the management server itself?
I want to automate the execution of some python scripts for policy maintenance from AWX against the management server using the ansible cp_mgmt_run_script module. This module requires you to specify a target host in the playbook, which in this case is the management server itself.
It will then attempt to run the script locally from the target host (mgmt server).
I've copied the scripts to a location on the management server, however when I try to run them the mgmt server report the require module cpapi is missing - which was expected as the sdk is not installed.
The README.md in the github site (https://github.com/CheckPointSW/cp_mgmt_api_python_sdk) refers to configuring the sdk on a management machine - not sure 100 what this would be. It requires you to download then sdk (not install it using pip), then configure a reference to it in an environment variable.
export PYTHONPATH=$PYTHONPATH:/home/admin/cp_mgmt_api_python_sdk/
Regards,
Simon
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Simon - Martin was saying to create a folder on your management server and call it "cpapi". Then download all of the files API into it like the instructions say on the github page.
Example CPAPI path: /home/admin/cpapi
If you put your script in this folder: /home/admin/
This should allow it to find the CPAPI module. See the example I did using the find_dup_ip.py sample script:
[Expert@mgmt-sa1:0]# pwd
/home/admin
[Expert@mgmt-sa1:0]# ls -d c*
cpapi
[Expert@mgmt-sa1:0]# cd cpapi/
[Expert@mgmt-sa1:0]# ls
__init__.py __init__.pyc api_exceptions.py api_exceptions.pyc api_response.py api_response.pyc cli.py mgmt_api.py mgmt_api.pyc utils.py utils.pyc
[Expert@mgmt-sa1:0]# cd ..
[Expert@mgmt-sa1:0]# python find_dup_ip.py
Enter server IP address or hostname:x.x.x.x
Enter username: admin
Enter password:
Processing. Please wait...
Saving data to debug file api_calls.json
List of Duplicate IP addresses:
-------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it's enough to create folder called "cpapi" and put those files to it and script which will be running in same folder where "cpapi" is located it will load it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Martin,
Can you please explain that in a bit more detail.
Regards,
Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Simon - Martin was saying to create a folder on your management server and call it "cpapi". Then download all of the files API into it like the instructions say on the github page.
Example CPAPI path: /home/admin/cpapi
If you put your script in this folder: /home/admin/
This should allow it to find the CPAPI module. See the example I did using the find_dup_ip.py sample script:
[Expert@mgmt-sa1:0]# pwd
/home/admin
[Expert@mgmt-sa1:0]# ls -d c*
cpapi
[Expert@mgmt-sa1:0]# cd cpapi/
[Expert@mgmt-sa1:0]# ls
__init__.py __init__.pyc api_exceptions.py api_exceptions.pyc api_response.py api_response.pyc cli.py mgmt_api.py mgmt_api.pyc utils.py utils.pyc
[Expert@mgmt-sa1:0]# cd ..
[Expert@mgmt-sa1:0]# python find_dup_ip.py
Enter server IP address or hostname:x.x.x.x
Enter username: admin
Enter password:
Processing. Please wait...
Saving data to debug file api_calls.json
List of Duplicate IP addresses:
-------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content