This message was deleted.
# bolt
s
This message was deleted.
n
export GEM_HOME=~/.gem
causes it to install to your user-local gems instead of to Bolt’s Ruby install, so when you run Bolt it can’t find the gem.
If you use rvm or rbenv, those also set
GEM_HOME
and will cause a similar problem.
h
is the expectation that you'd use root to install to the puppet provided bolt's gem path?
n
Yeah, since the package is installed as root you have to install the gem as root
h
my coworker is on vacation so I can't ask, but I'm not seeing a
mail
gem for bolt on their workstation
is it possible to make use of a gem in a plan and not install it in bolt's gem path?
n
Does the plan need mail, or does it run a task that needs mail?
h
it's a task
n
It looks like that task is running on localhost, is that right?
h
yes
starts with
Copy code
#!/opt/puppetlabs/puppet/bin/ruby                                                                                            
                                                                                                                             
require 'json'                                                                                                               
require 'mail'
n
Ahh, I see. Bolt includes its own ruby install, and so does Puppet. That task is actually using Puppet’s ruby
h
Copy code
# /opt/puppetlabs/puppet/bin/gem list mail

*** LOCAL GEMS ***
so it doesn't appear to be in puppet's path either
n
But it’s a little strange because the stack trace mentions this line `from /opt/puppetlabs/bolt/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb83in
require’
which does reference
/opt/puppetlabs/bolt
, hmm
h
I'm only finding it in the coworker's ~/.gem directory
n
Maybe you need
/opt/puppetlabs/puppet/bin/gem install mail
instead of
/opt/puppetlabs/bolt/bin/gem
But I’m not really sure why it would ever use
~/.gem
, that’s strange.
h
I've tried all three
gem
from the system, puppet/bin, and bolt/bin and the task won't see it
n
I would expect
/opt/puppetlabs/bolt/bin/gem install mail
to work without
GEM_HOME
set
Are you just running
bolt plan run <...>
?
h
yes
Using root to install into bolt's path worked. I'll have to follow up with this coworker to find out how it's intended to work.
n
They might have a config file in
~/.puppetlabs/etc/bolt/bolt-defaults.yaml
that changes how it runs ruby tasks
h
I'll have to look, thanks!
y
or maybe they have bundler-installed version of bolt