summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/command_line.rb
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-04-07 12:22:30 -0700
committerMax Martin <max@puppetlabs.com>2011-04-07 12:22:30 -0700
commitfe45c2417af580597cd39adec96a30a05a7cd66a (patch)
tree38191b4766c8e2354c27c0868c12e0e254b4389f /lib/puppet/util/command_line.rb
parent9c06fbd762cddcc41a7185a36f2a8e72879125eb (diff)
parent20bff91c8b8e450d913deeb1750a00a14f1b1061 (diff)
downloadpuppet-fe45c2417af580597cd39adec96a30a05a7cd66a.tar.gz
puppet-fe45c2417af580597cd39adec96a30a05a7cd66a.tar.xz
puppet-fe45c2417af580597cd39adec96a30a05a7cd66a.zip
Merge branch 'next'
* next: (23 commits) (maint) Indentation fixes (#6490) Add plugin initialization callback system to core (Maint) Fix uninitialized constant. (5200) -- replace containers with sentinals (#5528) Add REST API for signing, revoking, retrieving, cleaning certs Fix #4339 - Locally save the last report to $lastrunreport Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yaml Fixed #3127 - removed legacy debug code Fixed #3127 - Fixed gem selection regex (6911) Cleanup and renaming of transaction internals (6911) Core change -- replace topsort with frontier ordered by salted SHA1 (6911) Add bookkeeping facade around Transaction#relationship_graph (#5437) Invalidate cached TypeCollection when there was an error parsing (#6937) Adjust formatting of recurse's desc (#6937) Document the recurse parameter of File type. (#6937) Document the recurse parameter of File type. (6911) Cleanup of generate_additional_resources (6911) Refactor to localize eval_generate dependency assumptions (#6893) Document the cron type in the case of specials. (maint) Fix for require order issue ...
Diffstat (limited to 'lib/puppet/util/command_line.rb')
-rw-r--r--lib/puppet/util/command_line.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 7f74d266a..52b5f81ef 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -1,9 +1,10 @@
+require "puppet/util/plugins"
+
module Puppet
module Util
class CommandLine
- LegacyName = Hash.new{|h,k| k}.update(
- {
+ LegacyName = Hash.new{|h,k| k}.update(
'agent' => 'puppetd',
'cert' => 'puppetca',
'doc' => 'puppetdoc',
@@ -13,9 +14,8 @@ module Puppet
'queue' => 'puppetqd',
'resource' => 'ralsh',
'kick' => 'puppetrun',
- 'master' => 'puppetmasterd',
-
- })
+ 'master' => 'puppetmasterd'
+ )
def initialize( zero = $0, argv = ARGV, stdin = STDIN )
@zero = zero
@@ -23,6 +23,7 @@ module Puppet
@stdin = stdin
@subcommand_name, @args = subcommand_and_args( @zero, @argv, @stdin )
+ Puppet::Plugins.on_commandline_initialization(:command_line_object => self)
end
attr :subcommand_name
@@ -56,21 +57,23 @@ module Puppet
puts usage_message
elsif available_subcommands.include?(subcommand_name) #subcommand
require_application subcommand_name
- Puppet::Application.find(subcommand_name).new(self).run
+ app = Puppet::Application.find(subcommand_name).new(self)
+ Puppet::Plugins.on_application_initialization(:appliation_object => self)
+ app.run
else
abort "Error: Unknown command #{subcommand_name}.\n#{usage_message}" unless execute_external_subcommand
end
end
def execute_external_subcommand
- external_command = "puppet-#{subcommand_name}"
+ external_command = "puppet-#{subcommand_name}"
- require 'puppet/util'
- path_to_subcommand = Puppet::Util.which( external_command )
- return false unless path_to_subcommand
+ require 'puppet/util'
+ path_to_subcommand = Puppet::Util.which( external_command )
+ return false unless path_to_subcommand
- system( path_to_subcommand, *args )
- true
+ system( path_to_subcommand, *args )
+ true
end
def legacy_executable_name