def assert_security_groups
      aws_ec2 = ec2_obj

      if security_groups == :auto
        loaded_groups = load_security_group

        # this will make it hit the second block everytime from now on (and
        # bootstrap it recursively)
        if loaded_groups
          self.security_groups loaded_groups
          assert_security_groups
        else
          self.security_groups create_security_group
        end
      else
        self.security_groups = [security_groups] unless security_groups.kind_of?(Array)

        self.security_groups.each do |group|
          #
          # just retry this until it works -- some stupid flexible proxy in aws-sdk will bark about a missing method otherwise.
          #

          begin
            aws_ec2.security_groups[group]
          rescue
            sleep 1
            retry
          end

          raise "EC2 security group #{group} does not exist and it should." unless aws_ec2.security_groups[group]
        end
      end
    end
def assert_security_groups
      aws_ec2 = ec2_obj

      if security_groups == :auto
        loaded_groups = load_security_group

        # this will make it hit the second block everytime from now on (and
        # bootstrap it recursively)
        if loaded_groups
          self.security_groups loaded_groups
          assert_security_groups
        else
          self.security_groups create_security_group
        end
      else
        self.security_groups = [security_groups] unless security_groups.kind_of?(Array)

        self.security_groups.each do |group|
          #
          # just retry this until it works -- some stupid flexible proxy in aws-sdk will bark about a missing method otherwise.
          #

          begin
            aws_ec2.security_groups[group]
          rescue
            sleep 1
            retry
          end

          raise "EC2 security group #{group} does not exist and it should." unless aws_ec2.security_groups[group]
        end
      end
    end
Ensures security groups exist.

 If @security_groups is :auto, creates one and sets it up with the
 security_group_open_ports on TCP and UDP.

 If @security_groups is an array of group names or a single group name,
 asserts they exist. If they do not exist, it raises.