Class: Registration::Storage::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
src/lib/registration/storage.rb

Overview

AutoYast configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig


95
96
97
# File 'src/lib/registration/storage.rb', line 95

def initialize
  reset
end

Instance Attribute Details

#addonsObject

Returns the value of attribute addons


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def addons
  @addons
end

#do_registrationObject

Returns the value of attribute do_registration


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def do_registration
  @do_registration
end

#emailObject

Returns the value of attribute email


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def email
  @email
end

#install_updatesObject

Returns the value of attribute install_updates


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def install_updates
  @install_updates
end

#modifiedObject

Returns the value of attribute modified


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def modified
  @modified
end

#reg_codeObject

Returns the value of attribute reg_code


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def reg_code
  @reg_code
end

#reg_serverObject

Returns the value of attribute reg_server


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def reg_server
  @reg_server
end

#reg_server_certObject

Returns the value of attribute reg_server_cert


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def reg_server_cert
  @reg_server_cert
end

#reg_server_cert_fingerprintObject

Returns the value of attribute reg_server_cert_fingerprint


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def reg_server_cert_fingerprint
  @reg_server_cert_fingerprint
end

#reg_server_cert_fingerprint_typeObject

Returns the value of attribute reg_server_cert_fingerprint_type


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def reg_server_cert_fingerprint_type
  @reg_server_cert_fingerprint_type
end

#slp_discoveryObject

Returns the value of attribute slp_discovery


91
92
93
# File 'src/lib/registration/storage.rb', line 91

def slp_discovery
  @slp_discovery
end

Instance Method Details

#exportObject


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'src/lib/registration/storage.rb', line 113

def export
  ret = { "do_registration" => do_registration }
  # export only the boolean flag when registration is disabled,
  # all other config values are useless in that case
  return ret unless do_registration

  ret.merge!(
    "reg_server"      => reg_server,
    "slp_discovery"   => slp_discovery,
    "email"           => email,
    "reg_code"        => reg_code,
    "install_updates" => install_updates
  )

  ret["addons"] = export_addons
  ret.merge!(export_ssl_config)

  ret
end

#import(settings) ⇒ Object


133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'src/lib/registration/storage.rb', line 133

def import(settings)
  reset

  @do_registration = settings.fetch("do_registration", false)
  @reg_server = settings["reg_server"] || ""
  @slp_discovery = settings.fetch("slp_discovery", false)
  @reg_server_cert = settings["reg_server_cert"] || ""
  @email = settings["email"] || ""
  @reg_code = settings["reg_code"] || ""
  @install_updates = settings.fetch("install_updates", false)
  @addons = import_addons(settings)
  @reg_server_cert_fingerprint_type = settings["reg_server_cert_fingerprint_type"] || ""
  @reg_server_cert_fingerprint = settings["reg_server_cert_fingerprint"] || ""
end

#resetObject


99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'src/lib/registration/storage.rb', line 99

def reset
  @modified = false
  @do_registration = false
  @reg_server = ""
  @reg_server_cert = ""
  @email = ""
  @reg_code = ""
  @install_updates = false
  @addons = []
  @slp_discovery = false
  @reg_server_cert_fingerprint_type = nil
  @reg_server_cert_fingerprint = ""
end