Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stat document 'version' return doc #76589

Merged
merged 3 commits into from Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/ansible/modules/stat.py
Expand Up @@ -369,6 +369,12 @@
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
Expand Down
1 change: 1 addition & 0 deletions test/integration/targets/stat/meta/main.yml
@@ -1,2 +1,3 @@
dependencies:
- prepare_tests
- setup_remote_tmp_dir
16 changes: 8 additions & 8 deletions test/integration/targets/stat/tasks/main.yml
Expand Up @@ -17,10 +17,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

- 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down