Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting PATH #210

Closed
Ginja opened this issue Apr 8, 2014 · 3 comments
Closed

Setting PATH #210

Ginja opened this issue Apr 8, 2014 · 3 comments

Comments

@Ginja
Copy link

Ginja commented Apr 8, 2014

Submitting this issue after talking with @anodelman on IRC.

I'm using a RVM Ruby installation to run Puppet on my SUTs, and it seems like beaker is forcing a set path before every Puppet run:

env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply  --verbose --detailed-exitcodes /tmp/apply_manifest.pp.NQ3AbV

This is causing the following warnings during my tests:

centos-65-x64 02:09:29$ env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply  --verbose --detailed-exitcodes /tmp/apply_manifest.pp.NQ3AbV
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Info: Loading facts in /etc/puppet/modules/rvm/lib/facter/rvm_installed.rb
Info: Loading facts in /etc/puppet/modules/rvm/lib/facter/rvm_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/ip6tables_version.rb
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p451/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p451'.
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Notice: Compiled catalog for centos-65-x64.shott.lan in environment production in 4.28 seconds
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Info: Loading facts in /etc/puppet/modules/rvm/lib/facter/rvm_installed.rb
Info: Loading facts in /etc/puppet/modules/rvm/lib/facter/rvm_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/iptables_version.rb
Info: Loading facts in /etc/puppet/modules/firewall/lib/facter/ip6tables_version.rb
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p451/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p451'.
Info: Applying configuration version '1396948171'
Warning: Could not match Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p451/bin' is not at first place,
Warning: Could not match Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p451/bin' is not at first place,
Warning: Could not match Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p451/bin' is not at first place,
Notice: Finished catalog run in 6.12 seconds

centos-65-x64 executed in 13.92 seconds
  should work with no errors
removing temporory ssh-config files per-vagrant box
Destroying vagrant boxes
==> centos-65-x64: Forcing shutdown of VM...
==> centos-65-x64: Destroying VM and associated drives...

I've tried setting a custom path using the :environment key in the options hash for apply_manifest, however it doesn't seem to respect it:

# pp being a variable, which holds my manifest
apply_manifest pp, { :environment => {'PATH' => '/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin' }, :catch_failures => true }

A snippet of the result:

centos-65-x64 10:25:45$  mktemp -t apply_manifest.pp.XXXXXX  
/tmp/apply_manifest.pp.mAdZlR

centos-65-x64 executed in 0.14 seconds
localhost $ scp /var/folders/w9/c36_jf6d2kvfsvvy_5mw5s0c0000gn/T/beaker20140408-68015-9op1c3 centos-65-x64:/tmp/apply_manifest.pp.mAdZlR {}

centos-65-x64 10:25:45$ env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply  --verbose --detailed-exitcodes {:environment=>{"PATH"=>"/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin"}} /tmp/apply_manifest.pp.mAdZlR
bash: /usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin}}: No such file or directory

centos-65-x64 executed in 0.14 seconds
Exited: 1
  should work with no errors (FAILED - 1)

Failures:

  1) puppet_stack should work with no errors
     Failure/Error: apply_manifest pp, { :environment => {'PATH' => '/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin' }, :catch_failures => true }
     Beaker::Host::CommandFailure:
       Host 'centos-65-x64' exited with 1 running:
        env PATH="/usr/bin:/opt/puppet-git-repos/hiera/bin:${PATH}" RUBYLIB="/opt/puppet-git-repos/hiera/lib:/opt/puppet-git-repos/hiera-puppet/lib:${RUBYLIB}" puppet apply  --verbose --detailed-exitcodes {:environment=>{"PATH"=>"/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin"}} /tmp/apply_manifest.pp.mAdZlR
       Last 10 lines of output were:
        bash: /usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/gems/ruby-2.0.0-p451/bin:/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/bin:/opt/puppet-git-repos/hiera/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/local/rvm/bin}}: No such file or directory
     # ./spec/acceptance/puppet_stack_spec.rb:16:in `block (2 levels) in <top (required)>'

Finished in 6.69 seconds
1 example, 1 failure

Failed examples:

As you can see, it doesn't recognize :environment, and just appends it wholesale to the puppet apply command.

@anodelman
Copy link
Contributor

@justinstoller I remember you better understanding how environment variables are handled by beaker - could you take a quick look at this?

anodelman pushed a commit to anodelman/beaker that referenced this issue Aug 6, 2014
- we do not correctly handle adding additional environment variables to
  puppet commands, this patch allows you to add those env vars
anodelman pushed a commit to anodelman/beaker that referenced this issue Aug 6, 2014
- we do not correctly handle adding additional environment variables to
  puppet commands, this patch allows you to add those env vars
anodelman pushed a commit to anodelman/beaker that referenced this issue Aug 6, 2014
- we do not correctly handle adding additional environment variables to
  puppet commands, this patch allows you to add those env vars
anodelman pushed a commit to anodelman/beaker that referenced this issue Aug 7, 2014
- we do not correctly handle adding additional environment variables to
  puppet commands, this patch allows you to add those env vars
anodelman pushed a commit to anodelman/beaker that referenced this issue Aug 7, 2014
- we do not correctly handle adding additional environment variables to
  puppet commands, this patch allows you to add those env vars
@anodelman
Copy link
Contributor

The issue was in how we handle adding environment variables to the constructed puppet command. Currently in a pending PR.

colinPL added a commit that referenced this issue Aug 8, 2014
(MAINT)(gh-210) series of commits to get beaker smoketest working in ec2
@anodelman
Copy link
Contributor

Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants