Skip to content

Commit 5954fc8

Browse files
silugclaude
andcommitted
Remove configprint setting
The --configprint CLI option and associated settings functionality have been removed. Use 'puppet config' instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Steven Pritchard <steven.pritchard@gmail.com>
1 parent ae6182c commit 5954fc8

File tree

3 files changed

+1
-105
lines changed

3 files changed

+1
-105
lines changed

lib/puppet/defaults.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,6 @@ def self.initialize_default_settings!(settings)
318318
sense when specified on the command line as `--genmanifest`. Takes into account arguments specified
319319
on the CLI.",
320320
},
321-
:configprint => {
322-
:default => "",
323-
:deprecated => :completely,
324-
:desc => "Prints the value of a specific configuration setting. If the name of a
325-
setting is provided for this, then the value is printed and puppet
326-
exits. Comma-separate multiple values. For a list of all values,
327-
specify 'all'. This setting is deprecated, the 'puppet config' command replaces this functionality.",
328-
},
329321
:color => {
330322
:default => "ansi",
331323
:type => :string,

lib/puppet/settings.rb

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -512,45 +512,6 @@ def include?(name)
512512
@config.include?(name)
513513
end
514514

515-
# Prints the contents of a config file with the available config settings, or it
516-
# prints a single value of a config setting.
517-
def print_config_options
518-
if Puppet::Util::Log.sendlevel?(:info)
519-
Puppet::Util::Log.newdestination(:console)
520-
message = _("Using --configprint is deprecated. Use 'puppet config <subcommand>' instead.")
521-
Puppet.deprecation_warning(message)
522-
end
523-
524-
env = value(:environment)
525-
val = value(:configprint)
526-
if val == "all"
527-
hash = {}
528-
each do |name, _obj|
529-
val = value(name, env)
530-
val = val.inspect if val == ""
531-
hash[name] = val
532-
end
533-
hash.sort { |a, b| a[0].to_s <=> b[0].to_s }.each do |name, v|
534-
puts "#{name} = #{v}"
535-
end
536-
else
537-
val.split(/\s*,\s*/).sort.each do |v|
538-
if include?(v)
539-
# if there is only one value, just print it for back compatibility
540-
if v == val
541-
puts value(val, env)
542-
break
543-
end
544-
puts "#{v} = #{value(v, env)}"
545-
else
546-
puts "invalid setting: #{v}"
547-
return false
548-
end
549-
end
550-
end
551-
true
552-
end
553-
554515
def generate_config
555516
puts to_config
556517
true
@@ -562,14 +523,13 @@ def generate_manifest
562523
end
563524

564525
def print_configs
565-
return print_config_options if value(:configprint) != ""
566526
return generate_config if value(:genconfig)
567527

568528
generate_manifest if value(:genmanifest)
569529
end
570530

571531
def print_configs?
572-
(value(:configprint) != "" || value(:genconfig) || value(:genmanifest)) && true
532+
(value(:genconfig) || value(:genmanifest)) && true
573533
end
574534

575535
# The currently configured run mode that is preferred for constructing the application configuration.

spec/unit/settings_spec.rb

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,11 +2044,6 @@ def assert_accessing_setting_is_deprecated(settings, setting)
20442044
expect(@settings.print_configs?).to be_falsey
20452045
end
20462046

2047-
it "should return true when :configprint has a value" do
2048-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2049-
expect(@settings.print_configs?).to be_truthy
2050-
end
2051-
20522047
it "should return true when :genconfig has a value" do
20532048
allow(@settings).to receive(:value).with(:genconfig).and_return(true)
20542049
expect(@settings.print_configs?).to be_truthy
@@ -2061,57 +2056,6 @@ def assert_accessing_setting_is_deprecated(settings, setting)
20612056
end
20622057

20632058
describe "when printing configs" do
2064-
describe "when :configprint has a value" do
2065-
it "should call print_config_options" do
2066-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2067-
expect(@settings).to receive(:print_config_options)
2068-
@settings.print_configs
2069-
end
2070-
2071-
it "should get the value of the option using the environment" do
2072-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2073-
allow(@settings).to receive(:include?).with("something").and_return(true)
2074-
expect(@settings).to receive(:value).with(:environment).and_return("env")
2075-
expect(@settings).to receive(:value).with("something", "env").and_return("foo")
2076-
allow(@settings).to receive(:puts).with("foo")
2077-
@settings.print_configs
2078-
end
2079-
2080-
it "should print the value of the option" do
2081-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2082-
allow(@settings).to receive(:include?).with("something").and_return(true)
2083-
allow(@settings).to receive(:value).with("something", nil).and_return("foo")
2084-
expect(@settings).to receive(:puts).with("foo")
2085-
@settings.print_configs
2086-
end
2087-
2088-
it "should print the value pairs if there are multiple options" do
2089-
allow(@settings).to receive(:value).with(:configprint).and_return("bar,baz")
2090-
allow(@settings).to receive(:include?).with("bar").and_return(true)
2091-
allow(@settings).to receive(:include?).with("baz").and_return(true)
2092-
allow(@settings).to receive(:value).with("bar", nil).and_return("foo")
2093-
allow(@settings).to receive(:value).with("baz", nil).and_return("fud")
2094-
expect(@settings).to receive(:puts).with("bar = foo")
2095-
expect(@settings).to receive(:puts).with("baz = fud")
2096-
@settings.print_configs
2097-
end
2098-
2099-
it "should return true after printing" do
2100-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2101-
allow(@settings).to receive(:include?).with("something").and_return(true)
2102-
allow(@settings).to receive(:value).with("something", nil).and_return("foo")
2103-
allow(@settings).to receive(:puts).with("foo")
2104-
expect(@settings.print_configs).to be_truthy
2105-
end
2106-
2107-
it "should return false if a config param is not found" do
2108-
allow(@settings).to receive(:puts)
2109-
allow(@settings).to receive(:value).with(:configprint).and_return("something")
2110-
allow(@settings).to receive(:include?).with("something").and_return(false)
2111-
expect(@settings.print_configs).to be_falsey
2112-
end
2113-
end
2114-
21152059
describe "when genconfig is true" do
21162060
before do
21172061
allow(@settings).to receive(:puts)

0 commit comments

Comments
 (0)