Exemplo n.º 1
0
 def setUp(self):
     super(validateTest, self).setUp()
     resources.initialise()
     self.fc = fakes.FakeClient()
     resources.initialise()
     utils.setup_dummy_db()
     self.ctx = utils.dummy_context()
    def setUp(self):
        super(TestMistralWorkflow, self).setUp()
        resources.initialise()
        utils.setup_dummy_db()
        self.ctx = utils.dummy_context()
        tmpl = template_format.parse(workflow_template)
        self.stack = utils.parse_stack(tmpl, stack_name='test_stack')

        resource_defns = self.stack.t.resource_definitions(self.stack)
        self.rsrc_defn = resource_defns['workflow']

        self.mistral = mock.Mock()
        self.patchobject(workflow.Workflow, 'client',
                         return_value=self.mistral)

        self.patches = []
        self.patches.append(mock.patch.object(stack_user.StackUser,
                                              '_create_user'))
        self.patches.append(mock.patch.object(signal_responder.SignalResponder,
                                              '_create_keypair'))
        self.patches.append(mock.patch.object(client,
                                              'mistral_base'))
        self.patches.append(mock.patch.object(client.MistralClientPlugin,
                                              '_create'))
        for patch in self.patches:
            patch.start()

        self.client = client.MistralClientPlugin(self.ctx)
Exemplo n.º 3
0
    def setUp(self):
        super(TestMistralWorkflow, self).setUp()
        resources.initialise()
        utils.setup_dummy_db()
        self.ctx = utils.dummy_context()
        tmpl = template_format.parse(workflow_template)
        self.stack = utils.parse_stack(tmpl, stack_name='test_stack')

        resource_defns = self.stack.t.resource_definitions(self.stack)
        self.rsrc_defn = resource_defns['workflow']

        self.mistral = mock.Mock()
        self.patchobject(workflow.Workflow, 'client',
                         return_value=self.mistral)

        self.patches = []
        self.patches.append(mock.patch.object(stack_user.StackUser,
                                              '_create_user'))
        self.patches.append(mock.patch.object(signal_responder.SignalResponder,
                                              '_create_keypair'))
        self.patches.append(mock.patch.object(client,
                                              'mistral_base'))
        self.patches.append(mock.patch.object(client.MistralClientPlugin,
                                              '_create'))
        for patch in self.patches:
            patch.start()

        self.client = client.MistralClientPlugin(self.ctx)
Exemplo n.º 4
0
    def __init__(self,
                 context,
                 stack_name,
                 tmpl,
                 env=None,
                 stack_id=None,
                 action=None,
                 status=None,
                 status_reason='',
                 timeout_mins=60,
                 resolve_data=True,
                 disable_rollback=True,
                 parent_resource=None,
                 owner_id=None):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if owner_id is None:
            if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
                raise ValueError(
                    _('Invalid stack name %s'
                      ' must contain only alphanumeric or '
                      '\"_-.\" characters, must start with alpha') %
                    stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.action = action
        self.status = status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = Parameters(self.name,
                                     self.t,
                                     user_params=self.env.params)

        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[template.OUTPUTS])
        else:
            self.outputs = {}

        template_resources = self.t[template.RESOURCES]
        self.resources = dict((name, resource.Resource(name, data, self))
                              for (name, data) in template_resources.items())

        self.dependencies = self._get_dependencies(self.resources.itervalues())
Exemplo n.º 5
0
 def setUp(self):
     super(validateTest, self).setUp()
     resources.initialise()
     self.fc = fakes.FakeClient()
     resources.initialise()
     utils.setup_dummy_db()
     self.ctx = utils.dummy_context()
Exemplo n.º 6
0
    def test_instance_group_custom_resource(self):
        """
        If AWS::EC2::Instance is overridden, InstanceGroup will automatically
        use that overridden resource type.
        """
        # resources may need to be initialised if this is the first test run.
        resources.initialise()

        class MyInstance(instance.Instance):
            """A customized Instance resource."""

        original_instance = resource.get_class("AWS::EC2::Instance")
        resource._register_class("AWS::EC2::Instance", MyInstance)
        self.addCleanup(resource._register_class, "AWS::EC2::Instance",
                        original_instance)

        t = template_format.parse(ig_template)
        stack = utils.parse_stack(t)
        self._stub_create(1, instance_class=MyInstance)

        self.m.ReplayAll()
        conf = self.create_resource(t, stack, 'JobServerConfig')
        rsrc = self.create_resource(t, stack, 'JobServerGroup')
        self.assertEqual('JobServerGroup', rsrc.FnGetRefId())
        rsrc.delete()
        self.m.VerifyAll()
Exemplo n.º 7
0
    def test_instance_group_custom_resource(self):
        """
        If AWS::EC2::Instance is overridden, InstanceGroup will automatically
        use that overridden resource type.
        """
        # resources may need to be initialised if this is the first test run.
        resources.initialise()

        class MyInstance(instance.Instance):
            """A customized Instance resource."""

        original_instance = resource.get_class("AWS::EC2::Instance")
        resource._register_class("AWS::EC2::Instance", MyInstance)
        self.addCleanup(resource._register_class, "AWS::EC2::Instance",
                        original_instance)

        t = template_format.parse(ig_template)
        stack = utils.parse_stack(t)
        self._stub_create(1, instance_class=MyInstance)

        self.m.ReplayAll()
        conf = self.create_resource(t, stack, 'JobServerConfig')
        rsrc = self.create_resource(t, stack, 'JobServerGroup')
        self.assertEqual(utils.PhysName(stack.name, rsrc.name),
                         rsrc.FnGetRefId())
        rsrc.delete()
        self.m.VerifyAll()
Exemplo n.º 8
0
    def __init__(self, context, stack_name, tmpl, env=None,
                 stack_id=None, action=None, status=None,
                 status_reason='', timeout_mins=None, resolve_data=True,
                 disable_rollback=True, parent_resource=None, owner_id=None,
                 adopt_stack_data=None, stack_user_project_id=None,
                 created_time=None, updated_time=None,
                 user_creds_id=None, tenant_id=None, validate_parameters=True):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if owner_id is None:
            if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
                raise ValueError(_('Invalid stack name %s'
                                   ' must contain only alphanumeric or '
                                   '\"_-.\" characters, must start with alpha'
                                   ) % stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.action = action
        self.status = status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None
        self._access_allowed_handlers = {}
        self._db_resources = None
        self.adopt_stack_data = adopt_stack_data
        self.stack_user_project_id = stack_user_project_id
        self.created_time = created_time
        self.updated_time = updated_time
        self.user_creds_id = user_creds_id

        # This will use the provided tenant ID when loading the stack
        # from the DB or get it from the context for new stacks.
        self.tenant_id = tenant_id or self.context.tenant_id

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = self.t.parameters(self.identifier(),
                                            user_params=self.env.params)
        self.parameters.validate(validate_value=validate_parameters,
                                 context=context)
        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[self.t.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 9
0
    def __init__(
        self,
        context,
        stack_name,
        tmpl,
        env=None,
        stack_id=None,
        action=None,
        status=None,
        status_reason="",
        timeout_mins=60,
        resolve_data=True,
        disable_rollback=True,
        parent_resource=None,
        owner_id=None,
    ):
        """
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        """

        if owner_id is None:
            if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
                raise ValueError(
                    _(
                        "Invalid stack name %s"
                        " must contain only alphanumeric or "
                        '"_-." characters, must start with alpha'
                    )
                    % stack_name
                )

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.action = action
        self.status = status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = Parameters(self.name, self.t, user_params=self.env.params)

        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[template.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 10
0
    def __init__(self, context, stack_name, tmpl, env=None,
                 stack_id=None, action=None, status=None,
                 status_reason='', timeout_mins=None, resolve_data=True,
                 disable_rollback=True, parent_resource=None, owner_id=None,
                 adopt_stack_data=None, stack_user_project_id=None,
                 created_time=None, updated_time=None,
                 user_creds_id=None, tenant_id=None, validate_parameters=True):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if owner_id is None:
            if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
                raise ValueError(_('Invalid stack name %s'
                                   ' must contain only alphanumeric or '
                                   '\"_-.\" characters, must start with alpha'
                                   ) % stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.action = action
        self.status = status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None
        self._access_allowed_handlers = {}
        self._db_resources = None
        self.adopt_stack_data = adopt_stack_data
        self.stack_user_project_id = stack_user_project_id
        self.created_time = created_time
        self.updated_time = updated_time
        self.user_creds_id = user_creds_id

        # This will use the provided tenant ID when loading the stack
        # from the DB or get it from the context for new stacks.
        self.tenant_id = tenant_id or self.context.tenant_id

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = self.t.parameters(self.identifier(),
                                            user_params=self.env.params)
        self.parameters.validate(validate_value=validate_parameters,
                                 context=context)
        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[self.t.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 11
0
 def setUp(self):
     super(validateTest, self).setUp()
     resources.initialise()
     self.fc = fakes.FakeClient()
     self.gc = fakes.FakeClient()
     resources.initialise()
     self.ctx = utils.dummy_context()
     self.patch('heat.engine.service.warnings')
Exemplo n.º 12
0
 def setUp(self):
     super(validateTest, self).setUp()
     resources.initialise()
     self.fc = fakes_v1_1.FakeClient()
     self.gc = fakes_v1_1.FakeClient()
     resources.initialise()
     self.ctx = utils.dummy_context()
     self.patch('heat.engine.service.warnings')
Exemplo n.º 13
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__(host, topic)
        resources.initialise()

        self.engine_id = stack_lock.StackLock.generate_engine_id()
        self.thread_group_mgr = ThreadGroupManager()
        self.listener = EngineListener(host, self.engine_id)
        logger.debug(_("Starting listener for engine %s") % self.engine_id)
        self.listener.start()
Exemplo n.º 14
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__(host, topic)
        resources.initialise()

        self.engine_id = stack_lock.StackLock.generate_engine_id()
        self.thread_group_mgr = ThreadGroupManager()
        self.listener = EngineListener(host, self.engine_id)
        logger.debug(_("Starting listener for engine %s") % self.engine_id)
        self.listener.start()
Exemplo n.º 15
0
 def setUp(self):
     super(validateTest, self).setUp()
     resources.initialise()
     self.fc = fakes.FakeClient()
     self.gc = fakes.FakeClient()
     resources.initialise()
     self.ctx = utils.dummy_context()
     self.mock_warnings = mock.patch('heat.engine.service.warnings')
     self.mock_warnings.start()
     self.addCleanup(self.mock_warnings.stop)
Exemplo n.º 16
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__(host, topic)
        # stg == "Stack Thread Groups"
        self.stg = {}
        resources.initialise()

        self.listener = EngineListener(host, stack_lock.engine_id)
        logger.debug(_("Starting listener for engine %s")
                     % stack_lock.engine_id)
        self.listener.start()
Exemplo n.º 17
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__(host, topic)
        resources.initialise()
        self.host = host

        # The following are initialized here, but assigned in start() which
        # happens after the fork when spawning multiple worker processes
        self.stack_watch = None
        self.listener = None
        self.engine_id = None
        self.thread_group_mgr = None
Exemplo n.º 18
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__(host, topic)
        resources.initialise()
        self.host = host

        # The following are initialized here, but assigned in start() which
        # happens after the fork when spawning multiple worker processes
        self.stack_watch = None
        self.listener = None
        self.engine_id = None
        self.thread_group_mgr = None
Exemplo n.º 19
0
    def setUp(self):
        super(MistralCronTriggerTest, self).setUp()
        resources.initialise()
        utils.setup_dummy_db()
        self.ctx = utils.dummy_context()

        t = template_format.parse(stack_template)
        self.stack = utils.parse_stack(t)
        resource_defns = self.stack.t.resource_definitions(self.stack)
        self.rsrc_defn = resource_defns["cron_trigger"]

        self.client = mock.Mock()
        self.patchobject(MistralCronTriggerTestResource, "client", return_value=self.client)
Exemplo n.º 20
0
    def __init__(self,
                 context,
                 stack_name,
                 tmpl,
                 parameters=None,
                 stack_id=None,
                 state=None,
                 state_description='',
                 timeout_mins=60,
                 resolve_data=True,
                 disable_rollback=True):
        '''
        Initialise from a context, name, Template object and (optionally)
        Parameters object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
            raise ValueError(
                _("Invalid stack name %s" % stack_name +
                  ", must contain only alphanumeric or " +
                  "\"_-.\" characters, must start with alpha"))

        self.id = stack_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.state = state
        self.state_description = state_description
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback

        resources.initialise()

        if parameters is None:
            parameters = Parameters(self.name, self.t)
        self.parameters = parameters

        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[template.OUTPUTS])
        else:
            self.outputs = {}

        template_resources = self.t[template.RESOURCES]
        self.resources = dict((name, resource.Resource(name, data, self))
                              for (name, data) in template_resources.items())

        self.dependencies = self._get_dependencies(self.resources.itervalues())
Exemplo n.º 21
0
    def setUp(self):
        super(MistralCronTriggerTest, self).setUp()
        resources.initialise()
        utils.setup_dummy_db()
        self.ctx = utils.dummy_context()

        t = template_format.parse(stack_template)
        self.stack = utils.parse_stack(t)
        resource_defns = self.stack.t.resource_definitions(self.stack)
        self.rsrc_defn = resource_defns['cron_trigger']

        self.client = mock.Mock()
        self.patchobject(cron_trigger.CronTrigger, 'client',
                         return_value=self.client)
Exemplo n.º 22
0
    def setUp(self):
        super(ManilaSecurityServiceTest, self).setUp()
        resources.initialise()
        utils.setup_dummy_db()
        self.ctx = utils.dummy_context()

        t = template_format.parse(stack_template)
        self.stack = utils.parse_stack(t)
        resource_defns = self.stack.t.resource_definitions(self.stack)
        self.rsrc_defn = resource_defns['security_service']

        self.client = mock.Mock()
        self.patchobject(security_service.SecurityService, 'client',
                         return_value=self.client)
    def __init__(self, yaml_file, files, yml_data):
        resources.initialise()
        self.fc = fakes_nova.FakeClient()
        self.gc = fakes_nova.FakeClient()
        resources.initialise()
        self.ctx = utils.dummy_context()
        self.mock_isa = mock.patch(
            "heat.engine.resource.Resource.is_service_available",
            return_value=(True, None),
        )
        self.mock_is_service_available = self.mock_isa.start()
        self.engine = service.EngineService("a", "t")

        self.yaml_file = yaml_file
        self.files = files
        self.yml_data = yml_data
Exemplo n.º 24
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__()
        resources.initialise()
        self.host = host
        self.topic = topic

        # The following are initialized here, but assigned in start() which
        # happens after the fork when spawning multiple worker processes
        self.stack_watch = None
        self.listener = None
        self.engine_id = None
        self.thread_group_mgr = None
        self.target = None

        if cfg.CONF.instance_user:
            warnings.warn('The "instance_user" option in heat.conf is '
                          'deprecated and will be removed in the Juno '
                          'release.')
Exemplo n.º 25
0
    def __init__(self, host, topic, manager=None):
        super(EngineService, self).__init__()
        resources.initialise()
        self.host = host
        self.topic = topic

        # The following are initialized here, but assigned in start() which
        # happens after the fork when spawning multiple worker processes
        self.stack_watch = None
        self.listener = None
        self.engine_id = None
        self.thread_group_mgr = None
        self.target = None

        if cfg.CONF.instance_user:
            warnings.warn('The "instance_user" option in heat.conf is '
                          'deprecated and will be removed in the Juno '
                          'release.')
Exemplo n.º 26
0
    def __init__(self, context, stack_name, tmpl, parameters=None,
                 stack_id=None, state=None, state_description='',
                 timeout_mins=60, resolve_data=True, disable_rollback=True):
        '''
        Initialise from a context, name, Template object and (optionally)
        Parameters object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
            raise ValueError(_('Invalid stack name %s'
                               ' must contain only alphanumeric or '
                               '\"_-.\" characters, must start with alpha'
                               ) % stack_name)

        self.id = stack_id
        self.context = context
        self.clients = Clients(context)
        self.t = tmpl
        self.name = stack_name
        self.state = state
        self.state_description = state_description
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback

        resources.initialise()

        if parameters is None:
            parameters = Parameters(self.name, self.t)
        self.parameters = parameters

        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[template.OUTPUTS])
        else:
            self.outputs = {}

        template_resources = self.t[template.RESOURCES]
        self.resources = dict((name,
                               resource.Resource(name, data, self))
                              for (name, data) in template_resources.items())

        self.dependencies = self._get_dependencies(self.resources.itervalues())
 def setUp(self):
     super(ManilaShareTypeTest, self).setUp()
     resources.initialise()
     utils.setup_dummy_db()
     self.ctx = utils.dummy_context()
Exemplo n.º 28
0
 def __init__(self, host, topic, manager=None):
     super(EngineService, self).__init__(host, topic)
     # stg == "Stack Thread Groups"
     self.stg = {}
     resources.initialise()
Exemplo n.º 29
0
    def __init__(self, context, stack_name, tmpl, env=None,
                 stack_id=None, action=None, status=None,
                 status_reason='', timeout_mins=None, resolve_data=True,
                 disable_rollback=True, parent_resource=None, owner_id=None,
                 adopt_stack_data=None, stack_user_project_id=None,
                 created_time=None, updated_time=None,
                 user_creds_id=None, tenant_id=None,
                 use_stored_context=False, username=None,
                 stack_apps_style=None, isscaler=False,
                 enduser=None, description=None, app_name=None, template_id=None,error_codes=None):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        if owner_id is None:
            if re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", stack_name) is None:
                raise ValueError(_('Invalid stack name %s'
                                   ' must contain only alphanumeric or '
                                   '\"_-.\" characters, must start with alpha'
                                   ) % stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.t = tmpl
        self.name = stack_name
        self.action = self.CREATE if action is None else action
        self.status = self.IN_PROGRESS if status is None else status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None
        self._access_allowed_handlers = {}
        self._db_resources = None
        self.adopt_stack_data = adopt_stack_data
        self.stack_user_project_id = stack_user_project_id
        self.created_time = created_time
        self.updated_time = updated_time
        self.user_creds_id = user_creds_id
        #add by xm=2015.06.02
        self.stack_apps_style = stack_apps_style
        self.isscaler = isscaler
        self.enduser = enduser
        self.description = description
        self.app_name = app_name
        if error_codes is not None:
            self.error_codes = error_codes
        else:
            self.error_codes = []
        self.template_id = template_id

        if use_stored_context:
            self.context = self.stored_context()

        self.clients = self.context.clients

        # This will use the provided tenant ID when loading the stack
        # from the DB or get it from the context for new stacks.
        self.tenant_id = tenant_id or self.context.tenant_id
        self.username = username or self.context.username

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = self.t.parameters(self.identifier(),
                                            user_params=self.env.params)
        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[self.t.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 30
0
def setup(app):

    resources.initialise()
    app.add_node(resourcepages)

    app.add_directive('resourcepages', ResourcePages)
Exemplo n.º 31
0
    def __init__(self, context, stack_name, tmpl, env=None,
                 stack_id=None, action=None, status=None,
                 status_reason='', timeout_mins=None, resolve_data=True,
                 disable_rollback=True, parent_resource=None, owner_id=None,
                 adopt_stack_data=None, stack_user_project_id=None,
                 created_time=None, updated_time=None,
                 user_creds_id=None, tenant_id=None,
                 use_stored_context=False, username=None,
                 nested_depth=0):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''

        def _validate_stack_name(name):
            if not re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", name):
                message = _('Invalid stack name %s must contain '
                            'only alphanumeric or \"_-.\" characters, '
                            'must start with alpha') % name
                raise exception.StackValidationFailed(message=message)

        if owner_id is None:
            _validate_stack_name(stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.t = tmpl
        self.name = stack_name
        self.action = self.CREATE if action is None else action
        self.status = self.IN_PROGRESS if status is None else status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None
        self._access_allowed_handlers = {}
        self._db_resources = None
        self.adopt_stack_data = adopt_stack_data
        self.stack_user_project_id = stack_user_project_id
        self.created_time = created_time
        self.updated_time = updated_time
        self.user_creds_id = user_creds_id
        self.nested_depth = nested_depth

        if use_stored_context:
            self.context = self.stored_context()

        self.clients = self.context.clients

        # This will use the provided tenant ID when loading the stack
        # from the DB or get it from the context for new stacks.
        self.tenant_id = tenant_id or self.context.tenant_id
        self.username = username or self.context.username

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = self.t.parameters(
            self.identifier(),
            user_params=self.env.params,
            param_defaults=self.env.param_defaults)
        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[self.t.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 32
0
 def setUp(self):
     super(ManilaShareTypeTest, self).setUp()
     resources.initialise()
     utils.setup_dummy_db()
     self.ctx = utils.dummy_context()
Exemplo n.º 33
0
    def __init__(self,
                 context,
                 stack_name,
                 tmpl,
                 env=None,
                 stack_id=None,
                 action=None,
                 status=None,
                 status_reason='',
                 timeout_mins=None,
                 resolve_data=True,
                 disable_rollback=True,
                 parent_resource=None,
                 owner_id=None,
                 adopt_stack_data=None,
                 stack_user_project_id=None,
                 created_time=None,
                 updated_time=None,
                 user_creds_id=None,
                 tenant_id=None,
                 use_stored_context=False,
                 username=None,
                 nested_depth=0,
                 strict_validate=True):
        '''
        Initialise from a context, name, Template object and (optionally)
        Environment object. The database ID may also be initialised, if the
        stack is already in the database.
        '''
        def _validate_stack_name(name):
            if not re.match("[a-zA-Z][a-zA-Z0-9_.-]*$", name):
                message = _('Invalid stack name %s must contain '
                            'only alphanumeric or \"_-.\" characters, '
                            'must start with alpha') % name
                raise exception.StackValidationFailed(message=message)

        if owner_id is None:
            _validate_stack_name(stack_name)

        self.id = stack_id
        self.owner_id = owner_id
        self.context = context
        self.t = tmpl
        self.name = stack_name
        self.action = self.CREATE if action is None else action
        self.status = self.IN_PROGRESS if status is None else status
        self.status_reason = status_reason
        self.timeout_mins = timeout_mins
        self.disable_rollback = disable_rollback
        self.parent_resource = parent_resource
        self._resources = None
        self._dependencies = None
        self._access_allowed_handlers = {}
        self._db_resources = None
        self.adopt_stack_data = adopt_stack_data
        self.stack_user_project_id = stack_user_project_id
        self.created_time = created_time
        self.updated_time = updated_time
        self.user_creds_id = user_creds_id
        self.nested_depth = nested_depth
        self.strict_validate = strict_validate

        if use_stored_context:
            self.context = self.stored_context()

        self.clients = self.context.clients

        # This will use the provided tenant ID when loading the stack
        # from the DB or get it from the context for new stacks.
        self.tenant_id = tenant_id or self.context.tenant_id
        self.username = username or self.context.username

        resources.initialise()

        self.env = env or environment.Environment({})
        self.parameters = self.t.parameters(
            self.identifier(),
            user_params=self.env.params,
            param_defaults=self.env.param_defaults)
        self._set_param_stackid()

        if resolve_data:
            self.outputs = self.resolve_static_data(self.t[self.t.OUTPUTS])
        else:
            self.outputs = {}
Exemplo n.º 34
0
def setup(app):
    resources.initialise()
    _load_all_resources()
    app.add_node(resourcepages)

    app.add_directive('resourcepages', ResourcePages)
Exemplo n.º 35
0
 def __init__(self, host, topic, manager=None):
     super(EngineService, self).__init__(host, topic)
     # stg == "Stack Thread Groups"
     self.stg = {}
     resources.initialise()
Exemplo n.º 36
0
def setup(app):

    resources.initialise()
    app.add_node(resourcepages)

    app.add_directive("resourcepages", ResourcePages)