Skip to content

Commit

Permalink
Merge pull request #268 from pvelumul/configpush_changes
Browse files Browse the repository at this point in the history
providing a flag to consider deleted filters in ContractSubject while…
  • Loading branch information
michsmit99 committed Dec 15, 2016
2 parents 55205bd + 9a1e27f commit d76d040
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions acitoolkit/acitoolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3951,6 +3951,10 @@ def get_json(self):
for entry in self.get_filters():
filt = {subjectFilter: {'attributes': {'tnVzFilterName': entry.name}}}
filters.append(filt)

for entry in self.get_filters(deleted=True):
filt = {'vzRsSubjFiltAtt': {'attributes': {'status': 'deleted', 'tnVzFilterName': entry.name}}}
filters.append(filt)
resp_json[subject]['children'] = filters

terminals = []
Expand All @@ -3975,16 +3979,22 @@ def add_filter(self, filter_obj):
raise TypeError('add_filter not called with Filter')
self._add_relation(filter_obj)

def get_filters(self):
def get_filters(self, deleted=False):
"""
Get all of the filters that are attached to this ContractSubject.
:returns: List of Filter objects
"""
resp = []
for relation in self._relations:
if isinstance(relation.item, Filter):
resp.append(relation.item)
if deleted:
if relation.status == 'detached':
if isinstance(relation.item, Filter):
resp.append(relation.item)
else:
if relation.status == 'attached':
if isinstance(relation.item, Filter):
resp.append(relation.item)
return resp

def _get_instance_subscription_urls(self):
Expand Down

0 comments on commit d76d040

Please sign in to comment.