Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Russell_Fulton
Explorer

API call show-access-rulebase dies after 4 iterations getting 50 rules at a time

I am using https://github.com/CheckPointSW/ExportImportPolicyPackage script to export a ruleset.

when I run it I get:

 

Checking existence of package [Border_Policy]

Exporting Access Control layers

Exporting Access Layer [Border_Policy Security]

Getting layer information for layer [Border_Policy Security]
Getting information from show-access-rulebase
Retrieved 50 out of 688 rules (7%)
Retrieved 100 out of 688 rules (14%)
Retrieved 150 out of 688 rules (21%)
Retrieved 200 out of 688 rules (29%)

Traceback (most recent call last):
  File "import_export_package.py", line 44, in <module>
    export_package(client, args)
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/export_package.py", line 39, in export_package
    = export_access_rulebase(show_package.data["name"], access_layer["name"], access_layer["uid"], client, timestamp, tar_file)
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/export_access_rulebase.py", line 16, in export_access_rulebase
    get_query_rulebase_data(client, "access-rulebase", {"name": layer, "uid": layer_uid, "package": package})
  File "/Users/rful011/src/ExportImportPolicyPackage/exporting/export_objects.py", line 64, in get_query_rulebase_data
    for rulebase_reply in rulebase_replies:
  File "/Users/rful011/src/ExportImportPolicyPackage/cpapi/mgmt_api.py", line 414, in gen_api_query
    raise APIException(api_res.error_message, api_res.data)
cpapi.api_exceptions.APIException: APIResponse received a response which is not a valid JSON.

Following this the API is unresponsive and needs to be restarted on the server.  All API calls get 503 errors.

This feels like some sort of resource exhaustion on the server end.

Any suggestions on how to diagnose what is wrong?  Or ways to work around the issue?   I have considered getting the script to process fixed ranges of rules for each run.

 

 

 

 

0 Kudos
4 Replies
Joshua_Hatter
Employee
Employee

0 Kudos
Russell_Fulton
Explorer

I don't have permission to view solution to that post but it looks like the right problem.  I actually solved it by reducing the number of objects retrieved from 50 to 20.  Odd that it dies after 4 successful calls.

0 Kudos
Ronilson
Explorer

How you change the number of objects retrieved from 50 to 20? I'm with the same problem on R81

0 Kudos
PhoneBoy
Admin
Admin

That would be changing the relevant API call so that includes a limit 20 as one of the options.

However, it’s probably worth a TAC case if only to get to the bottom of the underlying issue with the API.

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events