lib/rudy/command/base.rb in rudy-0.2.3 vs lib/rudy/command/base.rb in rudy-0.2.4
- old
+ new
@@ -84,10 +84,17 @@
@sdb = Rudy::AWS::SimpleDB.new(@access_key, @secret_key)
@ec2 = Rudy::AWS::EC2.new(@access_key, @secret_key)
#@s3 = Rudy::AWS::SimpleDB.new(@access_key, @secret_key)
end
+ # Raises exceptions if the requested user does
+ # not have a valid keypair configured. (See: EC2_KEYPAIR_*)
+ def check_keys
+ raise "No SSH key provided for #{keypairname}!" unless has_keypair?(keypairname)
+ raise "SSH key provided but cannot be found! (#{keypairpath})" unless File.exists?(keypairpath)
+ end
+
def has_pem_keys?
(@ec2_cert && File.exists?(@ec2_cert) &&
@ec2_private_key && File.exists?(@ec2_private_key))
end
@@ -183,29 +190,30 @@
# Print a default header to the screen for every command.
# +cmd+ is the name of the command current running.
def print_header(cmd=nil)
- print "RUDY v#{Rudy::VERSION}"
- print " -- #{@alias}" if @alias
- puts
-
- criteria = []
- [:zone, :environment, :role, :position].each do |n|
- val = instance_variable_get("@#{n}")
- criteria << "[#{n} = #{val}]"
- end
- puts criteria.join(" and ")
-
+ title = "RUDY v#{Rudy::VERSION}"
+ title << " -- #{@alias}" if @alias
+ puts title, $/
+
if (@environment == "prod")
- puts %q(
+ puts %q(=======================================================
=======================================================
-=======================================================
!!!!!!!!! YOU ARE PLAYING WITH PRODUCTION !!!!!!!!!
=======================================================
=======================================================
- )
+
+)
end
+
+ criteria = []
+ [:zone, :environment, :role, :position].each do |n|
+ val = instance_variable_get("@#{n}")
+ criteria << "[#{n} = #{val}]"
+ end
+ puts criteria.join(" and ")
+ puts
end
def print_footer
\ No newline at end of file