[PUP-5269] Puppet scheduled_task provider on windows fails if non-ASCII characters are in Task Name Created: 2015/09/21  Updated: 2016/07/25  Resolved: 2016/06/24

Status: Closed
Project: Puppet
Component/s: Windows
Affects Version/s: PUP 3.8.2
Fix Version/s: PUP 4.5.3

Type: Bug Priority: Major
Reporter: Eric Zhu Assignee: Erick Banks
Resolution: Fixed Votes: 0
Labels: puppet-agent, scheduled_task, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7,2008,8,8.1,2012,2012 R2


Template:
Acceptance Criteria:
  • Can create a task with utf8 characters in it
  • Can re-run the same manifest without error
  • puppet resource scheduled_task properly shows the task definition
Epic Link: Non-US Language / Unicode Support for Windows
Story Points: 2
Sprint: Windows 2016-06-29

 Description   

If there is a scheduled task with a Non-ASCII name in the task library(%SYSTEMROOT%/Tasks), scheduled_task provider will fail.

Of course I don't name scheduled task like that, but sometimes third-party program or the end users might do so.

I tried set the codepage to 1252, but the error occurs anyway. So I guess it's a issue of Ruby again like PUP-4333?

C:\Users\Administrator\Desktop>puppet apply sch.pp --debug --trace
......
Info: Applying configuration version '1443053017'
Error: Could not set 'present' on ensure: U+00AE to IBM437 in conversion from UTF-16LE to UTF-8 to IBM437 at 10:C:/Users/Admi
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `encode'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `read_wide_string'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:69:in `block in read_arbitrary_wide_string_up
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `upto'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `read_arbitrary_wide_string_up_to'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:215:in `block (6 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:214:in `block (5 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `each'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `block (4 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:210:in `block (3 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `block (2 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `block in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:117:in `block in UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:202:in `enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:514:in `new_work_item'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:191:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `create'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property/ensure.rb:16:in `block in defaultvalues'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:197:in `call_valuemethod'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:498:in `set'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:581:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:204:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:128:in `sync_if_needed'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:81:in `perform_changes'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:20:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:204:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:217:in `eval_resource'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `call'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:335:in `block in thinmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:334:in `thinmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/graph/relationship_graph.rb:118:in `traverse'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:138:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:169:in `block in apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/log.rb:149:in `with_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/report.rb:112:in `as_logging_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:168:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:120:in `block in apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:161:in `block in benchmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:160:in `benchmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:119:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:227:in `run_internal'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:134:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:133:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:302:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:236:in `block in main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:198:in `main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:159:in `run_command'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block (2 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:507:in `plugin_hook'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:496:in `exit_on_fail'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:146:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:92:in `execute'
C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:8:in `<main>'
Error: Could not set 'present' on ensure: U+00AE to IBM437 in conversion from UTF-16LE to UTF-8 to IBM437 at 10:C:/Users/Admi
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `encode'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `read_wide_string'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:69:in `block in read_arbitrary_wide_string_up
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `upto'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `read_arbitrary_wide_string_up_to'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:215:in `block (6 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:214:in `block (5 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `each'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `block (4 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:210:in `block (3 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `block (2 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `block in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:117:in `block in UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:202:in `enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:514:in `new_work_item'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:191:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `create'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property/ensure.rb:16:in `block in defaultvalues'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:197:in `call_valuemethod'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:498:in `set'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:581:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:204:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:128:in `sync_if_needed'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:81:in `perform_changes'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:20:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:204:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:217:in `eval_resource'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `call'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:335:in `block in thinmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:334:in `thinmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/graph/relationship_graph.rb:118:in `traverse'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:138:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:169:in `block in apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/log.rb:149:in `with_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/report.rb:112:in `as_logging_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:168:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:120:in `block in apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:161:in `block in benchmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:160:in `benchmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:119:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:227:in `run_internal'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:134:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:133:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:302:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:236:in `block in main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:198:in `main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:159:in `run_command'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block (2 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:507:in `plugin_hook'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:496:in `exit_on_fail'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:146:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:92:in `execute'
C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:8:in `<main>'
Wrapped exception:
U+00AE to IBM437 in conversion from UTF-16LE to UTF-8 to IBM437
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `encode'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:58:in `read_wide_string'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:69:in `block in read_arbitrary_wide_string_up
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `upto'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:67:in `read_arbitrary_wide_string_up_to'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:215:in `block (6 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:214:in `block (5 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `each'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:213:in `block (4 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/api_types.rb:97:in `read_com_memory_pointer'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:210:in `block (3 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:204:in `block (2 levels) in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:203:in `block in enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:117:in `block in UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/com.rb:114:in `UseInstance'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:202:in `enum'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:514:in `new_work_item'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/windows/taskscheduler.rb:191:in `initialize'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `new'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb:214:in `create'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property/ensure.rb:16:in `block in defaultvalues'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:197:in `call_valuemethod'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:498:in `set'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/property.rb:581:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:204:in `sync'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:128:in `sync_if_needed'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:81:in `perform_changes'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/resource_harness.rb:20:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:204:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:217:in `eval_resource'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `call'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:335:in `block in thinmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:334:in `thinmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:147:in `block in evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/graph/relationship_graph.rb:118:in `traverse'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction.rb:138:in `evaluate'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:169:in `block in apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/log.rb:149:in `with_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/transaction/report.rb:112:in `as_logging_destination'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/resource/catalog.rb:168:in `apply'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:120:in `block in apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:161:in `block in benchmark'
C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:160:in `benchmark'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:119:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:227:in `run_internal'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:134:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:133:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:302:in `apply_catalog'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:236:in `block in main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:64:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:244:in `override'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:198:in `main'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/apply.rb:159:in `run_command'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block (2 levels) in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:507:in `plugin_hook'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `block in run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:496:in `exit_on_fail'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:381:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:146:in `run'
C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:92:in `execute'
C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:8:in `<main>'
Error: /Stage[main]/Main/Scheduled_task[test]/ensure: change from absent to present failed: Could not set 'present' on ensure
version from UTF-16LE to UTF-8 to IBM437 at 10:C:/Users/Administrator/Desktop/sch.pp
Debug: Finishing transaction 34518192
Debug: Storing state
Debug: Stored state in 0.06 seconds
Notice: Finished catalog run in 0.23 seconds
Debug: Using settings: adding file resource 'rrddir': 'File[C:/ProgramData/PuppetLabs/puppet/var/rrd]{:path=>"C:/ProgramData/
", :mode=>"750", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}'
Debug: Finishing transaction 33852696
Debug: Received report to process from win2k8sp2x86
Debug: Evicting cache entry for environment 'devel'
Debug: Caching environment 'devel' (ttl = 0 sec)
Debug: Processing report from win2k8sp2x86 with processor Puppet::Reports::Store
 
C:\Users\Administrator\Desktop>



 Comments   
Comment by Ethan Brown [ 2016/06/21 ]

The following manifest can be used to demonstrate the problem / validate the fix

scheduled_task { 'Test-Taskᚠᛇᚻ':
  ensure  => 'present',
  command => "C:\\windows\\system32\\notepad.exe",
  enabled => true,
  trigger => {
    'every'      => '1',
    'schedule'   => 'daily',
    'start_time' => '13:00'
  },
}

(Note that depending on browser, the above manifest may not render properly, but copying / pasting the contents should properly carry the rune characters over to a manifest)

Comment by Glenn Sarti [ 2016/06/21 ]

PR Review

Unit tests and Integration tests all succeeded

Test Manifest

scheduled_task { 'Test-Taskᚠᛇᚻ':
  ensure  => 'present',
  command => "C:\\windows\\system32\\notepad.exe",
  enabled => true,
  trigger => {
    'every'      => '1',
    'schedule'   => 'daily',
    'start_time' => '13:00'
  },
}

Errors without the fixes in the PR

C:\source\puppet>bundle exec puppet apply temp\test.pp
DL is deprecated, please use Fiddle
Notice: Compiled catalog for win-edson23cglf.localdomain in environment production in 0.19 seconds
Notice: /Stage[main]/Main/Scheduled_task[Test-Taskᚠᛇᚻ]/ensure: created
Notice: Applied catalog in 0.79 seconds
 
C:\source\puppet>bundle exec puppet apply temp\test.pp
DL is deprecated, please use Fiddle
Notice: Compiled catalog for win-edson23cglf.localdomain in environment production in 0.19 seconds
Error: Failed to call #<Win32::TaskScheduler::COM::TaskScheduler:0x000000092a5400>::NewWorkItem with HRESULT: -2147024816.:  The file exists.
Error: /Stage[main]/Main/Scheduled_task[Test-Taskᚠᛇᚻ]/ensure: change from absent to present failed: Failed to call #<Win32::TaskScheduler::COM::TaskScheduler:0x000000092a5400>::NewWorkItem with HRESULT: -2147024816.:  The file exists.
Notice: Applied catalog in 0.65 seconds

Using puppet resource shows it can't interpret the task correctly.

C:\source\puppet>bundle exec puppet resource scheduled_task
DL is deprecated, please use Fiddle
...
scheduled_task { 'Test-Taskᚠᛇᚻ':
  ensure => 'absent',
}
...

Using the fix in this PR;
Apply the manifest behaves as expected

C:\source\puppet>bundle exec puppet apply temp\test.pp
DL is deprecated, please use Fiddle
Notice: Compiled catalog for win-edson23cglf.localdomain in environment production in 0.21 seconds
Notice: /Stage[main]/Main/Scheduled_task[Test-Taskᚠᛇᚻ]/ensure: created
Notice: Applied catalog in 0.73 seconds
 
C:\source\puppet>bundle exec puppet apply temp\test.pp
DL is deprecated, please use Fiddle
Notice: Compiled catalog for win-edson23cglf.localdomain in environment production in 0.21 seconds
Notice: Applied catalog in 0.69 seconds

Using puppet resource

C:\source\puppet>bundle exec puppet resource scheduled_task
DL is deprecated, please use Fiddle
...
scheduled_task { 'Test-Taskᚠᛇᚻ':
  ensure  => 'present',
  command => 'C:\windows\system32\notepad.exe',
  enabled => 'true',
  trigger => [{'enabled' => 'true', 'every' => '1', 'index' => '0', 'minutes_duration' => '0', 'minutes_interval' => '0', 'schedule' => 'daily', 'start_date' => '2016-6-21', 'start_time' => '13:00'}],
  user    => 'system',
}
...

Comment by Glenn Sarti [ 2016/06/21 ]

Merged into stable at;
https://github.com/puppetlabs/puppet/commit/ea02ca1fb237cb7d80343d41cda7ee2005af2f0c

This was merged in error and will cause CI failures, as it picked up a WIP acceptance test that was part of PUP-1498

An additional PR https://github.com/puppetlabs/puppet/pull/5042/files need to be merged to fix the inevitable test failure that will result from the inclusion of the PUP-1498 non-tweaked commits that were originally in https://github.com/puppetlabs/puppet/pull/5036

Comment by Glenn Sarti [ 2016/06/21 ]

Additional PR merged into stable at;
https://github.com/puppetlabs/puppet/commit/fffcf8a6bf59f6cb2d1d9a555a8c6c28e5d33606

Comment by Erick Banks [ 2016/06/24 ]

QA demo'ed to me by Glenn.

I pulled the puppet.msi from http://nightlies.puppetlabs.com/puppet-agent/latest/repos/windows/ and ensured the changes from the pr above were included. Then ran a puppet apply on a manifest with a multibyte utf-8 character as the name of the manifest "test竹".

The manifest was applied once and on the second run proved to be idempotent.

I feel the tests in spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb are sufficient to prove the change works. Will not FR.

Generated at Wed Nov 13 11:49:09 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.