mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-07 21:42:38 +00:00
Enable black formatting test (#259)
Enable black formatting test SUMMARY Signed-off-by: Abhijeet Kasurde akasurde@redhat.com ISSUE TYPE Bugfix Pull Request COMPONENT NAME plugins/action/k8s_info.py plugins/connection/kubectl.py plugins/doc_fragments/helm_common_options.py plugins/doc_fragments/k8s_auth_options.py plugins/doc_fragments/k8s_delete_options.py plugins/doc_fragments/k8s_name_options.py plugins/doc_fragments/k8s_resource_options.py plugins/doc_fragments/k8s_scale_options.py plugins/doc_fragments/k8s_state_options.py plugins/doc_fragments/k8s_wait_options.py plugins/filter/k8s.py plugins/inventory/k8s.py plugins/lookup/k8s.py plugins/lookup/kustomize.py plugins/module_utils/ansiblemodule.py plugins/module_utils/apply.py plugins/module_utils/args_common.py plugins/module_utils/client/discovery.py plugins/module_utils/client/resource.py plugins/module_utils/common.py plugins/module_utils/exceptions.py plugins/module_utils/hashes.py plugins/module_utils/helm.py plugins/module_utils/k8sdynamicclient.py plugins/module_utils/selector.py plugins/modules/helm.py plugins/modules/helm_info.py plugins/modules/helm_plugin.py plugins/modules/helm_plugin_info.py plugins/modules/helm_repository.py plugins/modules/helm_template.py plugins/modules/k8s.py plugins/modules/k8s_cluster_info.py plugins/modules/k8s_cp.py plugins/modules/k8s_drain.py plugins/modules/k8s_exec.py plugins/modules/k8s_info.py plugins/modules/k8s_json_patch.py plugins/modules/k8s_log.py plugins/modules/k8s_rollback.py plugins/modules/k8s_scale.py plugins/modules/k8s_service.py tests/integration/targets/kubernetes/library/test_tempfile.py tests/unit/module_utils/test_apply.py tests/unit/module_utils/test_common.py tests/unit/module_utils/test_discoverer.py tests/unit/module_utils/test_hashes.py tests/unit/module_utils/test_marshal.py tests/unit/module_utils/test_selector.py tox.ini Reviewed-by: None <None> Reviewed-by: Mike Graves <mgraves@redhat.com> Reviewed-by: None <None>
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
# 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
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: test_tempfile
|
||||
|
||||
@@ -50,7 +51,7 @@ seealso:
|
||||
|
||||
author:
|
||||
- Krzysztof Magosa (@krzysztof-magosa)
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
- name: create temporary build directory
|
||||
@@ -71,13 +72,13 @@ EXAMPLES = """
|
||||
when: tempfile_1.path is defined
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
RETURN = """
|
||||
path:
|
||||
description: Path to created file or directory
|
||||
returned: success
|
||||
type: str
|
||||
sample: "/tmp/ansible.bMlvdk"
|
||||
'''
|
||||
"""
|
||||
|
||||
from os import close
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
@@ -90,26 +91,26 @@ from ansible.module_utils._text import to_native
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
state=dict(type='str', default='file', choices=['file', 'directory']),
|
||||
path=dict(type='path'),
|
||||
prefix=dict(type='str', default='ansible.'),
|
||||
suffix=dict(type='str', default=''),
|
||||
state=dict(type="str", default="file", choices=["file", "directory"]),
|
||||
path=dict(type="path"),
|
||||
prefix=dict(type="str", default="ansible."),
|
||||
suffix=dict(type="str", default=""),
|
||||
),
|
||||
)
|
||||
|
||||
try:
|
||||
if module.params['state'] == 'file':
|
||||
if module.params["state"] == "file":
|
||||
handle, path = mkstemp(
|
||||
prefix=module.params['prefix'],
|
||||
suffix=module.params['suffix'],
|
||||
dir=module.params['path'],
|
||||
prefix=module.params["prefix"],
|
||||
suffix=module.params["suffix"],
|
||||
dir=module.params["path"],
|
||||
)
|
||||
close(handle)
|
||||
elif module.params['state'] == 'directory':
|
||||
elif module.params["state"] == "directory":
|
||||
path = mkdtemp(
|
||||
prefix=module.params['prefix'],
|
||||
suffix=module.params['suffix'],
|
||||
dir=module.params['path'],
|
||||
prefix=module.params["prefix"],
|
||||
suffix=module.params["suffix"],
|
||||
dir=module.params["path"],
|
||||
)
|
||||
|
||||
module.exit_json(changed=True, path=path)
|
||||
@@ -117,5 +118,5 @@ def main():
|
||||
module.fail_json(msg=to_native(e), exception=format_exc())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user