The watcher.objects.audit_template Module

The watcher.objects.audit_template Module

An Audit may be launched several times with the same settings (Goal, thresholds, …). Therefore it makes sense to save those settings in some sort of Audit preset object, which is known as an Audit Template.

An Audit Template contains at least the Goal of the Audit.

It may also contain some error handling settings indicating whether:

and how many retries should be attempted before failure occurs (also the latter can be complex: for example the scenario in which there are many first-time failures on ultimately successful Actions).

Moreover, an Audit Template may contain some settings related to the level of automation for the Action Plan that will be generated by the Audit. A flag will indicate whether the Action Plan will be launched automatically or will need a manual confirmation from the Administrator.

Last but not least, an Audit Template may contain a list of extra parameters related to the Strategy configuration. These parameters can be provided as a list of key-value pairs.

class watcher.objects.audit_template.AuditTemplate(context=None, **kwargs)[source]

Bases: watcher.objects.base.WatcherPersistentObject, watcher.objects.base.WatcherObject, watcher.objects.base.WatcherObjectDictCompat

create(*args, **kwargs)[source]

Create a AuditTemplate record in the DB

Returns:An AuditTemplate object.
destroy()[source]

Delete the AuditTemplate from the DB

classmethod get(context, *args, **kwargs)[source]

Find an audit template based on its id or uuid

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • audit_template_id – the id or uuid of a audit_template.
  • eager – Load object fields if True (Default: False)
Returns:

a AuditTemplate object.

classmethod get_by_id(context, *args, **kwargs)[source]

Find an audit template based on its integer id

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • audit_template_id – the id of a audit_template.
  • eager – Load object fields if True (Default: False)
Returns:

a AuditTemplate object.

classmethod get_by_name(context, *args, **kwargs)[source]

Find an audit template based on name

Parameters:
  • name – the logical name of a audit_template.
  • context – Security context
  • eager – Load object fields if True (Default: False)
Returns:

a AuditTemplate object.

classmethod get_by_uuid(context, *args, **kwargs)[source]

Find an audit template based on uuid

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • uuid – the uuid of a audit_template.
  • eager – Load object fields if True (Default: False)
Returns:

a AuditTemplate object.

classmethod list(context, *args, **kwargs)[source]

Return a list of AuditTemplate objects.

Parameters:
  • context – Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don’t use it. A context should be set when instantiating the object, e.g.: AuditTemplate(context)
  • filters – dict mapping the filter key to a value.
  • limit – maximum number of resources to return in a single result.
  • marker – pagination marker for large data sets.
  • sort_key – column to sort results by.
  • sort_dir – direction to sort. “asc” or “desc”.
  • eager – Load object fields if True (Default: False)
Returns:

a list of AuditTemplate object.

refresh(*args, **kwargs)[source]

Loads updates for this AuditTemplate.

Loads a audit_template with the same uuid from the database and checks for updated attributes. Updates are applied from the loaded audit_template column by column, if there are any updates. :param eager: Load object fields if True (Default: False)

save(*args, **kwargs)[source]

Save updates to this AuditTemplate.

Updates will be made column by column based on the result of self.what_changed().

soft_delete(*args, **kwargs)[source]

Soft Delete the AuditTemplate from the DB

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.