Skip to content

Commit

Permalink
(#7177) Deprecate implicit 'puppet apply' for 2.7.0
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Daniel Pittman committed Jun 1, 2011
1 parent 3f47b0c commit a23cfd8
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/puppet/util/command_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,27 @@ def subcommand_and_args(zero, argv, stdin)
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]]
Expand All @@ -112,3 +127,10 @@ def subcommand_and_args(zero, argv, stdin)
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'

0 comments on commit a23cfd8

Please sign in to comment.