Module: Smartdc::Cli

Defined in:
lib/smartdc/cli.rb,
lib/smartdc/cli/key.rb,
lib/smartdc/cli/image.rb,
lib/smartdc/cli/machine.rb,
lib/smartdc/cli/package.rb,
lib/smartdc/cli/analytic.rb,
lib/smartdc/cli/datacenter.rb,
lib/smartdc/cli/machine/tag.rb,
lib/smartdc/cli/machine/metadata.rb,
lib/smartdc/cli/machine/snapshot.rb

Defined Under Namespace

Classes: Analytic, Datacenter, Image, Key, Machine, MachineMetadata, MachineSnapshot, MachineTag, Main, Package

Class Method Summary collapse

Class Method Details

.setupObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/smartdc/cli.rb', line 45

def setup
  clicfg = Smartdc::CliConfigure.new
  sdccfg = clicfg.read
  Smartdc.configure do |config|
    config.url = "https://#{sdccfg[:hostname]}" if sdccfg.key?(:hostname)
    config.version = sdccfg[:version] if sdccfg.key?(:version)
    config.username = sdccfg[:username] if sdccfg.key?(:username)
    config.use_key = sdccfg[:use_key] if sdccfg.key?(:use_key)
    config.rsa_path = sdccfg[:rsa_path] if sdccfg.key?(:rsa_path)
    config.ssl_verify = sdccfg[:ssl_verify].to_s =~ /false|0/ ? false : true
    config.middleware = Faraday::RackBuilder.new do |builder|
      builder.adapter Faraday.default_adapter
      #builder.use CassetteRack::Response::RaiseError
      #builder.response :logger
    end
  end
end