solutious-rudy 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/CHANGES.txt +19 -1
  2. data/README.rdoc +66 -35
  3. data/Rakefile +1 -0
  4. data/Rudyfile +97 -6
  5. data/bin/ird +7 -4
  6. data/bin/rudy +120 -212
  7. data/bin/rudy-ec2 +240 -0
  8. data/bin/rudy-s3 +76 -0
  9. data/bin/rudy-sdb +67 -0
  10. data/lib/annoy.rb +61 -18
  11. data/lib/console.rb +10 -5
  12. data/lib/rudy/aws/ec2/address.rb +76 -40
  13. data/lib/rudy/aws/ec2/group.rb +138 -78
  14. data/lib/rudy/aws/ec2/image.rb +134 -12
  15. data/lib/rudy/aws/ec2/instance.rb +116 -89
  16. data/lib/rudy/aws/ec2/keypair.rb +26 -14
  17. data/lib/rudy/aws/ec2/snapshot.rb +23 -12
  18. data/lib/rudy/aws/ec2/volume.rb +198 -202
  19. data/lib/rudy/aws/ec2/zone.rb +77 -0
  20. data/lib/rudy/aws/ec2.rb +56 -25
  21. data/lib/rudy/aws/s3.rb +54 -0
  22. data/lib/rudy/aws/sdb/error.rb +46 -0
  23. data/lib/rudy/aws/sdb.rb +298 -0
  24. data/lib/rudy/aws.rb +29 -57
  25. data/lib/rudy/{metadata/backup.rb → backup.rb} +8 -8
  26. data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
  27. data/lib/rudy/cli/aws/ec2/candy.rb +208 -0
  28. data/lib/rudy/cli/aws/ec2/groups.rb +121 -0
  29. data/lib/rudy/cli/aws/ec2/images.rb +196 -0
  30. data/lib/rudy/cli/aws/ec2/instances.rb +194 -0
  31. data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
  32. data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
  33. data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
  34. data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
  35. data/lib/rudy/cli/aws/s3/buckets.rb +50 -0
  36. data/lib/rudy/cli/aws/s3/store.rb +22 -0
  37. data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
  38. data/lib/rudy/cli/{deploy.rb → candy.rb} +2 -6
  39. data/lib/rudy/cli/config.rb +25 -20
  40. data/lib/rudy/cli/disks.rb +18 -108
  41. data/lib/rudy/cli/machines.rb +94 -0
  42. data/lib/rudy/cli/routines.rb +47 -70
  43. data/lib/rudy/cli.rb +104 -89
  44. data/lib/rudy/config/objects.rb +5 -43
  45. data/lib/rudy/config.rb +8 -24
  46. data/lib/rudy/disks.rb +248 -0
  47. data/lib/rudy/global.rb +121 -0
  48. data/lib/rudy/huxtable.rb +232 -147
  49. data/lib/rudy/machines.rb +245 -0
  50. data/lib/rudy/metadata.rb +136 -0
  51. data/lib/rudy/routines/helpers/diskhelper.rb +101 -0
  52. data/lib/rudy/routines/helpers/scripthelper.rb +91 -0
  53. data/lib/rudy/routines/release.rb +27 -8
  54. data/lib/rudy/routines/shutdown.rb +47 -32
  55. data/lib/rudy/routines/startup.rb +47 -37
  56. data/lib/rudy/routines.rb +30 -37
  57. data/lib/rudy/scm/svn.rb +1 -1
  58. data/lib/rudy/utils.rb +262 -4
  59. data/lib/rudy.rb +76 -248
  60. data/lib/storable.rb +19 -16
  61. data/lib/sysinfo.rb +1 -1
  62. data/rudy.gemspec +88 -68
  63. data/support/rudy-ec2-startup +5 -5
  64. data/test/05_config/00_setup_test.rb +3 -7
  65. data/test/20_sdb/00_setup_test.rb +2 -17
  66. data/test/20_sdb/10_domains_test.rb +18 -16
  67. data/test/25_ec2/00_setup_test.rb +5 -10
  68. data/test/25_ec2/10_keypairs_test.rb +13 -5
  69. data/test/25_ec2/20_groups_test.rb +48 -56
  70. data/test/25_ec2/30_addresses_test.rb +13 -10
  71. data/test/25_ec2/40_volumes_test.rb +11 -8
  72. data/test/25_ec2/50_snapshots_test.rb +17 -12
  73. data/test/26_ec2_instances/00_setup_test.rb +3 -8
  74. data/test/26_ec2_instances/10_instances_test.rb +21 -19
  75. data/test/30_sdb_metadata/00_setup_test.rb +2 -9
  76. data/test/30_sdb_metadata/10_disks_test.rb +47 -37
  77. data/test/30_sdb_metadata/20_backups_test.rb +9 -9
  78. data/test/helper.rb +5 -3
  79. data/vendor/highline-1.5.1/CHANGELOG +222 -0
  80. data/vendor/highline-1.5.1/INSTALL +35 -0
  81. data/vendor/highline-1.5.1/LICENSE +7 -0
  82. data/vendor/highline-1.5.1/README +63 -0
  83. data/vendor/highline-1.5.1/Rakefile +82 -0
  84. data/vendor/highline-1.5.1/TODO +6 -0
  85. data/vendor/highline-1.5.1/examples/ansi_colors.rb +38 -0
  86. data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +18 -0
  87. data/vendor/highline-1.5.1/examples/basic_usage.rb +75 -0
  88. data/vendor/highline-1.5.1/examples/color_scheme.rb +32 -0
  89. data/vendor/highline-1.5.1/examples/limit.rb +12 -0
  90. data/vendor/highline-1.5.1/examples/menus.rb +65 -0
  91. data/vendor/highline-1.5.1/examples/overwrite.rb +19 -0
  92. data/vendor/highline-1.5.1/examples/page_and_wrap.rb +322 -0
  93. data/vendor/highline-1.5.1/examples/password.rb +7 -0
  94. data/vendor/highline-1.5.1/examples/trapping_eof.rb +22 -0
  95. data/vendor/highline-1.5.1/examples/using_readline.rb +17 -0
  96. data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +120 -0
  97. data/vendor/highline-1.5.1/lib/highline/compatibility.rb +17 -0
  98. data/vendor/highline-1.5.1/lib/highline/import.rb +43 -0
  99. data/vendor/highline-1.5.1/lib/highline/menu.rb +395 -0
  100. data/vendor/highline-1.5.1/lib/highline/question.rb +463 -0
  101. data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +193 -0
  102. data/vendor/highline-1.5.1/lib/highline.rb +758 -0
  103. data/vendor/highline-1.5.1/setup.rb +1360 -0
  104. data/vendor/highline-1.5.1/test/tc_color_scheme.rb +56 -0
  105. data/vendor/highline-1.5.1/test/tc_highline.rb +823 -0
  106. data/vendor/highline-1.5.1/test/tc_import.rb +54 -0
  107. data/vendor/highline-1.5.1/test/tc_menu.rb +429 -0
  108. data/vendor/highline-1.5.1/test/ts_all.rb +15 -0
  109. metadata +81 -69
  110. data/lib/aws_sdb/error.rb +0 -42
  111. data/lib/aws_sdb/service.rb +0 -215
  112. data/lib/aws_sdb.rb +0 -3
  113. data/lib/rudy/aws/simpledb.rb +0 -71
  114. data/lib/rudy/cli/addresses.rb +0 -85
  115. data/lib/rudy/cli/backups.rb +0 -175
  116. data/lib/rudy/cli/domains.rb +0 -17
  117. data/lib/rudy/cli/groups.rb +0 -77
  118. data/lib/rudy/cli/images.rb +0 -111
  119. data/lib/rudy/cli/instances.rb +0 -142
  120. data/lib/rudy/cli/keypairs.rb +0 -47
  121. data/lib/rudy/cli/manager.rb +0 -51
  122. data/lib/rudy/cli/release.rb +0 -174
  123. data/lib/rudy/cli/volumes.rb +0 -121
  124. data/lib/rudy/command/addresses.rb +0 -69
  125. data/lib/rudy/command/backups.rb +0 -65
  126. data/lib/rudy/command/disks-old.rb +0 -322
  127. data/lib/rudy/command/disks.rb +0 -9
  128. data/lib/rudy/command/domains.rb +0 -34
  129. data/lib/rudy/command/groups.rb +0 -118
  130. data/lib/rudy/command/instances.rb +0 -278
  131. data/lib/rudy/command/keypairs.rb +0 -149
  132. data/lib/rudy/command/manager.rb +0 -65
  133. data/lib/rudy/command/volumes.rb +0 -127
  134. data/lib/rudy/metadata/disk.rb +0 -149
  135. data/lib/rudy/metadata/machine.rb +0 -34
  136. data/lib/rudy/routines/disk_handler.rb +0 -190
  137. data/lib/rudy/routines/script_runner.rb +0 -65
  138. data/test/50_commands/00_setup_test.rb +0 -11
  139. data/test/50_commands/10_keypairs_test.rb +0 -79
  140. data/test/50_commands/20_groups_test.rb +0 -77
  141. data/test/50_commands/40_volumes_test.rb +0 -55
  142. data/test/50_commands/50_instances_test.rb +0 -110
  143. data/tryouts/console_tryout.rb +0 -91
  144. data/tryouts/disks.rb +0 -55
  145. data/tryouts/nested_methods.rb +0 -36
  146. data/tryouts/session_tryout.rb +0 -46
data/lib/rudy/config.rb CHANGED
@@ -36,7 +36,7 @@ module Rudy
36
36
  # The "core" config file can have any or all configuration
37
37
  # but it should generally only contain the access identifiers
38
38
  # and defaults. That's why we only load one of them.
39
- core_config_paths = [adhoc_path, cwd_path, RUDY_CONFIG_FILE]
39
+ core_config_paths = [adhoc_path, cwd_path, Rudy::CONFIG_FILE]
40
40
  core_config_paths.each do |path|
41
41
  next unless path && File.exists?(path)
42
42
  @paths << path
@@ -44,26 +44,25 @@ module Rudy
44
44
  end
45
45
 
46
46
  # Rudy then looks for the rest of the config in these locations
47
- @paths += Dir.glob(File.join('/etc', 'rudy', '*.rb')) || []
48
47
  @paths += Dir.glob(File.join(cwd, 'Rudyfile')) || []
49
48
  @paths += Dir.glob(File.join(cwd, 'config', 'rudy', '*.rb')) || []
50
49
  @paths += Dir.glob(File.join(cwd, '.rudy', '*.rb')) || []
50
+ @paths += Dir.glob(File.join('/etc', 'rudy', '*.rb')) || []
51
51
  @paths &&= @paths.uniq
52
52
 
53
53
  refresh
54
54
  end
55
55
 
56
56
 
57
-
58
57
  def self.init_config_dir
59
58
 
60
- unless File.exists?(RUDY_CONFIG_DIR)
61
- puts "Creating #{RUDY_CONFIG_DIR}"
62
- Dir.mkdir(RUDY_CONFIG_DIR, 0700)
59
+ unless File.exists?(Rudy::CONFIG_DIR)
60
+ puts "Creating #{Rudy::CONFIG_DIR}"
61
+ Dir.mkdir(Rudy::CONFIG_DIR, 0700)
63
62
  end
64
63
 
65
- unless File.exists?(RUDY_CONFIG_FILE)
66
- puts "Creating #{RUDY_CONFIG_FILE}"
64
+ unless File.exists?(Rudy::CONFIG_FILE)
65
+ puts "Creating #{Rudy::CONFIG_FILE}"
67
66
  rudy_config = Rudy::Utils.without_indent %Q{
68
67
  # Amazon Web Services
69
68
  # Account access indentifiers.
@@ -77,21 +76,6 @@ module Rudy
77
76
  cert "~/path/2/cert-xxxx.pem"
78
77
  end
79
78
  end
80
-
81
- # Machine Configuration
82
- # Specify your private keys here. These can be defined globally
83
- # or by environment and role like in machines.rb.
84
- machines do
85
- users do
86
- #root :keypair => "path/2/root-private-key"
87
- end
88
- zone :"us-east-1b" do
89
- ami 'ami-235fba4a' # Amazon Getting Started AMI (US)
90
- end
91
- zone :"eu-west-1b" do
92
- ami 'ami-e40f2790' # Amazon Getting Started AMI (EU)
93
- end
94
- end
95
79
 
96
80
  # Global Defaults
97
81
  # Define the values to use unless otherwise specified on the command-line.
@@ -104,7 +88,7 @@ module Rudy
104
88
  user ENV['USER'].to_sym
105
89
  end
106
90
  }
107
- Rudy::Utils.write_to_file(RUDY_CONFIG_FILE, rudy_config, 'w', 0600)
91
+ Rudy::Utils.write_to_file(Rudy::CONFIG_FILE, rudy_config, 'w', 0600)
108
92
  end
109
93
  end
110
94
 
data/lib/rudy/disks.rb ADDED
@@ -0,0 +1,248 @@
1
+
2
+
3
+ module Rudy
4
+ class Disk < Storable
5
+ include Rudy::MetaData::ObjectBase
6
+
7
+ field :rtype
8
+ field :awsid
9
+ field :status
10
+ field :instid
11
+
12
+ field :region
13
+ field :zone
14
+ field :environment
15
+ field :role
16
+ field :position
17
+ field :path
18
+
19
+ field :device
20
+ field :size
21
+ #field :backups => Array
22
+
23
+ field :mounted
24
+
25
+ def init(path=nil, size=nil, device=nil, position=nil)
26
+ @path, @size, @device = path, size, device
27
+ @rtype = 'disk'
28
+ @region = @@global.region
29
+ @zone = @@global.zone
30
+ @environment = @@global.environment
31
+ @role = @@global.role
32
+ @position = position || @@global.position
33
+ @mounted = false
34
+ postprocess
35
+ end
36
+
37
+ def postprocess
38
+ @size &&= @size.to_i
39
+ @mounted = true if @mounted == "true"
40
+ end
41
+
42
+ def liner_note
43
+ info = @awsid && !@awsid.empty? ? @awsid : 'no volume'
44
+ "%s %s" % [self.name.bright, info]
45
+ end
46
+
47
+ def to_s(with_titles=true)
48
+ update
49
+ mtd = @mounted ? "mounted" : @status
50
+ "%s; %3sGB; %s; %s" % [liner_note, @size, @device, mtd]
51
+ end
52
+
53
+ def inspect
54
+ lines = []
55
+ lines << liner_note
56
+ field_names.each do |key|
57
+ next unless self.respond_to?(key)
58
+ val = self.send(key)
59
+ lines << sprintf(" %22s: %s", key, (val.is_a?(Array) ? val.join(', ') : val))
60
+ end
61
+ lines.join($/)
62
+ end
63
+
64
+ def name
65
+ sep=File::SEPARATOR
66
+ dirs = @path.split sep if @path && !@path.empty?
67
+ dirs.shift while dirs && (dirs[0].nil? || dirs[0].empty?)
68
+ super("disk", @zone, @environment, @role, @position, *dirs)
69
+ end
70
+
71
+
72
+
73
+ def create(snapshot=nil)
74
+ raise "#{name} is already running" if exists?
75
+ vol = @rvol.create(@size, @zone, snapshot)
76
+ @awsid = vol.awsid
77
+ self.save
78
+ self
79
+ end
80
+
81
+ def attach(instid)
82
+ raise "No volume id" unless exists?
83
+ vol = @rvol.attach(@awsid, instid, @device)
84
+ end
85
+
86
+ def detach
87
+ raise "No volume id" unless exists?
88
+ vol = @rvol.detach(@awsid)
89
+ end
90
+
91
+ def destroy(force=false)
92
+ if @awsid && !deleting?
93
+ if !force
94
+ raise Rudy::AWS::EC2::VolumeNotAvailable, @awsid if attached?
95
+ else
96
+ detach if exists? && attached?
97
+ sleep 0.1
98
+ end
99
+ raise Rudy::AWS::EC2::VolumeNotAvailable, @awsid if in_use?
100
+ @rvol.destroy(@awsid) if exists? && available?
101
+ end
102
+ super() # quotes, otherwise Ruby will send this method's args
103
+ end
104
+
105
+ def update
106
+ return false unless @awsid
107
+ @volume = @rvol.get(@awsid)
108
+ if @volume.is_a?(Rudy::AWS::EC2::Volume)
109
+ @status = @volume.status
110
+ @instid = @volume.instid
111
+ save
112
+ end
113
+ end
114
+
115
+ def to_query(more=[], less=[])
116
+ super([:path, *more], less) # Add path to the default fields
117
+ end
118
+
119
+ def to_select(more=[], less=[])
120
+ super([:path, *more], less)
121
+ end
122
+
123
+ # Does this disk have enough info to be saved or used?
124
+ # The test is based on the same criteria for building
125
+ # SimpleDB queries.
126
+ def valid?
127
+ criteria = build_criteria([:path]).flatten
128
+ criteria.size == criteria.compact.size
129
+ end
130
+
131
+ def mounted?
132
+ @mounted && @mounted == true
133
+ end
134
+
135
+
136
+ %w[exists? deleting? available? attached? in_use?].each do |state|
137
+ define_method(state) do
138
+ return false if @awsid.nil? || @awsid.empty?
139
+ @rvol.send(state, @awsid) rescue false # deleting?, available?, etc...
140
+ end
141
+ end
142
+ end
143
+
144
+ class Disks
145
+ include Rudy::MetaData
146
+
147
+
148
+ def create(&each_mach)
149
+
150
+ end
151
+
152
+
153
+ def destroy(&each_mach)
154
+ #raise MachineGroupNotRunning, current_machine_group unless running?
155
+ #raise MachineGroupNotDefined, current_machine_group unless known_machine_group?
156
+ list do |disk|
157
+ puts "Destroying #{disk.name}"
158
+ disk.destroy
159
+ end
160
+ end
161
+
162
+ def list(more=[], less=[], &each_disk)
163
+ disks = list_as_hash(&each_disk)
164
+ disks &&= disks.values
165
+ disks
166
+ end
167
+
168
+ def list_as_hash(more=[], less=[], &each_disk)
169
+ query = to_select([:rtype, 'disk'], less)
170
+ list = @sdb.select(query) || {}
171
+ disks = {}
172
+ list.each_pair do |n,d|
173
+ disks[n] = Rudy::Disk.from_hash(d)
174
+ end
175
+ disks.each_pair { |n,disk| each_disk.call(disk) } if each_disk
176
+ disks = nil if disks.empty?
177
+ disks
178
+ end
179
+
180
+ def get(rname=nil)
181
+ dhash = @sdb.get(Rudy::DOMAIN, rname)
182
+ return nil if dhash.nil? || dhash.empty?
183
+ d = Rudy::Disk.from_hash(dhash)
184
+ d.update if d
185
+ d
186
+ end
187
+
188
+
189
+ def running?
190
+ !list.nil?
191
+ # TODO: add logic that checks whether the instances are running.
192
+ end
193
+
194
+
195
+
196
+
197
+ end
198
+ end
199
+
200
+
201
+
202
+
203
+ __END__
204
+
205
+ def format(instance)
206
+ raise "No instance supplied" unless instance
207
+ raise "Disk not valid" unless self.valid?
208
+
209
+ begin
210
+ puts "Creating the filesystem (mkfs.ext3 -F #{disk.device})".bright
211
+ ssh_command instance.dns_public, current_user_keypairpath, @@global.user, "mkfs.ext3 -F #{disk.device}"
212
+ sleep 1
213
+ rescue => ex
214
+ @logger.puts ex.backtrace if debug?
215
+ raise "Error formatting #{disk.path}: #{ex.message}"
216
+ end
217
+ true
218
+ end
219
+ def mount(instance)
220
+ raise "No instance supplied" unless instance
221
+ disk = find_disk(opts[:disk] || opts[:path])
222
+ raise "Disk #{opts[:disk] || opts[:path]} cannot be found" unless disk
223
+ switch_user(:root)
224
+ begin
225
+ puts "Mounting #{disk.device} to #{disk.path}".bright
226
+ ssh_command instance.dns_public, current_user_keypairpath, @@global.user, "mkdir -p #{disk.path} && mount -t ext3 #{disk.device} #{disk.path}"
227
+ rescue => ex
228
+ @logger.puts ex.backtrace if debug?
229
+ raise "Error mounting #{disk.path}: #{ex.message}"
230
+ end
231
+ true
232
+ end
233
+
234
+ def unmount(instance)
235
+ raise "No instance supplied" unless instance
236
+ disk = find_disk(opts[:disk] || opts[:path])
237
+ raise "Disk #{opts[:disk] || opts[:path]} cannot be found" unless disk
238
+ switch_user(:root)
239
+ begin
240
+ puts "Unmounting #{disk.path}...".bright
241
+ ssh_command instance.dns_public, current_user_keypairpath, global.user, "umount #{disk.path}"
242
+ sleep 1
243
+ rescue => ex
244
+ @logger.puts ex.backtrace if debug?
245
+ raise "Error unmounting #{disk.path}: #{ex.message}"
246
+ end
247
+ true
248
+ end
@@ -0,0 +1,121 @@
1
+
2
+
3
+ module Rudy
4
+
5
+ # = Rudy::Global
6
+ #
7
+ # This global class is used by all Huxtable objects.
8
+ # When a new CLI global is added, the appropriate field must
9
+ # be added to this class (optional: a default value in initialize).
10
+ class Global < Storable
11
+
12
+ field :region
13
+ field :zone
14
+ field :environment
15
+ field :role
16
+ field :position
17
+ field :user
18
+ field :pkey
19
+
20
+ field :nocolor
21
+ field :quiet
22
+ field :verbose
23
+ field :format
24
+ field :print_header
25
+ field :yes
26
+
27
+ field :accesskey
28
+ field :secretkey
29
+ field :accountnum
30
+ field :accountname # TODO: use this. And accounttype (aws)
31
+ field :cert
32
+ field :privatekey
33
+
34
+ field :local_user
35
+ field :local_hostname
36
+
37
+ field :config => String
38
+
39
+ attr_accessor :print_header
40
+
41
+ def initialize
42
+ postprocess
43
+ # These attributes MUST have values.
44
+ @verbose ||= 0
45
+ @nocolor ||= false
46
+ @quiet ||= false
47
+ @format ||= 'string' # as in, to_s
48
+ @print_header = true if @print_header == nil
49
+ @yes = false if @yes.nil?
50
+ end
51
+
52
+ def apply_config(config)
53
+ return unless config.is_a?(Rudy::Config)
54
+ if config.defaults?
55
+ %w[region zone environment role position user nocolor quiet].each do |name|
56
+ val = config.defaults.send(name)
57
+ self.send("#{name}=", val) if val
58
+ end
59
+ end
60
+
61
+ if config.accounts? && config.accounts.aws
62
+ %w[accesskey secretkey accountnum cert privatekey].each do |name|
63
+ val = config.accounts.aws.send(name)
64
+ self.send("#{name}=", val) if val
65
+ end
66
+ end
67
+
68
+ postprocess
69
+ end
70
+
71
+
72
+ def update(ghash={})
73
+ ghash = ghash.marshal_dump if ghash.is_a?(OpenStruct)
74
+
75
+ if ghash.is_a?(Hash)
76
+ ghash.each_pair { |n,v| self.send("#{n}=", v) }
77
+ else
78
+ raise "Unexpected #{ghash.class.to_s}"
79
+ end
80
+
81
+ postprocess
82
+ end
83
+
84
+
85
+ private
86
+
87
+
88
+ def postprocess
89
+ apply_environment_variables
90
+ apply_system_defaults
91
+
92
+ @cert &&= File.expand_path(@cert)
93
+ @privatekey &&= File.expand_path(@privatekey)
94
+ @position &&= @position.to_s.rjust(2, '0')
95
+
96
+ String.disable_color if @nocolor
97
+ Rudy.enable_quiet if @quiet
98
+ Annoy.enable_skip if @yes
99
+ end
100
+
101
+ def apply_environment_variables
102
+ @accesskey ||= ENV['AWS_ACCESS_KEY']
103
+ @secretkey ||= ENV['AWS_SECRET_KEY'] || ENV['AWS_SECRET_ACCESS_KEY']
104
+ @accountnum ||= ENV['AWS_ACCOUNT_NUMBER']
105
+ @cert ||= ENV['EC2_CERT']
106
+ @privatekey ||= ENV['EC2_PRIVATE_KEY']
107
+ @local_user = ENV['USER'] || :rudy
108
+ @local_hostname = Socket.gethostname || :localhost
109
+ end
110
+
111
+ def apply_system_defaults
112
+ @region ||= Rudy::DEFAULT_REGION
113
+ @zone ||= Rudy::DEFAULT_ZONE
114
+ @environment ||= Rudy::DEFAULT_ENVIRONMENT
115
+ @role ||= Rudy::DEFAULT_ROLE
116
+ @position ||= Rudy::DEFAULT_POSITION
117
+ @user ||= Rudy::DEFAULT_USER
118
+ end
119
+
120
+ end
121
+ end