-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
file.managed fails with a list of one or more source files #22747
Comments
After a WAG, it looks like this is a documentation bug. If |
Thanks for the report and for updating your ticket. This should be a simple fix. |
Interesting. I can't figure out how that's working. |
I'm baffled too...b/c |
Ok...I'm mistaken...sorry. |
@brianz Can you clarify what you meant in the last comment? The changes to all of the files you put in sources list actually occur, but the state run isn't reporting that correctly? Or the state "runs" but doesn't "fail" and no changes actually occur to the files in the sources list? |
@rallytime ...sure. So, original bug report description is valid. When I changed the
...note the s in sources...the state reported that it ran successfully. However, it either didn't run or ran incorrectly, because the state wasn't actually applied (i.e., the target file wasn't changed). When updating an existing file the existing file didn't get changed. |
@brianz I'm having trouble reproducing this issue. I've tested it on 2014.7.4, 2014.7.6, and 2015.5.3. Every one of these versions have worked with source being used as a list for me. Are you still having the issue? |
I'll go back and test this again. IIRC Salt was installed via |
Since this feature is documented to work already with |
Hello all, I also notice this regression behavior but only with a http source. I can reproduce the bug like this:
calling the state with:
And it works as a single line. Could someone confirm it is the right syntax?
|
@ealphonse, thanks for reporting. I can confirm this. # cat /srv/salt/test.sls
installation:
file.managed:
- name: /tmp/bootstrap
- source: https://bootstrap.saltstack.com/
#- source:
# - https://bootstrap.saltstack.com/
# - salt://non_existent_file
- source_hash: sha256=e4294157c2133ae78dbb0972ff22d86536ceffd35d57353e15094a43d6caffac # salt jmoney-main state.apply test
jmoney-main:
----------
ID: installation
Function: file.managed
Name: /tmp/bootstrap
Result: True
Comment: File /tmp/bootstrap updated
Started: 13:09:08.328548
Duration: 480.34 ms
Changes:
----------
diff:
New file
mode:
0644
Summary for jmoney-main
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1 # cat /srv/salt/test.sls
installation:
file.managed:
- name: /tmp/bootstrap
#- source: https://bootstrap.saltstack.com/
- source:
- https://bootstrap.saltstack.com/
- salt://non_existent_file
- source_hash: sha256=e4294157c2133ae78dbb0972ff22d86536ceffd35d57353e15094a43d6caffac jmoney-main ~ master # salt jmoney-main state.apply test
jmoney-main:
----------
ID: installation
Function: file.managed
Name: /tmp/bootstrap
Result: False
Comment: Unable to manage file: none of the specified sources were found
Started: 13:09:23.841516
Duration: 26.519 ms
Changes:
Summary for jmoney-main
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
ERROR: Minions returned with non-zero exit code # salt --versions
Salt Version:
Salt: 2015.8.8.2
Dependency Versions:
Jinja2: 2.7.3
M2Crypto: 0.21.1
Mako: 1.0.0
PyYAML: 3.11
PyZMQ: 14.4.0
Python: 2.7.9 (default, Mar 1 2015, 12:57:24)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: 0.8.6
cherrypy: Not Installed
dateutil: Not Installed
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: Not Installed
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: debian 8.4
machine: x86_64
release: 3.16.0-4-amd64
system: debian 8.4 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
It seems this problem had reared its head again. Version 2019.02 (master and minion) no longer accepts source when given multiple sources. my.cnf: Gives this warning
Yet changing the sls to: my.cnf: gives the following: [WARNING ] State for file: /etc/mysql/my.cnf - Neither 'source' nor 'contents' nor 'contents_pillar' nor 'contents_grains' was defined, yet 'replace' was set to 'True'. As there is no source to replace the file with, 'replace' has been set to 'False' to avoid reading the file unnecessarily. So now neither solution works. When the salt-master is 2018.03 (minion is still 2019.02) the first solution (source:) does work. |
My previously working states fail to run when upgrading from 2014.7.2 to 2014.7.4. The issue I'm seeing is that the
source
filed forfile.managed
must be a single item, rather than a list of one or more items.From the docs:
http://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html#salt.states.file.managed
The following works:
However, this fails:
Changing to a single-item list still fails:
Whether
source
has one item in the list or multiple, the error returned is:"Comment: Unable to manage file: none of the specified sources were found"
As soon as I switch to the
source: salt://...
syntax, it works as expected.The text was updated successfully, but these errors were encountered: