Implement goal_id, strategy_id and host_aggregate into Audit api
Modifying the api controller for audit objects to allow creation of audit objects by specifying either an audit_template uuid/id and/or a goal_id. strategy_id is optional. Partially Implements: blueprint persistent-audit-parameters Change-Id: I7b3eae4d0752a11208f5f92ee13ab1018d8521ad
This commit is contained in:
@@ -33,23 +33,19 @@ class DefaultStrategyContext(base.BaseStrategyContext):
|
||||
def execute_strategy(self, audit_uuid, request_context):
|
||||
audit = objects.Audit.get_by_uuid(request_context, audit_uuid)
|
||||
|
||||
# Retrieve the Audit Template
|
||||
audit_template = objects.AuditTemplate.get_by_id(
|
||||
request_context, audit.audit_template_id)
|
||||
|
||||
osc = clients.OpenStackClients()
|
||||
# todo(jed) retrieve in audit_template parameters (threshold,...)
|
||||
# todo(jed) retrieve in audit parameters (threshold,...)
|
||||
# todo(jed) create ActionPlan
|
||||
|
||||
goal = objects.Goal.get_by_id(request_context, audit_template.goal_id)
|
||||
goal = objects.Goal.get_by_id(request_context, audit.goal_id)
|
||||
|
||||
# NOTE(jed56) In the audit_template object, the 'strategy_id' attribute
|
||||
# NOTE(jed56) In the audit object, the 'strategy_id' attribute
|
||||
# is optional. If the admin wants to force the trigger of a Strategy
|
||||
# it could specify the Strategy uuid in the Audit Template.
|
||||
# it could specify the Strategy uuid in the Audit.
|
||||
strategy_name = None
|
||||
if audit_template.strategy_id:
|
||||
if audit.strategy_id:
|
||||
strategy = objects.Strategy.get_by_id(request_context,
|
||||
audit_template.strategy_id)
|
||||
audit.strategy_id)
|
||||
strategy_name = strategy.name
|
||||
|
||||
strategy_selector = default.DefaultStrategySelector(
|
||||
|
||||
Reference in New Issue
Block a user