summaryrefslogtreecommitdiff
path: root/lib/chef/config.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-10-14 15:13:31 -0700
committerdanielsdeleo <dan@opscode.com>2013-10-16 13:53:37 -0700
commit3b877d8956531eb18ca5b398e2b2c8b4e33b71ce (patch)
treecf8ec0e44bc0f399f5c4a77d151e40c1b66a09ad /lib/chef/config.rb
parent6bd425c97be8c323b8c721ab7bb945a0524e903d (diff)
downloadchef-3b877d8956531eb18ca5b398e2b2c8b4e33b71ce.tar.gz
Support evaluation of a string as config
This allows remote config files to be fetched to memory and evauated without requiring an intermediate tempfile.
Diffstat (limited to 'lib/chef/config.rb')
-rw-r--r--lib/chef/config.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index f2610f01e2..82dfb85101 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -29,6 +29,13 @@ class Chef
extend Mixlib::Config
+ # Evaluates the given string as config.
+ #
+ # +filename+ is used for context in stacktraces, but doesn't need to be the name of an actual file.
+ def self.from_string(string, filename)
+ self.instance_eval(string, filename, 1)
+ end
+
# Manages the chef secret session key
# === Returns
# <newkey>:: A new or retrieved session key