Hi guys,
I was running into a couple things while setting up smart-proxy and I
wanted to share and see if these things might be worth submitting as
features or bugs.
First was path issues, since I'm using the Gem versions of puppet they
are installed into:
/usr/local/rvm/gems/ruby-1.8.7-p352/bin/puppet
Which smart-proxy doesn't check in it's default_path.
I was thinking instead of hardcoding paths in the puppetca.rb file in
lib/proxy it would be nice to be able to set the default_path in the
settings file.
I tested the changes and it seems to work well.
Here's the patch against lib/proxy/puppetca.rb:
@@ -98,7 +100,6 @@
end
# puppetca is the old method of using puppet cert which is new
in puppet 2.6
-
default_path = ["/usr/sbin","/opt/puppet/bin"] @puppetca = which("puppetca", default_path) || which("puppet",
default_path)
unless File.exists?("#{@puppetca}")
logger.warn "unable to find puppetca binary"
@@ -117,6 +118,10 @@
end
- def default_path
-
SETTINGS.default_path || ["/usr/sbin","/opt/puppet/bin"]
- end
···
+ def ssldir SETTINGS.ssldir || "/var/lib/puppet/ssl" endAnd for lib/proxy/puppet.rb
@@ -6,9 +6,11 @@
class << self
- def default_path
-
SETTINGS.default_path || ["/usr/sbin", "/usr/bin", "/opt/
puppet/bin"]
- end
- def run *hosts
-
# Search in /opt/ for puppet enterprise users
-
default_path = ["/usr/sbin", "/usr/bin", "/opt/puppet/bin"] # search for puppet for users using puppet 2.6+ puppetrun = which("puppetrun", default_path) ||
which(“puppet”, default_path)
sudo = which(“sudo”, “/usr/bin”)
Then in settings.yml I added:
Default Path for puppet / puppetca / puppetrun
:default_path: /usr/local/rvm/gems/ruby-1.8.7-p352/bin
The other thing giving me issues was how sudo was being used.
As far as I can tell there isn’t a user specified anywhere, so the use
of sudo -S seems odd to me, especially if I start the proxy using sudo
to begin with, since I’m not using init scripts, at least not yet.
Foreman and Smart-Proxy where pulled down via git to /opt.
I start the process this way:
sudo -E -u smartproxy /opt/smart-proxy/bin/smart-proxy
I have to use -E to preserve my GEM ENV for rvm or sudo will reset it.
I would say it’s an odd case but I think it’s fairly common to use rvm
to install Ruby, so I’m not sure.
It might be nice to have a setting to specify whether or not to use
sudo, and if so the user you want to use.
For my testing I just pulled the sudo part out of command to run
puppetca which solved my issue getting it to return a list.
Even though I could run the exact sudo command the debug log was
saying smart-proxy was running, I was getting a return value of 256
and a blank response.