Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
2
-
Windows 2015-10-21
-
Bug Fix
-
Description
This might be a rare case, but fixing it can improve the code actually.
If a Windows Server 2003 system is upgraded from Windows 2000 or NT, the default %SYSTEMROOT% or %WINDIR% is C:\WINNT rather than C:\Windows. This will cause failure of scheduled_task resource, because taskscheduler.rb hardcoded the path of scheduled tasks as C:\Windows\Tasks when testing if a job exists.
Error: /Stage[main]/test/Scheduled_task[foo]: Could not evaluate: No such file or directory @ dir_initialize - C:/Windows/Tasks
|
I don't think it's a good way:
- The windows directory doesn't have to be C:\Windows
- The system drive doesn't have to be C:
It's better to use "#{ENV['WINDIR']}/Tasks" here.
# Returns whether or not the scheduled task exists. |
def exists?(job_name) |
bool = false |
Dir.foreach('C:/Windows/Tasks'){ |file| |
if File.basename(file, '.job') == job_name |
bool = true |
break |
end |
}
|
bool
|
end |
Attachments
Issue Links
- links to