Class: PoolParty::Installers::Ec2
Instance Attribute Summary collapse
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
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
5
6
7
|
# File 'lib/poolparty/installers/ec2.rb', line 5
def access_key
@access_key
end
|
#ec2_directory ⇒ Object
Returns the value of attribute ec2_directory.
5
6
7
|
# File 'lib/poolparty/installers/ec2.rb', line 5
def ec2_directory
@ec2_directory
end
|
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
5
6
7
|
# File 'lib/poolparty/installers/ec2.rb', line 5
def secret_access_key
@secret_access_key
end
|
Class Method Details
.description ⇒ Object
18
19
20
|
# File 'lib/poolparty/installers/ec2.rb', line 18
def self.description
"Ec2 installer"
end
|
14
15
16
|
# File 'lib/poolparty/installers/ec2.rb', line 14
def self.name
"Ec2"
end
|
Instance Method Details
#ask_for_access_key ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/poolparty/installers/ec2.rb', line 46
def ask_for_access_key
access_key_help ="EC2 uses an access key to identify you and allows you to start and stop instances.\n EOV\n\n access_key = <<-EOE\nWhat is your access key?\n EOE\n ask_with_help :message => access_key, :no_value => true, :help => access_key_help do |k|\n @access_key = k\n end\nend\n"
|
#ask_for_ec2_directory ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/poolparty/installers/ec2.rb', line 73
def ask_for_ec2_directory
ec2_directory_help ="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. \n EOV\n\n ec2_directory_msg = <<-EOE\nWhat's path to your ec2 directory with your cert and pk files?\n EOE\n ask_with_help :message => ec2_directory_msg, :help => ec2_directory_help\nend\n"
|
#ask_for_private_access_key ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/poolparty/installers/ec2.rb', line 59
def ask_for_private_access_key
private_access_key_help ="EC2 uses a private access key to identify you and allows you to start and stop instances.\n EOV\n\n private_access_key = <<-EOE\nWhat is your private access key?\n EOE\n ask_with_help :message => private_access_key, :help => private_access_key_help do |k|\n @secret_access_key = k\n end\nend\n"
|
#check_for_access_keys ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/poolparty/installers/ec2.rb', line 22
def check_for_access_keys
msg = "
I've detected the following for your ec2 setup.
<line>
access key: #{CloudProviders::Ec2.default_access_key}
secret access key: #{CloudProviders::Ec2.default_secret_access_key}
certificate: #{CloudProviders::Ec2.default_cert}
private key: #{CloudProviders::Ec2.default_private_key}
<yellow>Are these values correct?</yellow>
"
v = choose msg, %W(Yes No)
if v == "Yes"
puts "Using the values above"
@access_key = CloudProviders::Ec2.default_access_key
@secret_access_key = CloudProviders::Ec2.default_secret_access_key
@ec2_directory = File.dirname(CloudProviders::Ec2.default_cert)
else
[
:ask_for_ec2_directory, :ask_for_access_key, :ask_for_private_access_key
].each {|meth| self.send meth}
end
end
|
#show_env_setup ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/poolparty/installers/ec2.rb', line 85
def show_env_setup
colored_say "<line>\n \n Setup your environment:\n \n export EC2_ACCESS_KEY=\#{access_key}\n export EC2_SECRET_KEY=\#{secret_access_key}\n\n export EC2_PRIVATE_KEY=$(ls \#{ec2_directory}/pk-*.pem)\n export EC2_CERT=$(ls \#{ec2_directory}/cert-*.pem)\n \n<line>\n EOE\n exit 0\nend\n"
|
7
8
9
10
11
12
|
# File 'lib/poolparty/installers/ec2.rb', line 7
def steps
[
:check_for_access_keys,
:show_env_setup
]
end
|