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.
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/satops.rb', line 240 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.
223 224 225 |
# File 'lib/satops.rb', line 223 def operations @operations end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
223 224 225 |
# File 'lib/satops.rb', line 223 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
223 224 225 |
# File 'lib/satops.rb', line 223 def target @target end |
Instance Method Details
#context ⇒ Object
304 305 306 307 |
# File 'lib/satops.rb', line 304 def context str="\nSatellite Synchronisation Context:\n" str << "#{@operations}\n" end |
#destroy(target) ⇒ Object
258 259 260 261 262 |
# File 'lib/satops.rb', line 258 def destroy(target) @operations.each do |op| op.destroy(target) end end |
#export(type, sat_source, path) ⇒ Object
264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/satops.rb', line 264 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.
279 280 281 282 283 |
# File 'lib/satops.rb', line 279 def extra(*args) @operations.each do |op| op.extra(*args) end end |
#import(type, *args) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/satops.rb', line 285 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
298 299 300 301 302 |
# File 'lib/satops.rb', line 298 def sync(*args) @operations.each do |op| op.sync(*args) end end |