Class: Zypper::Patch

Inherits:
Update show all
Defined in:
lib/zypper/patch.rb

Defined Under Namespace

Classes: Category, Status

Constant Summary collapse

FILTER_OPTIONS =
[:name, :edition, :arch, :category, :status, :pkgmanager,
:restart, :interactive, :repository_url, :repository_alias]

Constants inherited from Update

Update::DEFALUT_TYPE, Update::KNOWN_TYPES

Constants included from ZypperUtils

ZypperUtils::ATTRIBUTE_STARTS_WITH, ZypperUtils::PARAMS_FOR_TYPES, ZypperUtils::XML_COMMANDS_GET

Instance Attribute Summary

Attributes included from ZypperUtils

#config, #last_error_message, #last_exit_status, #last_message

Instance Method Summary collapse

Methods inherited from Update

#find_updates

Methods included from ZypperUtils

#initialize

Instance Method Details

#all(options = {}) ⇒ Object

Lists all known patches



36
37
38
# File 'lib/zypper/patch.rb', line 36

def all(options = {})
  find(options)
end

#applicable(options = {}) ⇒ Object

All applicable patches



41
42
43
# File 'lib/zypper/patch.rb', line 41

def applicable(options = {})
  find(options.merge(:status => Status::NEEDED))
end

#applicable?(options = {}) ⇒ Boolean

Are there any applicable patches present?

Returns:

  • (Boolean)


46
47
48
# File 'lib/zypper/patch.rb', line 46

def applicable?(options = {})
  applicable(options).size > 0
end

#find(options = {}) ⇒ Object

Lists all patches

Examples:

find(:status => Zypper::Patch::Status::INSTALLED)

Parameters:

  • Hash

    with optional key :where (Hash) that can consist of one or more parameters from :repository, :name, :version, :category, and :status. Logical AND is always applied for all the options present



31
32
33
# File 'lib/zypper/patch.rb', line 31

def find(options = {})
  apply_filters(find_updates(options.merge(:type => :patch)), options)
end

#install(options = {}) ⇒ Object

Installs all applicable patches



51
52
53
54
# File 'lib/zypper/patch.rb', line 51

def install(options = {})

  run(build_command('patch', options))
end

#installed(options = {}) ⇒ Object

All installed patches



57
58
59
# File 'lib/zypper/patch.rb', line 57

def installed(options = {})
  find(options.merge(:status => Status::INSTALLED))
end