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

There is no difference between files in a recursive directory #75727

Closed
1 task done
zyayun opened this issue Sep 17, 2021 · 3 comments
Closed
1 task done

There is no difference between files in a recursive directory #75727

zyayun opened this issue Sep 17, 2021 · 3 comments
Labels
affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@zyayun
Copy link

zyayun commented Sep 17, 2021

Summary

A single file in the directory shows the difference ,But multiple files will not show the difference

/tmp » ansible localhost  -m copy  -a 'src=/tmp/test1 dest=/tmp/test5' -C --diff -v                                                                                                                  yayun@zyyMAC
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
--- before
+++ after: /tmp/test1/tox.ini
@@ -0,0 +1,31 @@
+[tox]
+envlist = py26,py27,py35,py36
+
+[testenv]
+deps = -c{toxinidir}/test/runner/requirements/constraints.txt
+       -r{toxinidir}/test/runner/requirements/ansible-test.txt
+       -r{toxinidir}/test/runner/requirements/sanity.txt
+       -r{toxinidir}/test/runner/requirements/units.txt
+commands =
+    python --version
+    # The recommended method of running tests with tox is to execute
+    # ansible-test directly and use the --tox and --python options.
+    # The commands below are provided as a convenience for those who
+    # prefer to run tox directly instead of through ansible-test.
+    {toxinidir}/test/runner/ansible-test sanity  --python default -v
+    {toxinidir}/test/runner/ansible-test units   --python default -v
+passenv =
+    # Pass HOME to the test environment to avoid the missing HOME env
+    # variable error. See issue: #20424
+    HOME
+
+[pytest]
+xfail_strict = true
+cache_dir = .pytest_cache
+
+[flake8]
+# These are things that the devs don't agree make the code more readable
+# E402 module level import not at top of file
+ignore = E402
+# not all the devs believe in 80 column line length
+max-line-length = 160

localhost | CHANGED => {
    "changed": true
}

Issue Type

Bug Report

Component Name

copy,file,state

Ansible Version

$ ansible --version
ansible [core 2.12.0.dev0]
  config file = None
  configured module search path = ['/Users/yayun/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/yayun/workspace/venv/lib/python3.8/site-packages/ansible_core-2.12.0.dev0-py3.8.egg/ansible
  ansible collection location = /Users/yayun/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/yayun/workspace/venv/bin/ansible
  python version = 3.8.2 (default, Dec 21 2020, 15:06:04) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 2.10.3
  libyaml = True

Configuration

$ ansible-config dump --only-changed
...skipping...
~
~
~
~

OS / Environment

Centos,Ubuntu,MacOS

Steps to Reproduce

The source directory has single file

/tmp » ansible localhost  -m copy  -a 'src=/tmp/test1 dest=/tmp/test5' -C --diff -v

[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
--- before
+++ after: /tmp/test1/tox.ini
@@ -0,0 +1,31 @@
+[tox]
+envlist = py26,py27,py35,py36
+
+[testenv]
+deps = -c{toxinidir}/test/runner/requirements/constraints.txt
+       -r{toxinidir}/test/runner/requirements/ansible-test.txt
+       -r{toxinidir}/test/runner/requirements/sanity.txt
+       -r{toxinidir}/test/runner/requirements/units.txt
+commands =
+    python --version
+    # The recommended method of running tests with tox is to execute
+    # ansible-test directly and use the --tox and --python options.
+    # The commands below are provided as a convenience for those who
+    # prefer to run tox directly instead of through ansible-test.
+    {toxinidir}/test/runner/ansible-test sanity  --python default -v
+    {toxinidir}/test/runner/ansible-test units   --python default -v
+passenv =
+    # Pass HOME to the test environment to avoid the missing HOME env
+    # variable error. See issue: #20424
+    HOME
+
+[pytest]
+xfail_strict = true
+cache_dir = .pytest_cache
+
+[flake8]
+# These are things that the devs don't agree make the code more readable
+# E402 module level import not at top of file
+ignore = E402
+# not all the devs believe in 80 column line length
+max-line-length = 160

localhost | CHANGED => {
    "changed": true
}

The source directory has multiple files, No differences between multiple files are shown

/tmp » cp ~/workspace/ansible/Makefile ./test1                                                                                                                                                       yayun@zyyMAC
(venv) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/tmp » ansible localhost  -m copy  -a 'src=/tmp/test1 dest=/tmp/test5' -C --diff -v                                                                                                                  yayun@zyyMAC
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | CHANGED => {
    "changed": true,
    "dest": "/tmp/test5/",
    "src": "/tmp/test1"
}
(venv)

Expected Results

···yaml
/tmp » ansible localhost -m copy -a 'src=/tmp/test1 dest=/tmp/test5' -C --diff -v yayun@zyyMAC
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
--- before
+++ after: /tmp/test1/tox.ini
@@ -0,0 +1,31 @@
+[tox]
+envlist = py26,py27,py35,py36
+
+[testenv]
+deps = -c{toxinidir}/test/runner/requirements/constraints.txt

  •   -r{toxinidir}/test/runner/requirements/ansible-test.txt
    
  •   -r{toxinidir}/test/runner/requirements/sanity.txt
    
  •   -r{toxinidir}/test/runner/requirements/units.txt
    

.....

--- before
+++ after: /tmp/test1/Makefile
@@ -0,0 +1,31 @@
+# WARN: gmake syntax
+########################################################
+# Makefile for Ansible
+#
+# useful targets:
+# make sdist ---------------- produce a tarball
+# make srpm ----------------- produce a SRPM
+# make rpm ----------------- produce RPMs
+# make deb-src -------------- produce a DEB source
+# make deb ------------------ produce a DEB
+# make docs ----------------- rebuild the manpages (results are checked in)
+# make tests ---------------- run the tests (see +https://docs.ansible.com/ansible/devel/dev_guide/testing_units.html for requirements)
+# make pyflakes, make pep8 -- source code checks

localhost | CHANGED => {
"changed": true
}


### Actual Results

```console
/tmp » ansible localhost  -m copy  -a 'src=/tmp/test1 dest=/tmp/test5' -C --diff -v                                                                                                                  yayun@zyyMAC
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible engine, or trying out features under development. This is a rapidly
changing source of code and can become unstable at any point.
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | CHANGED => {
    "changed": true,
    "dest": "/tmp/test5/",
    "src": "/tmp/test1"
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Sep 17, 2021

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 17, 2021
@zyayun
Copy link
Author

zyayun commented Sep 17, 2021

I don't want to synchronize module, Because his differences are hard to understand and see, right

I think many people have also raised this issue, the community has not solved the problem, this is a serious problem in production

@sivel
Copy link
Member

sivel commented Sep 17, 2021

Duplicate of #74947

@sivel sivel marked this as a duplicate of #74947 Sep 17, 2021
@sivel sivel closed this as completed Sep 17, 2021
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Sep 20, 2021
@ansible ansible locked and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

4 participants