
from rally.task.scenarios import base


class ScenarioPlugin(base.Scenario):
    """Sample plugin which lists flavors."""

    @base.atomic_action_timer("list_flavors")
    def _list_flavors(self):
        """Sample of usage clients - list flavors

        You can use self.context, self.admin_clients and self.clients which are
        initialized on scenario instance creation.
        """
        self.clients("nova").flavors.list()

    @base.atomic_action_timer("list_flavors_as_admin")
    def _list_flavors_as_admin(self):
        """The same with admin clients."""
        self.admin_clients("nova").flavors.list()

    @base.scenario()
    def list_flavors(self):
        """List flavors."""
        self._list_flavors()
        self._list_flavors_as_admin()


from rally.plugins.openstack import scenario
from rally.task import atomic


class ScenarioPlugin(scenario.OpenStackScenario):
    """Sample plugin which lists flavors."""

    @atomic.action_timer("list_flavors")
    def _list_flavors(self):
        """Sample of usage clients - list flavors

        You can use self.context, self.admin_clients and self.clients which are
        initialized on scenario instance creation.
        """
        self.clients("nova").flavors.list()

    @atomic.action_timer("list_flavors_as_admin")
    def _list_flavors_as_admin(self):
        """The same with admin clients."""
        self.admin_clients("nova").flavors.list()

    @scenario.configure()
    def list_flavors(self):
        """List flavors."""
        self._list_flavors()
        self._list_flavors_as_admin()

Fix the scenario plugin sample
Fix the scenario plugin sample

We forgot to fix scenario plugin sample when we were doing
rally.task.scenario refactoring

Change-Id: Iadbb960cf168bd3b9cd6c1881a5f7a8dffd7036f

  
- from rally.task.scenarios import base
+ from rally.plugins.openstack import scenario
+ from rally.task import atomic
  
  
- class ScenarioPlugin(base.Scenario):
+ class ScenarioPlugin(scenario.OpenStackScenario):
      """Sample plugin which lists flavors."""
  
-     @base.atomic_action_timer("list_flavors")
+     @atomic.action_timer("list_flavors")
      def _list_flavors(self):
          """Sample of usage clients - list flavors
  
          You can use self.context, self.admin_clients and self.clients which are
          initialized on scenario instance creation.
          """
          self.clients("nova").flavors.list()
  
-     @base.atomic_action_timer("list_flavors_as_admin")
+     @atomic.action_timer("list_flavors_as_admin")
      def _list_flavors_as_admin(self):
          """The same with admin clients."""
          self.admin_clients("nova").flavors.list()
  
-     @base.scenario()
+     @scenario.configure()
      def list_flavors(self):
          """List flavors."""
          self._list_flavors()
          self._list_flavors_as_admin()
  
Fix the scenario plugin sample
## Code Before:

from rally.task.scenarios import base


class ScenarioPlugin(base.Scenario):
    """Sample plugin which lists flavors."""

    @base.atomic_action_timer("list_flavors")
    def _list_flavors(self):
        """Sample of usage clients - list flavors

        You can use self.context, self.admin_clients and self.clients which are
        initialized on scenario instance creation.
        """
        self.clients("nova").flavors.list()

    @base.atomic_action_timer("list_flavors_as_admin")
    def _list_flavors_as_admin(self):
        """The same with admin clients."""
        self.admin_clients("nova").flavors.list()

    @base.scenario()
    def list_flavors(self):
        """List flavors."""
        self._list_flavors()
        self._list_flavors_as_admin()

## Instruction:
Fix the scenario plugin sample
## Code After:

from rally.plugins.openstack import scenario
from rally.task import atomic


class ScenarioPlugin(scenario.OpenStackScenario):
    """Sample plugin which lists flavors."""

    @atomic.action_timer("list_flavors")
    def _list_flavors(self):
        """Sample of usage clients - list flavors

        You can use self.context, self.admin_clients and self.clients which are
        initialized on scenario instance creation.
        """
        self.clients("nova").flavors.list()

    @atomic.action_timer("list_flavors_as_admin")
    def _list_flavors_as_admin(self):
        """The same with admin clients."""
        self.admin_clients("nova").flavors.list()

    @scenario.configure()
    def list_flavors(self):
        """List flavors."""
        self._list_flavors()
        self._list_flavors_as_admin()
