[PUP-9194] REGRESSION exec cwd is not respected for unless or onlyif commands in 6.0.1 Created: 2018/10/03  Updated: 2019/02/22  Resolved: 2018/10/09

Status: Closed
Project: Puppet
Component/s: Types and Providers
Affects Version/s: PUP 6.0.1
Fix Version/s: PUP 6.0.2

Type: Bug Priority: Blocker
Reporter: Peter Meier Assignee: Enis Inan
Resolution: Done Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
Relates
Template: PUP Bug Template
Team: Platform OS
Sprint: Platform OS Kanban
Method Found: Needs Assessment
Release Notes: Bug Fix
Release Notes Summary: The unless or onlyif commands now respect the cwd parameter in the Exec resource.
QA Risk Assessment: Needs Assessment

 Description   

Since 6.0.1 there is a pretty severe regression which makes unless & onlyif of the exec resource not respecting the specified cwd.

Here is the (shortened output of a run in 6.0.0:

 

$ puppet apply --debug <<EOF
exec{'/usr/bin/pwd':
  onlyif    => '/usr/bin/pwd',
  cwd       => '/tmp',
  logoutput => true,
}
EOF
Debug: Runtime environment: puppet_version=6.0.0, ruby_version=2.5.1, run_mode=user, default_encoding=UTF-8
 
[...]
 
Info: Applying configuration version '1538554714'
Debug: Exec[/usr/bin/pwd](provider=posix): Executing check '/usr/bin/pwd'
Debug: Executing: '/usr/bin/pwd'
Debug: /Stage[main]/Main/Exec[/usr/bin/pwd]/onlyif: /tmp
Debug: Exec[/usr/bin/pwd](provider=posix): Executing '/usr/bin/pwd'
Debug: Executing: '/usr/bin/pwd'
Notice: /Stage[main]/Main/Exec[/usr/bin/pwd]/returns: /tmp
Notice: /Stage[main]/Main/Exec[/usr/bin/pwd]/returns: executed successfully
Debug: /Stage[main]/Main/Exec[/usr/bin/pwd]: The container Class[Main] will propagate my refresh event

 

While this is the output from a 6.0.1 run:

 
 $puppet apply --debug <<EOF
> exec{'/usr/bin/pwd':
>   onlyif    => '/usr/bin/pwd',
>   cwd       => '/tmp',
>   logoutput => true,
> }
> EOF
Debug: Runtime environment: puppet_version=6.0.1, ruby_version=2.5.1, run_mode=user, default_encoding=UTF-8
 
[...]
 
Debug: Exec[/usr/bin/pwd](provider=posix): Executing check '/usr/bin/pwd'
Debug: Executing: '/usr/bin/pwd'
Debug: /Stage[main]/Main/Exec[/usr/bin/pwd]/onlyif: /root
Debug: Exec[/usr/bin/pwd](provider=posix): Executing '/usr/bin/pwd'
Debug: Executing: '/usr/bin/pwd'
Notice: /Stage[main]/Main/Exec[/usr/bin/pwd]/returns: /tmp
Notice: /Stage[main]/Main/Exec[/usr/bin/pwd]/returns: executed successfully
Debug: /Stage[main]/Main/Exec[/usr/bin/pwd]: The container Class[Main] will propagate my refresh event

 

This is a pretty severe Regression as it breaks tons of existing execs, which might even trigger unwanted commands, as the safeguards are not working anymore.



 Comments   
Comment by Geoff Nichols [ 2018/10/03 ]

PR#7138 merged to puppet#5.5.x at https://github.com/puppetlabs/puppet/commit/2bd6f42fef3d7b99e6c90fc4ff6469ade946470e

Comment by Michelle Fredette [ 2018/10/03 ]

release note added.

Comment by Kenn Hussey [ 2018/10/04 ]

Enis Inan please close this issue once the changes have been merged up to master and passed CI.

Comment by Jarret Lavallee [ 2019/02/22 ]

It looks like this change also made it into 5.5.7. Can we add that to the fix version?

Generated at Thu Aug 22 11:49:04 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.