Module: Yast::SCR

Defined in:
src/ruby/yast/scr.rb

Overview

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

Class Method Summary collapse

Class Method Details

.Dir(path) ⇒ Array<String>

Gets array of all children attached directly below path

Examples:

get all sysconfig agents

SCR.Dir(path(".sysconfig"))

get all keys in install inf

SCR.Dir(path(".etc.install_inf"))

Parameters:

  • path (Yast::Path, String)

    sub-path where to search for children

Returns:

  • (Array<String>)

    list of children names



54
55
56
# File 'src/ruby/yast/scr.rb', line 54

def self.Dir(path)
  call_builtin_wrapper("Dir", Yast.path(path))
end

.Error(path) ⇒ Hash

Gets detailled error description from agent

Parameters:

Returns:

  • (Hash)

    with keys "code" and "summary"



61
62
63
# File 'src/ruby/yast/scr.rb', line 61

def self.Error(path)
  call_builtin_wrapper("Error", Yast.path(path))
end

.Execute(path, *args) ⇒ Object

Executes command

Examples:

halt computer

SCR.Execute(path(".target.bash"), "/sbin/halt -f -n -p")

umount /mnt path

SCR.Execute(path(".target.umount"), "/mnt")

Parameters:

  • path (Yast::Path, String)

    path to agent

  • args

    additional arguments depending on agent



42
43
44
# File 'src/ruby/yast/scr.rb', line 42

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

.Read(path, *args) ⇒ Object

Reads data

Examples:

Get netcards discovered by probe agent

SCR.Read(path(".probe.netcard"))

Read content of file /tmp/test

SCR.Read(path(".target.string"), "tmp/test")

Parameters:

  • path (Yast::Path, String)

    path that is combination of path where agent is attached and path inside agent

  • args

    additional arguments depending on agent, usually optional



17
18
19
# File 'src/ruby/yast/scr.rb', line 17

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

.RegisterAgent(path, description) ⇒ true, false

Register an agent at given path with description

Parameters:

  • path (Yast::Path, String)

    path to agent

  • description (Yast::Term, String)

    path to file description or direct term with agent description

Returns:

  • (true, false)

    if succeed



71
72
73
# File 'src/ruby/yast/scr.rb', line 71

def self.RegisterAgent(path, description)
  call_builtin_wrapper("RegisterAgent", Yast.path(path), description)
end

.RegisterNewAgentstrue, false

Register new agents. (bnc#245508#c16)

Rescan the scrconf registration directories and register any agents at new(!) paths. Agents, even new ones, on paths that are registered already, will not be replaced. This means that .oes.specific.agent will start to work but something like adding /usr/local/etc/sysconfig to .sysconfig.network would not.

Returns:

  • (true, false)

    if succeed



83
84
85
# File 'src/ruby/yast/scr.rb', line 83

def self.RegisterNewAgents
  call_builtin_wrapper("RegisterNewAgents")
end

.UnmountAgent(path) ⇒ Object

Unmounts agent. The agent is detached, but when needed it is mounted again automatically.

It sends to component result() which force to terminate component. If there is any lazy write, then it is properly finished.

Parameters:



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

def self.UnmountAgent(path)
  call_builtin_wrapper("UnmountAgent", Yast.path(path))
end

.UnregisterAgent(path) ⇒ true, false

Unregister agent from given path

Parameters:

Returns:

  • (true, false)

    if succeed



90
91
92
# File 'src/ruby/yast/scr.rb', line 90

def self.UnregisterAgent(path)
  call_builtin_wrapper("UnregisterAgent", Yast.path(path))
end

.UnregisterAllAgentstrue, false

Unregister all agents

Returns:

  • (true, false)

    if succeed



96
97
98
# File 'src/ruby/yast/scr.rb', line 96

def self.UnregisterAllAgents
  call_builtin_wrapper("UnregisterAllAgents")
end

.Write(path, *args) ⇒ true, false

Writes data

Examples:

change default desktop in sysconfig to kde

SCR.Write(path(".sysconfig.windowmanager.DEFAULT_WM"), "kde")

write string s to file /tmp/f

SCR.Write(path(".target.string"), "/tmp/f", "s")

Parameters:

  • path (Yast::Path, String)

    path that is combination of path where agent is attached and path inside agent

  • args

    additional arguments depending on agent

Returns:

  • (true, false)

    success



31
32
33
# File 'src/ruby/yast/scr.rb', line 31

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