Class: Zypper::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/zypper/config.rb

Constant Summary collapse

DEFAULT_ROOT =
'/'
DEFAULT_IMPORT_GPG =
true
DEFAULT_REFRESH_REPO =
true
DEFAULT_AUTO_AGREE_WITH_LICENSES =
true
DEFAULT_CHROOT_METHOD =
'local'
CHROOT_METHOD_LOCAL =
'local'
CHROOT_METHOD_CHROOT =
'chroot'
KNOWN_CHROOT_METHODS =
[CHROOT_METHOD_LOCAL, CHROOT_METHOD_CHROOT]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Config

Constructor

Possible parameters

(string)  :root
          Defines the changed root environment, default '/'
(boolean) :auto_import_gpg
          Automatically trust (and import) new GPG keys, default true
(boolean) :refresh_repo
          Adds new repositories with autorefresh flag, default true
(string)  :chroot_method
          Defines which zypper is used; 'local' uses the local zypper with
          changed root directory specified as --root parameter whereas
          'chroot' uses chroot binary and calls zypper directly in the
          :root directory. This can be ignored if changed :root is not
          defined
(boolean  :auto_agree_with_licenses
          automatically accept all licenses, otherwise such packages
          cannot be installed


35
36
37
38
39
40
41
42
# File 'lib/zypper/config.rb', line 35

def initialize(params = {})
  self.root = (params[:root] || DEFAULT_ROOT)
  self.chroot_method = (params[:chroot_method] || DEFAULT_CHROOT_METHOD)

  @auto_import_gpg = (params[:auto_import_gpg] || DEFAULT_IMPORT_GPG)
  @refresh_repo = (params[:refresh_repo] || DEFAULT_REFRESH_REPO)
  @auto_agree_with_licenses = (params[:auto_agree_with_licenses] || DEFAULT_AUTO_AGREE_WITH_LICENSES)
end

Instance Attribute Details

#auto_import_gpgObject

Returns the value of attribute auto_import_gpg.



44
45
46
# File 'lib/zypper/config.rb', line 44

def auto_import_gpg
  @auto_import_gpg
end

#chroot_methodObject

Returns the value of attribute chroot_method.



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

def chroot_method
  @chroot_method
end

#rootObject

Returns the value of attribute root.



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

def root
  @root
end

Instance Method Details

#auto_agree_with_licenses?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/zypper/config.rb', line 82

def auto_agree_with_licenses?
  @auto_agree_with_licenses
end

#auto_import_gpg?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/zypper/config.rb', line 78

def auto_import_gpg?
  @auto_import_gpg
end

#changed_root?Boolean

Using zypper –root of the root is actually different

Returns:

  • (Boolean)


74
75
76
# File 'lib/zypper/config.rb', line 74

def changed_root?
  root != DEFAULT_ROOT && chroot_method == CHROOT_METHOD_LOCAL
end

#chrooted?Boolean

Using chroot command

Returns:

  • (Boolean)


69
70
71
# File 'lib/zypper/config.rb', line 69

def chrooted?
  chroot_method == CHROOT_METHOD_CHROOT
end

#refresh_repo?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/zypper/config.rb', line 86

def refresh_repo?
  @refresh_repo
end