Class: Chef::Server
- Inherits:
-
Object
- Object
- Chef::Server
- Defined in:
- lib/chef/server.rb
Instance Attribute Summary collapse
-
#root_url ⇒ Object
Returns the value of attribute root_url.
Class Method Summary collapse
Instance Method Summary collapse
- #direct_account_access? ⇒ Boolean
-
#initialize(root_url) ⇒ Server
constructor
A new instance of Server.
- #supports_user_acls? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(root_url) ⇒ Server
Returns a new instance of Server.
8 9 10 |
# File 'lib/chef/server.rb', line 8 def initialize(root_url) @root_url = root_url end |
Instance Attribute Details
#root_url ⇒ Object
Returns the value of attribute root_url.
7 8 9 |
# File 'lib/chef/server.rb', line 7 def root_url @root_url end |
Class Method Details
Instance Method Details
#direct_account_access? ⇒ Boolean
31 32 33 34 35 36 |
# File 'lib/chef/server.rb', line 31 def direct_account_access? Chef::REST.new("http://127.0.0.1:9465").get("users") true rescue false end |
#supports_user_acls? ⇒ Boolean
27 28 29 |
# File 'lib/chef/server.rb', line 27 def supports_user_acls? version >= Gem::Version.new("11.0.1") end |
#version ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/chef/server.rb', line 17 def version @version ||= begin uri = URI.parse("#{root_url}/version") ver_line = open(uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).each_line.first ver_string = ver_line.split(' ').last ver_string = ver_string.gsub(/\+.*$/, '') Gem::Version.new(ver_string) end end |