-
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
Cron.file is not working - 'NoneType' object has no attribute 'startswith' #10656
Comments
Strange, thanks for the report. We'll look into this. |
@luizsilva can you show me the cron state you are using. |
{% if grains['class'] != 'dev' %} cronie: service: |
Sorry, clicked "close" by mistake. |
Thank you @luizsilva I will try get to this at the weekend. |
I am seeing a similar failure in cron.file after upgrading to 2014.1.0 (from 0.17). My cron state is a bit simpler: crontab:
cron.file:
- name: salt://files/crontab
- user: root Salt fails with ----------
ID: crontab
Function: cron.file
Name: salt://files/crontab
Result: False
Comment: Source file salt://files/crontab not found
Changes: I am not using templates like OP is, but these issue may be related. |
I am too seeing the "Source file salt://files/crontab not found" issue after upgrading to 2014.1.0. |
Seems like, on def cache_loc(self, path, saltenv='base', env=None) at salt/fileclient.py, if saltenv is None
code block threws
(it's strange that it is None because the prototype shows a default value for the param) |
So python 2.7 has the tendency to use None value if you intensionally pass a None value to a parameter with a default.
|
For a workaround one may use env: prod in the cron.file state. |
Fix for #10656: __env__ should be passed around instead of env
I can confirm that the workaround worked for me. |
Is this issue fixed with the above commits? |
I don't see the nonetype issue, but I still get the source file not found
|
@defunctzombie can you view your crontab file on the master from the client? Can you verify this with sudo salt-call cp.list_master |
I get that result back with the file shown in the list. Guessing that is as expected? |
So after applying the patch I think the issue with file not found goes away (when I run salt-call locally on the machine it works) but when I do state.highstate from the master it doesn't until I restart the minion to use the patched version. So it seems the patch did help. |
So the source file not found issue is now fixed as well? |
@basepi seems to be |
Awesome! |
After updating salt to 2014.1 (from 0.17) the cron state is not working anymore.
I was under the impression it was because the crontab for user root was empty but even with something on it (in this case a comment) the state still fails.
[INFO ] Running state [salt://cron/configs/ops_root.txt] at time 16:47:40.498803
[INFO ] Executing state cron.file for salt://cron/configs/ops_root.txt
[INFO ] Executing command 'crontab -l -u root' in directory '/root'
[INFO ] stdout: #
[ERROR ] Unable to manage file: 'NoneType' object has no attribute 'startswith'
[INFO ] Completed state [salt://cron/configs/ops_root.txt] at time 16:47:40.521779
This is an Arch Linux box ( 2.6.32-23-pve #1 SMP Tue Aug 6 07:04:06 CEST 2013 x86_64 GNU/Linux) running as a container on proxmox.
The text was updated successfully, but these errors were encountered: