Class: Chef::Knife::HitoriPrepare

Inherits:
Chef::Knife show all
Includes:
HitoriBase, KnifeHitori::InteractiveConfigure
Defined in:
lib/chef/knife/hitori_prepare.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from KnifeHitori::InteractiveConfigure

#ask_ec2_config_all, #input_arg

Methods included from HitoriBase

#update_environment

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



15
16
17
# File 'lib/chef/knife/hitori_prepare.rb', line 15

def server
  @server
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
# File 'lib/chef/knife/hitori_prepare.rb', line 21

def run
  update_environment(config[:environment]) if config[:environment]
  conf = ask_ec2_config_all(Chef::Config.knife, true)
  ec2 = setup_knife_ec2(conf)
  ec2.run
  @server = ec2.server
end

#setup_knife_ec2(conf) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/chef/knife/hitori_prepare.rb', line 29

def setup_knife_ec2(conf)
  Chef::Knife::Ec2ServerCreate.load_deps
  args = []
  args << '--groups=' + conf[:security_groups]
  args << '--availability-zone=' + conf[:availability_zone]
  args << '--image=' + conf[:image]
  args << '--flavor=' + conf[:flavor]

  args << '--ssh-user=' + conf[:ssh_user]
  args << '--ssh-port=' + conf[:ssh_port].to_s
  args << '--identity-file=' + conf[:identity_file]
  args << '--ssh-key=' + conf[:aws_ssh_key_id]
  args << '--region=' + conf[:region]
  args << '--template-file=' + conf[:template_file]
  ui.info args.join(' ')
  Chef::Knife::Ec2ServerCreate.new(args)
end