2014-09-26 01:01:01 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
Remove wildcard imports
Made the following changes:
* Removed wildcard imports
* Replaced long form of GPL header with short form
* Removed get_exception usage
* Added from __future__ boilerplate
* Adjust division operator to // where necessary
For the following files:
* web_infrastructure modules
* system modules
* linode, lxc, lxd, atomic, cloudscale, dimensiondata, ovh, packet,
profitbricks, pubnub, smartos, softlayer, univention modules
* compat dirs (disabled as its used intentionally)
2017-07-28 05:55:24 +00:00
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
|
|
|
|
2014-09-26 01:01:01 +00:00
|
|
|
|
2017-03-14 16:07:22 +00:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
|
|
|
'status': ['stableinterface'],
|
|
|
|
'supported_by': 'core'}
|
|
|
|
|
2016-12-06 10:35:05 +00:00
|
|
|
|
2014-09-26 01:01:01 +00:00
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
module: assert
|
2017-01-27 23:20:31 +00:00
|
|
|
short_description: Asserts given expressions are true
|
2014-09-26 01:01:01 +00:00
|
|
|
description:
|
2016-09-20 15:51:57 +00:00
|
|
|
- This module asserts that given expressions are true with an optional custom message.
|
2017-06-26 15:26:53 +00:00
|
|
|
- This module is also supported for Windows targets.
|
2014-09-26 01:01:01 +00:00
|
|
|
version_added: "1.5"
|
|
|
|
options:
|
|
|
|
that:
|
|
|
|
description:
|
|
|
|
- "A string expression of the same form that can be passed to the 'when' statement"
|
|
|
|
- "Alternatively, a list of string expressions"
|
|
|
|
required: true
|
2016-09-20 15:51:57 +00:00
|
|
|
msg:
|
|
|
|
description:
|
|
|
|
- "The customized message used for a failing assertion"
|
2017-06-26 15:26:53 +00:00
|
|
|
notes:
|
|
|
|
- This module is also supported for Windows targets.
|
2017-01-27 23:20:31 +00:00
|
|
|
author:
|
2015-06-15 19:53:30 +00:00
|
|
|
- "Ansible Core Team"
|
|
|
|
- "Michael DeHaan"
|
2014-09-26 01:01:01 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
- assert: { that: "ansible_os_family != 'RedHat'" }
|
|
|
|
|
2017-01-27 23:20:31 +00:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "'foo' in some_command_result.stdout"
|
2014-09-26 01:01:01 +00:00
|
|
|
- "number_of_the_counting == 3"
|
2016-09-20 15:51:57 +00:00
|
|
|
|
2017-01-27 23:20:31 +00:00
|
|
|
- assert:
|
|
|
|
that:
|
2016-09-20 15:51:57 +00:00
|
|
|
- "my_param <= 100"
|
|
|
|
- "my_param >= 0"
|
2016-09-22 14:49:26 +00:00
|
|
|
msg: "'my_param' must be between 0 and 100"
|
2014-09-26 01:01:01 +00:00
|
|
|
'''
|