Class: Registration::FinishDialog

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

Constant Summary collapse

USABLE_WORKFLOWS =
[
  :installation,
  :live_installation,
  :autoinst,
  :update
].freeze

Instance Method Summary collapse

Constructor Details

#initializeFinishDialog


20
21
22
# File 'src/lib/registration/finish_dialog.rb', line 20

def initialize
  textdomain "registration"
end

Instance Method Details

#run(*args) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'src/lib/registration/finish_dialog.rb', line 24

def run(*args)
  func = args.first
  param = args[1] || {}

  log.debug "registration finish client called with #{func} and #{param}"

  case func
  when "Info"
    {
      "steps" => 1,
      # progress step title
      "title" => _(
        "Storing Registration Configuration..."
      ),
      "when"  => USABLE_WORKFLOWS
    }

  when "Write"
    # do not write anything if registration was skipped
    return nil unless Registration.is_registered?

    # enable back the update repositories in the installed system
    RepoStateStorage.instance.restore_all

    Yast.import "Installation"

    # write the current config
    Helpers.write_config

    # copy it to the target system
    source_path = SUSE::Connect::YaST::DEFAULT_CONFIG_FILE
    target_path = Yast::Installation.destdir + source_path

    Yast::WFM.Execute(Yast::Path.new(".local.bash"), "mv '#{source_path}' '#{target_path}'")

    # copy the imported SSL certificate
    Helpers.copy_certificate_to_target
    nil
  else
    raise "Uknown action #{func} passed as first parameter"
  end
end