nessrest
nessrest copied to clipboard
`policy_exists` fails if no policies exist
Trying to run policy_exists with ness6rest.Scanner when no policies exist returns the following.
In [14]: scan.policy_exists('test')
TypeError Traceback (most recent call last)
<ipython-input-14-1cb8ff8a73e0> in <module>()
----> 1 scan.policy_exists('test')
/.../lib/python3.5/site-packages/nessrest/ness6rest.py in policy_exists(self, name)
334 self.action(action="policies", method="get")
335
--> 336 for policy in self.res["policies"]:
337 if policy["name"] == name:
338 self.policy_id = policy["id"]
TypeError: 'NoneType' object is not iterable
could switch to using self.res.get("policies", [])