module SingleServiceScript

Require the script to specify a default replication service. If there is a single replication service, that will be used as the default. If there are multiple, the user must specify –service.

Public Instance Methods

configure() click to toggle source
Calls superclass method
# File lib/tungsten/script.rb, line 589
def configure
  super()
  
  if TI
    if TI.replication_services.size() > 1
      default_service = nil
    else
      default_service = TI.default_dataservice()
    end
    
    add_option(:service, {
      :on => "--service String",
      :help => "Replication service to read information from",
      :default => default_service
    })
  end
end
validate() click to toggle source
Calls superclass method
# File lib/tungsten/script.rb, line 607
def validate
  super()

  if @options[:service] == nil
    TU.error("You must specify a dataservice for this command with the --service argument")
  else
    if TI
      unless TI.replication_services().include?(@options[:service])
        TU.error("The #{@options[:service]} service was not found in the replicator at #{TI.hostname()}:#{TI.root()}")
      end
    end
  end
end