The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #16997

Allow path environment to be specified on a per-resource basis

Added by Luis Mayorga over 3 years ago. Updated over 1 year ago.

Status:AcceptedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected Puppet version: Branch:
Keywords:windows command execute path gem

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-3688


Description

Currently, only the exec resource type permits the path to be specified for commands it executes. However, it would be generally useful for other resource types. For example, to specify the path to use when executing package commands (that are relative).

The only workaround is to modify the provider source or to use the http://docs.puppetlabs.com/references/latest/configuration.html#path setting, though that is global, and won’t work in cases where a module installs a package in a location that isn’t already in the path, e.g. Java applications on windows.

Original description:

Hi,

I just installed ruby1.9.3.exe package on a windows build server and also i was thinking on installing some gems. It seems that is installing the gems as part as as the 1.8.7 ruby version shipped with the Puppet Client windows installer.

class ruby{

file {'ruby':
    name => 'C:\Temp\rubyinstaller-1.9.3-p194.exe',
    ensure => present,
    source => 'V:\shardata\Puppet\rubyinstaller-1.9.3-p194.exe'
}


exec { 'ruby':
        command => 'C:\Temp\rubyinstaller-1.9.3-p194.exe /verysilent /dir="C:\ruby" /tasks="assocfiles,modpath"',
        require => File["ruby"]
    }
    
    
# package { 'nokogiri':
    # ensure => '1.5.5',
    # provider => 'gem',
    # require => Exec['ruby']
# } 

Should I still use the gem provider or should i use the exec and map the new ruby package gem.bat path?


Related issues

Duplicates Puppet - Feature #16048: Type and provider for managing windows environment, espec... Accepted 08/20/2012

History

#1 Updated by Luis Mayorga over 3 years ago

http://stackoverflow.com/questions/12900802/puppet-gem-provider-on-windows/12915887#12915887

#2 Updated by Josh Cooper over 3 years ago

  • Description updated (diff)

#3 Updated by Anonymous over 3 years ago

  • Status changed from Unreviewed to Duplicate

It sounds like what you are expecting to happen is that puppet picks up the modified environment after the ruby install has happened. This looks to be that same as the underlying issue in #16048. I’m marking this as a duplicate of that issue.

#4 Updated by Josh Cooper over 3 years ago

  • Subject changed from Puppet gem provider on windows does not work as expected to Allow path environment to be specified on a per-resource basis
  • Description updated (diff)
  • Status changed from Duplicate to Accepted

Hi Luis, we discussed this and came to the conclusion that this would be possible today if you could modify the PATH that the provider uses to execute its command(s), so ideally you could do:

package { 'ruby193':
  ensure => installed,
  source => 'V:\shardata\Puppet\rubyinstaller-1.9.3-p194.exe',
  install_options => [ '/verysilent', { '/dir' => 'C:\ruby', '/tasks' => 'assocfiles,modpath' } ],
  provider => :windows
}

package { 'nokogiri':
    ensure => '1.5.5',
    provider => 'gem',
    path => "c:\\ruby;$::path",
    require => Package['ruby193']
} 

We’ve seen this issue come up on the mailing list for other package types, and the only workaround has been to modify the provider source. This seems like a generally useful thing for any provider that needs to execute commands.

Starting in Puppet 3, you can manage executable packages using the package resource. However, you’ll have to install the gem using an exec and provide a custom path parameter.

#5 Updated by Josh Cooper over 3 years ago

  • Keywords set to windows command execute path gem

#6 Updated by Kylo Ginsberg over 1 year ago

Redmine Issue #16997 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-3688

Also available in: Atom PDF