[PUP-6919] Puppet::Util::Windows::Process.execute should accept a working directory Created: 2016/11/15  Updated: 2019/09/04  Resolved: 2018/09/26

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 5.5.7, PUP 6.0.1

Type: Bug Priority: Normal
Reporter: Ethan Brown Assignee: Enis Inan
Resolution: Fixed Votes: 0
Labels: package, type_and_provider, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks PUP-6920 Windows package provider should set w... Closed
blocks PUP-9150 cwd option in Puppet::Util::Execution... Closed
Relates
relates to PUP-9997 Puppet must not call Dir.chdir() exce... Accepted
relates to PUP-5808 puppet via sudo from nfs home is not ... Closed
Template: PUP Bug Template
Acceptance Criteria:
  • Tests should validate cwd behaves correctly with exec on Windows
Epic Link: WINning
Team: Platform OS
Story Points: 3
Sprint: Platform OS Kanban
Release Notes: New Feature
Release Notes Summary: Puppet::Util::Execution.execute now supports a `cwd` option to specify the current working directory that the command will run in. This option is only available on the agent. It cannot be used on the master, meaning it cannot be used in, for example, regular functions, hiera backends, or report processors.

 Description   

Puppet::Util::Execution.execute should take in a `cwd` option that lets the user specify the new process' working directory.



 Comments   
Comment by Ethan Brown [ 2017/02/24 ]

I've temporarily added PUP 5.0.0 as a fixVersion, though I'd like to see this fixed for the Glisan agent if possible.

Comment by Enis Inan [ 2018/09/05 ]

Ended up reverting this change – see https://github.com/puppetlabs/puppet/pull/7045. Note that the POSIX issue with cd'ing to the cwd when the user does not have permissions to access it would have been resolved in https://github.com/puppetlabs/puppet/pull/7034; however, that was not merged due to some other issues with the existing implementation. These were:

  1. Puppet::Util::Execution.execute still runs the command in the cwd even if the cwd cannot be accessed.
  2. There are some design questions around whether we can move the directory existence check to the top-level execute method so that both execute_posix + execute_windows can use it. Right now, we only do this in execute_posix while in execute_windows, we wrap the system call error.

For reference, the original implementation of this ticket was merged here: https://github.com/puppetlabs/puppet/pull/7016

Comment by Kris Bosland [ 2018/09/26 ]

Passed CI in e2f7ccfb7

Comment by Michelle Fredette [ 2018/10/01 ]

added release note for 6.0.1

Generated at Wed Oct 16 03:21:44 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.