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

[BUG] Unable to execute methods using cp.cache_file from saltcheck tst files #62398

Closed
golmaal opened this issue Jul 29, 2022 · 1 comment · Fixed by #62726
Closed

[BUG] Unable to execute methods using cp.cache_file from saltcheck tst files #62398

golmaal opened this issue Jul 29, 2022 · 1 comment · Fixed by #62726
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@golmaal
Copy link
Contributor

golmaal commented Jul 29, 2022

Description
Any module methods using cp.cache_file are failing from tst files in saltcheck-tests.

Setup

Steps to Reproduce the behavior
Add /srv/test folder and following files in it.

find /srv/test
/srv/test
/srv/test/init.sls
/srv/test/saltcheck-tests
/srv/test/saltcheck-tests/test.tst
/srv/test/download_me.txt
cat /srv/test/init.sls
test_state:
  test.show_notification:
    - text: The test state
cat /srv/test/saltcheck-tests/test.tst
test cp.cache_file:
  module_and_function: cp.cache_file
  args:
    - salt://test/download_me.txt
    - base
  assertion: assertNotEmpty
  output_details: True
salt-call cp.cache_file salt://test/download_me.txt #WORKS
local:
    /var/cache/salt/minion/files/base/test/download_me.txt
salt-call saltcheck.run_state_tests test # DOES NOT WORK
[22:22:33.038] [ERROR   ] Unable to cache file 'salt://test/download_me.txt' from saltenv 'base'.
local:
    |_
      ----------
      test:
          ----------
          test cp.cache_file:
              ----------
              duration:
                  1.3636
              module.function [args]:
                  cp.cache_file ["salt://test/download_me.txt", "base"]
              saltcheck assertion:
                  IS NOT EMPTY False
              status:
                  Fail: value is empty
    |_
      ----------
      TEST RESULTS:
          ----------
          Execution Time:
              1.3636
          Failed:
              1
          Missing Tests:
              0
          Passed:
              0
          Skipped:
              0

Expected behavior
The execution modules should work when called by saltcheck test files as they work when called directly.

Versions Report

salt --versions-report Salt Version: Salt: 3004.1

Dependency Versions:
cffi: 1.15.0
cherrypy: unknown
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: 1.0.6
msgpack: 1.0.3
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.14
pycrypto: Not Installed
pycryptodome: 3.12.0
pygit2: Not Installed
Python: 3.6.8 (default, Sep 10 2021, 09:13:53)
python-gnupg: 0.4.8
PyYAML: 3.12
PyZMQ: 19.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: centos 8
locale: UTF-8
machine: x86_64
release: 4.18.0-348.7.1.el8_5.x86_64
system: Linux
version: CentOS Linux 8

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
PASTE HERE

Additional context
Add any other context about the problem here.

@golmaal golmaal added Bug broken, incorrect, or confusing behavior needs-triage labels Jul 29, 2022
@nicholasmhughes
Copy link
Collaborator

@wcannon @mchugh19 (or others) - can anyone speak to why saltcheck demands the local file client?

# A new salt client is instantiated with the default configuration because the main module's
# client is hardcoded to local

The test case defined in this issue works if the following line is commented:

mlocal_opts["file_client"] = "local"

My specific use case is attempting to use file.check_managed_changes (which uses cp functionality under the hood) to see if a local file has drifted from from the source on the master during a saltcheck test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants