import operator


def pick_flavor(flavors):
    """Given a flavor list pick the smallest one."""
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        return flavor


def pick_image(images):
    for image in images:
        if image.name.startswith('cirros') and image.name.endswith('-uec'):
            return image
    for image in images:
        if image.name.lower().startswith('ubuntu'):
            return image

import operator


def pick_flavor(flavors):
    """Given a flavor list pick the smallest one."""
    # Enable running functional tests against rax - which requires
    # performance flavors be used for boot from volume
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        if 'performance' in flavor.name:
            return flavor
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        return flavor


def pick_image(images):
    for image in images:
        if image.name.startswith('cirros') and image.name.endswith('-uec'):
            return image
    for image in images:
        if image.name.lower().startswith('ubuntu'):
            return image
    for image in images:
        if image.name.lower().startswith('centos'):
            return image

Enable running tests against RAX and IBM
Enable running tests against RAX and IBM

Rackspace requires performance flavors be used for boot from volume. IBM
does not have Ubuntu or Cirros images in the cloud.

Change-Id: I95c15d92072311eb4aa0a4b7f551a95c4dc6e082

  import operator
  
  
  def pick_flavor(flavors):
      """Given a flavor list pick the smallest one."""
+     # Enable running functional tests against rax - which requires
+     # performance flavors be used for boot from volume
+     for flavor in sorted(
+             flavors,
+             key=operator.attrgetter('ram')):
+         if 'performance' in flavor.name:
+             return flavor
      for flavor in sorted(
              flavors,
              key=operator.attrgetter('ram')):
          return flavor
  
  
  def pick_image(images):
      for image in images:
          if image.name.startswith('cirros') and image.name.endswith('-uec'):
              return image
      for image in images:
          if image.name.lower().startswith('ubuntu'):
              return image
+     for image in images:
+         if image.name.lower().startswith('centos'):
+             return image
  
Enable running tests against RAX and IBM
## Code Before:
import operator


def pick_flavor(flavors):
    """Given a flavor list pick the smallest one."""
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        return flavor


def pick_image(images):
    for image in images:
        if image.name.startswith('cirros') and image.name.endswith('-uec'):
            return image
    for image in images:
        if image.name.lower().startswith('ubuntu'):
            return image

## Instruction:
Enable running tests against RAX and IBM
## Code After:
import operator


def pick_flavor(flavors):
    """Given a flavor list pick the smallest one."""
    # Enable running functional tests against rax - which requires
    # performance flavors be used for boot from volume
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        if 'performance' in flavor.name:
            return flavor
    for flavor in sorted(
            flavors,
            key=operator.attrgetter('ram')):
        return flavor


def pick_image(images):
    for image in images:
        if image.name.startswith('cirros') and image.name.endswith('-uec'):
            return image
    for image in images:
        if image.name.lower().startswith('ubuntu'):
            return image
    for image in images:
        if image.name.lower().startswith('centos'):
            return image
