Method: Puppet::HTTP::Session#supports?
- Defined in:
- lib/puppet/http/session.rb
#supports?(name, capability) ⇒ Boolean
Determine if a session supports a capability. Depending on the server version we are talking to, we know certain features are available or not. These specifications are defined here so we can modify our requests appropriately.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/puppet/http/session.rb', line 106 def supports?(name, capability) raise ArgumentError, "Unknown service #{name}" unless Puppet::HTTP::Service.valid_name?(name) service = @resolved_services[name] return false unless service site = Puppet::HTTP::Site.from_uri(service.url) server_version = @server_versions[site] case capability when CAP_LOCALES !server_version.nil? && Gem::Version.new(server_version) >= SUPPORTED_LOCALES_MOUNT_AGENT_VERSION when CAP_JSON server_version.nil? || Gem::Version.new(server_version) >= SUPPORTED_JSON_DEFAULT else false end end |