Class: TungstenInstall::TungstenTopology

Inherits:
Object
  • Object
show all
Defined in:
lib/tungsten/install.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(install, dataservice) ⇒ TungstenTopology

Returns a new instance of TungstenTopology.



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/tungsten/install.rb', line 479

def initialize(install, dataservice)
  @install = install
  @name = dataservice
  
  unless @install.use_tpm?()
    raise "Unable to parse the topology for #{@name} from #{@install.hostname()}:#{@install.root()} because tpm was not used for installation"
  end
  
  values = @install.settings([
    "dataservices.#{@name}.dataservice_hosts",
    "dataservices.#{@name}.dataservice_master_host",
    "dataservices.#{@name}.dataservice_connectors",
    "dataservices.#{@name}.dataservice_composite_datasources",
    "dataservices.#{@name}.dataservice_topology"
  ])
  
  @type = values["dataservices.#{@name}.dataservice_topology"]
  @members = values["dataservices.#{@name}.dataservice_hosts"].to_s().split(",")
  @master = values["dataservices.#{@name}.dataservice_master_host"]
  @connectors = values["dataservices.#{@name}.dataservice_connectors"].to_s().split(",")
  @dataservices = values["dataservices.#{@name}.dataservice_composite_datasources"].to_s().split(",")
end

Instance Attribute Details

#connectorsObject (readonly)

Returns the value of attribute connectors.



477
478
479
# File 'lib/tungsten/install.rb', line 477

def connectors
  @connectors
end

#dataservicesObject (readonly)

Returns the value of attribute dataservices.



477
478
479
# File 'lib/tungsten/install.rb', line 477

def dataservices
  @dataservices
end

#datasourcesObject (readonly)

Returns the value of attribute datasources.



477
478
479
# File 'lib/tungsten/install.rb', line 477

def datasources
  @datasources
end

#masterObject (readonly)

Returns the value of attribute master.



477
478
479
# File 'lib/tungsten/install.rb', line 477

def master
  @master
end

#typeObject (readonly)

Returns the value of attribute type.



477
478
479
# File 'lib/tungsten/install.rb', line 477

def type
  @type
end

Instance Method Details

#is_composite?Boolean

Returns:

  • (Boolean)


502
503
504
# File 'lib/tungsten/install.rb', line 502

def is_composite?
  (@dataservices.size() > 0)
end

#to_hashObject



506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/tungsten/install.rb', line 506

def to_hash
  {
    :hostname => @install.hostname(),
    :root => @install.root(),
    :is_composite => is_composite?(),
    :type => @type,
    :members => @members,
    :master => @master,
    :connectors => @connectors,
    :dataservices => @dataservices
  }
end