Class: Installation::AutoClient

Inherits:
Yast::Client
  • Object
show all
Includes:
Yast::Logger
Defined in:
library/general/src/lib/installation/auto_client.rb

Overview

An abstract class that simplifies writing `*_auto.rb` clients for AutoYaST.

It provides a single entry point which dispatches calls to the abstract methods that all proposal clients need to implement.

You need to implement all the methods, except #packages.

“Autoinstall” basically means #import, then #write.

The workflow for interactive editing in the UI (`Mode.config == true`, see Yast::ModeClass) is more complicated. The user can choose to perform any action, and a corresponding method is called:

  • #summary: clicking on the icon of the module.

  • #reset: clicking Clear.

  • if the user clicks to Edit a module, at first #export is called, then #change is called for UI interaction, which can end up in multiple situations:

    • if cancelled/aborted, #import is called (on the previous result of #export)

    • otherwise #export is called. If the output is different from the previous call, then #modified is called.

  • #write: clicking Apply to System.

  • #read: clicking Clone.

  • #import: selecting File/Open to load an autoyast profile

  • it calls #modified? to recognize if a given module is modified and needs its section with content of #export when saving the profile

  • the order of all calls is independent, so the client should not depend on a certain order unless it is defined here as a workflow call

Examples:

how to run a client

require "installation/example_auto"
::Installation::ExampleAuto.run

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

Entry point for calling the client. The only part needed in client rb file.

Returns:

  • response from abstract methods



51
52
53
# File 'library/general/src/lib/installation/auto_client.rb', line 51

def self.run
  new.run
end

Instance Method Details

#runObject

Dispatches to abstract method based on passed Arguments to client



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'library/general/src/lib/installation/auto_client.rb', line 56

def run
  func, param = Yast::WFM.Args
  log.info "Called #{self.class}.run with #{func} and params #{param}"

  case func
  when "Import"
    import(param)
  when "Export"
    export
  when "Summary"
    summary
  when "Reset"
    reset
  when "Change"
    change
  when "Write"
    write
  when "Packages"
    packages
  when "Read"
    read
  when "GetModified"
    modified?
  when "SetModified"
    modified
  else
    raise ArgumentError, "Invalid action for auto client '#{func.inspect}'"
  end
end