Class: Chef::Provider::Package::Yum::YumCache

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/chef/provider/package/yum/yum_cache.rb

Instance Method Summary collapse

Instance Method Details

#available_version(name, arch = nil) ⇒ Object


60
61
62
63
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 60

def available_version(name, arch = nil)
  p = python_helper.package_query(:whatavailable, name, arch: arch)
  "#{p.version}.#{p.arch}" unless p.version.nil?
end

#installed_version(name, arch = nil) ⇒ Object


65
66
67
68
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 65

def installed_version(name, arch = nil)
  p = python_helper.package_query(:whatinstalled, name, arch: arch)
  "#{p.version}.#{p.arch}" unless p.version.nil?
end

#package_available?(name, arch = nil) ⇒ Boolean

Returns:

  • (Boolean)

70
71
72
73
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 70

def package_available?(name, arch = nil)
  p = python_helper.package_query(:whatavailable, name, arch: arch)
  !p.version.nil?
end

#python_helperObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


85
86
87
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 85

def python_helper
  @python_helper ||= PythonHelper.instance
end

#refreshObject


36
37
38
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 36

def refresh
  python_helper.restart
end

#reloadObject


40
41
42
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 40

def reload
  python_helper.restart
end

#reload_installedObject


44
45
46
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 44

def reload_installed
  python_helper.restart
end

#reload_providesObject


48
49
50
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 48

def reload_provides
  python_helper.restart
end

#resetObject


52
53
54
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 52

def reset
  python_helper.restart
end

#reset_installedObject


56
57
58
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 56

def reset_installed
  python_helper.restart
end

#version_available?(name, version, arch = nil) ⇒ Boolean

NOTE that it is the responsibility of the python_helper to get these APIs correct and we do not do any validation here that the e.g. version or arch matches the requested value (because the bigger issue there is a buggy+broken python_helper -- so don't try to fix those kinds of bugs here)

Returns:

  • (Boolean)

79
80
81
82
# File 'lib/chef/provider/package/yum/yum_cache.rb', line 79

def version_available?(name, version, arch = nil)
  p = python_helper.package_query(:whatavailable, name, version: version, arch: arch)
  !p.version.nil?
end