Compare commits

...

36 Commits

Author SHA1 Message Date
b108c59b89 New release v2.9.0b1 2019-09-05 11:46:29 -07:00
d2b5a08eb8 To fix and rename checkpoint to check_point due to legal reasons (#61872)
* Rename checkpoint to check_point due to legal reasons, fix #61145 (#61172)

* Fix #61145

* Fix type keyword

* Removed file fragment

(cherry picked from commit 9744ce1e1d)

* add changelogs

* adding eol

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
2019-09-05 10:47:04 -07:00
124036337e azure_rm_iothub: disable the functional test (#61854)
The test fails with: Operation failed with status: 'Unauthorized'
This commit disable the test until the situation is resolved.

See: https://github.com/ansible/ansible/issues/61852
(cherry picked from commit 08e01380e6)
2019-09-05 08:59:49 -07:00
622f5a248d [stable-2.9] Rebalance Azure tests groups
(cherry picked from commit 173d47d1f4)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-09-05 08:59:27 -07:00
ec48f1d35b [stable-2.9] test: disable the docker swarm tests (#61816)
`docker_swarm` tests tend to hang during the creation of the Swarn
cluster.

See: https://github.com/ansible/ansible/issues/61815
(cherry picked from commit 7132466327)

Co-authored-by: Gonéri Le Bouder <goneri@lebouder.net>
2019-09-05 08:57:54 -07:00
ac61dc60aa Azure _info modules: fix returned ansible_facts when called as _info (#61805)
* Fix Azure _info modules which still returned ansible_facts.

* Adjust PR #.

* Fix wrong assignment.

* Reorganize code for clarity.

(cherry picked from commit e06dbe6e4f)
2019-09-05 08:48:31 -07:00
ec7803387e documentation: modify the link to the docker.txt listing all images (#61838) (#61846)
The file was moved.

(cherry picked from commit aadb192846)
2019-09-05 10:06:17 -05:00
3bf9f57f43 ansible-galaxy fix --server option for roles (#61820)
(cherry picked from commit 3a7b77a94c)
2019-09-04 19:55:46 -07:00
ab6efcd6cc [stable-2.9] Don't truncate the last character from galaxy urls. Fixes #61624 (#61775)
(cherry picked from commit 8214d18)

Co-authored-by: Matt Martz <matt@sivel.net>
2019-09-04 18:01:46 -07:00
23a79ecc77 [stable-2.9] aws_s3 - wait for the bucket before setting ACLs (#61735) (#61768)
* [stable-2.9] aws_s3 - wait for the bucket before setting ACLs (#61735)

* Wait for the bucket to become available if possible before setting ACLs
(cherry picked from commit 91ccb03552)

Co-authored-by: Sloane Hertel <shertel@redhat.com>

* s3 - improve waiting for the bucket (#61802)

(cherry picked from commit ff05991265)
2019-09-04 14:01:24 -07:00
9ff8d8d898 Fix creation of DigitalOcean droplets using digital_ocean_droplet module (#61655)
* Omit disallowed 'id' attribute in request body to create a droplet

* Add changelog fragment for PR #61655
2019-09-04 12:10:00 -07:00
4cc9ee950f [stable-2.9] Allow 13 asterisk characters in password field without warning (#54893)
On OpenBSD, 13 asterisk characters as a password hash, marks the
account as disabled. Otherwise daily(8) script which executes
security(8) will email operator about not properly locked accounts.

Before the diff, we see following warning:

> [WARNING]: The input password appears not to have been hashed. The 'password' argument must be encrypted for this module to work properly.

After the diff, warning is gone.
(cherry picked from commit 1dea661ce8)

Co-authored-by: kucharskim <mikolaj@kucharski.name>
2019-09-04 12:09:04 -07:00
3558d38b17 [stable-2.9] Fix systemd start state with deactivating service state
(cherry picked from commit ee4b3b8854)

Co-authored-by: Strahinja Kustudic <kustodian@gmail.com>
2019-09-04 12:08:03 -07:00
8141aa9a55 To fix iosxr_l3_interfaces module zuul tests (#61592)
* fix 61540

* fix utils

(cherry picked from commit 24ad1dffc9)
2019-09-04 12:07:39 -07:00
58fda1632f Fixes IOS L3 intermittent zuul failure (#61682)
* fix ios l3 intermittent failure

* fix self

* dict to ordered dict

* fix diff_again fn

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* remove orderdict as its expensive

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* update verify fn

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
(cherry picked from commit 2672dc9694)
2019-09-04 12:06:58 -07:00
fa3d52729c Backport/2.9/61691 (#61759)
* Fix Decode Bug in Py3

(cherry picked from commit 87642ac93e)

* Update fortios.py

(cherry picked from commit 416bc3c040)

* Remove special char from name

* Ensure full compatibility when ansible is install from Py2

* Update lib/ansible/plugins/httpapi/fortios.py

Co-Authored-By: Nathaniel Case <this.is@nathanielca.se>
(cherry picked from commit 7601b7fa0d)

* Update lib/ansible/module_utils/network/fortios/fortios.py

Co-Authored-By: Nathaniel Case <this.is@nathanielca.se>
(cherry picked from commit e4f6a19cb4)

* Update lib/ansible/module_utils/network/fortios/fortios.py

Co-Authored-By: Nathaniel Case <this.is@nathanielca.se>
(cherry picked from commit ba1c2e4ea0)

* Suggested changes by Qalthos

(cherry picked from commit ae4bde8500)

* Suggested changes by Qalthos

(cherry picked from commit 63bea8e2a6)

* Retriggerting due to shippable failure
2019-09-04 12:04:33 -07:00
187f85f4d2 [stable-2.9] aws_codebuild tests - add retries and delay instead of a pause task (#61731) (#61771)
* [stable-2.9] aws_codebuild tests - add retries and delay instead of a pause task (#61731)

- Add retries instead of a pause task
- Shorten the IAM role name length
- Put the IAM role name in defaults/main.yml instead
- Fix the aws_codepipeline tests too
(cherry picked from commit 9ee0deea24)

Co-authored-by: Sloane Hertel <shertel@redhat.com>

* codebuild/codepipeline - fix regex for shippable resource_prefix (#61783)

* Fix bad assumption about shippable resource_prefix for codebuild and codepipeline tests
* Update test/integration/targets/aws_codepipeline/defaults/main.yml

(cherry picked from commit d5c8d325e4)
2019-09-04 10:38:35 -07:00
682c3674b8 Set win_pagefile as unstable as thats what it is (#61732)
(cherry picked from commit 00add5b668)
2019-09-04 10:30:04 -07:00
e14ccbf2c0 [stable-2.9] debian: prepare the ansible-test package
- Generate an extra package for `ansible-test`.
- Manually install the files because CDBS get confused by our two
  Python packages
- Refresh the package descriptions to match what is done with the RPM
(cherry picked from commit 3f9316b)

Co-authored-by: Gonéri Le Bouder <goneri@lebouder.net>
2019-09-03 23:52:33 -07:00
0f55c2c04b [stable-2.9] Update the rpm spec file to include ansible-test
* Include ansible-test in a subpackage
* Sync with the ansible engine spec file
* Addresses https://github.com/ansible/ansible/issues/60380 to the
  extent that we're likely to fix that.
(cherry picked from commit 9be8a98)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2019-09-03 21:59:29 -07:00
365acd0daa Correct indentation of the code in the example (#61622) (#61725) 2019-09-03 13:47:28 -05:00
23ea477734 [stable-2.9] Increase unit test timeout to account for long image download times (#61717)
(cherry picked from commit c9e7a2122d)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-09-03 10:11:38 -07:00
53db5020b6 Update Fedora 29 test image
(cherry picked from commit 3d78dad84b)
2019-09-03 09:53:13 -07:00
06220179e5 [stable-2.9] Avoid infinite recursion on login (#61617)
(cherry picked from commit d20d10b)

Co-authored-by: Nathaniel Case <ncase@redhat.com>
2019-09-03 09:48:27 -07:00
e9e8d2b5d6 Make sure postgresql tests are run for all postgres_* modules (#61647)
(cherry picked from commit 4d057e0331)
2019-09-03 09:44:37 -07:00
bbf268c451 [stable-2.9] apt: honor cache_update=false on auto-install deps (#56549)
* apt: honor cache_update=false on auto-install deps
* add porting guide
(cherry picked from commit fd4ff54580)

Co-authored-by: Rene Moser <mail@renemoser.net>
2019-09-03 09:43:46 -07:00
a1715ee1b2 postgresql modules: explicit defaults for bool params (#61538) (#61679)
(cherry picked from commit a6d9401c88)
2019-09-03 11:38:10 -05:00
dc5f369245 [stable-2.9] ansible-test - Continue if the git command returns an error (#61605)
* ansible-test - Contiune if the git command returns an error

* Just return stdout

* Use to_text() when displaying exception

* Add a message property to SubprocessError
(cherry picked from commit e218c98)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-08-30 13:23:26 -07:00
e9310c1a44 [stable-2.9] Fix ansible-test coverage path handling. (#61528) (#61593)
* [stable-2.9] Fix ansible-test coverage path handling. (#61528)

* Fix ansible-test coverage path handling.
* Split CI unit tests into two groups.
(cherry picked from commit e4e5005640)

Co-authored-by: Matt Clay <matt@mystile.com>

* Add changelog fragment.
2019-08-30 09:44:21 -07:00
72d93259e7 [stable-2.9] Use relative submodule status in ansible-test.
The `git submodule status` command is relative to the current git repository by default.
When running from a repository subdirectory paths can be returned above the current directory.
Specifying the current directory with `git submodule status` avoids listing submodules above that directory.

This will fix issues when testing a collection that is rooted below the repository root when that repository uses submodules.
(cherry picked from commit 4063d58339)

Co-authored-by: Matt Clay <matt@mystile.com>
2019-08-30 07:57:47 -07:00
c6996727ba Skip certain tests on 2016 (#61585)
(cherry picked from commit 3bd69a47ec)
2019-08-30 07:55:11 -07:00
a271cb6136 Azure fix _info/_facts return values for some modules (#61584)
* Azure fix _info/_facts return values for some modules

* Further test fixes

* securitygroup fixes after the move to _info module

(cherry picked from commit 951dac7691)
2019-08-29 23:33:14 -07:00
391a67401d New release v2.9.0b1 2019-08-29 22:33:55 -07:00
a8023c52d9 Galaxy refactory 2.9 (#61581)
* Refactor galaxy collection API for v3 support (#61510)

* Refactor galaxy collection API for v3 support

* Added unit tests for GalaxyAPI and starting to fix other failures

* finalise tests

* more unit test fixes

(cherry picked from commit a7fd6e99d9)

* Added changelog fragment
2019-08-29 22:31:17 -07:00
d82e61c939 New release v2.9.0b1 2019-08-29 18:55:35 -07:00
7c342183c5 Update changelog url 2019-08-29 14:37:43 -07:00
206 changed files with 5153 additions and 1821 deletions

1148
changelogs/.changes.yaml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
---
bugfixes:
- apt - Fixed the issue the cache being updated while auto-installing its
dependencies even when ``update_cache`` is set to false.

View File

@ -0,0 +1,3 @@
bugfixes:
- To rename CheckPoint to Check_Point due to CP legal reasons.
(https://github.com/ansible/ansible/pull/61172).

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy - Fix url building to not truncate the URL (https://github.com/ansible/ansible/issues/61624)

View File

@ -0,0 +1,2 @@
bugfixes:
- digital_ocean_droplet - Fix creation of DigitalOcean droplets using digital_ocean_droplet module (https://github.com/ansible/ansible/pull/61655)

View File

@ -0,0 +1,2 @@
bugfixes:
- aws_s3 - Try to wait for the bucket to exist before setting the access control list.

View File

@ -0,0 +1,7 @@
bugfixes:
- "azure_rm_dnsrecordset_info - no longer returns empty ``azure_dnsrecordset`` facts when called as ``_info`` module."
- "azure_rm_resourcegroup_info - no longer returns ``azure_resourcegroups`` facts when called as ``_info`` module."
- "azure_rm_storageaccount_info - no longer returns empty ``azure_storageaccounts`` facts when called as ``_info`` module."
- "azure_rm_virtualmachineimage_info - no longer returns empty ``azure_vmimages`` facts when called as ``_info`` module."
- "azure_rm_virtualmachinescaleset_info - fix wrongly empty result, or ``ansible_facts`` result, when called as ``_info`` module."
- "azure_rm_virtualnetwork_info - no longer returns empty ``azure_virtualnetworks`` facts when called as ``_info`` module."

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-galaxy role - Fix issue where ``--server`` was not being used for certain ``ansible-galaxy role`` actions - https://github.com/ansible/ansible/issues/61609

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now creates output directories as needed for powershell coverage output before generating reports

View File

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now correctly enumerates submodules when a collection resides below the repository root

View File

@ -0,0 +1,3 @@
bugfixes:
- azure_rm_securitygroup_info - Fix up instances when ``ansible_facts`` is returned for the older ``_facts`` alias.
- azure_rm_networkinterface_info - Fix up instances when ``ansible_facts`` is returned for the older ``_facts`` alias.

View File

@ -0,0 +1,2 @@
minor_changes:
- Refactored ``ansible-galaxy collections`` API code to be more friendly for future bugfixes

View File

@ -0,0 +1,2 @@
bugfixes:
- user - allow 13 asterisk characters in password field without warning

View File

@ -0,0 +1,3 @@
release_summary: |
| Release Date: 2019-09-05
| `Porting Guide <https://docs.ansible.com/ansible/devel/porting_guides.html>`__

View File

@ -64,7 +64,7 @@ outside of those test subdirectories. They will also not reconfigure or bounce
.. note:: Running integration tests within Docker
To protect your system from any potential changes caused by integration tests, and to ensure a sensible set of dependencies are available we recommend that you always run integration tests with the ``--docker`` option. See the `list of supported docker images <https://github.com/ansible/ansible/blob/devel/test/runner/completion/docker.txt>`_ for options.
To protect your system from any potential changes caused by integration tests, and to ensure a sensible set of dependencies are available we recommend that you always run integration tests with the ``--docker`` option. See the `list of supported docker images <https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/_data/completion/docker.txt>`_ for options.
.. note:: Avoiding pulling new Docker images

View File

@ -9,7 +9,7 @@ This section discusses the behavioral changes between Ansible 2.8 and Ansible 2.
It is intended to assist in updating your playbooks, plugins and other parts of your Ansible infrastructure so they will work with this version of Ansible.
We suggest you read this page along with `Ansible Changelog for 2.9 <https://github.com/ansible/ansible/blob/devel/changelogs/CHANGELOG-v2.9.rst>`_ to understand what updates you may need to make.
We suggest you read this page along with `Ansible Changelog for 2.9 <https://github.com/ansible/ansible/blob/stable-2.9/changelogs/CHANGELOG-v2.9.rst>`_ to understand what updates you may need to make.
This document is part of a collection on porting. The complete list of porting guides can be found at :ref:`porting guides <porting_guides>`.
@ -61,7 +61,7 @@ Modules
=======
* The ``win_get_url`` and ``win_uri`` module now sends requests with a default ``User-Agent`` of ``ansible-httpget``. This can be changed by using the ``http_agent`` key.
* The ``apt`` module now honors ``update_cache=false`` while installing its own dependency and skips the cache update. Explicitly setting ``update_cache=true`` or omitting the param ``update_cache`` will result in a cache update while installing its own dependency.
Writing modules
---------------

View File

@ -13,22 +13,22 @@ Blocks allow for logical grouping of tasks and in play error handling. Most of w
tasks:
- name: Install, configure, and start Apache
block:
- name: install httpd and memcached
yum:
name:
- httpd
- memcached
state: present
- name: install httpd and memcached
yum:
name:
- httpd
- memcached
state: present
- name: apply the foo config template
template:
src: templates/src.j2
dest: /etc/foo.conf
- name: start service bar and enable it
service:
name: bar
state: started
enabled: True
- name: apply the foo config template
template:
src: templates/src.j2
dest: /etc/foo.conf
- name: start service bar and enable it
service:
name: bar
state: started
enabled: True
when: ansible_facts['distribution'] == 'CentOS'
become: true
become_user: root

View File

@ -405,7 +405,7 @@ class GalaxyCLI(CLI):
display.vvv("found role %s in yaml file" % to_text(role))
if "name" not in role and "src" not in role:
raise AnsibleError("Must specify name or src for role")
return [GalaxyRole(self.galaxy, **role)]
return [GalaxyRole(self.galaxy, self.api, **role)]
else:
b_include_path = to_bytes(requirement["include"], errors="surrogate_or_strict")
if not os.path.isfile(b_include_path):
@ -414,7 +414,7 @@ class GalaxyCLI(CLI):
with open(b_include_path, 'rb') as f_include:
try:
return [GalaxyRole(self.galaxy, **r) for r in
return [GalaxyRole(self.galaxy, self.api, **r) for r in
(RoleRequirement.role_yaml_parse(i) for i in yaml.safe_load(f_include))]
except Exception as e:
raise AnsibleError("Unable to load data from include requirements file: %s %s"
@ -722,7 +722,7 @@ class GalaxyCLI(CLI):
for role in context.CLIARGS['args']:
role_info = {'path': roles_path}
gr = GalaxyRole(self.galaxy, role)
gr = GalaxyRole(self.galaxy, self.api, role)
install_info = gr.install_info
if install_info:
@ -827,7 +827,7 @@ class GalaxyCLI(CLI):
# (and their dependencies, unless the user doesn't want us to).
for rname in context.CLIARGS['args']:
role = RoleRequirement.role_yaml_parse(rname.strip())
roles_left.append(GalaxyRole(self.galaxy, **role))
roles_left.append(GalaxyRole(self.galaxy, self.api, **role))
for role in roles_left:
# only process roles in roles files when names matches if given
@ -871,7 +871,7 @@ class GalaxyCLI(CLI):
display.debug('Installing dep %s' % dep)
dep_req = RoleRequirement()
dep_info = dep_req.role_yaml_parse(dep)
dep_role = GalaxyRole(self.galaxy, **dep_info)
dep_role = GalaxyRole(self.galaxy, self.api, **dep_info)
if '.' not in dep_role.name and '.' not in dep_role.src and dep_role.scm is None:
# we know we can skip this, as it's not going to
# be found on galaxy.ansible.com
@ -913,7 +913,7 @@ class GalaxyCLI(CLI):
raise AnsibleOptionsError('- you must specify at least one role to remove.')
for role_name in context.CLIARGS['args']:
role = GalaxyRole(self.galaxy, role_name)
role = GalaxyRole(self.galaxy, self.api, role_name)
try:
if role.remove():
display.display('- successfully removed %s' % role_name)
@ -941,7 +941,7 @@ class GalaxyCLI(CLI):
if context.CLIARGS['role']:
# show the requested role, if it exists
name = context.CLIARGS['role']
gr = GalaxyRole(self.galaxy, name)
gr = GalaxyRole(self.galaxy, self.api, name)
if gr.metadata:
display.display('# %s' % os.path.dirname(gr.path))
_display_role(gr)
@ -964,7 +964,7 @@ class GalaxyCLI(CLI):
path_files = os.listdir(role_path)
path_found = True
for path_file in path_files:
gr = GalaxyRole(self.galaxy, path_file, path=path)
gr = GalaxyRole(self.galaxy, self.api, path_file, path=path)
if gr.metadata:
_display_role(gr)
for w in warnings:

View File

@ -44,6 +44,7 @@ class Galaxy(object):
''' Keeps global galaxy info '''
def __init__(self):
# TODO: eventually remove this as it contains a mismash of properties that aren't really global
# roles_path needs to be a list and will be by default
roles_path = context.CLIARGS.get('roles_path', C.DEFAULT_ROLES_PATH)

View File

@ -1,29 +1,16 @@
########################################################################
#
# (C) 2013, James Cammarata <jcammarata@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
# Copyright: (c) 2019, Ansible Project
# 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
import base64
import json
import os
import tarfile
import uuid
import time
from ansible import context
from ansible.errors import AnsibleError
@ -33,125 +20,210 @@ from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlen
from ansible.module_utils._text import to_bytes, to_native, to_text
from ansible.module_utils.urls import open_url
from ansible.utils.display import Display
from ansible.utils.hashing import secure_hash_s
display = Display()
def g_connect(method):
''' wrapper to lazily initialize connection info to galaxy '''
def wrapped(self, *args, **kwargs):
if not self.initialized:
display.vvvv("Initial connection to galaxy_server: %s" % self.api_server)
server_version = self._get_server_api_version()
def g_connect(versions):
"""
Wrapper to lazily initialize connection info to Galaxy and verify the API versions required are available on the
endpoint.
if server_version not in self.SUPPORTED_VERSIONS:
raise AnsibleError("Unsupported Galaxy server API version: %s" % server_version)
:param versions: A list of API versions that the function supports.
"""
def decorator(method):
def wrapped(self, *args, **kwargs):
if not self._available_api_versions:
display.vvvv("Initial connection to galaxy_server: %s" % self.api_server)
self.baseurl = _urljoin(self.api_server, "api", server_version)
# Determine the type of Galaxy server we are talking to. First try it unauthenticated then with Bearer
# auth for Automation Hub.
n_url = _urljoin(self.api_server, 'api')
error_context_msg = 'Error when finding available api versions from %s (%s)' % (self.name, n_url)
self.version = server_version # for future use
try:
data = self._call_galaxy(n_url, method='GET', error_context_msg=error_context_msg)
except GalaxyError as e:
if e.http_code != 401:
raise
display.vvvv("Base API: %s" % self.baseurl)
self.initialized = True
return method(self, *args, **kwargs)
return wrapped
# Assume this is v3 (Automation Hub) and auth is required
headers = {}
self._add_auth_token(headers, n_url, token_type='Bearer', required=True)
data = self._call_galaxy(n_url, headers=headers, method='GET', error_context_msg=error_context_msg)
# Default to only supporting v1, if only v1 is returned we also assume that v2 is available even though
# it isn't returned in the available_versions dict.
available_versions = data.get('available_versions', {u'v1': u'/api/v1'})
if list(available_versions.keys()) == [u'v1']:
available_versions[u'v2'] = u'/api/v2'
self._available_api_versions = available_versions
display.vvvv("Found API version '%s' with Galaxy server %s (%s)"
% (', '.join(available_versions.keys()), self.name, self.api_server))
# Verify that the API versions the function works with are available on the server specified.
available_versions = set(self._available_api_versions.keys())
common_versions = set(versions).intersection(available_versions)
if not common_versions:
raise AnsibleError("Galaxy action %s requires API versions '%s' but only '%s' are available on %s %s"
% (method.__name__, ", ".join(versions), ", ".join(available_versions),
self.name, self.api_server))
return method(self, *args, **kwargs)
return wrapped
return decorator
def _urljoin(*args):
return '/'.join(to_native(a, errors='surrogate_or_strict').rstrip('/') for a in args + ('',))
return '/'.join(to_native(a, errors='surrogate_or_strict').strip('/') for a in args + ('',) if a)
class GalaxyAPI(object):
''' This class is meant to be used as a API client for an Ansible Galaxy server '''
class GalaxyError(AnsibleError):
""" Error for bad Galaxy server responses. """
SUPPORTED_VERSIONS = ['v1']
def __init__(self, http_error, message):
super(GalaxyError, self).__init__(message)
self.http_code = http_error.code
self.url = http_error.geturl()
def __init__(self, galaxy, name, url, username=None, password=None, token=None, token_type=None):
try:
http_msg = to_text(http_error.read())
err_info = json.loads(http_msg)
except (AttributeError, ValueError):
err_info = {}
url_split = self.url.split('/')
if 'v2' in url_split:
galaxy_msg = err_info.get('message', 'Unknown error returned by Galaxy server.')
code = err_info.get('code', 'Unknown')
full_error_msg = u"%s (HTTP Code: %d, Message: %s Code: %s)" % (message, self.http_code, galaxy_msg, code)
elif 'v3' in url_split:
errors = err_info.get('errors', [])
if not errors:
errors = [{}] # Defaults are set below, we just need to make sure 1 error is present.
message_lines = []
for error in errors:
error_msg = error.get('detail') or error.get('title') or 'Unknown error returned by Galaxy server.'
error_code = error.get('code') or 'Unknown'
message_line = u"(HTTP Code: %d, Message: %s Code: %s)" % (self.http_code, error_msg, error_code)
message_lines.append(message_line)
full_error_msg = "%s %s" % (message, ', '.join(message_lines))
else:
# v1 and unknown API endpoints
galaxy_msg = err_info.get('default', 'Unknown error returned by Galaxy server.')
full_error_msg = u"%s (HTTP Code: %d, Message: %s)" % (message, self.http_code, galaxy_msg)
self.message = to_native(full_error_msg)
class CollectionVersionMetadata:
def __init__(self, namespace, name, version, download_url, artifact_sha256, dependencies):
"""
Contains common information about a collection on a Galaxy server to smooth through API differences for
Collection and define a standard meta info for a collection.
:param namespace: The namespace name.
:param name: The collection name.
:param version: The version that the metadata refers to.
:param download_url: The URL to download the collection.
:param artifact_sha256: The SHA256 of the collection artifact for later verification.
:param dependencies: A dict of dependencies of the collection.
"""
self.namespace = namespace
self.name = name
self.version = version
self.download_url = download_url
self.artifact_sha256 = artifact_sha256
self.dependencies = dependencies
class GalaxyAPI:
""" This class is meant to be used as a API client for an Ansible Galaxy server """
def __init__(self, galaxy, name, url, username=None, password=None, token=None):
self.galaxy = galaxy
self.name = name
self.username = username
self.password = password
self.token = token
self.token_type = token_type or 'Token'
self.api_server = url
self.validate_certs = not context.CLIARGS['ignore_certs']
self.baseurl = None
self.version = None
self.initialized = False
self.available_api_versions = {}
self._available_api_versions = {}
display.debug('Validate TLS certificates for %s: %s' % (self.api_server, self.validate_certs))
def _auth_header(self, required=True, token_type=None):
'''Generate the Authorization header.
@property
@g_connect(['v1', 'v2', 'v3'])
def available_api_versions(self):
# Calling g_connect will populate self._available_api_versions
return self._available_api_versions
def _call_galaxy(self, url, args=None, headers=None, method=None, auth_required=False, error_context_msg=None):
headers = headers or {}
self._add_auth_token(headers, url, required=auth_required)
try:
display.vvvv("Calling Galaxy at %s" % url)
resp = open_url(to_native(url), data=args, validate_certs=self.validate_certs, headers=headers,
method=method, timeout=20, unredirected_headers=['Authorization'])
except HTTPError as e:
raise GalaxyError(e, error_context_msg)
except Exception as e:
raise AnsibleError("Unknown error when attempting to call Galaxy at '%s': %s" % (url, to_native(e)))
resp_data = to_text(resp.read(), errors='surrogate_or_strict')
try:
data = json.loads(resp_data)
except ValueError:
raise AnsibleError("Failed to parse Galaxy response from '%s' as JSON:\n%s"
% (resp.url, to_native(resp_data)))
return data
def _add_auth_token(self, headers, url, token_type=None, required=False):
# Don't add the auth token if one is already present
if 'Authorization' in headers:
return
Valid token_type values are 'Token' (galaxy v2) and 'Bearer' (galaxy v3)'''
token = self.token.get() if self.token else None
# 'Token' for v2 api, 'Bearer' for v3
token_type = token_type or self.token_type
# 'Token' for v2 api, 'Bearer' for v3 but still allow someone to override the token if necessary.
is_v3 = 'v3' in url.split('/')
token_type = token_type or ('Bearer' if is_v3 else 'Token')
if token:
return {'Authorization': "%s %s" % (token_type, token)}
headers['Authorization'] = '%s %s' % (token_type, token)
elif self.username:
token = "%s:%s" % (to_text(self.username, errors='surrogate_or_strict'),
to_text(self.password, errors='surrogate_or_strict', nonstring='passthru') or '')
b64_val = base64.b64encode(to_bytes(token, encoding='utf-8', errors='surrogate_or_strict'))
return {'Authorization': "Basic %s" % to_text(b64_val)}
headers['Authorization'] = 'Basic %s' % to_text(b64_val)
elif required:
raise AnsibleError("No access token or username set. A token can be set with --api-key, with "
"'ansible-galaxy login', or set in ansible.cfg.")
else:
return {}
@g_connect
def __call_galaxy(self, url, args=None, headers=None, method=None):
if args and not headers:
headers = self._auth_header()
try:
display.vvv(url)
resp = open_url(url, data=args, validate_certs=self.validate_certs, headers=headers, method=method,
timeout=20)
data = json.loads(to_text(resp.read(), errors='surrogate_or_strict'))
except HTTPError as e:
res = json.loads(to_text(e.fp.read(), errors='surrogate_or_strict'))
raise AnsibleError(res['detail'])
return data
def _get_server_api_version(self):
"""
Fetches the Galaxy API current version to ensure
the API server is up and reachable.
"""
url = _urljoin(self.api_server, "api")
try:
return_data = open_url(url, validate_certs=self.validate_certs)
except Exception as e:
raise AnsibleError("Failed to get data from the API server (%s): %s " % (url, to_native(e)))
try:
data = json.loads(to_text(return_data.read(), errors='surrogate_or_strict'))
except Exception as e:
raise AnsibleError("Could not process data from the API server (%s): %s " % (url, to_native(e)))
return data['current_version']
@g_connect
@g_connect(['v1'])
def authenticate(self, github_token):
"""
Retrieve an authentication token
"""
url = _urljoin(self.baseurl, "tokens")
url = _urljoin(self.api_server, self.available_api_versions['v1'], "tokens") + '/'
args = urlencode({"github_token": github_token})
resp = open_url(url, data=args, validate_certs=self.validate_certs, method="POST")
data = json.loads(to_text(resp.read(), errors='surrogate_or_strict'))
return data
@g_connect
@g_connect(['v1'])
def create_import_task(self, github_user, github_repo, reference=None, role_name=None):
"""
Post an import request
"""
url = _urljoin(self.baseurl, "imports")
url = _urljoin(self.api_server, self.available_api_versions['v1'], "imports") + '/'
args = {
"github_user": github_user,
"github_repo": github_repo,
@ -161,17 +233,17 @@ class GalaxyAPI(object):
args['alternate_role_name'] = role_name
elif github_repo.startswith('ansible-role'):
args['alternate_role_name'] = github_repo[len('ansible-role') + 1:]
data = self.__call_galaxy(url, args=urlencode(args), method="POST")
data = self._call_galaxy(url, args=urlencode(args), method="POST")
if data.get('results', None):
return data['results']
return data
@g_connect
@g_connect(['v1'])
def get_import_task(self, task_id=None, github_user=None, github_repo=None):
"""
Check the status of an import task.
"""
url = _urljoin(self.baseurl, "imports")
url = _urljoin(self.api_server, self.available_api_versions['v1'], "imports")
if task_id is not None:
url = "%s?id=%d" % (url, task_id)
elif github_user is not None and github_repo is not None:
@ -179,10 +251,10 @@ class GalaxyAPI(object):
else:
raise AnsibleError("Expected task_id or github_user and github_repo")
data = self.__call_galaxy(url)
data = self._call_galaxy(url)
return data['results']
@g_connect
@g_connect(['v1'])
def lookup_role_by_name(self, role_name, notify=True):
"""
Find a role by name.
@ -198,13 +270,14 @@ class GalaxyAPI(object):
except Exception:
raise AnsibleError("Invalid role name (%s). Specify role as format: username.rolename" % role_name)
url = _urljoin(self.baseurl, "roles", "?owner__username=%s&name=%s" % (user_name, role_name))[:-1]
data = self.__call_galaxy(url)
url = _urljoin(self.api_server, self.available_api_versions['v1'], "roles",
"?owner__username=%s&name=%s" % (user_name, role_name))
data = self._call_galaxy(url)
if len(data["results"]) != 0:
return data["results"][0]
return None
@g_connect
@g_connect(['v1'])
def fetch_role_related(self, related, role_id):
"""
Fetch the list of related items for the given role.
@ -213,27 +286,29 @@ class GalaxyAPI(object):
results = []
try:
url = _urljoin(self.baseurl, "roles", role_id, related, "?page_size=50")[:-1]
data = self.__call_galaxy(url)
url = _urljoin(self.api_server, self.available_api_versions['v1'], "roles", role_id, related,
"?page_size=50")
data = self._call_galaxy(url)
results = data['results']
done = (data.get('next_link', None) is None)
while not done:
url = _urljoin(self.api_server, data['next_link'])
data = self.__call_galaxy(url)
data = self._call_galaxy(url)
results += data['results']
done = (data.get('next_link', None) is None)
except Exception as e:
display.vvvv("Unable to retrive role (id=%s) data (%s), but this is not fatal so we continue: %s" % (role_id, related, to_text(e)))
display.vvvv("Unable to retrive role (id=%s) data (%s), but this is not fatal so we continue: %s"
% (role_id, related, to_text(e)))
return results
@g_connect
@g_connect(['v1'])
def get_list(self, what):
"""
Fetch the list of items specified.
"""
try:
url = _urljoin(self.baseurl, what, "?page_size")[:-1]
data = self.__call_galaxy(url)
url = _urljoin(self.api_server, self.available_api_versions['v1'], what, "?page_size")
data = self._call_galaxy(url)
if "results" in data:
results = data['results']
else:
@ -243,17 +318,17 @@ class GalaxyAPI(object):
done = (data.get('next_link', None) is None)
while not done:
url = _urljoin(self.api_server, data['next_link'])
data = self.__call_galaxy(url)
data = self._call_galaxy(url)
results += data['results']
done = (data.get('next_link', None) is None)
return results
except Exception as error:
raise AnsibleError("Failed to download the %s list: %s" % (what, to_native(error)))
@g_connect
@g_connect(['v1'])
def search_roles(self, search, **kwargs):
search_url = _urljoin(self.baseurl, "search", "roles", "?")[:-1]
search_url = _urljoin(self.api_server, self.available_api_versions['v1'], "search", "roles", "?")
if search:
search_url += '&autocomplete=' + to_text(urlquote(to_bytes(search)))
@ -277,35 +352,202 @@ class GalaxyAPI(object):
if author:
search_url += '&username_autocomplete=%s' % author
data = self.__call_galaxy(search_url)
data = self._call_galaxy(search_url)
return data
@g_connect
@g_connect(['v1'])
def add_secret(self, source, github_user, github_repo, secret):
url = _urljoin(self.baseurl, "notification_secrets")
url = _urljoin(self.api_server, self.available_api_versions['v1'], "notification_secrets") + '/'
args = urlencode({
"source": source,
"github_user": github_user,
"github_repo": github_repo,
"secret": secret
})
data = self.__call_galaxy(url, args=args, method="POST")
data = self._call_galaxy(url, args=args, method="POST")
return data
@g_connect
@g_connect(['v1'])
def list_secrets(self):
url = _urljoin(self.baseurl, "notification_secrets")
data = self.__call_galaxy(url, headers=self._auth_header())
url = _urljoin(self.api_server, self.available_api_versions['v1'], "notification_secrets")
data = self._call_galaxy(url, auth_required=True)
return data
@g_connect
@g_connect(['v1'])
def remove_secret(self, secret_id):
url = _urljoin(self.baseurl, "notification_secrets", secret_id)
data = self.__call_galaxy(url, headers=self._auth_header(), method='DELETE')
url = _urljoin(self.api_server, self.available_api_versions['v1'], "notification_secrets", secret_id) + '/'
data = self._call_galaxy(url, auth_required=True, method='DELETE')
return data
@g_connect
@g_connect(['v1'])
def delete_role(self, github_user, github_repo):
url = _urljoin(self.baseurl, "removerole", "?github_user=%s&github_repo=%s" % (github_user, github_repo))[:-1]
data = self.__call_galaxy(url, headers=self._auth_header(), method='DELETE')
url = _urljoin(self.api_server, self.available_api_versions['v1'], "removerole",
"?github_user=%s&github_repo=%s" % (github_user, github_repo))
data = self._call_galaxy(url, auth_required=True, method='DELETE')
return data
# Collection APIs #
@g_connect(['v2', 'v3'])
def publish_collection(self, collection_path):
"""
Publishes a collection to a Galaxy server and returns the import task URI.
:param collection_path: The path to the collection tarball to publish.
:return: The import task URI that contains the import results.
"""
display.display("Publishing collection artifact '%s' to %s %s" % (collection_path, self.name, self.api_server))
b_collection_path = to_bytes(collection_path, errors='surrogate_or_strict')
if not os.path.exists(b_collection_path):
raise AnsibleError("The collection path specified '%s' does not exist." % to_native(collection_path))
elif not tarfile.is_tarfile(b_collection_path):
raise AnsibleError("The collection path specified '%s' is not a tarball, use 'ansible-galaxy collection "
"build' to create a proper release artifact." % to_native(collection_path))
with open(b_collection_path, 'rb') as collection_tar:
data = collection_tar.read()
boundary = '--------------------------%s' % uuid.uuid4().hex
b_file_name = os.path.basename(b_collection_path)
part_boundary = b"--" + to_bytes(boundary, errors='surrogate_or_strict')
form = [
part_boundary,
b"Content-Disposition: form-data; name=\"sha256\"",
to_bytes(secure_hash_s(data), errors='surrogate_or_strict'),
part_boundary,
b"Content-Disposition: file; name=\"file\"; filename=\"%s\"" % b_file_name,
b"Content-Type: application/octet-stream",
b"",
data,
b"%s--" % part_boundary,
]
data = b"\r\n".join(form)
headers = {
'Content-type': 'multipart/form-data; boundary=%s' % boundary,
'Content-length': len(data),
}
if 'v3' in self.available_api_versions:
n_url = _urljoin(self.api_server, self.available_api_versions['v3'], 'artifacts', 'collections') + '/'
else:
n_url = _urljoin(self.api_server, self.available_api_versions['v2'], 'collections') + '/'
resp = self._call_galaxy(n_url, args=data, headers=headers, method='POST', auth_required=True,
error_context_msg='Error when publishing collection to %s (%s)'
% (self.name, self.api_server))
return resp['task']
@g_connect(['v2', 'v3'])
def wait_import_task(self, task_url, timeout=0):
"""
Waits until the import process on the Galaxy server has completed or the timeout is reached.
:param task_url: The full URI of the import task to wait for, this is returned by publish_collection.
:param timeout: The timeout in seconds, 0 is no timeout.
"""
# TODO: actually verify that v3 returns the same structure as v2, right now this is just an assumption.
state = 'waiting'
data = None
display.display("Waiting until Galaxy import task %s has completed" % task_url)
start = time.time()
wait = 2
while timeout == 0 or (time.time() - start) < timeout:
data = self._call_galaxy(task_url, method='GET', auth_required=True,
error_context_msg='Error when getting import task results at %s' % task_url)
state = data.get('state', 'waiting')
if data.get('finished_at', None):
break
display.vvv('Galaxy import process has a status of %s, wait %d seconds before trying again'
% (state, wait))
time.sleep(wait)
# poor man's exponential backoff algo so we don't flood the Galaxy API, cap at 30 seconds.
wait = min(30, wait * 1.5)
if state == 'waiting':
raise AnsibleError("Timeout while waiting for the Galaxy import process to finish, check progress at '%s'"
% to_native(task_url))
for message in data.get('messages', []):
level = message['level']
if level == 'error':
display.error("Galaxy import error message: %s" % message['message'])
elif level == 'warning':
display.warning("Galaxy import warning message: %s" % message['message'])
else:
display.vvv("Galaxy import message: %s - %s" % (level, message['message']))
if state == 'failed':
code = to_native(data['error'].get('code', 'UNKNOWN'))
description = to_native(
data['error'].get('description', "Unknown error, see %s for more details" % task_url))
raise AnsibleError("Galaxy import process failed: %s (Code: %s)" % (description, code))
@g_connect(['v2', 'v3'])
def get_collection_version_metadata(self, namespace, name, version):
"""
Gets the collection information from the Galaxy server about a specific Collection version.
:param namespace: The collection namespace.
:param name: The collection name.
:param version: Optional version of the collection to get the information for.
:return: CollectionVersionMetadata about the collection at the version requested.
"""
api_path = self.available_api_versions.get('v3', self.available_api_versions.get('v2'))
url_paths = [self.api_server, api_path, 'collections', namespace, name, 'versions', version]
n_collection_url = _urljoin(*url_paths)
error_context_msg = 'Error when getting collection version metadata for %s.%s:%s from %s (%s)' \
% (namespace, name, version, self.name, self.api_server)
data = self._call_galaxy(n_collection_url, error_context_msg=error_context_msg)
return CollectionVersionMetadata(data['namespace']['name'], data['collection']['name'], data['version'],
data['download_url'], data['artifact']['sha256'],
data['metadata']['dependencies'])
@g_connect(['v2', 'v3'])
def get_collection_versions(self, namespace, name):
"""
Gets a list of available versions for a collection on a Galaxy server.
:param namespace: The collection namespace.
:param name: The collection name.
:return: A list of versions that are available.
"""
if 'v3' in self.available_api_versions:
api_path = self.available_api_versions['v3']
results_key = 'data'
pagination_path = ['links', 'next']
else:
api_path = self.available_api_versions['v2']
results_key = 'results'
pagination_path = ['next']
n_url = _urljoin(self.api_server, api_path, 'collections', namespace, name, 'versions')
error_context_msg = 'Error when getting available collection versions for %s.%s from %s (%s)' \
% (namespace, name, self.name, self.api_server)
data = self._call_galaxy(n_url, error_context_msg=error_context_msg)
versions = []
while True:
versions += [v['version'] for v in data[results_key]]
next_link = data
for path in pagination_path:
next_link = next_link.get(path, {})
if not next_link:
break
data = self._call_galaxy(to_native(next_link, errors='surrogate_or_strict'),
error_context_msg=error_context_msg)
return versions

View File

@ -13,7 +13,6 @@ import tarfile
import tempfile
import threading
import time
import uuid
import yaml
from contextlib import contextmanager
@ -30,9 +29,9 @@ except ImportError:
import ansible.constants as C
from ansible.errors import AnsibleError
from ansible.galaxy import get_collections_galaxy_meta_info
from ansible.galaxy.api import _urljoin
from ansible.module_utils._text import to_bytes, to_native, to_text
from ansible.galaxy.api import CollectionVersionMetadata, GalaxyError
from ansible.module_utils import six
from ansible.module_utils._text import to_bytes, to_native, to_text
from ansible.utils.collection_loader import AnsibleCollectionRef
from ansible.utils.display import Display
from ansible.utils.hashing import secure_hash, secure_hash_s
@ -65,7 +64,8 @@ class CollectionRequirement:
:param requirement: The version requirement string used to verify the list of versions fit the requirements.
:param force: Whether the force flag applied to the collection.
:param parent: The name of the parent the collection is a dependency of.
:param metadata: The collection metadata dict if it has already been retrieved.
:param metadata: The galaxy.api.CollectionVersionMetadata that has already been retrieved from the Galaxy
server.
:param files: The files that exist inside the collection. This is based on the FILES.json file inside the
collection artifact.
:param skip: Whether to skip installing the collection. Should be set if the collection is already installed
@ -82,7 +82,6 @@ class CollectionRequirement:
self._metadata = metadata
self._files = files
self._galaxy_info = None
self.add_requirement(parent, requirement)
@ -102,12 +101,12 @@ class CollectionRequirement:
@property
def dependencies(self):
if self._metadata:
return self._metadata['dependencies']
return self._metadata.dependencies
elif len(self.versions) > 1:
return None
self._get_metadata()
return self._metadata['dependencies']
return self._metadata.dependencies
def add_requirement(self, parent, requirement):
self.required_by.append((parent, requirement))
@ -150,9 +149,10 @@ class CollectionRequirement:
display.display("Installing '%s:%s' to '%s'" % (to_text(self), self.latest_version, collection_path))
if self.b_path is None:
download_url = self._galaxy_info['download_url']
artifact_hash = self._galaxy_info['artifact']['sha256']
headers = self.api._auth_header(required=False)
download_url = self._metadata.download_url
artifact_hash = self._metadata.artifact_sha256
headers = {}
self.api._add_auth_token(headers, download_url)
self.b_path = _download_file(download_url, b_temp_path, artifact_hash, self.api.validate_certs,
headers=headers)
@ -186,13 +186,7 @@ class CollectionRequirement:
def _get_metadata(self):
if self._metadata:
return
n_collection_url = _urljoin(self.api.api_server, 'api', 'v2', 'collections', self.namespace, self.name,
'versions', self.latest_version)
details = json.load(open_url(n_collection_url, validate_certs=self.api.validate_certs,
headers=self.api._auth_header(required=False)))
self._galaxy_info = details
self._metadata = details['metadata']
self._metadata = self.api.get_collection_version_metadata(self.namespace, self.name, self.latest_version)
def _meets_requirements(self, version, requirements, parent):
"""
@ -260,6 +254,7 @@ class CollectionRequirement:
namespace = meta['namespace']
name = meta['name']
version = meta['version']
meta = CollectionVersionMetadata(namespace, name, version, None, None, meta['dependencies'])
return CollectionRequirement(namespace, name, b_path, None, [version], version, force, parent=parent,
metadata=meta, files=files)
@ -280,22 +275,21 @@ class CollectionRequirement:
% to_native(b_file_path))
if 'manifest_file' in info:
meta = info['manifest_file']['collection_info']
manifest = info['manifest_file']['collection_info']
namespace = manifest['namespace']
name = manifest['name']
version = manifest['version']
dependencies = manifest['dependencies']
else:
display.warning("Collection at '%s' does not have a MANIFEST.json file, cannot detect version."
% to_text(b_path))
parent_dir, name = os.path.split(to_text(b_path, errors='surrogate_or_strict'))
namespace = os.path.split(parent_dir)[1]
meta = {
'namespace': namespace,
'name': name,
'version': '*',
'dependencies': {},
}
namespace = meta['namespace']
name = meta['name']
version = meta['version']
version = '*'
dependencies = {}
meta = CollectionVersionMetadata(namespace, name, version, None, None, dependencies)
files = info.get('files_file', {}).get('files', {})
@ -305,67 +299,31 @@ class CollectionRequirement:
@staticmethod
def from_name(collection, apis, requirement, force, parent=None):
namespace, name = collection.split('.', 1)
galaxy_info = None
galaxy_meta = None
for api in apis:
collection_url_paths = [api.api_server, 'api', 'v2', 'collections', namespace, name, 'versions']
available_api_versions = get_available_api_versions(api)
if 'v3' in available_api_versions:
# /api/v3/ exists, use it
collection_url_paths[2] = 'v3'
# update this v3 GalaxyAPI to use Bearer token from now on
api.token_type = 'Bearer'
headers = api._auth_header(required=False)
is_single = False
if not (requirement == '*' or requirement.startswith('<') or requirement.startswith('>') or
requirement.startswith('!=')):
if requirement.startswith('='):
requirement = requirement.lstrip('=')
collection_url_paths.append(requirement)
is_single = True
n_collection_url = _urljoin(*collection_url_paths)
try:
resp = json.load(open_url(n_collection_url, validate_certs=api.validate_certs, headers=headers))
except urllib_error.HTTPError as err:
if not (requirement == '*' or requirement.startswith('<') or requirement.startswith('>') or
requirement.startswith('!=')):
if requirement.startswith('='):
requirement = requirement.lstrip('=')
if err.code == 404:
display.vvv("Collection '%s' is not available from server %s %s" % (collection, api.name, api.api_server))
continue
resp = api.get_collection_version_metadata(namespace, name, requirement)
_handle_http_error(err, api, available_api_versions,
'Error fetching info for %s from %s (%s)' % (collection, api.name, api.api_server))
galaxy_meta = resp
versions = [resp.version]
else:
resp = api.get_collection_versions(namespace, name)
if is_single:
galaxy_info = resp
galaxy_meta = resp['metadata']
versions = [resp['version']]
else:
versions = []
results_key = 'results'
if 'v3' in available_api_versions:
results_key = 'data'
while True:
# Galaxy supports semver but ansible-galaxy does not. We ignore any versions that don't match
# StrictVersion (x.y.z) and only support pre-releases if an explicit version was set (done above).
versions += [v['version'] for v in resp[results_key] if StrictVersion.version_re.match(v['version'])]
next_link = resp.get('next', None)
if 'v3' in available_api_versions:
next_link = resp['links']['next']
if next_link is None:
break
resp = json.load(open_url(to_native(next_link, errors='surrogate_or_strict'),
validate_certs=api.validate_certs, headers=headers))
versions = [v for v in resp if StrictVersion.version_re.match(v)]
except GalaxyError as err:
if err.http_code == 404:
display.vvv("Collection '%s' is not available from server %s %s"
% (collection, api.name, api.api_server))
continue
raise
display.vvv("Collection '%s' obtained from server %s %s" % (collection, api.name, api.api_server))
break
@ -374,49 +332,9 @@ class CollectionRequirement:
req = CollectionRequirement(namespace, name, None, api, versions, requirement, force, parent=parent,
metadata=galaxy_meta)
req._galaxy_info = galaxy_info
return req
def get_available_api_versions(galaxy_api):
headers = {}
headers.update(galaxy_api._auth_header(required=False))
url = _urljoin(galaxy_api.api_server, "api")
try:
return_data = open_url(url, headers=headers, validate_certs=galaxy_api.validate_certs)
except urllib_error.HTTPError as err:
if err.code != 401:
_handle_http_error(err, galaxy_api, {},
"Error when finding available api versions from %s (%s)" %
(galaxy_api.name, galaxy_api.api_server))
# assume this is v3 and auth is required.
headers = {}
headers.update(galaxy_api._auth_header(token_type='Bearer', required=True))
# try again with auth
try:
return_data = open_url(url, headers=headers, validate_certs=galaxy_api.validate_certs)
except urllib_error.HTTPError as authed_err:
_handle_http_error(authed_err, galaxy_api, {},
"Error when finding available api versions from %s using auth (%s)" %
(galaxy_api.name, galaxy_api.api_server))
except Exception as e:
raise AnsibleError("Failed to get data from the API server (%s): %s " % (url, to_native(e)))
try:
data = json.loads(to_text(return_data.read(), errors='surrogate_or_strict'))
except Exception as e:
raise AnsibleError("Could not process data from the API server (%s): %s " % (url, to_native(e)))
available_versions = data.get('available_versions',
{'v1': '/api/v1',
'v2': '/api/v2'})
return available_versions
def build_collection(collection_path, output_path, force):
"""
Creates the Ansible collection artifact in a .tar.gz file.
@ -461,40 +379,11 @@ def publish_collection(collection_path, api, wait, timeout):
:param wait: Whether to wait until the import process is complete.
:param timeout: The time in seconds to wait for the import process to finish, 0 is indefinite.
"""
b_collection_path = to_bytes(collection_path, errors='surrogate_or_strict')
if not os.path.exists(b_collection_path):
raise AnsibleError("The collection path specified '%s' does not exist." % to_native(collection_path))
elif not tarfile.is_tarfile(b_collection_path):
raise AnsibleError("The collection path specified '%s' is not a tarball, use 'ansible-galaxy collection "
"build' to create a proper release artifact." % to_native(collection_path))
display.display("Publishing collection artifact '%s' to %s %s" % (collection_path, api.name, api.api_server))
n_url = _urljoin(api.api_server, 'api', 'v2', 'collections')
available_api_versions = get_available_api_versions(api)
if 'v3' in available_api_versions:
n_url = _urljoin(api.api_server, 'api', 'v3', 'artifacts', 'collections')
api.token_type = 'Bearer'
headers = {}
headers.update(api._auth_header())
data, content_type = _get_mime_data(b_collection_path)
headers.update({
'Content-type': content_type,
'Content-length': len(data),
})
try:
resp = json.load(open_url(n_url, data=data, headers=headers, method='POST', validate_certs=api.validate_certs))
except urllib_error.HTTPError as err:
_handle_http_error(err, api, available_api_versions, "Error when publishing collection to %s (%s)" % (api.name, api.api_server))
import_uri = resp['task']
import_uri = api.publish_collection(collection_path)
if wait:
display.display("Collection has been published to the Galaxy server %s %s" % (api.name, api.api_server))
_wait_import(import_uri, api, timeout)
with _display_progress():
api.wait_import_task(import_uri, timeout)
display.display("Collection has been successfully published and imported to the Galaxy server %s %s"
% (api.name, api.api_server))
else:
@ -836,76 +725,6 @@ def _build_collection_tar(b_collection_path, b_tar_path, collection_manifest, fi
display.display('Created collection for %s at %s' % (collection_name, to_text(b_tar_path)))
def _get_mime_data(b_collection_path):
with open(b_collection_path, 'rb') as collection_tar:
data = collection_tar.read()
boundary = '--------------------------%s' % uuid.uuid4().hex
b_file_name = os.path.basename(b_collection_path)
part_boundary = b"--" + to_bytes(boundary, errors='surrogate_or_strict')
form = [
part_boundary,
b"Content-Disposition: form-data; name=\"sha256\"",
to_bytes(secure_hash_s(data), errors='surrogate_or_strict'),
part_boundary,
b"Content-Disposition: file; name=\"file\"; filename=\"%s\"" % b_file_name,
b"Content-Type: application/octet-stream",
b"",
data,
b"%s--" % part_boundary,
]
content_type = 'multipart/form-data; boundary=%s' % boundary
return b"\r\n".join(form), content_type
def _wait_import(task_url, api, timeout):
headers = api._auth_header()
state = 'waiting'
resp = None
display.display("Waiting until Galaxy import task %s has completed" % task_url)
with _display_progress():
start = time.time()
wait = 2
while timeout == 0 or (time.time() - start) < timeout:
resp = json.load(open_url(to_native(task_url, errors='surrogate_or_strict'), headers=headers,
method='GET', validate_certs=api.validate_certs))
state = resp.get('state', 'waiting')
if resp.get('finished_at', None):
break
display.vvv('Galaxy import process has a status of %s, wait %d seconds before trying again'
% (state, wait))
time.sleep(wait)
# poor man's exponential backoff algo so we don't flood the Galaxy API, cap at 30 seconds.
wait = min(30, wait * 1.5)
if state == 'waiting':
raise AnsibleError("Timeout while waiting for the Galaxy import process to finish, check progress at '%s'"
% to_native(task_url))
for message in resp.get('messages', []):
level = message['level']
if level == 'error':
display.error("Galaxy import error message: %s" % message['message'])
elif level == 'warning':
display.warning("Galaxy import warning message: %s" % message['message'])
else:
display.vvv("Galaxy import message: %s - %s" % (level, message['message']))
if state == 'failed':
code = to_native(resp['error'].get('code', 'UNKNOWN'))
description = to_native(resp['error'].get('description', "Unknown error, see %s for more details" % task_url))
raise AnsibleError("Galaxy import process failed: %s (Code: %s)" % (description, code))
def _find_existing_collections(path):
collections = []
@ -1075,33 +894,3 @@ def _extract_tar_file(tar, filename, b_dest, b_temp_path, expected_hash=None):
os.makedirs(b_parent_dir)
shutil.move(to_bytes(tmpfile_obj.name, errors='surrogate_or_strict'), b_dest_filepath)
def _handle_http_error(http_error, api, available_api_versions, context_error_message):
try:
err_info = json.load(http_error)
except (AttributeError, ValueError):
err_info = {}
if 'v3' in available_api_versions:
message_lines = []
errors = err_info.get('errors', None)
if not errors:
errors = [{'detail': 'Unknown error returned by Galaxy server.',
'code': 'Unknown'}]
for error in errors:
error_msg = error.get('detail') or error.get('title') or 'Unknown error returned by Galaxy server.'
error_code = error.get('code') or 'Unknown'
message_line = "(HTTP Code: %d, Message: %s Code: %s)" % (http_error.code, error_msg, error_code)
message_lines.append(message_line)
full_error_msg = "%s %s" % (context_error_message, ', '.join(message_lines))
else:
code = to_native(err_info.get('code', 'Unknown'))
message = to_native(err_info.get('message', 'Unknown error returned by Galaxy server.'))
full_error_msg = "%s (HTTP Code: %d, Message: %s Code: %s)" \
% (context_error_message, http_error.code, message, code)
raise AnsibleError(full_error_msg)

View File

@ -31,13 +31,11 @@ import yaml
from distutils.version import LooseVersion
from shutil import rmtree
import ansible.constants as C
from ansible import context
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_native, to_text
from ansible.module_utils.urls import open_url
from ansible.playbook.role.requirement import RoleRequirement
from ansible.galaxy.api import GalaxyAPI
from ansible.utils.display import Display
display = Display()
@ -50,7 +48,7 @@ class GalaxyRole(object):
META_INSTALL = os.path.join('meta', '.galaxy_install_info')
ROLE_DIRS = ('defaults', 'files', 'handlers', 'meta', 'tasks', 'templates', 'vars', 'tests')
def __init__(self, galaxy, name, src=None, version=None, scm=None, path=None):
def __init__(self, galaxy, api, name, src=None, version=None, scm=None, path=None):
self._metadata = None
self._install_info = None
@ -59,6 +57,7 @@ class GalaxyRole(object):
display.debug('Validate TLS certificates: %s' % self._validate_certs)
self.galaxy = galaxy
self.api = api
self.name = name
self.version = version
@ -205,17 +204,16 @@ class GalaxyRole(object):
role_data = self.src
tmp_file = self.fetch(role_data)
else:
api = GalaxyAPI(self.galaxy, 'role_default', C.GALAXY_SERVER)
role_data = api.lookup_role_by_name(self.src)
role_data = self.api.lookup_role_by_name(self.src)
if not role_data:
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server))
raise AnsibleError("- sorry, %s was not found on %s." % (self.src, self.api.api_server))
if role_data.get('role_type') == 'APP':
# Container Role
display.warning("%s is a Container App role, and should only be installed using Ansible "
"Container" % self.name)
role_versions = api.fetch_role_related('versions', role_data['id'])
role_versions = self.api.fetch_role_related('versions', role_data['id'])
if not self.version:
# convert the version names to LooseVersion objects
# and sort them to get the latest version. If there

View File

@ -25,13 +25,13 @@
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
#
import os
import time
import traceback
from ansible.module_utils._text import to_native
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import env_fallback
import json
@ -117,11 +117,11 @@ class FortiOSHandler(object):
if status == 200:
if vdom == "global":
return json.loads(result_data.decode('utf-8'))[0]['results']
return json.loads(to_text(result_data))[0]['results']
else:
return json.loads(result_data.decode('utf-8'))['results']
return json.loads(to_text(result_data))['results']
else:
return json.loads(result_data.decode('utf-8'))
return json.loads(to_text(result_data))
def get_mkeyname(self, path, name, vdom=None):
schema = self.schema(path, name, vdom=vdom)
@ -200,10 +200,10 @@ class FortiOSHandler(object):
def formatresponse(self, res, vdom=None):
if vdom == "global":
resp = json.loads(res.decode('utf-8'))[0]
resp = json.loads(to_text(res))[0]
resp['vdom'] = "global"
else:
resp = json.loads(res.decode('utf-8'))
resp = json.loads(to_text(res))
return resp
# BEGIN DEPRECATED
@ -253,7 +253,7 @@ class AnsibleFortios(object):
try:
self.forti_device.open()
except Exception as e:
self.module.fail_json(msg='Error connecting device. %s' % to_native(e),
self.module.fail_json(msg='Error connecting device. %s' % to_text(e),
exception=traceback.format_exc())
def load_config(self, path):
@ -266,7 +266,7 @@ class AnsibleFortios(object):
running = f.read()
f.close()
except IOError as e:
self.module.fail_json(msg='Error reading configuration file. %s' % to_native(e),
self.module.fail_json(msg='Error reading configuration file. %s' % to_text(e),
exception=traceback.format_exc())
self.forti_device.load_config(config_text=running, path=path)
@ -276,7 +276,7 @@ class AnsibleFortios(object):
self.forti_device.load_config(path=path)
except Exception as e:
self.forti_device.close()
self.module.fail_json(msg='Error reading running config. %s' % to_native(e),
self.module.fail_json(msg='Error reading running config. %s' % to_text(e),
exception=traceback.format_exc())
# set configs in object
@ -302,7 +302,7 @@ class AnsibleFortios(object):
f.close()
except IOError as e:
self.module.fail_json(msg='Error writing configuration file. %s' %
to_native(e), exception=traceback.format_exc())
to_text(e), exception=traceback.format_exc())
else:
try:
self.forti_device.commit()

View File

@ -204,6 +204,42 @@ class L3_Interfaces(ConfigBase):
return commands
def verify_diff_again(self, want, have):
"""
Verify the IPV4 difference again as sometimes due to
change in order of set, set difference may result into change,
when there's actually no difference between want and have
:param want: want_dict IPV4
:param have: have_dict IPV4
:return: diff
"""
diff = False
for each in want:
each_want = dict(each)
for every in have:
every_have = dict(every)
if each_want.get('address') != every_have.get('address') and \
each_want.get('secondary') != every_have.get('secondary') and \
len(each_want.keys()) == len(every_have.keys()):
diff = True
break
elif each_want.get('dhcp_client') != every_have.get('dhcp_client') and each_want.get(
'dhcp_client') is not None:
diff = True
break
elif each_want.get('dhcp_hostname') != every_have.get('dhcp_hostname') and each_want.get(
'dhcp_hostname') is not None:
diff = True
break
elif each_want.get('address') != every_have.get('address') and len(each_want.keys()) == len(
every_have.keys()):
diff = True
break
if diff:
break
return diff
def _set_config(self, want, have, module):
# Set the interface config based on the want and have config
commands = []
@ -225,6 +261,8 @@ class L3_Interfaces(ConfigBase):
# Get the diff b/w want and have IPV4
if have.get('ipv4'):
ipv4 = tuple(set(dict(want_dict).get('ipv4')) - set(dict(have_dict).get('ipv4')))
if ipv4:
ipv4 = ipv4 if self.verify_diff_again(dict(want_dict).get('ipv4'), dict(have_dict).get('ipv4')) else ()
else:
diff = want_dict - have_dict
ipv4 = dict(diff).get('ipv4')

View File

@ -30,7 +30,7 @@ def add_command_to_config_list(interface, cmd, commands):
def dict_to_set(sample_dict):
# Generate a set with passed dictionary for comparison
test_dict = {}
test_dict = dict()
if isinstance(sample_dict, dict):
for k, v in iteritems(sample_dict):
if v is not None:

View File

@ -96,6 +96,10 @@ def filter_dict_having_none_value(want, have):
if each.get('secondary') and diff_ip is True:
test_key_dict.update({'secondary': True})
test_dict.update({'ipv4': test_key_dict})
# Checks if want doesn't have secondary IP but have has secondary IP set
elif have.get('ipv4'):
if [True for each_have in have.get('ipv4') if 'secondary' in each_have]:
test_dict.update({'ipv4': {'secondary': True}})
if k == 'l2protocol':
if want[k] != have.get('l2protocol') and have.get('l2protocol'):
test_dict.update({k: v})

View File

@ -389,6 +389,9 @@ def create_bucket(module, s3, bucket, location=None):
s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration)
else:
s3.create_bucket(Bucket=bucket)
if module.params.get('permission'):
# Wait for the bucket to exist before setting ACLs
s3.get_waiter('bucket_exists').wait(Bucket=bucket)
for acl in module.params.get('permission'):
s3.put_bucket_acl(ACL=acl, Bucket=bucket)
except botocore.exceptions.ClientError as e:

View File

@ -202,7 +202,6 @@ class AzureRMContainerInstanceInfo(AzureRMModuleBase):
# store the results of the module operation
self.results = dict(
changed=False,
ansible_facts=dict()
)
self.resource_group = None
self.name = None

View File

@ -179,7 +179,6 @@ class AzureRMRecordSetInfo(AzureRMModuleBase):
# store the results of the module operation
self.results = dict(
changed=False,
ansible_info=dict(azure_dnsrecordset=[])
)
self.relative_name = None
@ -221,7 +220,9 @@ class AzureRMRecordSetInfo(AzureRMModuleBase):
results = self.list_zone()
if is_old_facts:
self.results['ansible_facts']['azure_dnsrecordset'] = self.serialize_list(results)
self.results['ansible_facts'] = {
'azure_dnsrecordset': self.serialize_list(results)
}
self.results['dnsrecordsets'] = self.curated_list(results)
return self.results

View File

@ -273,7 +273,6 @@ class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_info=dict(azure_networkinterfaces=[])
)
self.name = None
@ -307,7 +306,10 @@ class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
else:
results = self.list_all()
self.results['ansible_info']['azure_networkinterfaces'] = self.serialize_nics(results)
if is_old_facts:
self.results['ansible_facts'] = {
'azure_networkinterfaces': self.serialize_nics(results)
}
self.results['networkinterfaces'] = self.to_dict_list(results)
return self.results

View File

@ -207,7 +207,6 @@ class AzureRMPublicIPInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(azure_publicipaddresses=[])
)
self.name = None
@ -240,7 +239,9 @@ class AzureRMPublicIPInfo(AzureRMModuleBase):
raw = self.filter(result)
if is_old_facts:
self.results['ansible_facts']['azure_publicipaddresses'] = self.serialize(raw)
self.results['ansible_facts'] = {
'azure_publicipaddresses': self.serialize(raw),
}
self.results['publicipaddresses'] = self.format(raw)
return self.results

View File

@ -154,7 +154,6 @@ class AzureRMResourceGroupInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(azure_resourcegroups=[]),
resourcegroups=[]
)
@ -167,20 +166,25 @@ class AzureRMResourceGroupInfo(AzureRMModuleBase):
facts_module=True)
def exec_module(self, **kwargs):
is_old_facts = self.module._name == 'azure_rm_resourcegroup_facts'
if is_old_facts:
self.module.deprecate("The 'azure_rm_resourcegroup_facts' module has been renamed to 'azure_rm_resourcegroup_info'", version='2.13')
for key in self.module_arg_spec:
setattr(self, key, kwargs[key])
if self.name:
self.results['ansible_facts']['azure_resourcegroups'] = self.get_item()
result = self.get_item()
else:
self.results['ansible_facts']['azure_resourcegroups'] = self.list_items()
result = self.list_items()
if self.list_resources:
for item in self.results['ansible_facts']['azure_resourcegroups']:
for item in result:
item['resources'] = self.list_by_rg(item['name'])
self.results['resourcegroups'] = self.results['ansible_facts']['azure_resourcegroups']
if is_old_facts:
self.results['ansible_facts']['azure_resourcegroups'] = result
self.results['resourcegroups'] = result
return self.results

View File

@ -59,7 +59,7 @@ EXAMPLES = '''
'''
RETURN = '''
azure_securitygroups:
securitygroups:
description:
- List containing security group dicts.
returned: always
@ -247,7 +247,6 @@ class AzureRMSecurityGroupInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_info=dict(azure_securitygroups=[])
)
self.name = None
@ -268,9 +267,15 @@ class AzureRMSecurityGroupInfo(AzureRMModuleBase):
setattr(self, key, kwargs[key])
if self.name is not None:
self.results['ansible_info']['azure_securitygroups'] = self.get_item()
info = self.get_item()
else:
self.results['ansible_info']['azure_securitygroups'] = self.list_items()
info = self.list_items()
if is_old_facts:
self.results['ansible_facts'] = {
'azure_securitygroups': info
}
self.results['securitygroups'] = info
return self.results

View File

@ -138,7 +138,6 @@ class AzureRMSqlServerInfo(AzureRMModuleBase):
# store the results of the module operation
self.results = dict(
changed=False,
ansible_facts=dict()
)
self.resource_group = None
self.server_name = None

View File

@ -371,7 +371,6 @@ class AzureRMStorageAccountInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(azure_storageaccounts=[]),
storageaccounts=[]
)
@ -407,8 +406,10 @@ class AzureRMStorageAccountInfo(AzureRMModuleBase):
filtered = self.filter_tag(results)
if is_old_facts:
self.results['ansible_facts']['azure_storageaccounts'] = self.serialize(filtered)
self.results['ansible_facts']['storageaccounts'] = self.format_to_dict(filtered)
self.results['ansible_facts'] = {
'azure_storageaccounts': self.serialize(filtered),
'storageaccounts': self.format_to_dict(filtered),
}
self.results['storageaccounts'] = self.format_to_dict(filtered)
return self.results

View File

@ -139,7 +139,6 @@ class AzureRMVirtualMachineImageInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(azure_vmimages=[])
)
self.location = None
@ -159,6 +158,7 @@ class AzureRMVirtualMachineImageInfo(AzureRMModuleBase):
setattr(self, key, kwargs[key])
if is_old_facts:
self.results['ansible_facts'] = dict()
if self.location and self.publisher and self.offer and self.sku and self.version:
self.results['ansible_facts']['azure_vmimages'] = self.get_item()
elif self.location and self.publisher and self.offer and self.sku:

View File

@ -280,9 +280,6 @@ class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(
azure_vmss=[]
)
)
self.name = None
@ -308,20 +305,14 @@ class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
if self.name and not self.resource_group:
self.fail("Parameter error: resource group required when filtering by name.")
if is_old_facts:
if self.name:
self.results['ansible_facts']['azure_vmss'] = self.get_item()
else:
self.results['ansible_facts']['azure_vmss'] = self.list_items()
if self.name:
result = self.get_item()
else:
if self.name:
self.results['vmss'] = self.get_item()
else:
self.results['vmss'] = self.list_items()
result = self.list_items()
if self.format == 'curated':
for index in range(len(self.results['ansible_facts']['azure_vmss'])):
vmss = self.results['ansible_facts']['azure_vmss'][index]
for index in range(len(result)):
vmss = result[index]
subnet_name = None
load_balancer_name = None
virtual_network_name = None
@ -385,13 +376,18 @@ class AzureRMVirtualMachineScaleSetInfo(AzureRMModuleBase):
'tags': vmss.get('tags')
}
self.results['ansible_facts']['azure_vmss'][index] = updated
result[index] = updated
# proper result format we want to support in the future
# dropping 'ansible_facts' and shorter name 'vmss'
self.results['vmss'] = self.results['ansible_facts']['azure_vmss']
if not is_old_facts:
self.results.pop('ansible_facts', None)
if is_old_facts:
self.results['ansible_facts'] = {
'azure_vmss': result
}
if self.format == 'curated':
# proper result format we want to support in the future
# dropping 'ansible_facts' and shorter name 'vmss'
self.results['vmss'] = result
else:
self.results['vmss'] = result
return self.results

View File

@ -214,7 +214,6 @@ class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
self.results = dict(
changed=False,
ansible_facts=dict(azure_virtualnetworks=[]),
virtualnetworks=[]
)
@ -242,7 +241,9 @@ class AzureRMNetworkInterfaceInfo(AzureRMModuleBase):
results = self.list_items()
if is_old_facts:
self.results['ansible_facts']['azure_virtualnetworks'] = self.serialize(results)
self.results['ansible_facts'] = {
'azure_virtualnetworks': self.serialize(results)
}
self.results['virtualnetworks'] = self.curated(results)
return self.results

View File

@ -252,7 +252,9 @@ class DODroplet(object):
self.module.exit_json(changed=False, data=droplet_data)
if self.module.check_mode:
self.module.exit_json(changed=True)
response = self.rest.post('droplets', data=self.module.params)
request_params = dict(self.module.params)
del request_params['id']
response = self.rest.post('droplets', data=request_params)
json_data = response.json
if response.status_code >= 400:
self.module.fail_json(changed=False, msg=json_data['message'])

View File

@ -57,6 +57,7 @@ options:
- Mark I(src)/I(dst) as a program. Data will be copied to/from a program.
- See block Examples and PROGRAM arg description U(https://www.postgresql.org/docs/current/sql-copy.html).
type: bool
default: no
options:
description:
- Options of COPY command.
@ -334,7 +335,7 @@ def main():
dst=dict(type='str', aliases=['destination']),
columns=dict(type='list', aliases=['column']),
options=dict(type='dict'),
program=dict(type='bool'),
program=dict(type='bool', default=False),
db=dict(type='str', aliases=['login_db']),
session_role=dict(type='str'),
)

View File

@ -64,6 +64,7 @@ options:
(e.g., VACUUM).
- Mutually exclusive with I(check_mode).
type: bool
default: no
version_added: '2.9'
author:
- Felix Archambault (@archf)
@ -233,7 +234,7 @@ def main():
named_args=dict(type='dict'),
session_role=dict(type='str'),
path_to_script=dict(type='path'),
autocommit=dict(type='bool'),
autocommit=dict(type='bool', default=False),
)
module = AnsibleModule(

View File

@ -92,6 +92,7 @@ options:
has reached its maximum value will return an error. False (NO CYCLE) is
the default.
type: bool
default: no
cascade:
description:
- Automatically drop objects that depend on the sequence, and in turn all
@ -99,6 +100,7 @@ options:
- Ignored if I(state=present).
- Only used with I(state=absent).
type: bool
default: no
rename_to:
description:
- The new name for the I(sequence).
@ -471,9 +473,9 @@ def main():
maxvalue=dict(type='int', aliases=['max']),
start=dict(type='int'),
cache=dict(type='int'),
cycle=dict(type='bool'),
cycle=dict(type='bool', default=False),
schema=dict(type='str', default='public'),
cascade=dict(type='bool'),
cascade=dict(type='bool', default=False),
rename_to=dict(type='str'),
owner=dict(type='str'),
newschema=dict(type='str'),

View File

@ -464,15 +464,15 @@ def main():
db=dict(type='str', default='', aliases=['login_db']),
tablespace=dict(type='str'),
owner=dict(type='str'),
unlogged=dict(type='bool'),
unlogged=dict(type='bool', default=False),
like=dict(type='str'),
including=dict(type='str'),
rename=dict(type='str'),
truncate=dict(type='bool'),
truncate=dict(type='bool', default=False),
columns=dict(type='list'),
storage_params=dict(type='list'),
session_role=dict(type='str'),
cascade=dict(type='bool'),
cascade=dict(type='bool', default=False),
)
module = AnsibleModule(
argument_spec=argument_spec,

View File

@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_access_rule
short_description: Manages access rules on Checkpoint over Web Services API
short_description: Manages access rules on Check Point over Web Services API
description:
- Manages access rules on Checkpoint devices including creating, updating, removing access rules objects,
- Manages access rules on Check Point devices including creating, updating, removing access rules objects,
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -29,9 +29,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_access_rule_facts
short_description: Get access rules objects facts on Checkpoint over Web Services API
short_description: Get access rules objects facts on Check Point over Web Services API
description:
- Get access rules objects facts on Checkpoint devices.
- Get access rules objects facts on Check Point devices.
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_host
short_description: Manages host objects on Checkpoint over Web Services API
short_description: Manages host objects on Check Point over Web Services API
description:
- Manages host objects on Checkpoint devices including creating, updating, removing access rules objects.
- Manages host objects on Check Point devices including creating, updating, removing access rules objects.
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -29,9 +29,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_host_facts
short_description: Get host objects facts on Checkpoint over Web Services API
short_description: Get host objects facts on Check Point over Web Services API
description:
- Get host objects facts on Checkpoint devices.
- Get host objects facts on Check Point devices.
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_run_script
short_description: Run scripts on Checkpoint devices over Web Services API
short_description: Run scripts on Check Point devices over Web Services API
description:
- Run scripts on Checkpoint devices.
- Run scripts on Check Point devices.
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -29,9 +29,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: checkpoint_task_facts
short_description: Get task objects facts on Checkpoint over Web Services API
short_description: Get task objects facts on Check Point over Web Services API
description:
- Get task objects facts on Checkpoint devices.
- Get task objects facts on Check Point devices.
All operations are performed over Web Services API.
version_added: "2.8"
author: "Ansible by Red Hat (@rcarrillocruz)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_layer
short_description: Manages access-layer objects on Checkpoint over Web Services API
short_description: Manages access-layer objects on Check Point over Web Services API
description:
- Manages access-layer objects on Checkpoint devices including creating, updating and removing objects.
- Manages access-layer objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_layer_facts
short_description: Get access-layer objects facts on Checkpoint over Web Services API
short_description: Get access-layer objects facts on Check Point over Web Services API
description:
- Get access-layer objects facts on Checkpoint devices.
- Get access-layer objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_role
short_description: Manages access-role objects on Checkpoint over Web Services API
short_description: Manages access-role objects on Check Point over Web Services API
description:
- Manages access-role objects on Checkpoint devices including creating, updating and removing objects.
- Manages access-role objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_role_facts
short_description: Get access-role objects facts on Checkpoint over Web Services API
short_description: Get access-role objects facts on Check Point over Web Services API
description:
- Get access-role objects facts on Checkpoint devices.
- Get access-role objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_rule
short_description: Manages access-rule objects on Checkpoint over Web Services API
short_description: Manages access-rule objects on Check Point over Web Services API
description:
- Manages access-rule objects on Checkpoint devices including creating, updating and removing objects.
- Manages access-rule objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_access_rule_facts
short_description: Get access-rule objects facts on Checkpoint over Web Services API
short_description: Get access-rule objects facts on Check Point over Web Services API
description:
- Get access-rule objects facts on Checkpoint devices.
- Get access-rule objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_address_range
short_description: Manages address-range objects on Checkpoint over Web Services API
short_description: Manages address-range objects on Check Point over Web Services API
description:
- Manages address-range objects on Checkpoint devices including creating, updating and removing objects.
- Manages address-range objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_address_range_facts
short_description: Get address-range objects facts on Checkpoint over Web Services API
short_description: Get address-range objects facts on Check Point over Web Services API
description:
- Get address-range objects facts on Checkpoint devices.
- Get address-range objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_administrator
short_description: Manages administrator objects on Checkpoint over Web Services API
short_description: Manages administrator objects on Check Point over Web Services API
description:
- Manages administrator objects on Checkpoint devices including creating, updating and removing objects.
- Manages administrator objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_administrator_facts
short_description: Get administrator objects facts on Checkpoint over Web Services API
short_description: Get administrator objects facts on Check Point over Web Services API
description:
- Get administrator objects facts on Checkpoint devices.
- Get administrator objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site
short_description: Manages application-site objects on Checkpoint over Web Services API
short_description: Manages application-site objects on Check Point over Web Services API
description:
- Manages application-site objects on Checkpoint devices including creating, updating and removing objects.
- Manages application-site objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site_category
short_description: Manages application-site-category objects on Checkpoint over Web Services API
short_description: Manages application-site-category objects on Check Point over Web Services API
description:
- Manages application-site-category objects on Checkpoint devices including creating, updating and removing objects.
- Manages application-site-category objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site_category_facts
short_description: Get application-site-category objects facts on Checkpoint over Web Services API
short_description: Get application-site-category objects facts on Check Point over Web Services API
description:
- Get application-site-category objects facts on Checkpoint devices.
- Get application-site-category objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site_facts
short_description: Get application-site objects facts on Checkpoint over Web Services API
short_description: Get application-site objects facts on Check Point over Web Services API
description:
- Get application-site objects facts on Checkpoint devices.
- Get application-site objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site_group
short_description: Manages application-site-group objects on Checkpoint over Web Services API
short_description: Manages application-site-group objects on Check Point over Web Services API
description:
- Manages application-site-group objects on Checkpoint devices including creating, updating and removing objects.
- Manages application-site-group objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_application_site_group_facts
short_description: Get application-site-group objects facts on Checkpoint over Web Services API
short_description: Get application-site-group objects facts on Check Point over Web Services API
description:
- Get application-site-group objects facts on Checkpoint devices.
- Get application-site-group objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_assign_global_assignment
short_description: assign global assignment on Checkpoint over Web Services API
short_description: assign global assignment on Check Point over Web Services API
description:
- assign global assignment on Checkpoint over Web Services API
- assign global assignment on Check Point over Web Services API
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_dns_domain
short_description: Manages dns-domain objects on Checkpoint over Web Services API
short_description: Manages dns-domain objects on Check Point over Web Services API
description:
- Manages dns-domain objects on Checkpoint devices including creating, updating and removing objects.
- Manages dns-domain objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_dns_domain_facts
short_description: Get dns-domain objects facts on Checkpoint over Web Services API
short_description: Get dns-domain objects facts on Check Point over Web Services API
description:
- Get dns-domain objects facts on Checkpoint devices.
- Get dns-domain objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_dynamic_object
short_description: Manages dynamic-object objects on Checkpoint over Web Services API
short_description: Manages dynamic-object objects on Check Point over Web Services API
description:
- Manages dynamic-object objects on Checkpoint devices including creating, updating and removing objects.
- Manages dynamic-object objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_dynamic_object_facts
short_description: Get dynamic-object objects facts on Checkpoint over Web Services API
short_description: Get dynamic-object objects facts on Check Point over Web Services API
description:
- Get dynamic-object objects facts on Checkpoint devices.
- Get dynamic-object objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_exception_group
short_description: Manages exception-group objects on Checkpoint over Web Services API
short_description: Manages exception-group objects on Check Point over Web Services API
description:
- Manages exception-group objects on Checkpoint devices including creating, updating and removing objects.
- Manages exception-group objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_exception_group_facts
short_description: Get exception-group objects facts on Checkpoint over Web Services API
short_description: Get exception-group objects facts on Check Point over Web Services API
description:
- Get exception-group objects facts on Checkpoint devices.
- Get exception-group objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_global_assignment
short_description: Manages global-assignment objects on Checkpoint over Web Services API
short_description: Manages global-assignment objects on Check Point over Web Services API
description:
- Manages global-assignment objects on Checkpoint devices including creating, updating and removing objects.
- Manages global-assignment objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_global_assignment_facts
short_description: Get global-assignment objects facts on Checkpoint over Web Services API
short_description: Get global-assignment objects facts on Check Point over Web Services API
description:
- Get global-assignment objects facts on Checkpoint devices.
- Get global-assignment objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_group
short_description: Manages group objects on Checkpoint over Web Services API
short_description: Manages group objects on Check Point over Web Services API
description:
- Manages group objects on Checkpoint devices including creating, updating and removing objects.
- Manages group objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_group_facts
short_description: Get group objects facts on Checkpoint over Web Services API
short_description: Get group objects facts on Check Point over Web Services API
description:
- Get group objects facts on Checkpoint devices.
- Get group objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_group_with_exclusion
short_description: Manages group-with-exclusion objects on Checkpoint over Web Services API
short_description: Manages group-with-exclusion objects on Check Point over Web Services API
description:
- Manages group-with-exclusion objects on Checkpoint devices including creating, updating and removing objects.
- Manages group-with-exclusion objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_group_with_exclusion_facts
short_description: Get group-with-exclusion objects facts on Checkpoint over Web Services API
short_description: Get group-with-exclusion objects facts on Check Point over Web Services API
description:
- Get group-with-exclusion objects facts on Checkpoint devices.
- Get group-with-exclusion objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_host
short_description: Manages host objects on Checkpoint over Web Services API
short_description: Manages host objects on Check Point over Web Services API
description:
- Manages host objects on Checkpoint devices including creating, updating and removing objects.
- Manages host objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_host_facts
short_description: Get host objects facts on Checkpoint over Web Services API
short_description: Get host objects facts on Check Point over Web Services API
description:
- Get host objects facts on Checkpoint devices.
- Get host objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_install_policy
short_description: install policy on Checkpoint over Web Services API
short_description: install policy on Check Point over Web Services API
description:
- install policy on Checkpoint over Web Services API
- install policy on Check Point over Web Services API
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_mds_facts
short_description: Get Multi-Domain Server (mds) objects facts on Checkpoint over Web Services API
short_description: Get Multi-Domain Server (mds) objects facts on Check Point over Web Services API
description:
- Get mds objects facts on Checkpoint devices.
- Get mds objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_multicast_address_range
short_description: Manages multicast-address-range objects on Checkpoint over Web Services API
short_description: Manages multicast-address-range objects on Check Point over Web Services API
description:
- Manages multicast-address-range objects on Checkpoint devices including creating, updating and removing objects.
- Manages multicast-address-range objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_multicast_address_range_facts
short_description: Get multicast-address-range objects facts on Checkpoint over Web Services API
short_description: Get multicast-address-range objects facts on Check Point over Web Services API
description:
- Get multicast-address-range objects facts on Checkpoint devices.
- Get multicast-address-range objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_network
short_description: Manages network objects on Checkpoint over Web Services API
short_description: Manages network objects on Check Point over Web Services API
description:
- Manages network objects on Checkpoint devices including creating, updating and removing objects.
- Manages network objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_network_facts
short_description: Get network objects facts on Checkpoint over Web Services API
short_description: Get network objects facts on Check Point over Web Services API
description:
- Get network objects facts on Checkpoint devices.
- Get network objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_package
short_description: Manages package objects on Checkpoint over Web Services API
short_description: Manages package objects on Check Point over Web Services API
description:
- Manages package objects on Checkpoint devices including creating, updating and removing objects.
- Manages package objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_package_facts
short_description: Get package objects facts on Checkpoint over Web Services API
short_description: Get package objects facts on Check Point over Web Services API
description:
- Get package objects facts on Checkpoint devices.
- Get package objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_put_file
short_description: put file on Checkpoint over Web Services API
short_description: put file on Check Point over Web Services API
description:
- put file on Checkpoint over Web Services API
- put file on Check Point over Web Services API
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_security_zone
short_description: Manages security-zone objects on Checkpoint over Web Services API
short_description: Manages security-zone objects on Check Point over Web Services API
description:
- Manages security-zone objects on Checkpoint devices including creating, updating and removing objects.
- Manages security-zone objects on Check Point devices including creating, updating and removing objects.
- All operations are performed over Web Services API.
version_added: "2.9"
author: "Or Soffer (@chkp-orso)"

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
# Ansible module to manage Check Point Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,9 +28,9 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
DOCUMENTATION = """
---
module: cp_mgmt_security_zone_facts
short_description: Get security-zone objects facts on Checkpoint over Web Services API
short_description: Get security-zone objects facts on Check Point over Web Services API
description:
- Get security-zone objects facts on Checkpoint devices.
- Get security-zone objects facts on Check Point devices.
- All operations are performed over Web Services API.
- This module handles both operations, get a specific object and get several objects,
For getting a specific object use the parameter 'name'.

Some files were not shown because too many files have changed in this diff Show More