46: def ssh_valid?
47: if @@global.pkey
48: raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
49: raise "Insecure permissions for #{@@global.pkey}" unless (File.stat(@@global.pkey).mode & 600) == 0
50: end
51: if @option.group
52: raise "Cannot supply group and instance ID" if @option.instid
53: raise "Group #{@option.group} does not exist" unless Rudy::AWS::EC2::Groups.exists?(@option.group)
54: end
55: if @option.instid && !Rudy::Utils.is_id?(:instance, @option.instid)
56: raise "#{@option.instid} is not an instance ID"
57: end
58: true
59: end