deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [14/15] git commit: * bin/deltacloudd: change config file to use string keys
Date Tue, 28 Aug 2012 00:16:55 GMT
* bin/deltacloudd: change config file to use string keys

If using a config file for credentials via the --config option, look for
string keys, not symbols. That makes the file usable for tests, too,
e.g. as a tests/config.yaml


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/f538ffee
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/f538ffee
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/f538ffee

Branch: refs/heads/master
Commit: f538ffee1f188cbd3300c81a7692a152ddec6d93
Parents: 467d54f
Author: David Lutterkort <lutter@redhat.com>
Authored: Fri Aug 24 11:57:05 2012 -0700
Committer: David Lutterkort <lutter@redhat.com>
Committed: Fri Aug 24 12:05:15 2012 -0700

----------------------------------------------------------------------
 server/bin/deltacloudd |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f538ffee/server/bin/deltacloudd
----------------------------------------------------------------------
diff --git a/server/bin/deltacloudd b/server/bin/deltacloudd
index abe1def..30c4b87 100755
--- a/server/bin/deltacloudd
+++ b/server/bin/deltacloudd
@@ -150,10 +150,15 @@ end
 
 if options[:config]
   cfg = YAML::load(File.read(options[:config]))
-  if c = cfg[ENV["API_DRIVER"].to_sym]
-    ENV["API_PROVIDER"] ||= c[:provider]
-    ENV["API_USER"] ||= c[:user]
-    ENV["API_PASSWORD"] ||= c[:password]
+  if cfg.keys.any? { |k| k.is_a?(Symbol) }
+    puts "The config file #{options[:config]} uses symbols as keys"
+    puts "  Change them to be ordinary strings"
+    exit(1)
+  end
+  if c = cfg[ENV["API_DRIVER"]]
+    ENV["API_PROVIDER"] ||= c["provider"]
+    ENV["API_USER"] ||= c["user"]
+    ENV["API_PASSWORD"] ||= c["password"]
   end
 end
 


Mime
View raw message