Class: SatOperator
- Inherits:
-
Object
- Object
- SatOperator
- Defined in:
- lib/satops.rb
Overview
Satellite Interfacer
Constant Summary collapse
- OPS =
Operations are ordered - It matters for object dependencies
[Orgs, OrgTrusts, Systemgroups, Configchannels, SystemCustominfos, Systems, Users, Channels, Activationkeys, KickstartFilepreservations, KickstartKeys, KickstartSnippets, Kickstarts]
Instance Attribute Summary collapse
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #context ⇒ Object
- #destroy(target) ⇒ Object
- #export(type, sat_source, path) ⇒ Object
-
#extra(*args) ⇒ Object
Extra objects are only present in destination Delete is default operation unless overloaded by OperationSet subclasses.
- #import(type, *args) ⇒ Object
-
#initialize(options, log) ⇒ SatOperator
constructor
A new instance of SatOperator.
- #sync(*args) ⇒ Object
Constructor Details
#initialize(options, log) ⇒ SatOperator
Returns a new instance of SatOperator.
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/satops.rb', line 244 def initialize(, log) @log=log @operations=Array.new OPS.each do |klass| if .has_key?(klass.to_s) # Populate options (class variables) with their values klass.class_eval do [klass.to_s].each do |key, val| self.instance_variable_set("@#{key}", val) end end # Create Operation objects @operations << klass.class_eval { self.new(log) } end end end |
Instance Attribute Details
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
227 228 229 |
# File 'lib/satops.rb', line 227 def operations @operations end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
227 228 229 |
# File 'lib/satops.rb', line 227 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
227 228 229 |
# File 'lib/satops.rb', line 227 def target @target end |
Instance Method Details
#context ⇒ Object
308 309 310 311 |
# File 'lib/satops.rb', line 308 def context str="\nSatellite Synchronisation Context:\n" str << "#{@operations}\n" end |
#destroy(target) ⇒ Object
262 263 264 265 266 |
# File 'lib/satops.rb', line 262 def destroy(target) @operations.each do |op| op.destroy(target) end end |
#export(type, sat_source, path) ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/satops.rb', line 268 def export(type, sat_source, path) @operations.each do |op| case type when :bin op.export(:mrb, sat_source, path) when :ascii op.export(:yaml, sat_source, path) else raise "FATAL: No such export format" end end end |
#extra(*args) ⇒ Object
Extra objects are only present in destination Delete is default operation unless overloaded by OperationSet subclasses.
283 284 285 286 287 |
# File 'lib/satops.rb', line 283 def extra(*args) @operations.each do |op| op.extra(*args) end end |
#import(type, *args) ⇒ Object
289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/satops.rb', line 289 def import(type, *args) @operations.each do |op| case type when :bin op.import(:mrb, *args) when :ascii op.import(:yaml, *args) else raise "FATAL: No such import format" end end end |
#sync(*args) ⇒ Object
302 303 304 305 306 |
# File 'lib/satops.rb', line 302 def sync(*args) @operations.each do |op| op.sync(*args) end end |