summaryrefslogtreecommitdiff
path: root/lib/chef/mixin
diff options
context:
space:
mode:
authorsnehaldwivedi <sdwivedi@msystechnologies.com>2020-07-22 01:57:39 -0700
committersnehaldwivedi <sdwivedi@msystechnologies.com>2021-02-16 02:45:12 -0800
commit1f655be8219c9e20dffd68adc2ff97c29e2c29b3 (patch)
tree61989f31856029fea9534cc99cc7473bdd5454e5 /lib/chef/mixin
parent3f4ef1b91f7a24d2c533eb4791ae099f8de49f4f (diff)
downloadchef-1f655be8219c9e20dffd68adc2ff97c29e2c29b3.tar.gz
Merge this knife plugin into Chef directly
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
Diffstat (limited to 'lib/chef/mixin')
-rw-r--r--lib/chef/mixin/root_rest.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/chef/mixin/root_rest.rb b/lib/chef/mixin/root_rest.rb
new file mode 100644
index 0000000000..967213a16c
--- /dev/null
+++ b/lib/chef/mixin/root_rest.rb
@@ -0,0 +1,31 @@
+#
+# Author:: Steven Danna (<steve@chef.io>)
+# Copyright:: Copyright 2011-2016 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require "chef/server_api"
+class Chef
+ module Mixin
+ module RootRestv0
+ def root_rest
+ # Use v0 API for now
+ # Rather than upgrade all of this code to move to v1, the goal is to remove the
+ # need for this plugin. See
+ # https://github.com/chef/chef/issues/3517
+ @root_rest ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { api_version: "0" })
+ end
+ end
+ end
+end