# Path: opencenteragent/utils.py
# def detailed_exception():
#     exc_type, exc_value, exc_traceback = sys.exc_info()
#     full_traceback = repr(
#         traceback.format_exception(
#             exc_type, exc_value, exc_traceback))
# 
#     return full_traceback


import time
import logging
import opencenter.backends
from opencenterclient.client import OpenCenterEndpoint
from opencenteragent.utils import detailed_exception
from state import StateMachine, StateMachineState
from opencenter.db import api as db_api
        self.adventure_globals = adventure_globals
        if not adventure_globals:
            self.adventure_globals = {}

        if not logger:
            self.logger = logging.getLogger()

        opencenter.backends.load()

    def add_rollback_step(self, node_id, input_state, state_value):
        if not 'rollback_plan' in input_state:
            input_state['rollback_plan'] = {}

        if not node_id in input_state['rollback_plan']:
            input_state['rollback_plan'][node_id] = {
                'start_state': 'state_1',
                'states': {'state_1':
                           {'primitive': 'noop',
                            'parameters': {}}}}
        # we have a rollback plan already
        plan = input_state['rollback_plan'][node_id]

        old_start = plan['start_state']
        state_value['on_success'] = old_start

        # yeah, pep-8, you are right.  this is WAY more readable.
        state = 'state_%d' % (int(max(map(lambda x: int(
                              x.split('_')[1]), plan['states'].keys()))) + 1)

        plan['start_state'] = state

# Path: opencenteragent/utils.py
# def detailed_exception():
#     exc_type, exc_value, exc_traceback = sys.exc_info()
#     full_traceback = repr(
#         traceback.format_exception(
#             exc_type, exc_value, exc_traceback))
# 
#     return full_traceback


# Path: opencenteragent/plugins/lib/primitives.py
import time
import logging
import opencenter.backends
from opencenterclient.client import OpenCenterEndpoint
from opencenteragent.utils import detailed_exception
from state import StateMachine, StateMachineState
from opencenter.db import api as db_api

        self.adventure_globals = adventure_globals
        if not adventure_globals:
            self.adventure_globals = {}

        if not logger:
            self.logger = logging.getLogger()

        opencenter.backends.load()

    def add_rollback_step(self, node_id, input_state, state_value):
        if not 'rollback_plan' in input_state:
            input_state['rollback_plan'] = {}

        if not node_id in input_state['rollback_plan']:
            input_state['rollback_plan'][node_id] = {
                'start_state': 'state_1',
                'states': {'state_1':
                           {'primitive': 'noop',
                            'parameters': {}}}}
        # we have a rollback plan already
        plan = input_state['rollback_plan'][node_id]

        old_start = plan['start_state']
        state_value['on_success'] = old_start

        # yeah, pep-8, you are right.  this is WAY more readable.
        state = 'state_%d' % (int(max(map(lambda x: int(
                              x.split('_')[1]), plan['states'].keys()))) + 1)

        plan['start_state'] = state

        plan['states'][state] = state_value