Skip to content

Create scheduled task in "local" mode? #2

@ghost

Description

I guess this is more of a general Boxstarter question, but it came up while I was trying to use this cookbook with Test Kitchen so bear with me...
Basically the problem is this:

  1. I'm trying to install wix toolset in my cookbook
  2. The installer tries to disable Windows Update, resulting in the infamous "access denied" error since Test Kitchen uses WinRM to communicate with test machine and Windows Update doesn't work over WinRM for whatever reason.
  3. After reading up on Boxstarter I realized I could use its task scheduler trick to invoke the Windows Update locally, i.e. run chocolatey via the boxstarter wrapper.

So I did something like:

include_recipe 'boxstarter::default'
boxstarter 'boxstarter run' do
  code <<-EOH
    cinst wixtoolset -v 3.7.1224.0 -y
  EOH
end

After getting a weird error and digging through the boxstarter/chocolatey log I realized that the problem was that boxstarter was trying to run a scheduled task that hadn't been created.
Which ultimately made me realize that this cookbook doesn't really work nicely with the scheduled task feature because the way it invokes Install-BoxstarterPackage is always in "local" mode - in other words, when used in chef, boxstarter is always running via chef-solo/chef-client on the local machine. The implication is that the task mechanism is never actually used.

I was wondering if you think it would make sense to have boxstarter recognize whether or not it is being run via WinRM (assuming that's easy to do in powershell), and decide whether to "Invoke-FromTask" based on that information - regardless of how Install-BoxstarterPackage was invoked.

Let me know if that makes sense - thanks!

-Omer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions