diff --git a/plugins/doc_fragments/ipamodule_base_docs.py b/plugins/doc_fragments/ipamodule_base_docs.py
index 10b1bb2b..e60df97b 100644
--- a/plugins/doc_fragments/ipamodule_base_docs.py
+++ b/plugins/doc_fragments/ipamodule_base_docs.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
class ModuleDocFragment(object): # pylint: disable=R0205,R0903
DOCUMENTATION = r"""
diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py
index c6307aea..de09be1c 100644
--- a/plugins/module_utils/ansible_freeipa_module.py
+++ b/plugins/module_utils/ansible_freeipa_module.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
__all__ = ["gssapi", "netaddr", "api", "ipalib_errors", "Env",
"DEFAULT_CONFIG", "LDAP_GENERALIZED_TIME_FORMAT",
"kinit_password", "kinit_keytab", "run", "DN", "VERSION",
@@ -100,7 +103,7 @@ else:
import socket
import base64
- import six
+ from ansible.module_utils import six
try:
from collections.abc import Mapping # noqa
diff --git a/plugins/modules/ipaautomember.py b/plugins/modules/ipaautomember.py
index 7230ea57..27be1fc8 100644
--- a/plugins/modules/ipaautomember.py
+++ b/plugins/modules/ipaautomember.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -21,6 +20,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.0",
@@ -100,7 +102,7 @@ EXAMPLES = """
state: present
inclusive:
- key: "mail"
- expression: "example.com$
+ expression: "example.com"
# Delete an automember rule
- ipaautomember:
diff --git a/plugins/modules/ipaautomountlocation.py b/plugins/modules/ipaautomountlocation.py
index f1925ddc..8f0b77b7 100644
--- a/plugins/modules/ipaautomountlocation.py
+++ b/plugins/modules/ipaautomountlocation.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
# Chris Procter
@@ -19,6 +18,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipaconfig.py b/plugins/modules/ipaconfig.py
index 1239fbc3..4b2df6a5 100644
--- a/plugins/modules/ipaconfig.py
+++ b/plugins/modules/ipaconfig.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipadelegation.py b/plugins/modules/ipadelegation.py
index 33593056..6097a29e 100644
--- a/plugins/modules/ipadelegation.py
+++ b/plugins/modules/ipadelegation.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipadnsconfig.py b/plugins/modules/ipadnsconfig.py
index 889b7ee7..f6d4c468 100644
--- a/plugins/modules/ipadnsconfig.py
+++ b/plugins/modules/ipadnsconfig.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -21,6 +20,10 @@
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipadnsforwardzone.py b/plugins/modules/ipadnsforwardzone.py
index 09ff09b9..f8d19933 100644
--- a/plugins/modules/ipadnsforwardzone.py
+++ b/plugins/modules/ipadnsforwardzone.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipadnsrecord.py b/plugins/modules/ipadnsrecord.py
index 9f8d2772..dc728031 100644
--- a/plugins/modules/ipadnsrecord.py
+++ b/plugins/modules/ipadnsrecord.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
"""DNS Record ansible-freeipa module."""
ANSIBLE_METADATA = {
@@ -866,8 +869,7 @@ from ansible.module_utils.ansible_freeipa_module import \
import dns.reversename
import dns.resolver
-import six
-
+from ansible.module_utils import six
if six.PY3:
unicode = str
diff --git a/plugins/modules/ipadnszone.py b/plugins/modules/ipadnszone.py
index c1354d3a..f4dbc8ee 100644
--- a/plugins/modules/ipadnszone.py
+++ b/plugins/modules/ipadnszone.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -207,7 +210,7 @@ from ansible.module_utils.ansible_freeipa_module import (
ipalib_errors
) # noqa: E402
import netaddr
-import six
+from ansible.module_utils import six
if six.PY3:
diff --git a/plugins/modules/ipagroup.py b/plugins/modules/ipagroup.py
index 2815b460..979bf623 100644
--- a/plugins/modules/ipagroup.py
+++ b/plugins/modules/ipagroup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipahbacrule.py b/plugins/modules/ipahbacrule.py
index 3547b95a..4744acf7 100644
--- a/plugins/modules/ipahbacrule.py
+++ b/plugins/modules/ipahbacrule.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipahbacsvc.py b/plugins/modules/ipahbacsvc.py
index 30e9fdde..59053e07 100644
--- a/plugins/modules/ipahbacsvc.py
+++ b/plugins/modules/ipahbacsvc.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipahbacsvcgroup.py b/plugins/modules/ipahbacsvcgroup.py
index 60f05d2d..dc6d2780 100644
--- a/plugins/modules/ipahbacsvcgroup.py
+++ b/plugins/modules/ipahbacsvcgroup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipahost.py b/plugins/modules/ipahost.py
index aa94ccec..e4832583 100644
--- a/plugins/modules/ipahost.py
+++ b/plugins/modules/ipahost.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -403,7 +406,7 @@ host:
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, \
encode_certificate, is_ipv4_addr, is_ipv6_addr, ipalib_errors
-import six
+from ansible.module_utils import six
if six.PY3:
unicode = str
@@ -436,7 +439,7 @@ def find_dnsrecord(module, name):
This function may raise ipalib_errors.NotFound in some cases,
and it should be handled by the caller.
"""
- domain_name = name[name.find(".")+1:]
+ domain_name = name[name.find(".") + 1:]
host_name = name[:name.find(".")]
_args = {
@@ -1228,7 +1231,7 @@ def main():
}])
if len(dnsrecord_a_add) > 0 or len(dnsrecord_aaaa_add) > 0:
- domain_name = name[name.find(".")+1:]
+ domain_name = name[name.find(".") + 1:]
host_name = name[:name.find(".")]
_args = {"idnsname": host_name}
@@ -1245,7 +1248,7 @@ def main():
"dnsrecord_add", _args])
if len(dnsrecord_a_del) > 0 or len(dnsrecord_aaaa_del) > 0:
- domain_name = name[name.find(".")+1:]
+ domain_name = name[name.find(".") + 1:]
host_name = name[:name.find(".")]
# There seems to be an issue with dnsrecord_del (not
@@ -1361,7 +1364,7 @@ def main():
if "arecord" in dnsrecord_args or \
"aaaarecord" in dnsrecord_args:
- domain_name = name[name.find(".")+1:]
+ domain_name = name[name.find(".") + 1:]
host_name = name[:name.find(".")]
dnsrecord_args["idnsname"] = host_name
diff --git a/plugins/modules/ipahostgroup.py b/plugins/modules/ipahostgroup.py
index cf9ce90c..285fe51d 100644
--- a/plugins/modules/ipahostgroup.py
+++ b/plugins/modules/ipahostgroup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipalocation.py b/plugins/modules/ipalocation.py
index 9b017cd0..0b7feadc 100644
--- a/plugins/modules/ipalocation.py
+++ b/plugins/modules/ipalocation.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipapermission.py b/plugins/modules/ipapermission.py
index b1016133..2624a25e 100644
--- a/plugins/modules/ipapermission.py
+++ b/plugins/modules/ipapermission.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipaprivilege.py b/plugins/modules/ipaprivilege.py
index 6856b1a6..45abe646 100644
--- a/plugins/modules/ipaprivilege.py
+++ b/plugins/modules/ipaprivilege.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
"""ansible-freeipa module to manage FreeIPA privileges."""
@@ -110,7 +113,7 @@ RETURN = """
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, gen_add_list, \
gen_intersection_list
-import six
+from ansible.module_utils import six
if six.PY3:
unicode = str
diff --git a/plugins/modules/ipapwpolicy.py b/plugins/modules/ipapwpolicy.py
index 6f1fd06c..7746b10c 100644
--- a/plugins/modules/ipapwpolicy.py
+++ b/plugins/modules/ipapwpolicy.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/iparole.py b/plugins/modules/iparole.py
index 63d674fd..912cfc1e 100644
--- a/plugins/modules/iparole.py
+++ b/plugins/modules/iparole.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
"""ansible-freeipa iparole module implementation."""
@@ -21,6 +20,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -101,7 +104,7 @@ EXAMPLES = """
from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, gen_add_del_lists, compare_args_ipa
-import six
+from ansible.module_utils import six
if six.PY3:
diff --git a/plugins/modules/ipaselfservice.py b/plugins/modules/ipaselfservice.py
index 7bd26aff..cc6ca6bd 100644
--- a/plugins/modules/ipaselfservice.py
+++ b/plugins/modules/ipaselfservice.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipaserver.py b/plugins/modules/ipaserver.py
index ac52ca18..e80e706a 100644
--- a/plugins/modules/ipaserver.py
+++ b/plugins/modules/ipaserver.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipaservice.py b/plugins/modules/ipaservice.py
index 3f30bd23..d1623c93 100644
--- a/plugins/modules/ipaservice.py
+++ b/plugins/modules/ipaservice.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -183,21 +186,23 @@ EXAMPLES = """
ipaadmin_password: SomeADMINpassword
name: HTTP/www.example.com
certificate:
- - MIIC/zCCAeegAwIBAgIUMNHIbn+hhrOVew/2WbkteisV29QwDQYJKoZIhvcNAQELBQAw
- DzENMAsGA1UEAwwEdGVzdDAeFw0yMDAyMDQxNDQxMDhaFw0zMDAyMDExNDQxMDhaMA8xDT
- ALBgNVBAMMBHRlc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+XVVGFYpH
- VkcDfVnNInE1Y/pFciegdzqTjMwUWlRL4Zt3u96GhaMLRbtk+OfEkzLUAhWBOwEraELJzM
- LJOMvjYF3C+TiGO7dStFLikZmccuSsSIXjnzIPwBXa8KvgRVRyGLoVvGbLJvmjfMXp0nIT
- oTx/i74KF9S++WEes9H5ErJ99CDhLKFgq0amnvsgparYXhypHaRLnikn0vQINt55YoEd1s
- 4KrvEcD2VdZkIMPbLRu2zFvMprF3cjQQG4LT9ggfEXNIPZ1nQWAnAsu7OJEkNF+E4Mkmpc
- xj9aGUVt5bsq1D+Tzj3GsidSX0nSNcZ2JltXRnL/5v63g5cZyE+nAgMBAAGjUzBRMB0GA1
- UdDgQWBBRV0j7JYukuH/r/t9+QeNlRLXDlEDAfBgNVHSMEGDAWgBRV0j7JYukuH/r/t9+Q
- eNlRLXDlEDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCgVy1+1kNwHs
- 5y1Zp0WjMWGCJC6/zw7FDG4OW5r2GJiCXZYdJ0UonY9ZtoVLJPrp2/DAv1m5DtnDhBYqic
- uPgLzEkOS1KdTi20Otm/J4yxLLrZC5W4x0XOeSVPXOJuQWfwQ5pPvKkn6WxYUYkGwIt1OH
- 2nSMngkbami3CbSmKZOCpgQIiSlQeDJ8oGjWFMLDymYSHoVOIXHwNoooyEiaio3693l6no
- obyGv49zyCVLVR1DC7i6RJ186ql0av+D4vPoiF5mX7+sKC2E8xEj9uKQ5GTWRh59VnRBVC
- /SiMJ/H78tJnBAvoBwXxSEvj8Z3Kjm/BQqZfv4IBsA5yqV7MVq
+ - >
+ MIIC/zCCAeegAwIBAgIUMNHIbn+hhrOVew/2WbkteisV29QwDQYJKoZIhvcNAQELBQAw
+ DzENMAsGA1UEAwwEdGVzdDAeFw0yMDAyMDQxNDQxMDhaFw0zMDAyMDExNDQxMDhaMA8x
+ DTALBgNVBAMMBHRlc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+XVVG
+ FYpHVkcDfVnNInE1Y/pFciegdzqTjMwUWlRL4Zt3u96GhaMLRbtk+OfEkzLUAhWBOwEr
+ aELJzMLJOMvjYF3C+TiGO7dStFLikZmccuSsSIXjnzIPwBXa8KvgRVRyGLoVvGbLJvmj
+ fMXp0nIToTx/i74KF9S++WEes9H5ErJ99CDhLKFgq0amnvsgparYXhypHaRLnikn0vQI
+ Nt55YoEd1s4KrvEcD2VdZkIMPbLRu2zFvMprF3cjQQG4LT9ggfEXNIPZ1nQWAnAsu7OJ
+ EkNF+E4Mkmpcxj9aGUVt5bsq1D+Tzj3GsidSX0nSNcZ2JltXRnL/5v63g5cZyE+nAgMB
+ AAGjUzBRMB0GA1UdDgQWBBRV0j7JYukuH/r/t9+QeNlRLXDlEDAfBgNVHSMEGDAWgBRV
+ 0j7JYukuH/r/t9+QeNlRLXDlEDAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUA
+ A4IBAQCgVy1+1kNwHs5y1Zp0WjMWGCJC6/zw7FDG4OW5r2GJiCXZYdJ0UonY9ZtoVLJP
+ rp2/DAv1m5DtnDhBYqicuPgLzEkOS1KdTi20Otm/J4yxLLrZC5W4x0XOeSVPXOJuQWfw
+ Q5pPvKkn6WxYUYkGwIt1OH2nSMngkbami3CbSmKZOCpgQIiSlQeDJ8oGjWFMLDymYSHo
+ VOIXHwNoooyEiaio3693l6noobyGv49zyCVLVR1DC7i6RJ186ql0av+D4vPoiF5mX7+s
+ KC2E8xEj9uKQ5GTWRh59VnRBVC/SiMJ/H78tJnBAvoBwXxSEvj8Z3Kjm/BQqZfv4IBsA
+ 5yqV7MVq
action: member
state: present
@@ -285,7 +290,8 @@ def gen_args_smb(netbiosname, ok_as_delegate, ok_to_auth_as_delegate):
def check_parameters(module, state, action, names, parameters):
- assert isinstance(parameters, dict)
+ if not isinstance(parameters, dict):
+ raise AssertionError("parameters is not a dict")
# invalid parameters for everything but state 'present', action 'service'.
invalid = ['pac_type', 'auth_ind', 'skip_host_check',
diff --git a/plugins/modules/ipasudocmd.py b/plugins/modules/ipasudocmd.py
index 614f45b4..10089073 100644
--- a/plugins/modules/ipasudocmd.py
+++ b/plugins/modules/ipasudocmd.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipasudocmdgroup.py b/plugins/modules/ipasudocmdgroup.py
index 42f29fb8..118dea00 100644
--- a/plugins/modules/ipasudocmdgroup.py
+++ b/plugins/modules/ipasudocmdgroup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipasudorule.py b/plugins/modules/ipasudorule.py
index d5a459a8..27a99aba 100644
--- a/plugins/modules/ipasudorule.py
+++ b/plugins/modules/ipasudorule.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipatopologysegment.py b/plugins/modules/ipatopologysegment.py
index e8ef2b0a..616fc5f7 100644
--- a/plugins/modules/ipatopologysegment.py
+++ b/plugins/modules/ipatopologysegment.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipatopologysuffix.py b/plugins/modules/ipatopologysuffix.py
index c5be3d3e..9845eb7b 100644
--- a/plugins/modules/ipatopologysuffix.py
+++ b/plugins/modules/ipatopologysuffix.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/plugins/modules/ipatrust.py b/plugins/modules/ipatrust.py
index 0d9036eb..6251ecc8 100644
--- a/plugins/modules/ipatrust.py
+++ b/plugins/modules/ipatrust.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community',
'status': ['preview'],
diff --git a/plugins/modules/ipauser.py b/plugins/modules/ipauser.py
index f88e8d8f..b737f749 100644
--- a/plugins/modules/ipauser.py
+++ b/plugins/modules/ipauser.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -472,7 +475,7 @@ user:
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, date_format, \
encode_certificate, load_cert_from_str, DN_x500_text, to_text
-import six
+from ansible.module_utils import six
if six.PY3:
unicode = str
@@ -696,8 +699,8 @@ def check_certmapdata(data):
i = data.find("", 4)
s = data.find("", i) # pylint: disable=invalid-name
- issuer = data[i+3:s]
- subject = data[s+3:]
+ issuer = data[i + 3:s]
+ subject = data[s + 3:]
if i < 0 or s < 0 or "CN" not in issuer or "CN" not in subject:
return False
diff --git a/plugins/modules/ipavault.py b/plugins/modules/ipavault.py
index 0274b705..76d3ae2d 100644
--- a/plugins/modules/ipavault.py
+++ b/plugins/modules/ipavault.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
diff --git a/roles/ipabackup/library/ipabackup_get_backup_dir.py b/roles/ipabackup/library/ipabackup_get_backup_dir.py
index b76d01d4..d9eeb512 100644
--- a/roles/ipabackup/library/ipabackup_get_backup_dir.py
+++ b/roles/ipabackup/library/ipabackup_get_backup_dir.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -40,7 +43,8 @@ author:
EXAMPLES = '''
# Get IPA_BACKUP_DIR from ipaplatform
-- name: ipabackup_get_backup_dir:
+- name: Get IPA_BACKUP_DIR from ipaplatform
+ ipabackup_get_backup_dir:
register result
'''
diff --git a/roles/ipaclient/action_plugins/ipaclient_get_otp.py b/roles/ipaclient/action_plugins/ipaclient_get_otp.py
index 8e04ad99..c7a26462 100644
--- a/roles/ipaclient/action_plugins/ipaclient_get_otp.py
+++ b/roles/ipaclient/action_plugins/ipaclient_get_otp.py
@@ -17,6 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
try:
import gssapi
except ImportError:
diff --git a/roles/ipaclient/library/ipaclient_api.py b/roles/ipaclient/library/ipaclient_api.py
index 865438f3..908f538d 100644
--- a/roles/ipaclient/library/ipaclient_api.py
+++ b/roles/ipaclient/library/ipaclient_api.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
diff --git a/roles/ipaclient/library/ipaclient_fix_ca.py b/roles/ipaclient/library/ipaclient_fix_ca.py
index 858edc28..799920a5 100644
--- a/roles/ipaclient/library/ipaclient_fix_ca.py
+++ b/roles/ipaclient/library/ipaclient_fix_ca.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
diff --git a/roles/ipaclient/library/ipaclient_fstore.py b/roles/ipaclient/library/ipaclient_fstore.py
index 4c342960..f05c35b3 100644
--- a/roles/ipaclient/library/ipaclient_fstore.py
+++ b/roles/ipaclient/library/ipaclient_fstore.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_get_facts.py b/roles/ipaclient/library/ipaclient_get_facts.py
index b7e270fc..1a2b331c 100644
--- a/roles/ipaclient/library/ipaclient_get_facts.py
+++ b/roles/ipaclient/library/ipaclient_get_facts.py
@@ -1,6 +1,9 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
DOCUMENTATION = """
---
module: ipaclient_get_facts
@@ -12,9 +15,9 @@ author:
import os
import re
-import six
+from ansible.module_utils import six
try:
- from six.moves.configparser import RawConfigParser
+ from ansible.module_utils.six.moves.configparser import RawConfigParser
except ImportError:
from ConfigParser import RawConfigParser
@@ -81,7 +84,8 @@ def is_dogtag_configured(subsystem):
# ca / kra is configured when the directory
# /var/lib/pki/pki-tomcat/[ca|kra] # exists
available_subsystems = {'ca', 'kra'}
- assert subsystem in available_subsystems
+ if subsystem not in available_subsystems:
+ raise AssertionError("Subsystem '%s' not available" % subsystem)
return os.path.isdir(os.path.join(VAR_LIB_PKI_TOMCAT, subsystem))
@@ -120,7 +124,7 @@ def get_ipa_conf():
basedn=basedn,
realm=realm,
domain=domain
- )
+ )
def get_ipa_version():
@@ -147,7 +151,7 @@ def get_ipa_version():
vendor_version=version.VENDOR_VERSION,
version=version.VERSION,
version_info=version_info
- )
+ )
def main():
@@ -193,7 +197,7 @@ def main():
module.exit_json(
changed=False,
ansible_facts=dict(ipa=facts)
- )
+ )
if __name__ == '__main__':
diff --git a/roles/ipaclient/library/ipaclient_get_otp.py b/roles/ipaclient/library/ipaclient_get_otp.py
index 03e8b2b0..1ae05ea8 100644
--- a/roles/ipaclient/library/ipaclient_get_otp.py
+++ b/roles/ipaclient/library/ipaclient_get_otp.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
@@ -121,9 +124,9 @@ host:
'''
import os
-import six
from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils import six
from ipalib import api, errors
from ipaplatform.paths import paths
diff --git a/roles/ipaclient/library/ipaclient_ipa_conf.py b/roles/ipaclient/library/ipaclient_ipa_conf.py
index ac31e01f..36a41d83 100644
--- a/roles/ipaclient/library/ipaclient_ipa_conf.py
+++ b/roles/ipaclient/library/ipaclient_ipa_conf.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_join.py b/roles/ipaclient/library/ipaclient_join.py
index b67be370..2c72a6a6 100644
--- a/roles/ipaclient/library/ipaclient_join.py
+++ b/roles/ipaclient/library/ipaclient_join.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -179,7 +182,7 @@ def main():
if password is None and admin_keytab is None:
module.fail_json(msg="Password or admin_keytab is needed")
- client_domain = hostname[hostname.find(".")+1:]
+ client_domain = hostname[hostname.find(".") + 1:]
nolog = tuple()
env = {'PATH': SECURE_PATH}
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
diff --git a/roles/ipaclient/library/ipaclient_set_hostname.py b/roles/ipaclient/library/ipaclient_set_hostname.py
index 4145df9a..3b57d9ae 100644
--- a/roles/ipaclient/library/ipaclient_set_hostname.py
+++ b/roles/ipaclient/library/ipaclient_set_hostname.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_automount.py b/roles/ipaclient/library/ipaclient_setup_automount.py
index 1fda9ba0..6ff12bf4 100644
--- a/roles/ipaclient/library/ipaclient_setup_automount.py
+++ b/roles/ipaclient/library/ipaclient_setup_automount.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_firefox.py b/roles/ipaclient/library/ipaclient_setup_firefox.py
index 7095692e..69fccc58 100644
--- a/roles/ipaclient/library/ipaclient_setup_firefox.py
+++ b/roles/ipaclient/library/ipaclient_setup_firefox.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_krb5.py b/roles/ipaclient/library/ipaclient_setup_krb5.py
index 9eb3e948..48c42d00 100644
--- a/roles/ipaclient/library/ipaclient_setup_krb5.py
+++ b/roles/ipaclient/library/ipaclient_setup_krb5.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_nis.py b/roles/ipaclient/library/ipaclient_setup_nis.py
index e04b87c6..c95aadaa 100644
--- a/roles/ipaclient/library/ipaclient_setup_nis.py
+++ b/roles/ipaclient/library/ipaclient_setup_nis.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_nss.py b/roles/ipaclient/library/ipaclient_setup_nss.py
index d829a56b..8d1dccae 100644
--- a/roles/ipaclient/library/ipaclient_setup_nss.py
+++ b/roles/ipaclient/library/ipaclient_setup_nss.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_ntp.py b/roles/ipaclient/library/ipaclient_setup_ntp.py
index b41a910b..b95f2f24 100644
--- a/roles/ipaclient/library/ipaclient_setup_ntp.py
+++ b/roles/ipaclient/library/ipaclient_setup_ntp.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_ssh.py b/roles/ipaclient/library/ipaclient_setup_ssh.py
index f721b2a2..11ea652c 100644
--- a/roles/ipaclient/library/ipaclient_setup_ssh.py
+++ b/roles/ipaclient/library/ipaclient_setup_ssh.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaclient/library/ipaclient_setup_sssd.py b/roles/ipaclient/library/ipaclient_setup_sssd.py
index 3fd767fc..5d2f520c 100644
--- a/roles/ipaclient/library/ipaclient_setup_sssd.py
+++ b/roles/ipaclient/library/ipaclient_setup_sssd.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -156,7 +159,7 @@ def main():
options.krb5_offline_passwords = not options.no_krb5_offline_passwords
fstore = sysrestore.FileStore(paths.IPA_CLIENT_SYSRESTORE)
- client_domain = hostname[hostname.find(".")+1:]
+ client_domain = hostname[hostname.find(".") + 1:]
if configure_sssd_conf(fstore, cli_realm, cli_domain, cli_server,
options, client_domain, hostname):
diff --git a/roles/ipaclient/library/ipaclient_test.py b/roles/ipaclient/library/ipaclient_test.py
index 84c8f0a4..540daba4 100644
--- a/roles/ipaclient/library/ipaclient_test.py
+++ b/roles/ipaclient/library/ipaclient_test.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -197,7 +200,7 @@ import socket
import inspect
try:
- from six.moves.configparser import RawConfigParser
+ from ansible.module_utils.six.moves.configparser import RawConfigParser
except ImportError:
from ConfigParser import RawConfigParser
@@ -319,7 +322,7 @@ def main():
if options.domain_name is None and options.servers is not None:
if len(options.servers) > 0:
options.domain_name = options.servers[0][
- options.servers[0].find(".")+1:]
+ options.servers[0].find(".") + 1:]
try:
self = options
@@ -701,7 +704,7 @@ def main():
cli_domain_source = ds.domain_source
logger.debug("will use discovered domain: %s", cli_domain)
- client_domain = hostname[hostname.find(".")+1:]
+ client_domain = hostname[hostname.find(".") + 1:]
if ret in (ipadiscovery.NO_LDAP_SERVER, ipadiscovery.NOT_IPA_SERVER) \
or not ds.server:
diff --git a/roles/ipaclient/library/ipaclient_test_keytab.py b/roles/ipaclient/library/ipaclient_test_keytab.py
index 75ed1091..97a1ab79 100644
--- a/roles/ipaclient/library/ipaclient_test_keytab.py
+++ b/roles/ipaclient/library/ipaclient_test_keytab.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -131,7 +134,7 @@ def main():
kdc = module.params.get('kdc')
kinit_attempts = module.params.get('kinit_attempts')
- client_domain = hostname[hostname.find(".")+1:]
+ client_domain = hostname[hostname.find(".") + 1:]
host_principal = 'host/%s@%s' % (hostname, realm)
sssd = True
diff --git a/roles/ipaclient/module_utils/ansible_ipa_client.py b/roles/ipaclient/module_utils/ansible_ipa_client.py
index 733375c9..8826b6d4 100644
--- a/roles/ipaclient/module_utils/ansible_ipa_client.py
+++ b/roles/ipaclient/module_utils/ansible_ipa_client.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
__all__ = ["gssapi", "version", "ipadiscovery", "api", "errors", "x509",
"constants", "sysrestore", "certmonger", "certstore",
"delete_persistent_client_session_data", "ScriptError",
@@ -60,7 +63,7 @@ else:
# See ipapython/version.py
IPA_MAJOR, IPA_MINOR, IPA_RELEASE = [int(x) for x in
VERSION.split(".", 2)]
- IPA_PYTHON_VERSION = IPA_MAJOR*10000 + IPA_MINOR*100 + IPA_RELEASE
+ IPA_PYTHON_VERSION = IPA_MAJOR * 10000 + IPA_MINOR * 100 + IPA_RELEASE
else:
IPA_PYTHON_VERSION = NUM_VERSION
diff --git a/roles/ipareplica/library/ipareplica_add_to_ipaservers.py b/roles/ipareplica/library/ipareplica_add_to_ipaservers.py
index acd553b7..2ec634cc 100644
--- a/roles/ipareplica/library/ipareplica_add_to_ipaservers.py
+++ b/roles/ipareplica/library/ipareplica_add_to_ipaservers.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
@@ -63,7 +64,6 @@ RETURN = '''
'''
import os
-import six
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ansible_ipa_replica import (
@@ -72,6 +72,8 @@ from ansible.module_utils.ansible_ipa_replica import (
gen_remote_api, api
)
+from ansible.module_utils import six
+
if six.PY3:
unicode = str
diff --git a/roles/ipareplica/library/ipareplica_create_ipa_conf.py b/roles/ipareplica/library/ipareplica_create_ipa_conf.py
index c475469f..e75f150e 100644
--- a/roles/ipareplica/library/ipareplica_create_ipa_conf.py
+++ b/roles/ipareplica/library/ipareplica_create_ipa_conf.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_custodia_import_dm_password.py b/roles/ipareplica/library/ipareplica_custodia_import_dm_password.py
index c580ed5f..6199e50a 100644
--- a/roles/ipareplica/library/ipareplica_custodia_import_dm_password.py
+++ b/roles/ipareplica/library/ipareplica_custodia_import_dm_password.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_ds_apply_updates.py b/roles/ipareplica/library/ipareplica_ds_apply_updates.py
index 71008b32..3d2fc97b 100644
--- a/roles/ipareplica/library/ipareplica_ds_apply_updates.py
+++ b/roles/ipareplica/library/ipareplica_ds_apply_updates.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_ds_enable_ssl.py b/roles/ipareplica/library/ipareplica_ds_enable_ssl.py
index 3e4090d8..93f88f62 100644
--- a/roles/ipareplica/library/ipareplica_ds_enable_ssl.py
+++ b/roles/ipareplica/library/ipareplica_ds_enable_ssl.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_enable_ipa.py b/roles/ipareplica/library/ipareplica_enable_ipa.py
index d18552b5..da79154e 100644
--- a/roles/ipareplica/library/ipareplica_enable_ipa.py
+++ b/roles/ipareplica/library/ipareplica_enable_ipa.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_install_ca_certs.py b/roles/ipareplica/library/ipareplica_install_ca_certs.py
index b93f0b9a..72d28080 100644
--- a/roles/ipareplica/library/ipareplica_install_ca_certs.py
+++ b/roles/ipareplica/library/ipareplica_install_ca_certs.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_krb_enable_ssl.py b/roles/ipareplica/library/ipareplica_krb_enable_ssl.py
index a302b0fa..5fcd5c8c 100644
--- a/roles/ipareplica/library/ipareplica_krb_enable_ssl.py
+++ b/roles/ipareplica/library/ipareplica_krb_enable_ssl.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_master_password.py b/roles/ipareplica/library/ipareplica_master_password.py
index 02f9fd15..1b3f1b08 100644
--- a/roles/ipareplica/library/ipareplica_master_password.py
+++ b/roles/ipareplica/library/ipareplica_master_password.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipareplica/library/ipareplica_prepare.py b/roles/ipareplica/library/ipareplica_prepare.py
index 8adc46cb..a78629d2 100644
--- a/roles/ipareplica/library/ipareplica_prepare.py
+++ b/roles/ipareplica/library/ipareplica_prepare.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
@@ -194,7 +195,6 @@ RETURN = '''
import os
import tempfile
import traceback
-import six
from shutil import copyfile
from ansible.module_utils.basic import AnsibleModule
@@ -209,6 +209,7 @@ from ansible.module_utils.ansible_ipa_replica import (
dns, no_matching_interface_for_ip_address_warning, adtrust,
constants, api, redirect_stdout, replica_conn_check, tasks
)
+from ansible.module_utils import six
if six.PY3:
unicode = str
diff --git a/roles/ipareplica/library/ipareplica_promote_openldap_conf.py b/roles/ipareplica/library/ipareplica_promote_openldap_conf.py
index 207794ce..9d847fde 100644
--- a/roles/ipareplica/library/ipareplica_promote_openldap_conf.py
+++ b/roles/ipareplica/library/ipareplica_promote_openldap_conf.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_promote_sssd.py b/roles/ipareplica/library/ipareplica_promote_sssd.py
index 66d84d0d..da490b8f 100644
--- a/roles/ipareplica/library/ipareplica_promote_sssd.py
+++ b/roles/ipareplica/library/ipareplica_promote_sssd.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_restart_kdc.py b/roles/ipareplica/library/ipareplica_restart_kdc.py
index b9c99006..48d46678 100644
--- a/roles/ipareplica/library/ipareplica_restart_kdc.py
+++ b/roles/ipareplica/library/ipareplica_restart_kdc.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_adtrust.py b/roles/ipareplica/library/ipareplica_setup_adtrust.py
index 734e56d6..0c99a285 100644
--- a/roles/ipareplica/library/ipareplica_setup_adtrust.py
+++ b/roles/ipareplica/library/ipareplica_setup_adtrust.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_ca.py b/roles/ipareplica/library/ipareplica_setup_ca.py
index d71299b6..18aedd3d 100644
--- a/roles/ipareplica/library/ipareplica_setup_ca.py
+++ b/roles/ipareplica/library/ipareplica_setup_ca.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_certmonger.py b/roles/ipareplica/library/ipareplica_setup_certmonger.py
index 982aab0a..a04e5f1a 100644
--- a/roles/ipareplica/library/ipareplica_setup_certmonger.py
+++ b/roles/ipareplica/library/ipareplica_setup_certmonger.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_custodia.py b/roles/ipareplica/library/ipareplica_setup_custodia.py
index 2e95c262..825f756f 100644
--- a/roles/ipareplica/library/ipareplica_setup_custodia.py
+++ b/roles/ipareplica/library/ipareplica_setup_custodia.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_dns.py b/roles/ipareplica/library/ipareplica_setup_dns.py
index 51ab749d..31d219f3 100644
--- a/roles/ipareplica/library/ipareplica_setup_dns.py
+++ b/roles/ipareplica/library/ipareplica_setup_dns.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_ds.py b/roles/ipareplica/library/ipareplica_setup_ds.py
index 8a44120b..22427873 100644
--- a/roles/ipareplica/library/ipareplica_setup_ds.py
+++ b/roles/ipareplica/library/ipareplica_setup_ds.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_http.py b/roles/ipareplica/library/ipareplica_setup_http.py
index 3fa48070..8df3b699 100644
--- a/roles/ipareplica/library/ipareplica_setup_http.py
+++ b/roles/ipareplica/library/ipareplica_setup_http.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_kra.py b/roles/ipareplica/library/ipareplica_setup_kra.py
index 0b2f681a..5758ac22 100644
--- a/roles/ipareplica/library/ipareplica_setup_kra.py
+++ b/roles/ipareplica/library/ipareplica_setup_kra.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_krb.py b/roles/ipareplica/library/ipareplica_setup_krb.py
index 4500a6fe..ee772017 100644
--- a/roles/ipareplica/library/ipareplica_setup_krb.py
+++ b/roles/ipareplica/library/ipareplica_setup_krb.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_setup_otpd.py b/roles/ipareplica/library/ipareplica_setup_otpd.py
index 1b8117d8..8d8aedbe 100644
--- a/roles/ipareplica/library/ipareplica_setup_otpd.py
+++ b/roles/ipareplica/library/ipareplica_setup_otpd.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipareplica/library/ipareplica_test.py b/roles/ipareplica/library/ipareplica_test.py
index 217e29c8..784136d2 100644
--- a/roles/ipareplica/library/ipareplica_test.py
+++ b/roles/ipareplica/library/ipareplica_test.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -249,7 +252,8 @@ def main():
# If not defined, set domain from server name
if installer.domain_name is None and installer.server is not None:
- installer.domain_name = installer.server[installer.server.find(".")+1:]
+ installer.domain_name = \
+ installer.server[installer.server.find(".") + 1:]
# If not defined, set realm from domain name
if installer.realm_name is None and installer.domain_name is not None:
installer.realm_name = installer.domain_name.upper()
diff --git a/roles/ipareplica/module_utils/ansible_ipa_replica.py b/roles/ipareplica/module_utils/ansible_ipa_replica.py
index 1de75e1a..464a43fc 100644
--- a/roles/ipareplica/module_utils/ansible_ipa_replica.py
+++ b/roles/ipareplica/module_utils/ansible_ipa_replica.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
__all__ = ["contextlib", "dnsexception", "dnsresolver", "dnsreversename",
"parse_version", "IPAChangeConf",
"certstore", "sysrestore", "ipa_generate_password", "kinit_keytab",
@@ -62,7 +65,7 @@ else:
# See ipapython/version.py
IPA_MAJOR, IPA_MINOR, IPA_RELEASE = [int(x) for x in
VERSION.split(".", 2)]
- IPA_PYTHON_VERSION = IPA_MAJOR*10000 + IPA_MINOR*100 + IPA_RELEASE
+ IPA_PYTHON_VERSION = IPA_MAJOR * 10000 + IPA_MINOR * 100 + IPA_RELEASE
else:
IPA_PYTHON_VERSION = NUM_VERSION
diff --git a/roles/ipaserver/library/ipaserver_enable_ipa.py b/roles/ipaserver/library/ipaserver_enable_ipa.py
index 00bf3da6..d1333d5f 100644
--- a/roles/ipaserver/library/ipaserver_enable_ipa.py
+++ b/roles/ipaserver/library/ipaserver_enable_ipa.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_load_cache.py b/roles/ipaserver/library/ipaserver_load_cache.py
index ad29455c..e93567b5 100644
--- a/roles/ipaserver/library/ipaserver_load_cache.py
+++ b/roles/ipaserver/library/ipaserver_load_cache.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_master_password.py b/roles/ipaserver/library/ipaserver_master_password.py
index bf9c52b0..8d26cac4 100644
--- a/roles/ipaserver/library/ipaserver_master_password.py
+++ b/roles/ipaserver/library/ipaserver_master_password.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
diff --git a/roles/ipaserver/library/ipaserver_prepare.py b/roles/ipaserver/library/ipaserver_prepare.py
index 1341abfb..b3d3b483 100644
--- a/roles/ipaserver/library/ipaserver_prepare.py
+++ b/roles/ipaserver/library/ipaserver_prepare.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_set_ds_password.py b/roles/ipaserver/library/ipaserver_set_ds_password.py
index 4b5b3b35..283e093a 100644
--- a/roles/ipaserver/library/ipaserver_set_ds_password.py
+++ b/roles/ipaserver/library/ipaserver_set_ds_password.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_adtrust.py b/roles/ipaserver/library/ipaserver_setup_adtrust.py
index 341cb4e2..de15ef49 100644
--- a/roles/ipaserver/library/ipaserver_setup_adtrust.py
+++ b/roles/ipaserver/library/ipaserver_setup_adtrust.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_ca.py b/roles/ipaserver/library/ipaserver_setup_ca.py
index 53a3633a..fb185ac2 100644
--- a/roles/ipaserver/library/ipaserver_setup_ca.py
+++ b/roles/ipaserver/library/ipaserver_setup_ca.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_custodia.py b/roles/ipaserver/library/ipaserver_setup_custodia.py
index 565020b8..b0b98cc4 100644
--- a/roles/ipaserver/library/ipaserver_setup_custodia.py
+++ b/roles/ipaserver/library/ipaserver_setup_custodia.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_dns.py b/roles/ipaserver/library/ipaserver_setup_dns.py
index 396b4394..eba94e50 100644
--- a/roles/ipaserver/library/ipaserver_setup_dns.py
+++ b/roles/ipaserver/library/ipaserver_setup_dns.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_ds.py b/roles/ipaserver/library/ipaserver_setup_ds.py
index 3fc9d50a..602ec9ea 100644
--- a/roles/ipaserver/library/ipaserver_setup_ds.py
+++ b/roles/ipaserver/library/ipaserver_setup_ds.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_http.py b/roles/ipaserver/library/ipaserver_setup_http.py
index 4d9a54d6..350f39b5 100644
--- a/roles/ipaserver/library/ipaserver_setup_http.py
+++ b/roles/ipaserver/library/ipaserver_setup_http.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_kra.py b/roles/ipaserver/library/ipaserver_setup_kra.py
index 5296c09e..6ca32953 100644
--- a/roles/ipaserver/library/ipaserver_setup_kra.py
+++ b/roles/ipaserver/library/ipaserver_setup_kra.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_krb.py b/roles/ipaserver/library/ipaserver_setup_krb.py
index 1101d8d0..6cddbc83 100644
--- a/roles/ipaserver/library/ipaserver_setup_krb.py
+++ b/roles/ipaserver/library/ipaserver_setup_krb.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_ntp.py b/roles/ipaserver/library/ipaserver_setup_ntp.py
index ab1fde7e..9c37c23b 100644
--- a/roles/ipaserver/library/ipaserver_setup_ntp.py
+++ b/roles/ipaserver/library/ipaserver_setup_ntp.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_setup_otpd.py b/roles/ipaserver/library/ipaserver_setup_otpd.py
index e72d27b5..e1f9ce2c 100644
--- a/roles/ipaserver/library/ipaserver_setup_otpd.py
+++ b/roles/ipaserver/library/ipaserver_setup_otpd.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,7 +21,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from __future__ import print_function
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.0',
diff --git a/roles/ipaserver/library/ipaserver_test.py b/roles/ipaserver/library/ipaserver_test.py
index 175a1e03..4c7df49b 100644
--- a/roles/ipaserver/library/ipaserver_test.py
+++ b/roles/ipaserver/library/ipaserver_test.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
'metadata_version': '1.0',
'supported_by': 'community',
@@ -209,7 +212,6 @@ RETURN = '''
import os
import sys
-import six
import inspect
import random
from shutil import copyfile
@@ -226,6 +228,7 @@ from ansible.module_utils.ansible_ipa_server import (
validate_domain_name, load_pkcs12, IPA_PYTHON_VERSION,
encode_certificate, check_available_memory
)
+from ansible.module_utils import six
if six.PY3:
unicode = str
@@ -923,7 +926,7 @@ def main():
host_name = host_name.lower()
if not options.domain_name:
- domain_name = host_name[host_name.find(".")+1:]
+ domain_name = host_name[host_name.find(".") + 1:]
try:
validate_domain_name(domain_name)
except ValueError as e:
diff --git a/roles/ipaserver/module_utils/ansible_ipa_server.py b/roles/ipaserver/module_utils/ansible_ipa_server.py
index a5310f88..dfb424a8 100644
--- a/roles/ipaserver/module_utils/ansible_ipa_server.py
+++ b/roles/ipaserver/module_utils/ansible_ipa_server.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -22,6 +21,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
__all__ = ["IPAChangeConf", "certmonger", "sysrestore", "root_logger",
"ipa_generate_password", "run", "ScriptError", "services",
"tasks", "errors", "x509", "DOMAIN_LEVEL_0", "MIN_DOMAIN_LEVEL",
@@ -52,7 +55,7 @@ else:
import logging
from contextlib import contextmanager as contextlib_contextmanager
- import six
+ from ansible.module_utils import six
import base64
from ipapython.version import NUM_VERSION, VERSION
@@ -61,7 +64,7 @@ else:
# See ipapython/version.py
IPA_MAJOR, IPA_MINOR, IPA_RELEASE = [int(x) for x in
VERSION.split(".", 2)]
- IPA_PYTHON_VERSION = IPA_MAJOR*10000 + IPA_MINOR*100 + IPA_RELEASE
+ IPA_PYTHON_VERSION = IPA_MAJOR * 10000 + IPA_MINOR * 100 + IPA_RELEASE
else:
IPA_PYTHON_VERSION = NUM_VERSION
diff --git a/setup.cfg b/setup.cfg
index 15acf377..2a6d8789 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -57,7 +57,7 @@ disable =
fixme
[pylint.BASIC]
-good-names = ex, i, j, k, Run, _, e, x, dn, cn, ip, os, unicode
+good-names = ex, i, j, k, Run, _, e, x, dn, cn, ip, os, unicode, __metaclass__
[pylint.IMPORTS]
ignored-modules =
diff --git a/tests/ca-less/generate-certificates.sh b/tests/ca-less/generate-certificates.sh
index e96d323a..c366e87d 100755
--- a/tests/ca-less/generate-certificates.sh
+++ b/tests/ca-less/generate-certificates.sh
@@ -21,36 +21,36 @@ function generate_ipa_pkcs12_certificate {
# Generate CSR and private key
openssl req -new -newkey rsa:4096 -nodes \
-subj "/C=US/ST=Test/L=Testing/O=Default/CN=${ipa_fqdn}" \
- -keyout ${certs_dir}/private.key \
- -out ${certs_dir}/request.csr
+ -keyout "${certs_dir}/private.key" \
+ -out "${certs_dir}/request.csr"
# Sign CSR to generate PEM certificate
if [ -z "${extensions_file}" ]; then
openssl x509 -req -days 365 -sha256 \
-CAcreateserial \
- -CA ${root_ca_cert} \
- -CAkey ${root_ca_private_key} \
- -in ${certs_dir}/request.csr \
- -out ${certs_dir}/cert.pem
+ -CA "${root_ca_cert}" \
+ -CAkey "${root_ca_private_key}" \
+ -in "${certs_dir}/request.csr" \
+ -out "${certs_dir}/cert.pem"
else
openssl x509 -req -days 365 -sha256 \
-CAcreateserial \
- -CA ${ROOT_CA_DIR}/cert.pem \
- -CAkey ${ROOT_CA_DIR}/private.key \
- -extfile ${extensions_file} \
- -extensions ${extensions_name} \
- -in ${certs_dir}/request.csr \
- -out ${certs_dir}/cert.pem
+ -CA "${ROOT_CA_DIR}/cert.pem" \
+ -CAkey "${ROOT_CA_DIR}/private.key" \
+ -extfile "${extensions_file}" \
+ -extensions "${extensions_name}" \
+ -in "${certs_dir}/request.csr" \
+ -out "${certs_dir}/cert.pem"
fi
# Convert certificate to PKCS12 format
openssl pkcs12 -export \
- -name ${cert_name} \
- -certfile ${root_ca_cert} \
- -in ${certs_dir}/cert.pem \
- -inkey ${certs_dir}/private.key \
+ -name "${cert_name}" \
+ -certfile "${root_ca_cert}" \
+ -in "${certs_dir}/cert.pem" \
+ -inkey "${certs_dir}/private.key" \
-passout "pass:${PKCS12_PASSWORD}" \
- -out ${certs_dir}/cert.p12
+ -out "${certs_dir}/cert.p12"
}
# generate_ipa_pkcs12_certificates $ipa_fqdn $ipa_domain
@@ -73,27 +73,27 @@ function generate_ipa_pkcs12_certificates {
fi
# Generate certificates folder structure
- mkdir -p ${ROOT_CA_DIR}
- mkdir -p ${DIRSRV_CERTS_DIR}/$host
- mkdir -p ${HTTPD_CERTS_DIR}/$host
- mkdir -p ${PKINIT_CERTS_DIR}/$host
+ mkdir -p "${ROOT_CA_DIR}"
+ mkdir -p "${DIRSRV_CERTS_DIR}/$host"
+ mkdir -p "${HTTPD_CERTS_DIR}/$host"
+ mkdir -p "${PKINIT_CERTS_DIR}/$host"
# Generate root CA
if [ ! -f "${ROOT_CA_DIR}/private.key" ]; then
openssl genrsa \
- -out ${ROOT_CA_DIR}/private.key 4096
+ -out "${ROOT_CA_DIR}/private.key" 4096
openssl req -new -x509 -sha256 -nodes -days 3650 \
-subj "/C=US/ST=Test/L=Testing/O=Default" \
- -key ${ROOT_CA_DIR}/private.key \
- -out ${ROOT_CA_DIR}/cert.pem
+ -key "${ROOT_CA_DIR}/private.key" \
+ -out "${ROOT_CA_DIR}/cert.pem"
fi
# Generate a certificate for the Directory Server
if [ ! -f "${DIRSRV_CERTS_DIR}/$host/cert.pem" ]; then
generate_ipa_pkcs12_certificate \
"dirsrv-cert" \
- $host \
+ "$host" \
"${DIRSRV_CERTS_DIR}/$host" \
"${ROOT_CA_DIR}/cert.pem" \
"${ROOT_CA_DIR}/private.key"
@@ -103,7 +103,7 @@ function generate_ipa_pkcs12_certificates {
if [ ! -f "${HTTPD_CERTS_DIR}/$host/cert.pem" ]; then
generate_ipa_pkcs12_certificate \
"httpd-cert" \
- $host \
+ "$host" \
"${HTTPD_CERTS_DIR}/$host" \
"${ROOT_CA_DIR}/cert.pem" \
"${ROOT_CA_DIR}/private.key"
@@ -115,7 +115,7 @@ function generate_ipa_pkcs12_certificates {
generate_ipa_pkcs12_certificate \
"pkinit-cert" \
- $host \
+ "$host" \
"${PKINIT_CERTS_DIR}/$host" \
"${ROOT_CA_DIR}/cert.pem" \
"${ROOT_CA_DIR}/private.key" \
@@ -135,17 +135,17 @@ function delete_ipa_pkcs12_certificates {
exit 0;
fi
- rm -f certificates/*/$host/*
- rm -f ${ROOT_CA_DIR}/*
+ rm -f certificates/*/"$host"/*
+ rm -f "${ROOT_CA_DIR}"/*
}
# Entrypoint
case "$1" in
create)
- generate_ipa_pkcs12_certificates $2 $3
+ generate_ipa_pkcs12_certificates "$2" "$3"
;;
delete)
- delete_ipa_pkcs12_certificates $2
+ delete_ipa_pkcs12_certificates "$2"
;;
*)
echo $"Usage: $0 {create|delete}"
diff --git a/tests/pytests/dnszone/playbooks/dnszone_invalid_ip.yaml b/tests/pytests/dnszone/playbooks/dnszone_invalid_ip.yaml
index d16cff75..433d4294 100644
--- a/tests/pytests/dnszone/playbooks/dnszone_invalid_ip.yaml
+++ b/tests/pytests/dnszone/playbooks/dnszone_invalid_ip.yaml
@@ -1,5 +1,5 @@
---
-- name: Playbook to with invalid IP’s in allow_transfer.
+- name: Playbook to with invalid IPs in allow_transfer.
hosts: ipaserver
become: true
diff --git a/tests/pytests/dnszone/test_dnszone.py b/tests/pytests/dnszone/test_dnszone.py
index 35318123..00978f0f 100644
--- a/tests/pytests/dnszone/test_dnszone.py
+++ b/tests/pytests/dnszone/test_dnszone.py
@@ -112,7 +112,7 @@ class TestDNSZone(AnsibleFreeIPATestCase):
self.check_notexists([error], "dnszone-show", [add_zone])
def test_dnszone_invalid_ip(self):
- """TC-07: Update with invalid IP’s in allow_transfer. Bug#1845051."""
+ """TC-07: Update with invalid IPs in allow_transfer. Bug#1845051."""
invalid_zone_name = "invalidzone.test"
invalid_zone_ip = "in.va.li.d"
expected_error = "Invalid IP for DNS forwarder"
diff --git a/tests/user/users.sh b/tests/user/users.sh
index 52981c1e..da408d75 100644
--- a/tests/user/users.sh
+++ b/tests/user/users.sh
@@ -4,24 +4,26 @@ NUM=${1-1000}
FILE="users.json"
date=$(date --date='+2 years' "+%Y-%m-%d %H:%M:%S")
-echo "{" > $FILE
+echo "{" > "$FILE"
-echo " \"users\": [" >> $FILE
+echo " \"users\": [" >> "$FILE"
-for i in $(seq 1 $NUM); do
- echo " {" >> $FILE
- echo " \"name\": \"user$i\"," >> $FILE
- echo " \"first\": \"First $i\"," >> $FILE
- echo " \"last\": \"Last $i\"," >> $FILE
- echo " \"password\": \"user${i}PW\"," >> $FILE
- echo " \"passwordexpiration\": \"$date\"" >> $FILE
- if [ $i -lt $NUM ]; then
- echo " }," >> $FILE
+for i in $(seq 1 "$NUM"); do
+ {
+ echo " {"
+ echo " \"name\": \"user$i\","
+ echo " \"first\": \"First $i\","
+ echo " \"last\": \"Last $i\","
+ echo " \"password\": \"user${i}PW\","
+ echo " \"passwordexpiration\": \"$date\""
+ } >> "$FILE"
+ if [ "$i" -lt "$NUM" ]; then
+ echo " }," >> "$FILE"
else
- echo " }" >> $FILE
+ echo " }" >> "$FILE"
fi
done
-echo " ]" >> $FILE
+echo " ]" >> "$FILE"
-echo "}" >> $FILE
+echo "}" >> "$FILE"
diff --git a/tests/user/users_absent.sh b/tests/user/users_absent.sh
index 1ee89ada..f0179931 100644
--- a/tests/user/users_absent.sh
+++ b/tests/user/users_absent.sh
@@ -3,20 +3,20 @@
NUM=1000
FILE="users_absent.json"
-echo "{" > $FILE
+echo "{" > "$FILE"
-echo " \"users\": [" >> $FILE
+echo " \"users\": [" >> "$FILE"
-for i in $(seq 1 $NUM); do
- echo " {" >> $FILE
- echo " \"name\": \"user$i\"," >> $FILE
- if [ $i -lt $NUM ]; then
- echo " }," >> $FILE
+for i in $(seq 1 "$NUM"); do
+ echo " {" >> "$FILE"
+ echo " \"name\": \"user$i\"," >> "$FILE"
+ if [ "$i" -lt "$NUM" ]; then
+ echo " }," >> "$FILE"
else
- echo " }" >> $FILE
+ echo " }" >> "$FILE"
fi
done
-echo " ]" >> $FILE
+echo " ]" >> "$FILE"
-echo "}" >> $FILE
+echo "}" >> "$FILE"
diff --git a/utils/gen_module_docs.py b/utils/gen_module_docs.py
index 4994a346..b3ac9f57 100644
--- a/utils/gen_module_docs.py
+++ b/utils/gen_module_docs.py
@@ -206,7 +206,7 @@ def gen_module_docs(module_in):
# print("%s: Bad argument dict line '%s'" % (module_in,
# stripped))
while ")," not in stripped and i < len(in_lines) - 1:
- next_stripped = in_lines[i+1].strip()
+ next_stripped = in_lines[i + 1].strip()
if not next_stripped.startswith("# "):
stripped += next_stripped
i += 1
diff --git a/utils/templates/ipamodule+member.py.in b/utils/templates/ipamodule+member.py.in
index d3438b1b..1515ccc1 100644
--- a/utils/templates/ipamodule+member.py.in
+++ b/utils/templates/ipamodule+member.py.in
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -100,8 +103,7 @@ RETURN = """
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa, gen_add_del_lists, gen_add_list, \
gen_intersection_list
-
-import six
+from ansible.module_utils import six
if six.PY3:
unicode = str
diff --git a/utils/templates/ipamodule.py.in b/utils/templates/ipamodule.py.in
index e305c976..00750f83 100644
--- a/utils/templates/ipamodule.py.in
+++ b/utils/templates/ipamodule.py.in
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# -*- coding: utf-8 -*-
# Authors:
@@ -20,6 +19,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
@@ -79,7 +82,7 @@ RETURN = """
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, compare_args_ipa
-import six
+from ansible.module_utils import six
if six.PY3:
unicode = str