diff options
author | John Keiser <jkeiser@opscode.com> | 2014-04-18 16:29:59 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2014-04-18 16:29:59 -0700 |
commit | acd80b7e3422d22bc717db40cf26598b7f4e618e (patch) | |
tree | 21bc9130c7497cd5d2460eb5bf55d9099ce59325 /lib/chef_zero/rest_base.rb | |
parent | e655c7857e9568ece4555e627fc7d3aa372449ae (diff) | |
download | chef-zero-acd80b7e3422d22bc717db40cf26598b7f4e618e.tar.gz |
Get single_org backcompat mode working
Diffstat (limited to 'lib/chef_zero/rest_base.rb')
-rw-r--r-- | lib/chef_zero/rest_base.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb index 72361ab..de81ae6 100644 --- a/lib/chef_zero/rest_base.rb +++ b/lib/chef_zero/rest_base.rb @@ -120,11 +120,18 @@ module ChefZero end def build_uri(base_uri, rest_path) - RestBase::build_uri(base_uri, rest_path) + if server.options[:single_org] + # Strip off /organizations/chef if we are in single org mode + if rest_path[0..1] != [ 'organizations', 'chef' ] + raise "Unexpected URL #{rest_path[0..1]} passed to build_uri in single org mode" + end + "#{base_uri}/#{rest_path[2..-1].join('/')}" + else + "#{base_uri}/#{rest_path.join('/')}" + end end def self.build_uri(base_uri, rest_path) - "#{base_uri}/#{rest_path.join('/')}" end def populate_defaults(request, response) |