diff options
| author | Luke Kanies <luke@madstop.com> | 2008-07-02 00:32:52 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-07-02 00:32:52 -0500 |
| commit | 8e4312ed249d83ece754b80e993fa0d86bd36d46 (patch) | |
| tree | 8b6044079dbb05a1f84a09a2f8e99cf1b87a3e9e /lib/puppet/util/settings.rb | |
| parent | 49016bb29312bfeb6f41ce420159e6ffc477eebe (diff) | |
| parent | d3a81255245eec19ac21902ae3b877e00e620628 (diff) | |
| download | puppet-8e4312ed249d83ece754b80e993fa0d86bd36d46.tar.gz puppet-8e4312ed249d83ece754b80e993fa0d86bd36d46.tar.xz puppet-8e4312ed249d83ece754b80e993fa0d86bd36d46.zip | |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
spec/unit/node/catalog.rb
spec/unit/type/package.rb
spec/unit/type/schedule.rb
spec/unit/type/service.rb
spec/unit/util/settings.rb
Diffstat (limited to 'lib/puppet/util/settings.rb')
| -rw-r--r-- | lib/puppet/util/settings.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index eec86625d..aeda88e09 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -218,6 +218,64 @@ class Puppet::Util::Settings @used = [] end + # NOTE: ACS ahh the util classes. . .sigh + # as part of a fix for 1183, I pulled the logic for the following 5 methods out of the executables and puppet.rb + # They probably deserve their own class, but I don't want to do that until I can refactor environments + # its a little better than where they were + + # Prints the contents of a config file with the available config elements, or it + # prints a single value of a config element. + def print_config_options + env = value(:environment) + val = value(:configprint) + if val == "all" + hash = {} + each do |name, obj| + val = value(name,env) + val = val.inspect if val == "" + hash[name] = val + end + hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val| + puts "%s = %s" % [name, val] + end + else + val.split(/\s*,\s*/).sort.each do |v| + if include?(v) + #if there is only one value, just print it for back compatibility + if v == val + puts value(val,env) + break + end + puts "%s = %s" % [v, value(v,env)] + else + puts "invalid parameter: %s" % v + return false + end + end + end + true + end + + def generate_config + puts to_config + true + end + + def generate_manifest + puts to_manifest + true + end + + def print_configs + return print_config_options if value(:configprint) != "" + return generate_config if value(:genconfig) + return generate_manifest if value(:genmanifest) + end + + def print_configs? + return (value(:configprint) != "" || value(:genconfig) || value(:genmanifest)) && true + end + # Return a given object's file metadata. def metadata(param) if obj = @config[symbolize(param)] and obj.is_a?(CFile) |
