Exemplo n.º 1
0
    def _setup_sample_triggers(
        self, names=["st2.test.trigger1", "st2.test.trigger2", "st2.test.trigger3", "st2.test.trigger4"]
    ):
        trigger_dbs = []
        for name in names:
            trigtype = None
            try:
                trigtype = TriggerTypeDB()
                trigtype.pack = "dummy_pack_1"
                trigtype.name = name
                trigtype.description = ""
                trigtype.payload_schema = {}
                trigtype.parameters_schema = {}
                try:
                    trigtype = TriggerType.get_by_name(name)
                except:
                    trigtype = TriggerType.add_or_update(trigtype)
            except NotUniqueError:
                pass

            created = TriggerDB()
            created.name = name
            created.pack = "dummy_pack_1"
            created.description = ""
            created.type = trigtype.get_reference().ref

            if name in ["st2.test.trigger4"]:
                created.parameters = {"url": "sample"}
            else:
                created.parameters = {}

            created = Trigger.add_or_update(created)
            trigger_dbs.append(created)

        return trigger_dbs
Exemplo n.º 2
0
    def _setup_sample_triggers(self, names=['st2.test.trigger1', 'st2.test.trigger2',
                                            'st2.test.trigger3', 'st2.test.trigger4']):
        trigger_dbs = []
        for name in names:
            trigtype = None
            try:
                trigtype = TriggerTypeDB()
                trigtype.pack = 'dummy_pack_1'
                trigtype.name = name
                trigtype.description = ''
                trigtype.payload_schema = {}
                trigtype.parameters_schema = {}
                try:
                    trigtype = TriggerType.get_by_name(name)
                except:
                    trigtype = TriggerType.add_or_update(trigtype)
            except NotUniqueError:
                pass

            created = TriggerDB()
            created.name = name
            created.pack = 'dummy_pack_1'
            created.description = ''
            created.type = trigtype.get_reference().ref

            if name in ['st2.test.trigger4']:
                created.parameters = {'url': 'sample'}
            else:
                created.parameters = {}

            created = Trigger.add_or_update(created)
            trigger_dbs.append(created)

        return trigger_dbs
Exemplo n.º 3
0
 def _create_save_triggertype():
     created = TriggerTypeDB()
     created.pack = 'dummy_pack_1'
     created.name = 'triggertype-1'
     created.stupid = 'stupid'
     created.description = ''
     created.payload_schema = {}
     created.parameters_schema = {}
     return Trigger.add_or_update(created)
Exemplo n.º 4
0
 def _create_save_triggertype():
     created = TriggerTypeDB()
     created.pack = 'dummy_pack_1'
     created.name = 'triggertype-1'
     created.stupid = 'stupid'
     created.description = ''
     created.payload_schema = {}
     created.parameters_schema = {}
     return Trigger.add_or_update(created)
Exemplo n.º 5
0
    def _setup_sample_trigger(self, name):
        trigtype = TriggerTypeDB()
        trigtype.name = name
        trigtype.pack = 'dummy_pack_1'
        trigtype.description = ''
        trigtype.payload_schema = {}
        trigtype.parameters_schema = {}
        TriggerType.add_or_update(trigtype)

        created = TriggerDB()
        created.name = name
        created.pack = 'dummy_pack_1'
        created.description = ''
        created.type = trigtype.get_reference().ref
        created.parameters = {}
        Trigger.add_or_update(created)
Exemplo n.º 6
0
    def _setup_sample_triggers(self,
                               names=[
                                   'st2.test.trigger1', 'st2.test.trigger2',
                                   'st2.test.trigger3', 'st2.test.trigger4'
                               ]):
        trigger_dbs = []
        for name in names:
            trigtype = None
            try:
                trigtype = TriggerTypeDB()
                trigtype.pack = 'dummy_pack_1'
                trigtype.name = name
                trigtype.description = ''
                trigtype.payload_schema = {}
                trigtype.parameters_schema = {}
                try:
                    trigtype = TriggerType.get_by_name(name)
                except:
                    trigtype = TriggerType.add_or_update(trigtype)
            except NotUniqueError:
                pass

            created = TriggerDB()
            created.name = name
            created.pack = 'dummy_pack_1'
            created.description = ''
            created.type = trigtype.get_reference().ref

            if name in ['st2.test.trigger4']:
                created.parameters = {'url': 'sample'}
            else:
                created.parameters = {}

            created = Trigger.add_or_update(created)
            trigger_dbs.append(created)

        return trigger_dbs