Add Audit Scope Handler

This patch set adds audit scope mechanism.
It also removes host_aggregate field.

Change-Id: Ia98ed180a93fc8c19599735e2b41471d322bae9a
Partially-Implements: blueprint define-the-audit-scope
This commit is contained in:
Alexander Chadin
2016-08-24 18:28:19 +03:00
parent e7a1e148ca
commit 48cc6b2718
36 changed files with 673 additions and 101 deletions

View File

@@ -247,7 +247,6 @@ class DbAuditTemplateTestCase(base.DbTestCase):
uuid=w_utils.generate_uuid(),
name='My Audit Template 1',
description='Description of my audit template 1',
host_aggregate=5,
goal='DUMMY',
extra={'automatic': True})
audit_template2 = self._create_test_audit_template(
@@ -255,18 +254,9 @@ class DbAuditTemplateTestCase(base.DbTestCase):
uuid=w_utils.generate_uuid(),
name='My Audit Template 2',
description='Description of my audit template 2',
host_aggregate=3,
goal='DUMMY',
extra={'automatic': True})
res = self.dbapi.get_audit_template_list(self.context,
filters={'host_aggregate': 5})
self.assertEqual([audit_template1['id']], [r.id for r in res])
res = self.dbapi.get_audit_template_list(self.context,
filters={'host_aggregate': 1})
self.assertEqual([], [r.id for r in res])
res = self.dbapi.get_audit_template_list(
self.context,
filters={'goal': 'DUMMY'})

View File

@@ -28,11 +28,11 @@ def get_test_audit_template(**kwargs):
'name': kwargs.get('name', 'My Audit Template'),
'description': kwargs.get('description', 'Desc. Of My Audit Template'),
'extra': kwargs.get('extra', {'automatic': False}),
'host_aggregate': kwargs.get('host_aggregate', 1),
'version': kwargs.get('version', 'v1'),
'created_at': kwargs.get('created_at'),
'updated_at': kwargs.get('updated_at'),
'deleted_at': kwargs.get('deleted_at'),
'scope': kwargs.get('scope', []),
}
@@ -66,7 +66,7 @@ def get_test_audit(**kwargs):
'interval': kwargs.get('period', 3600),
'goal_id': kwargs.get('goal_id', 1),
'strategy_id': kwargs.get('strategy_id', None),
'host_aggregate': kwargs.get('host_aggregate', 1),
'scope': kwargs.get('scope', []),
}