Add command_prefix field to puppet mcagent
This will allow to run puppet with environment variables.
E.g. FACTER_foo=bar puppet apply ...
Change-Id: I1e435262e810ead46689078513607f6a99a19043
Implements: blueprint get-rid-cobbler-dnsmasq
(cherry picked from commit c734b03042
)
This commit is contained in:
parent
892894bfb5
commit
ec4abb2573
|
@ -97,6 +97,7 @@ module Astute
|
||||||
:manifest => @options['puppet_manifest'],
|
:manifest => @options['puppet_manifest'],
|
||||||
:modules => @options['puppet_modules'],
|
:modules => @options['puppet_modules'],
|
||||||
:cwd => @options['cwd'],
|
:cwd => @options['cwd'],
|
||||||
|
:command_prefix => @options['command_prefix'],
|
||||||
:puppet_noop_run => @options['puppet_noop_run'],
|
:puppet_noop_run => @options['puppet_noop_run'],
|
||||||
).first
|
).first
|
||||||
return result[:statuscode] == 0, result[:statusmsg]
|
return result[:statuscode] == 0, result[:statusmsg]
|
||||||
|
|
|
@ -43,6 +43,7 @@ module Astute
|
||||||
'retries' => Astute.config.puppet_retries,
|
'retries' => Astute.config.puppet_retries,
|
||||||
'puppet_manifest' => '/etc/puppet/manifests/site.pp',
|
'puppet_manifest' => '/etc/puppet/manifests/site.pp',
|
||||||
'puppet_modules' => Astute.config.puppet_module_path,
|
'puppet_modules' => Astute.config.puppet_module_path,
|
||||||
|
'command_prefix' => '',
|
||||||
'cwd' => Astute.config.shell_cwd,
|
'cwd' => Astute.config.shell_cwd,
|
||||||
'timeout' => Astute.config.puppet_timeout,
|
'timeout' => Astute.config.puppet_timeout,
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
|
|
|
@ -97,6 +97,15 @@ action "runonce", :description => "Invoke a single puppet run" do
|
||||||
:default => true,
|
:default => true,
|
||||||
:optional => true
|
:optional => true
|
||||||
|
|
||||||
|
input :command_prefix,
|
||||||
|
:prompt => "Puppet command prefix (allows to run puppet with variables)",
|
||||||
|
:description => "Allows to run puppet with variables (e.g. FACTER_foo=bar)",
|
||||||
|
:type => :string,
|
||||||
|
:validation => :shellsafe,
|
||||||
|
:default => '',
|
||||||
|
:optional => true,
|
||||||
|
:maxlength => 0
|
||||||
|
|
||||||
output :output,
|
output :output,
|
||||||
:description => "Output from puppet",
|
:description => "Output from puppet",
|
||||||
:display_as => "Output"
|
:display_as => "Output"
|
||||||
|
|
|
@ -202,7 +202,9 @@ module MCollective
|
||||||
cwd = request.fetch(:cwd, '/')
|
cwd = request.fetch(:cwd, '/')
|
||||||
manifest = request.fetch(:manifest, '/etc/puppet/manifests/site.pp')
|
manifest = request.fetch(:manifest, '/etc/puppet/manifests/site.pp')
|
||||||
module_path = request.fetch(:modules, '/etc/puppet/modules')
|
module_path = request.fetch(:modules, '/etc/puppet/modules')
|
||||||
|
command_prefix = request.fetch(:command_prefix, '')
|
||||||
cmd = [
|
cmd = [
|
||||||
|
command_prefix,
|
||||||
@puppetd,
|
@puppetd,
|
||||||
"-c #{cwd}",
|
"-c #{cwd}",
|
||||||
@puppetd_agent,
|
@puppetd_agent,
|
||||||
|
|
|
@ -35,6 +35,7 @@ describe Astute::PuppetMClient do
|
||||||
let(:options) do
|
let(:options) do
|
||||||
{
|
{
|
||||||
'cwd' => '/etc/puppet/mainfest/test',
|
'cwd' => '/etc/puppet/mainfest/test',
|
||||||
|
'command_prefix' => '',
|
||||||
'puppet_manifest' => 'test_manifest.pp',
|
'puppet_manifest' => 'test_manifest.pp',
|
||||||
'puppet_noop_run' => false,
|
'puppet_noop_run' => false,
|
||||||
'raw_report' => true,
|
'raw_report' => true,
|
||||||
|
@ -200,6 +201,7 @@ describe Astute::PuppetMClient do
|
||||||
:manifest => options['puppet_manifest'],
|
:manifest => options['puppet_manifest'],
|
||||||
:modules => options['puppet_modules'],
|
:modules => options['puppet_modules'],
|
||||||
:cwd => options['cwd'],
|
:cwd => options['cwd'],
|
||||||
|
:command_prefix => options['command_prefix'],
|
||||||
:puppet_noop_run => options['puppet_noop_run'],
|
:puppet_noop_run => options['puppet_noop_run'],
|
||||||
).returns([:statuscode => 0])
|
).returns([:statuscode => 0])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue