示例#1
0
    def run(self, args, **kwargs):
        instance = Inquiry()
        instance.id = args.id
        inquiry = self.get_resource_by_id(id=args.id, **kwargs)
        if args.response:
            instance.response = json.loads(args.response)
        else:
            response = InteractiveForm(
                inquiry.schema.get('properties')).initiate_dialog()
            instance.response = response

        return self.manager.respond(inquiry_id=instance.id,
                                    inquiry_response=instance.response,
                                    **kwargs)
示例#2
0
文件: inquiry.py 项目: StackStorm/st2
    def run(self, args, **kwargs):
        instance = Inquiry()
        instance.id = args.id
        inquiry = self.get_resource_by_id(id=args.id, **kwargs)
        if args.response:
            instance.response = json.loads(args.response)
        else:
            response = InteractiveForm(
                inquiry.schema.get('properties')).initiate_dialog()
            instance.response = response

        return self.manager.respond(inquiry_id=instance.id,
                                    inquiry_response=instance.response,
                                    **kwargs)
示例#3
0
    def run(self, args, **kwargs):
        instance = Inquiry()
        instance.id = args.id
        inquiry = self.get_resource_by_id(id=args.id, **kwargs)
        if args.response:
            instance.response = json.loads(args.response)
        else:
            response = InteractiveForm(
                inquiry.schema.get('properties')).initiate_dialog()
            instance.response = response

        # Send the response to the API first, then sanitize secrets
        instance = self.manager.update(instance, **kwargs)
        instance = self.sanitize_secrets(instance, inquiry.schema)
        return instance