Class: Registration::UI::MediaAddonWorkflow

Inherits:
Object
  • Object
show all
Includes:
Yast, Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
src/lib/registration/ui/media_addon_workflow.rb

Overview

This class handles workflow for registering media add-ons.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo_id) ⇒ MediaAddonWorkflow

the constructor


34
35
36
37
38
39
40
41
42
# File 'src/lib/registration/ui/media_addon_workflow.rb', line 34

def initialize(repo_id)
  textdomain "registration"

  @repo_id = repo_id

  url = UrlHelpers.registration_url
  @registration = Registration.new(url)
  @registration_ui = RegistrationUI.new(registration)
end

Class Method Details

.run(repo_id) ⇒ Object

run workflow for registering a media add-on from repositry repo_id.


27
28
29
30
# File 'src/lib/registration/ui/media_addon_workflow.rb', line 27

def self.run(repo_id)
  workflow = MediaAddonWorkflow.new(repo_id)
  workflow.run
end

Instance Method Details

#runObject

The media add-on workflow is:

  • find the add-on product resolvable from repo_id
  • register the base system if it is not registered yet
  • get available addons from SCC
  • find the matching add-on product from media
  • ask for a reg code if needed
  • register the add-on

52
53
54
55
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'src/lib/registration/ui/media_addon_workflow.rb', line 52

def run
  aliases = {
    "find_products"       => [->() { find_products }, true],
    "register_base"       => ->() { register_base },
    "load_remote_addons"  => ->() { load_remote_addons },
    "select_media_addons" => [->() { select_media_addons }, true],
    "register_addons"     => [->() { register_addons }, true]
  }

  sequence = {
    "ws_start"            => "find_products",
    "find_products"       => {
      abort:  :abort,
      finish: :finish,
      next:   "register_base"
    },
    "register_base"       => {
      abort: :abort,
      skip:  :skip,
      next:  "load_remote_addons"
    },
    "load_remote_addons"  => {
      abort: :abort,
      next:  "select_media_addons"
    },
    "select_media_addons" => {
      abort:  :abort,
      finish: :finish,
      next:   "register_addons"
    },
    "register_addons"     => {
      abort: :abort,
      next:  :next
    }
  }

  log.info "Starting registering media add-on sequence"

  begin
    Sequencer.Run(aliases, sequence)
  rescue => e
    log.error "Caught error: #{e.class}: #{e.message.inspect}, #{e.backtrace}"
    # TRANSLATORS: error message, %s are details
    Yast::Report.Error(_("Internal error: %s") % e.message)
    :abort
  end
end