Module: Yast::WFM

Extended by:
Logger
Defined in:
src/ruby/yast/wfm.rb

Overview

Wrapper class for WFM component in Yast See yast documentation for WFM

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

log

Class Method Details

.Args(*args) ⇒ Object

Returns list of arguments passed to client or element at given index

Examples:

Get all args

Yast::WFM.Args

Get only first argument

Yast::WFM.Args 0


23
24
25
# File 'src/ruby/yast/wfm.rb', line 23

def self.Args(*args)
  call_builtin_wrapper("Args", *args)
end

.CallFunction(client, args = []) ⇒ Object

calls client of given name with passed args

Examples:

call inst_moust client living in $Y2DIR/clients/inst_mouse.rb with parameter true

Yast::WFM.CallFunction("inst_mouse", [true])

Parameters:

  • client (String)

    name of client to run without suffix

  • args (Array) (defaults to: [])

    additional args passed to client, that can be obtained with Args

Returns:

  • response from client



187
188
189
190
191
192
193
194
195
196
# File 'src/ruby/yast/wfm.rb', line 187

def self.CallFunction(client, args = [])
  if !client.is_a?(::String)
    raise ArgumentError, "CallFunction first parameter('#{client.inspect}') have to be String."
  end
  if !args.is_a?(::Array)
    raise ArgumentError, "CallFunction second parameter('#{args.inspect}') have to be Array."
  end

  call_builtin_wrapper("CallFunction", client, args)
end

.ClientExists(client) ⇒ true, false

Note:

useful for checking before calling given client

Checks if client of given name exists on system

Examples:

Check if there is client "inst_bootloader"

Yast::WFM.ClientExists "inst_bootloader"

Returns:

  • (true, false)

See Also:



35
36
37
# File 'src/ruby/yast/wfm.rb', line 35

def self.ClientExists(client)
  call_builtin_wrapper("ClientExists", client)
end

.Execute(path, *args) ⇒ Object

Note:

very limited use-case. It is needed only if installer switched to scr on target system and agent from inst-sys must be called

Runs execute on local system agent operating on inst-sys

Examples:

Run command in bash in inst-sys

Yast::WFM.Execute(Yast::Path.new(".local.bash"), "halt -p")

Parameters:

  • path (Yast::Path, String)

    agent path

  • args

    arguments to agent

See Also:



51
52
53
# File 'src/ruby/yast/wfm.rb', line 51

def self.Execute(path, *args)
  call_builtin_wrapper("Execute", Yast.path(path), *args)
end

.GetEncodingString

Deprecated.

enconding is now always UTF-8

Returns current encoding code as string

Returns:

  • (String)


59
60
61
# File 'src/ruby/yast/wfm.rb', line 59

def self.GetEncoding
  call_builtin_wrapper("GetEncoding")
end

.GetEnvironmentEncodingString

Returns enconding of environment where Yast start

Returns:

  • (String)


66
67
68
# File 'src/ruby/yast/wfm.rb', line 66

def self.GetEnvironmentEncoding
  call_builtin_wrapper("GetEnvironmentEncoding")
end

.GetLanguageString

Returns current language without modifiers as string

Examples:

return value

Yast::WFM.GetLanguage
  => "en_US.UTF-8"

Returns:

  • (String)


76
77
78
# File 'src/ruby/yast/wfm.rb', line 76

def self.GetLanguage
  call_builtin_wrapper("GetLanguage")
end

.Read(path, *args) ⇒ Object

Note:

very limited use-case. It is needed only if installer switched to scr on target system and agent from inst-sys must be called

Runs read on local system agent operating on inst-sys

Examples:

Read kernel cmdline

Yast::WFM.Read(path(".local.string"), "/proc/cmdline")

Parameters:

  • path (Yast::Path, String)

    agent path

  • args

    arguments to agent

See Also:



92
93
94
# File 'src/ruby/yast/wfm.rb', line 92

def self.Read(path, *args)
  call_builtin_wrapper("Read", Yast.path(path), *args)
end

.scr_chrooted?Boolean

Tests if scr instance is pointed to chroot

Returns:

  • (Boolean)


118
119
120
# File 'src/ruby/yast/wfm.rb', line 118

def self.scr_chrooted?
  SCRGetName(SCRGetDefault()) != "scr"
end

.scr_rootString

Returns root on which scr operates. or "/mnt" when installation was switched.

Returns:

  • (String)

    path e.g. "/" when scr not switched



125
126
127
128
129
130
131
132
133
134
# File 'src/ruby/yast/wfm.rb', line 125

def self.scr_root
  case SCRGetName(SCRGetDefault())
  when "scr"
    "/"
  when /chroot=(.*):scr/
    Regexp.last_match(1)
  else
    raise "invalid SCR instance #{SCRGetName(SCRGetDefault())}"
  end
end

.SCRClose(handle) ⇒ Object

Closes SCR handle obtained via SCROpen

If SCR is set as default, then try to switch to another reasonable SCR openned



100
101
102
# File 'src/ruby/yast/wfm.rb', line 100

def self.SCRClose(handle)
  call_builtin_wrapper("SCRClose", handle)
end

.SCRGetDefaultObject

Gets handle of current default SCR



105
106
107
# File 'src/ruby/yast/wfm.rb', line 105

def self.SCRGetDefault
  call_builtin_wrapper("SCRGetDefault")
end

.SCRGetName(handle) ⇒ String

Gets name of SCR associated with handle

Returns:

  • (String)


112
113
114
# File 'src/ruby/yast/wfm.rb', line 112

def self.SCRGetName(handle)
  call_builtin_wrapper("SCRGetName", handle)
end

.SCROpen(name, check_version) ⇒ Object

Creates new SCR instance

It is useful for installation where agents start operation on installed system

Examples:

open SCR instance on /mnt root without version check

Yast::WFM.SCROpen("chroot=/mnt:scr", false)

Parameters:

  • name (String)

    name for instance. Currently it is supported on scr name with possible chrooting in format "chroot=<path_to_chroot>:scr"

  • check_version (Boolean)

    check if chrooted version match current core version

Returns:

  • handle of SCR instance



148
149
150
# File 'src/ruby/yast/wfm.rb', line 148

def self.SCROpen(name, check_version)
  call_builtin_wrapper("SCROpen", name, check_version)
end

.SCRSetDefault(handle) ⇒ Object

Sets the default SCR to given handle



153
154
155
# File 'src/ruby/yast/wfm.rb', line 153

def self.SCRSetDefault(handle)
  call_builtin_wrapper("SCRSetDefault", handle)
end

.SetLanguage(language, *args) ⇒ Object

Sets language for translate with optional enconding



158
159
160
# File 'src/ruby/yast/wfm.rb', line 158

def self.SetLanguage(language, *args)
  call_builtin_wrapper("SetLanguage", language, *args)
end

.Write(path, *args) ⇒ Object

Note:

very limited use-case. It is needed only if installer switched to scr on target system and agent from inst-sys must be called

Runs write on local system agent operating on inst-sys

Examples:

Write yast inf file in inst-sys

Yast::WFM.Write(path(".local.string"), "/etc/yast.inf", yast_inf)

Parameters:

  • path (Yast::Path, String)

    agent path

  • args

    arguments to agent

See Also:



174
175
176
# File 'src/ruby/yast/wfm.rb', line 174

def self.Write(path, *args)
  call_builtin_wrapper("Write", Yast.path(path), *args)
end

Instance Method Details

#call(client, arguments = []) ⇒ Object

Deprecated.


200
# File 'src/ruby/yast/wfm.rb', line 200

singleton_class.send(:alias_method, :call, :CallFunction)