diff options
| author | Egor Tensin <egor@tensin.name> | 2026-08-06 13:07:27 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-08-06 13:08:45 +0200 |
| commit | d7c131e370306aff43ebbfe682df7ba64302d9f1 (patch) | |
| tree | 8581994225110a24d7faceb43ae4d06b0ed1cfeb /plugins/module_utils/file.py | |
| parent | Merge pull request #2 from egor-tensin/dependabot/github_actions/actions/setu... (diff) | |
| download | infra-ansible-d7c131e370306aff43ebbfe682df7ba64302d9f1.tar.gz infra-ansible-d7c131e370306aff43ebbfe682df7ba64302d9f1.zip | |
reformat Python code with default Black settings
Diffstat (limited to 'plugins/module_utils/file.py')
| -rw-r--r-- | plugins/module_utils/file.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/module_utils/file.py b/plugins/module_utils/file.py index 4492f81..b0491e8 100644 --- a/plugins/module_utils/file.py +++ b/plugins/module_utils/file.py @@ -6,7 +6,7 @@ from ansible.module_utils.common.text.converters import to_text def _get_stat(action, path, task_vars): stat_result = action._execute_module( - module_name='ansible.builtin.stat', + module_name="ansible.builtin.stat", module_args=dict( path=path, get_attributes=False, @@ -15,18 +15,18 @@ def _get_stat(action, path, task_vars): ), task_vars=task_vars, ) - if stat_result.get('failed'): + if stat_result.get("failed"): raise AnsibleActionFail(f"Couldn't stat file {path}", result=stat_result) - return stat_result['stat'] + return stat_result["stat"] def does_file_exist(action, path, task_vars): - return _get_stat(action, path, task_vars)['exists'] + return _get_stat(action, path, task_vars)["exists"] def does_dir_exist(action, path, task_vars): stat = _get_stat(action, path, task_vars) - return stat['exists'] and stat.get('isdir', False) + return stat["exists"] and stat.get("isdir", False) def read_file(action, path, task_vars, default=False): @@ -34,10 +34,10 @@ def read_file(action, path, task_vars, default=False): if not does_file_exist(action, path, task_vars): return default read_result = action._execute_module( - module_name='ansible.builtin.slurp', + module_name="ansible.builtin.slurp", module_args=dict(src=path), task_vars=task_vars, ) - if read_result.get('failed'): + if read_result.get("failed"): raise AnsibleActionFail(f"Couldn't read file {path}", result=read_result) - return base64.b64decode(to_text(read_result['content'])).decode('utf-8') + return base64.b64decode(to_text(read_result["content"])).decode("utf-8") |
