Class: Provisioner::Provisioner

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

Direct Known Subclasses

BlankProvisioner

Constant Summary collapse

AVAILABLE_ACTIONS =
['create', 'delete']

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Provisioner

Returns a new instance of Provisioner.



8
9
10
11
# File 'lib/provisioner/provisioner.rb', line 8

def initialize options
  options[:created_by] = ENV['USER']
  self.options = options
end

Instance Method Details

#delete_vappObject



132
133
# File 'lib/provisioner/provisioner.rb', line 132

def delete_vapp
end

#execute(action) ⇒ Object



13
14
15
16
17
18
# File 'lib/provisioner/provisioner.rb', line 13

def execute(action)
  unless AVAILABLE_ACTIONS.include?(action)
    raise(ConfigurationError, "The action '#{action}' is not a valid action")
  end
  send(action)
end

#sshObject



66
67
68
69
70
71
72
# File 'lib/provisioner/provisioner.rb', line 66

def ssh
  @ssh ||= begin
    Provisioner.ssh_client.tap { |client|
      logger.debug "Using #{client} as my SSH client"
    }
  end
end

#ssh_to(hostname, &blk) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/provisioner/provisioner.rb', line 74

def ssh_to hostname, &blk
  puts "Sshing to #{hostname}"
  ssh.start hostname,
            options[:ssh_user],
            :config => options[:ssh_config],
            &blk
end