Class: Installation::SSHImportAutoClient
- Inherits:
-
AutoClient
- Object
- AutoClient
- Installation::SSHImportAutoClient
- Defined in:
- src/lib/installation/clients/ssh_import_auto.rb
Overview
AutoYaST client for ssh_import
Class Attribute Summary collapse
-
.changed ⇒ Object
Returns the value of attribute changed.
Instance Method Summary collapse
- #change ⇒ Object
-
#export ⇒ Object
Exporting data to the AutoYaST configuration module.
-
#import(data) ⇒ Object
Importing data from the AutoYaST configuration module AutoYaST data format:.
-
#initialize ⇒ SSHImportAutoClient
constructor
A new instance of SSHImportAutoClient.
- #modified ⇒ Object
- #modified? ⇒ Boolean
- #read ⇒ Object
- #reset ⇒ Object
- #run ⇒ Object
-
#ssh_importer ⇒ ::Installation::SshImporter
protected
Helper method to access to the SshImporter.
-
#summary ⇒ Object
Returns a human readable summary.
-
#write ⇒ Object
Writes the SSH keys from the selected device (and also other configuration files if #copy_config? is true) in the target filesystem.
Constructor Details
#initialize ⇒ SSHImportAutoClient
Returns a new instance of SSHImportAutoClient.
18 19 20 21 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 18 def initialize super textdomain "installation" end |
Class Attribute Details
.changed ⇒ Object
Returns the value of attribute changed.
15 16 17 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 15 def changed @changed end |
Instance Method Details
#change ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 87 def change # If this module has been called and do not # depends on the installed system we would like to # have this section in the exported AutoYaST file # regardless if the entries have been changed nor not. modified begin args = { "enable_back" => false, "enable_next" => false, "going_back" => false } Yast::Wizard.OpenAcceptDialog WFM.CallFunction("inst_ssh_import", [args]) ensure Yast::Wizard.CloseDialog end end |
#export ⇒ Object
Exporting data to the AutoYaST configuration module. That's are default entries.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 109 def export ret = {} # Taking values from AutoYast configuration module, otherwise do not export (bsc#1172749) if Mode.config if ssh_importer.device && !ssh_importer.device.empty? ret["import"] = true ret["copy_config"] = ssh_importer.copy_config if !ssh_importer.device.empty? && ssh_importer.device != "default" ret["device"] = ssh_importer.device end else ret["import"] = false ret["copy_config"] = false end end ret end |
#import(data) ⇒ Object
Importing data from the AutoYaST configuration module AutoYaST data format:
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 45 def import(data) if !data["import"] log.info "Do not import ssh keys/configuration" ssh_importer.device = nil # do not copy ssh keys into the installed system return true end log.info "Importing AutoYaST data: #{data}" ssh_importer.copy_config = data["copy_config"] == true if data["device"] && !data["device"].empty? if ssh_importer.configurations.key?(data["device"]) ssh_importer.device = data["device"] else Yast::Report.Warning( # TRANSLATORS: both %s are device names like /dev/sda0 _(format("Device %s not found. Using data from %s.", data["device"], ssh_importer.device)) ) end end true end |
#modified ⇒ Object
79 80 81 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 79 def modified self.class.changed = true end |
#modified? ⇒ Boolean
75 76 77 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 75 def modified? self.class.changed end |
#read ⇒ Object
140 141 142 143 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 140 def read # It is a user decision only. Not depending on system true end |
#reset ⇒ Object
83 84 85 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 83 def reset ssh_importer.reset end |
#run ⇒ Object
23 24 25 26 27 28 29 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 23 def run progress_orig = Yast::Progress.set(false) ret = super Yast::Progress.set(progress_orig) ret end |
#ssh_importer ⇒ ::Installation::SshImporter (protected)
Helper method to access to the SshImporter
150 151 152 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 150 def ssh_importer @ssh_importer ||= ::Installation::SshImporter.instance end |
#summary ⇒ Object
Returns a human readable summary
71 72 73 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 71 def summary ::Installation::SshImporterPresenter.new(ssh_importer).summary end |
#write ⇒ Object
Writes the SSH keys from the selected device (and also other configuration files if #copy_config? is true) in the target filesystem
131 132 133 134 135 136 137 138 |
# File 'src/lib/installation/clients/ssh_import_auto.rb', line 131 def write if Mode.config || Mode.normal # normal=configuration in an installed system Popup.Notify _("It makes no sense to write these settings to system.") true else ssh_importer.write(Yast::Installation.destdir) end end |