Class: Chef::ServerAPIVersions

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/chef/server_api_versions.rb

Instance Method Summary collapse

Instance Method Details

#max_server_versionObject



37
38
39
40
41
42
43
44
# File 'lib/chef/server_api_versions.rb', line 37

def max_server_version
  # If we're working with a pre-api-versioning server, always claim to be zero
  if @versions.nil?
    unversioned? ? 0 : nil
  else
    Integer(@versions["max_version"])
  end
end

#min_server_versionObject



28
29
30
31
32
33
34
35
# File 'lib/chef/server_api_versions.rb', line 28

def min_server_version
  # If we're working with a pre-api-versioning server, always claim to be zero
  if @versions.nil?
    unversioned? ? 0 : nil
  else
    Integer(@versions["min_version"])
  end
end

#negotiated?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/chef/server_api_versions.rb', line 54

def negotiated?
  !@versions.nil? || unversioned?
end

#reset!Object



58
59
60
61
# File 'lib/chef/server_api_versions.rb', line 58

def reset!
  @versions = nil
  @unversioned = false
end

#set_versions(versions) ⇒ Object



24
25
26
# File 'lib/chef/server_api_versions.rb', line 24

def set_versions(versions)
  @versions ||= versions
end

#unversioned!Object



46
47
48
# File 'lib/chef/server_api_versions.rb', line 46

def unversioned!
  @unversioned = true
end

#unversioned?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/chef/server_api_versions.rb', line 50

def unversioned?
  @unversioned
end