Skip to content

Commit

Permalink
ansible tests bug fixes (#122)
Browse files Browse the repository at this point in the history
* v5.1.3

* ansible-lint bug fixes

* ansible-lint bug fixes

* ansible-lint bug fixes

* ansible test bug-fixes
  • Loading branch information
chkp-edenbr authored Jan 28, 2024
1 parent 906df6f commit af769b8
Show file tree
Hide file tree
Showing 46 changed files with 144 additions and 69 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Check_Point.Mgmt Release Notes

.. contents:: Topics

v5.2.2
======

Release Summary
---------------

This is release 5.2.2 of ``check_point.mgmt``, released on 2024-01-28.

v5.2.1
======

Expand Down
7 changes: 7 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -956,3 +956,10 @@ releases:
fragments:
- 5.2.1.yml
release_date: "2024-01-16"
5.2.2:
changes:
release_summary: This is release 5.2.2 of ``check_point.mgmt``, released on
2024-01-28.
fragments:
- 5.2.2.yml
release_date: '2024-01-28'
10 changes: 5 additions & 5 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ namespace: check_point
name: mgmt

# The version of the collection. Must be compatible with semantic versioning
version: 5.2.1
version: 5.2.2

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Or Soffer <[email protected]>
- Shiran Golzar <[email protected]>
- Eden Brillant <[email protected]>
- Or Soffer <[email protected]>
- Shiran Golzar <[email protected]>
- Eden Brillant <[email protected]>


### OPTIONAL but strongly recommended
Expand All @@ -30,7 +30,7 @@ description: Check Point collection for the Management Server
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later
- GPL-2.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
Expand Down
50 changes: 50 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
---
requires_ansible: ">=2.14.0"
plugin_routing:
modules:
cp_mgmt_add_nat_rule:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_add_nat_rule will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_nat_rule with more functionality instead.
cp_mgmt_set_nat_rule:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_set_nat_rule will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_nat_rule with more functionality instead.
cp_mgmt_delete_nat_rule:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_delete_nat_rule will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_nat_rule with more functionality instead.
cp_mgmt_access_layer:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_access_layer will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_access_layers with more functionality instead.
cp_mgmt_show_task:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_show_task will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_task_facts instead.
cp_mgmt_show_tasks:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_show_tasks will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_task_facts instead.
cp_mgmt_host:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_host will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_hosts with more functionality instead.
cp_mgmt_threat_layer:
deprecation:
removal_date: "2024-11-01"
warning_text: >
cp_mgmt_threat_layer will be removed in a future release of this collection.
Use newer and updated module cp_mgmt_threat_layers with more functionality instead.
5 changes: 5 additions & 0 deletions plugins/doc_fragments/checkpoint_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ class ModuleDocFragment(object):
description:
- Version of checkpoint. If not given one, the latest version taken.
type: str
auto_publish_session:
description:
- Publish the current session if changes have been performed after task completes.
type: bool
default: False
"""
10 changes: 4 additions & 6 deletions plugins/doc_fragments/checkpoint_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ class ModuleDocFragment(object):
options:
state:
description:
- State of the access rule (present or absent). Defaults to present.
- State of the access rule (present or absent).
type: str
default: present
choices:
- 'present'
- 'absent'
choices: ['present', 'absent']
auto_publish_session:
description:
- Publish the current session if changes have been performed
after task completes.
- Publish the current session if changes have been performed after task completes.
type: bool
default: False
wait_for_task:
description:
- Wait for the task to end. Such as publish task.
Expand Down
1 change: 1 addition & 0 deletions plugins/doc_fragments/checkpoint_objects_action_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ModuleDocFragment(object):
- Publish the current session if changes have been performed
after task completes.
type: bool
default: False
wait_for_task_timeout:
description:
- How many minutes to wait until throwing a timeout error.
Expand Down
27 changes: 16 additions & 11 deletions plugins/module_utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
}

checkpoint_argument_spec_for_action_module = dict(
auto_publish_session=dict(type="bool"),
auto_publish_session=dict(type="bool", default=False),
wait_for_task_timeout=dict(type="int", default=30),
version=dict(type="str"),
)

checkpoint_argument_spec_for_objects = dict(
auto_publish_session=dict(type="bool"),
auto_publish_session=dict(type="bool", default=False),
wait_for_task=dict(type="bool", default=True),
wait_for_task_timeout=dict(type="int", default=30),
state=dict(type="str", choices=["present", "absent"], default="present"),
Expand All @@ -65,7 +65,7 @@
wait_for_task=dict(type="bool", default=True),
wait_for_task_timeout=dict(type="int", default=30),
version=dict(type="str"),
auto_publish_session=dict(type="bool"),
auto_publish_session=dict(type="bool", default=False),
)

delete_params = [
Expand All @@ -76,7 +76,8 @@
"rule-name",
"package",
"ignore-errors",
"ignore-warnings"
"ignore-warnings",
"gateway-uid"
]

remove_from_set_payload = {
Expand Down Expand Up @@ -304,6 +305,10 @@ def get_payload_from_parameters(params):
):
parameter = "version"

# message & syslog_facility are internally used by Ansible, so need to avoid param duplicity
elif parameter == "login_message":
parameter = "message"

payload[parameter.replace("_", "-")] = parameter_value

return payload
Expand Down Expand Up @@ -579,7 +584,7 @@ def api_call_facts(module, api_call_object, api_call_object_plural_version):
False,
False,
)
result = {api_call_object: response}
result = {api_call_object.replace("-", "_"): response}
return result


Expand Down Expand Up @@ -1431,12 +1436,12 @@ def api_call_facts_for_rule(


# The code from here till EOF will be deprecated when Rikis' modules will be deprecated
checkpoint_argument_spec = dict(
auto_publish_session=dict(type="bool", default=True),
policy_package=dict(type="str", default="standard"),
auto_install_policy=dict(type="bool", default=True),
targets=dict(type="list"),
)
# checkpoint_argument_spec = dict(
# auto_publish_session=dict(type="bool", default=True),
# policy_package=dict(type="str", default="standard"),
# auto_install_policy=dict(type="bool", default=True),
# targets=dict(type="list"),
# )


def publish(connection, uid=None):
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_access_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"status": ["deprecated"],
"supported_by": "community",
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_access_point_name_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "access-point-name"
api_call_object_plural_version = "access-point-names"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_add_nat_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"status": ["deprecated"],
"supported_by": "community",
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_checkpoint_host_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "checkpoint-host"
api_call_object_plural_version = "checkpoint-hosts"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_delete_nat_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"status": ["deprecated"],
"supported_by": "community",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "dynamic-global-network-object"
api_call_object_plural_version = "dynamic-global-network-objects"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_gsn_handover_group_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "gsn-handover-group"
api_call_object_plural_version = "gsn-handover-groups"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"status": ["deprecated"],
"supported_by": "community",
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- This resource module allows for addition, deletion, or modification of CP MGMT Hosts.
- This resource module also takes care of gathering Hosts config facts
version_added: "5.0.0"
author: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>-
options:
config:
description: A dictionary of HOSTS options
Expand Down Expand Up @@ -349,7 +350,6 @@
- replaced
- gathered
- deleted
author: Ansible Team
"""

EXAMPLES = """
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_https_layer_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "https-layer"
api_call_object_plural_version = "https-layers"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_import_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

def main():
argument_spec = dict(
file_path=dict(type='str'),
file_path=dict(type='str', required=True),
domain_name=dict(type='str'),
domain_ip_address=dict(type='str'),
domain_server_name=dict(type='str'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def main():
filter=dict(type='str'),
limit=dict(type='int'),
offset=dict(type='int'),
order=dict(type='list', elememnts='dict', options=dict(
order=dict(type='list', elements='dict', options=dict(
ASC=dict(type='str', choices=['name']),
DESC=dict(type='str', choices=['name'])
))
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "ips-protection-extended-attribute"
api_call_object_plural_version = "ips-protection-extended-attributes"
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/cp_mgmt_lock_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
DOCUMENTATION = """
---
module: cp_mgmt_lock_object
short_description: Lock object using uid or {name and type}.
short_description: Lock object using name and type.
description:
- Lock object using uid or {name and type}. Can lock object only if the object is not locked by another session.
- The object can be unlocked by the following commands: unlock, publish or discard.
- Lock object using name and type. Can lock object only if the object is not locked by another session.
- The object can be unlocked by the unlock, publish or discard commands.
- All operations are performed over Web Services API.
version_added: "5.0.0"
author: "Eden Brillant (@chkp-edenbr)"
Expand Down
3 changes: 1 addition & 2 deletions plugins/modules/cp_mgmt_lsv_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
- Maximum number of IP addresses in the VPN Domain of each peer. This value will be enforced only when limit-peer-domain-size field is
set to true. Select a value between 1 and 256. Default value is 256.
type: int
choices: ['1-256']
color:
description:
- Color of the object. Should be one of existing colors.
Expand Down Expand Up @@ -148,7 +147,7 @@ def main():
tags=dict(type='list', elements='str'),
vpn_domain=dict(type='dict', options=dict(
limit_peer_domain_size=dict(type='bool'),
max_allowed_addresses=dict(type='int', choices=['1-256'])
max_allowed_addresses=dict(type='int')
)),
color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown',
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_lsv_profile_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "lsv-profile"
api_call_object_plural_version = "lsv-profiles"
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cp_mgmt_radius_group_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def main():
)
argument_spec.update(checkpoint_argument_spec_for_facts)

module = AnsibleModule(argument_spec=argument_spec)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

api_call_object = "radius-group"
api_call_object_plural_version = "radius-groups"
Expand Down
Loading

0 comments on commit af769b8

Please sign in to comment.