Class: PoolParty::Installers::Ec2
Class Method Summary
collapse
Instance Method Summary
collapse
all, #closing_message, #exit_msg, find_by_name, inherited, #run, to_s, #welcome_message
Methods included from Askable
included
Methods included from Pinger
included
Class Method Details
.description ⇒ Object
16
17
18
|
# File 'lib/poolparty/installers/ec2.rb', line 16
def self.description
"Ec2 installer"
end
|
12
13
14
|
# File 'lib/poolparty/installers/ec2.rb', line 12
def self.name
"Ec2"
end
|
Instance Method Details
#ask_for_access_key ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/poolparty/installers/ec2.rb', line 32
def ask_for_access_key
access_key_help =<<-EOV
EC2 uses an access key to identify you and allows you to start and stop instances.
EOV
access_key = <<-EOE
What is your access key?
EOE
ask_with_help :message => access_key, :help => access_key_help do |k|
@access_key = k
end
end
|
#ask_for_ec2_directory ⇒ Object
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/poolparty/installers/ec2.rb', line 59
def ask_for_ec2_directory
ec2_directory_help =<<-EOV
Ec2 needs to know where you store your certificates and private keys. Amazon expects these to be in the ~/.ec2 directory. We suggest a subdirectory of the ~/.ec2 directory so you can separate ec2 accounts.
EOV
ec2_directory_msg = <<-EOE
What's path to your ec2 directory with your cert and pk files?
EOE
ask_with_help :message => ec2_directory_msg, :help => ec2_directory_help
end
|
#ask_for_private_access_key ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/poolparty/installers/ec2.rb', line 45
def ask_for_private_access_key
private_access_key_help =<<-EOV
EC2 uses a private access key to identify you and allows you to start and stop instances.
EOV
private_access_key = <<-EOE
What is your private access key?
EOE
ask_with_help :message => private_access_key, :help => private_access_key_help do |k|
@secret_access_key = k
end
end
|
#find_ec2_directory ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/poolparty/installers/ec2.rb', line 20
def find_ec2_directory
msg = "We found the following vmware files in the default vmware directory.\nChoose one of these to use as your vmrun file or select other\n<line>"
directories = {}
default_ec2_directories.each_with_index do |file,idx|
directories.merge!(idx+1 => file)
end
base = choose(msg, directories)
@ec2_directory = base == :other ? ask_for_ec2_directory : base
end
|
#show_env_setup ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/poolparty/installers/ec2.rb', line 71
def show_env_setup
colored_say <<-EOE
<line>
Setup your environment:
export EC2_ACCESS_KEY=#{@access_key}
export EC2_SECRET_KEY=#{@secret_access_key}
export EC2_PRIVATE_KEY=$(ls #{@ec2_directory}/pk-*.pem)
export EC2_CERT=$(ls #{@ec2_directory}/cert-*.pem)
<line>
EOE
exit 0
end
|
5
6
7
8
9
10
|
# File 'lib/poolparty/installers/ec2.rb', line 5
def steps
[
:find_ec2_directory, :ask_for_access_key, :ask_for_private_access_key,
:show_env_setup
]
end
|