From 8e0654504fa5c1b5813e4136b3718d2640eb08f2 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 6 Jan 2022 14:16:01 -0500 Subject: [PATCH] stat document 'version' return doc (#76589) * stat document 'version' return doc fixes #76588 * str * no output_dir for you! --- lib/ansible/modules/stat.py | 6 ++++++ test/integration/targets/stat/meta/main.yml | 1 + test/integration/targets/stat/tasks/main.yml | 16 ++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/stat.py b/lib/ansible/modules/stat.py index bb242ea87a4..262ee94ae73 100644 --- a/lib/ansible/modules/stat.py +++ b/lib/ansible/modules/stat.py @@ -369,6 +369,12 @@ stat: type: list sample: [ immutable, extent ] version_added: 2.3 + version: + description: The version/generation attribute of a file according to the filesystem + returned: success, path exists, user can execute the path, lsattr is available and filesystem supports + type: str + sample: "381700746" + version_added: 2.3 ''' import errno diff --git a/test/integration/targets/stat/meta/main.yml b/test/integration/targets/stat/meta/main.yml index 07faa217762..cb6005d042c 100644 --- a/test/integration/targets/stat/meta/main.yml +++ b/test/integration/targets/stat/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - prepare_tests + - setup_remote_tmp_dir diff --git a/test/integration/targets/stat/tasks/main.yml b/test/integration/targets/stat/tasks/main.yml index 285e2b8375a..374cb2fd0eb 100644 --- a/test/integration/targets/stat/tasks/main.yml +++ b/test/integration/targets/stat/tasks/main.yml @@ -17,10 +17,10 @@ # along with Ansible. If not, see . - name: make a new file - copy: dest={{output_dir}}/foo.txt mode=0644 content="hello world" + copy: dest={{remote_tmp_dir}}/foo.txt mode=0644 content="hello world" - name: check stat of file - stat: path={{output_dir}}/foo.txt + stat: path={{remote_tmp_dir}}/foo.txt register: stat_result - debug: var=stat_result @@ -64,13 +64,13 @@ - name: make a symlink file: - src: "{{ output_dir }}/foo.txt" - path: "{{ output_dir }}/foo-link" + src: "{{ remote_tmp_dir }}/foo.txt" + path: "{{ remote_tmp_dir }}/foo-link" state: link - name: check stat of a symlink with follow off stat: - path: "{{ output_dir }}/foo-link" + path: "{{ remote_tmp_dir }}/foo-link" register: stat_result - debug: var=stat_result @@ -113,7 +113,7 @@ - name: check stat of a symlink with follow on stat: - path: "{{ output_dir }}/foo-link" + path: "{{ remote_tmp_dir }}/foo-link" follow: True register: stat_result @@ -158,13 +158,13 @@ - name: make a new file with colon in filename copy: - dest: "{{ output_dir }}/foo:bar.txt" + dest: "{{ remote_tmp_dir }}/foo:bar.txt" mode: '0644' content: "hello world" - name: check stat of a file with colon in name stat: - path: "{{ output_dir }}/foo:bar.txt" + path: "{{ remote_tmp_dir }}/foo:bar.txt" follow: True register: stat_result