summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-02 22:56:35 -0500
committerJames Turnbull <james@lovedthanlost.net>2008-10-03 14:07:05 +1000
commit1a9b5677de01fc1ed5a9a6ebbea99a73def7f689 (patch)
tree4008bf1b6a4975dbf6526cb4181a90b1fc68619f /lib/puppet
parent397c8416f78c7a1d081f673dcfe2d70e2d7cee16 (diff)
downloadpuppet-1a9b5677de01fc1ed5a9a6ebbea99a73def7f689.tar.gz
puppet-1a9b5677de01fc1ed5a9a6ebbea99a73def7f689.tar.xz
puppet-1a9b5677de01fc1ed5a9a6ebbea99a73def7f689.zip
Fixing #1614 - Environments no longer have to be listed out.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/defaults.rb7
-rw-r--r--lib/puppet/node/environment.rb18
2 files changed, 2 insertions, 23 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index a2900fd43..e1b6dc423 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -122,16 +122,11 @@ module Puppet
namespaces and methods. This can be used as a coarse-grained
authorization system for both ``puppetd`` and ``puppetmasterd``."
],
- :environments => ["production,development", "The valid environments for Puppet clients.
- This is more useful as a server-side setting than client, but any
- environment chosen must be in this list. Values should be
- separated by a comma."],
:environment => {:default => "production", :desc => "The environment Puppet is running in. For clients
(e.g., ``puppetd``) this determines the environment itself, which
is used to find modules and much more. For servers (i.e.,
``puppetmasterd``) this provides the default environment for nodes
- we know nothing about.",
- :hook => proc { |value| raise(ArgumentError, "Invalid environment %s" % value) unless Puppet::Node::Environment.valid?(value) }
+ we know nothing about."
},
:diff_args => ["", "Which arguments to pass to the diff command when printing differences between files."],
:diff => ["diff", "Which diff command to use when printing differences between files."],
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index 343720a62..b64b9c2c4 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -1,30 +1,14 @@
# Model the environment that a node can operate in. This class just
# provides a simple wrapper for the functionality around environments.
class Puppet::Node::Environment
- # Return the list of valid environments. Just looks them up in
- # the settings.
- def self.valid
- # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
- x = Puppet.settings.value(:environments).split(",").collect { |e| e.to_sym }
- end
-
- # Is the provided environment valid?
- def self.valid?(name)
- return false if name.to_s == ""
- valid.include?(name.to_sym)
- end
-
@seen = {}
- # Return an existing environment instance, or create a new one,
- # validating the environment name.
+ # Return an existing environment instance, or create a new one.
def self.new(name = nil)
name ||= Puppet.settings.value(:environment)
raise ArgumentError, "Environment name must be specified" unless name
- raise(ArgumentError, "'%s' is not a valid environment" % name) unless valid?(name)
-
symbol = name.to_sym
return @seen[symbol] if @seen[symbol]