Back in prehistory (eg: 0.25 era), 'puppet' was the name for the agent, and
could be used directly to apply a manifest as well as to communicate with the
puppet master process.

During the 2.6 series we moved to a single binary, but continued to support
older scripts by detecting invocations that looked like the traditional
scripting uses and implicitly turning those into a call to 'puppet apply'.

Now, with the 2.7.0 release, we are moving to deprecate that behaviour.  We
still do the same detection, and still run the old manifests, but we now
emit a deprecation warning directing people to use 'puppet apply' directly.

We intend to remove the behaviour entirely in the 2.8 release, which also
paves the way to nicer handling of the command line.

Reviewed-By: Randall Hansen <[email protected]>
Reviewed-By: Nick Fagerlund <[email protected]>
---
 lib/puppet/util/command_line.rb |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index c475dac..372aa51 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -94,12 +94,27 @@ module Puppet
         if zero == 'puppet'
           case argv.first
           when nil then
-            # ttys get usage info
-            [stdin.tty? ? nil : "apply", argv]
+            if stdin.tty? then
+              [nil, argv]       # ttys get usage info
+            else
+              # Killed for 2.7.0 --daniel 2011-06-01
+              Puppet.deprecation_warning <<EOM
+Implicit invocation of 'puppet apply' by redirection into 'puppet' is 
deprecated,
+and will be removed in the 2.8 series. Please invoke 'puppet apply' directly
+in the future.
+EOM
+              ["apply", argv]
+            end
           when "--help", "-h" then
             # help should give you usage, not the help for `puppet apply`
             [nil, argv]
           when /^-|\.pp$|\.rb$/ then
+            # Killed for 2.7.0 --daniel 2011-06-01
+            Puppet.deprecation_warning <<EOM
+Implicit invocation of 'puppet apply' by passing files (or flags) directly
+to 'puppet' is deprecated, and will be removed in the 2.8 series.  Please
+invoke 'puppet apply' directly in the future.
+EOM
             ["apply", argv]
           else
             [argv.first, argv[1..-1]]
@@ -112,3 +127,10 @@ module Puppet
     end
   end
 end
+
+# REVISIT: Without this, we can't use the full Puppet suite inside the code,
+# but we can't include it before we get this far through defining things as
+# this code is the product of incestuous union with the global code; global
+# code at load scope depends on methods we define, while we only depend on
+# them at runtime scope.  --daniel 2011-06-01
+require 'puppet'
-- 
1.7.5.2

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to