Skip to content

Bug when calling zon API - NetworkZoneClient.list_network_zones() - exception raised #416

@leha007

Description

@leha007

Calling zone API (list_network_zones()) on my OKTA preview tenant with default zones in it:
image
Getting exception from the API call:

okta_api.errors.okta_errors_generic.OktaGenericError: 0

From the debugging it's clearly seen that the method expects to get collection of type list but getting dictionary instead.
image

This line throws the error

if not OktaCollection.is_formed(collection[index], data_type):

Problem originates from here

class NetworkZone(
    OktaObject
)
...
self.asns = OktaCollection.form_list(
                config["asns"] if "asns"\
                    in config else [],
                str
            )

Data got from OKTA

{
   "type":"DYNAMIC_V2",
   "id":".<reducted>",
   "name":"DefaultEnhancedDynamicZone",
   "status":"INACTIVE",
   "usage":"BLOCKLIST",
   "created":"2024-08-09T01:16:38.000Z",
   "lastUpdated":"2024-08-11T15:31:59.000Z",
   "system":true,
   "locations":{
      "include":[
         
      ],
      "exclude":[
         
      ]
   },
   "ipServiceCategories":{
      "include":[
         "ALL_ANONYMIZERS"
      ],
      "exclude":[
         
      ]
   },
   "asns":{
      "include":[
         
      ],
      "exclude":[
         
      ]
   },
   "links":{
      "activate":{
         "href":"https://<reducted>.oktapreview.com/api/v1/zones/<reducted>/lifecycle/activate",
         "hints":{
            "allow":[
               "POST"
            ]
         }
      },
      "self":{
         "href":"https://<reducted>.oktapreview.com/api/v1/zones/<reducted>",
         "hints":{
            "allow":[
               "GET",
               "PUT",
               "DELETE"
            ]
         }
      }
   }
}

OKTA package version 2.9.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions