mirror of
https://github.com/openshift/community.okd.git
synced 2026-11-24 01:43:46 +00:00
[backport stable-5] replace ansible.module_utils.six imports with Python 3 stdlib, add ignores (#287)
* Replace ansible.module_utils.six imports with Python 3 stdlib and add sanity ignore files for ansible-core 2.20/2.21 * Add changelog fragment
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
minor_changes:
|
||||||
|
- Replace ``ansible.module_utils.six`` imports (``iteritems``, ``string_types``) with Python 3 stdlib equivalents (https://github.com/openshift/community.okd/pull/287).
|
||||||
|
- Add sanity test ignore files for ansible-core 2.20 and 2.21 (https://github.com/openshift/community.okd/pull/287).
|
||||||
@@ -9,7 +9,6 @@ import copy
|
|||||||
|
|
||||||
from ansible.module_utils._text import to_native
|
from ansible.module_utils._text import to_native
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import iteritems
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_common import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import (
|
||||||
AnsibleOpenshiftModule,
|
AnsibleOpenshiftModule,
|
||||||
@@ -106,7 +105,7 @@ class OpenShiftAdmPruneImages(AnsibleOpenshiftModule):
|
|||||||
|
|
||||||
def list_objects(self):
|
def list_objects(self):
|
||||||
result = {}
|
result = {}
|
||||||
for kind, version in iteritems(ApiConfiguration):
|
for kind, version in ApiConfiguration.items():
|
||||||
namespace = None
|
namespace = None
|
||||||
if self.params.get("namespace") and kind.lower() == "imagestream":
|
if self.params.get("namespace") and kind.lower() == "imagestream":
|
||||||
namespace = self.params.get("namespace")
|
namespace = self.params.get("namespace")
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from datetime import datetime
|
|||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_docker_image import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_docker_image import (
|
||||||
parse_docker_image_ref,
|
parse_docker_image_ref,
|
||||||
)
|
)
|
||||||
from ansible.module_utils.six import iteritems
|
|
||||||
|
|
||||||
|
|
||||||
def get_image_blobs(image):
|
def get_image_blobs(image):
|
||||||
@@ -119,7 +118,7 @@ class OpenShiftAnalyzeImageStream(object):
|
|||||||
"CronJob",
|
"CronJob",
|
||||||
)
|
)
|
||||||
|
|
||||||
for k, objects in iteritems(resources):
|
for k, objects in resources.items():
|
||||||
if k not in keys:
|
if k not in keys:
|
||||||
continue
|
continue
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
@@ -222,7 +221,7 @@ class OpenShiftAnalyzeImageStream(object):
|
|||||||
def analyze_refs_from_build_strategy(self, resources):
|
def analyze_refs_from_build_strategy(self, resources):
|
||||||
# Json Path is always spec.strategy
|
# Json Path is always spec.strategy
|
||||||
keys = ("BuildConfig", "Build")
|
keys = ("BuildConfig", "Build")
|
||||||
for k, objects in iteritems(resources):
|
for k, objects in resources.items():
|
||||||
if k not in keys:
|
if k not in keys:
|
||||||
continue
|
continue
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ __metaclass__ = type
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import string_types
|
|
||||||
|
|
||||||
from ansible_collections.community.okd.plugins.module_utils.openshift_common import (
|
from ansible_collections.community.okd.plugins.module_utils.openshift_common import (
|
||||||
AnsibleOpenshiftModule,
|
AnsibleOpenshiftModule,
|
||||||
@@ -370,7 +369,7 @@ class OpenShiftImportImage(AnsibleOpenshiftModule):
|
|||||||
def execute_module(self):
|
def execute_module(self):
|
||||||
names = []
|
names = []
|
||||||
name = self.params.get("name")
|
name = self.params.get("name")
|
||||||
if isinstance(name, string_types):
|
if isinstance(name, str):
|
||||||
names.append(name)
|
names.append(name)
|
||||||
elif isinstance(name, list):
|
elif isinstance(name, list):
|
||||||
names = name
|
names = name
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import os
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import iteritems
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ldap
|
import ldap
|
||||||
@@ -46,7 +45,7 @@ def validate_ldap_sync_config(config):
|
|||||||
return "could not read ca file: {0}.".format(ca_file)
|
return "could not read ca file: {0}.".format(ca_file)
|
||||||
|
|
||||||
nameMapping = config.get("groupUIDNameMapping", {})
|
nameMapping = config.get("groupUIDNameMapping", {})
|
||||||
for k, v in iteritems(nameMapping):
|
for k, v in nameMapping.items():
|
||||||
if len(k) == 0 or len(v) == 0:
|
if len(k) == 0 or len(v) == 0:
|
||||||
return "groupUIDNameMapping has empty key or value"
|
return "groupUIDNameMapping has empty key or value"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/k8s.py validate-modules:return-syntax-error
|
||||||
|
plugins/modules/k8s.py validate-modules:bad-return-value-key
|
||||||
|
plugins/modules/openshift_process.py validate-modules:parameter-type-not-in-doc
|
||||||
|
plugins/modules/openshift_process.py validate-modules:bad-return-value-key
|
||||||
Reference in New Issue
Block a user