From patchwork Sat Mar 9 15:11:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1909978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=nPWBVyh+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33f; helo=mail-wm1-x33f.google.com; envelope-from=swupdate+bncbaabbr7ywgxqmgqesp3tvji@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-wm1-x33f.google.com (mail-wm1-x33f.google.com [IPv6:2a00:1450:4864:20::33f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsRNF2QKpz23qr for ; Sun, 10 Mar 2024 02:12:12 +1100 (AEDT) Received: by mail-wm1-x33f.google.com with SMTP id 5b1f17b1804b1-4131765ac62sf8230185e9.0 for ; Sat, 09 Mar 2024 07:12:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709997129; cv=pass; d=google.com; s=arc-20160816; b=GHH+tH54vxSgw7ehUsSuJ5qv7pf2bYkklHkIa/XmFp2d6zSEQCv6NvccNauQNQKhhd OR2oz6B/bgpioOf3eQYc/2UbR10dRX87eiSoQNYuVED+psHVHhhjfMLHJ8ObWV9ST7TB fyu7ZkY+jscWXQXwJjWXOobOl9tlKxcmaI6qh9k8cskqNMQY5crcjomASd4YkWOpanb5 Ez2+0C4iyj+3JxPl97+PJaHlD4zO2mEEsBVPK7nDdz1MfMTyqD01DZe9NcdEv+rkEoaX /ukjDYkcdXystdbx4cHXzUd2h9327IfZl6Hkn9cRFVV3ByPyF4JncNWqXbgFpHlK8wAO KE6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=L94ePFCg/YDYf0YjBzfudAQkOPgEvcJAbfFjIy54CHQ=; fh=XmboP/77JO02+pwCe/aeqSEq/uETDGDlnTsdMkz/+tA=; b=mwkYMD+dPeyZacnJdtBjwudx76pkP/3Ex3f1WF+xgikO/KvBQyvesDi4+48My5sRSW KxBfpasZ+3bOVZxeE1U64B4y5zDEKu3bgW52Dw4z+5QxW/q1sPf8e8yFDpYx4MyVyY3j vqrQV8L7NzBt9Y5K7yHInKlip1CH/YEiK0W9DmpcLyZQsh9EDjrxon81uWvy1mkV4tLy IdonIu3WngX73Jesnw94BVCGELFuv5PCFmNSsRkQoGN0r59fY1ywIsTAzA8GSPVHCZ9N 4re2qfd6Fk67K0Y+GLINw8NP1nRKpc2gyz40+MkPMBpiKPyUcU1cqJssTXVsXYoOoxpX zPbg==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=bIaB4eRf; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1709997129; x=1710601929; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=L94ePFCg/YDYf0YjBzfudAQkOPgEvcJAbfFjIy54CHQ=; b=nPWBVyh+JUo31Z4Oe8kel+p1Sv5xz7iGXtd1jcqHk/NRUKhYWS4lR9xJC1T3UEDQfY UU6TTyTONphLEhoi+/r8J9uoixLrLOkZntKgW7qYrxVE5YgQ0IvHaH/XKEw7kvPIl3zB NZ2w6xRNKs7RhJ07AFPrG18DnHfw/nHiAWuebv7NJmnUv9/VCheWIHttUIEgxl5OSAyp PmrfEwhsGZx20WhtIwKW3IWkeeS7V4Y9l+0ZSwS6430/UGEv7fSFr65XVxJZRKbzOejX XJyUkS3mh6k8jdxkur8BU156z8HgiflD7JIk60lcUbWPzXP+JgdloGgeGITYaiDiL4nE 6cTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709997129; x=1710601929; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=L94ePFCg/YDYf0YjBzfudAQkOPgEvcJAbfFjIy54CHQ=; b=uCHcUXmJnkUtPF3R2kbuzBrHtiRWYSxc1Dg6JHAYyK6eGFdnUmcnkD5hFNhb9nsiN9 0qozaHmtM9Q/Ouq+lc6uY2pVh31w3HWcUua0IT9OlG1FOo/+T6MdN4dg99CPltpMlppU fEosmP3rPpQvMAYV58xFqOClJxUwOFj/8Oopxhsxoy8GMkVjOqO+STYZCq3zksnUWDBf DCdRwLSJZls+q2ZNTVhN+Z8OinNgBOJB+P4kvLUXUYE6RbrmJwLXCJDvYU9kB8vBN6Vr jV0gs+1fQuIz13BA6y3dBNd8SuXlR/PKmvX7k7G096NpNPwNiyNUhFh9TmjKxkj0jmeM 96/Q== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXagBPWLHoblxO+Sm/mbIMNnVqCUsOgc2YJ+iGWFLlRKqL0VccmY+Upb7laA6WlQJvE7on79nLYgXtiiFK6MSijRoSV1g3lF8S0xbJMRA== X-Gm-Message-State: AOJu0YwLjDyw7r4amsbr8Pq0SXw2Nxrz/3shW1MEfIMxKdQSy02XcPH4 bpfZBPhoZjg9AJOsW6VoFtCHWrF6Wsgv7HjjpeyNyQ0H/+v/BCvf X-Google-Smtp-Source: AGHT+IFECc5EA201GpgrmiKai8B6dRiLF9gYO1+hgqMraZynZ62XAX1C0O4FlxS0SDwHQSFODgAlJw== X-Received: by 2002:a05:600c:4ecd:b0:413:1dbd:b4a9 with SMTP id g13-20020a05600c4ecd00b004131dbdb4a9mr1635288wmq.10.1709997127576; Sat, 09 Mar 2024 07:12:07 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:1d0b:b0:413:15f2:21ae with SMTP id l11-20020a05600c1d0b00b0041315f221aels907980wms.2.-pod-prod-01-eu; Sat, 09 Mar 2024 07:12:06 -0800 (PST) X-Received: by 2002:a05:600c:1d11:b0:413:21a4:a407 with SMTP id l17-20020a05600c1d1100b0041321a4a407mr997176wms.37.1709997125784; Sat, 09 Mar 2024 07:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709997125; cv=none; d=google.com; s=arc-20160816; b=yWNnDSd00nxTeW2G5bhyOocp99scUQbt6h90gL4w6otq2iXLnXoxhpgAHjZfZFOyqV Tk3fC0C+aj1cqIlYEl6fKPdfbN49jhzHAFmgaFsXQO3YjPCcHOaftQ/OaPO3CybzEYgP 00dR/y1KduV41yCUoQt+Tsa+LoYm32BcoxhGk1NoYaVHIZ1KH3TGYGWBkrkqiKej29BT 5l/79KFagEh637osmGfrEVmAJT/zs99m01HGOcq67h/M3H+kPPb/0NF/Y/+of29Y75OM aJm2vt9ZUqboC/iSZj+X2V4zb2om/w+Ni701XYCJRtu3GCsOZHOEuvc5rlH+68PZf9yY OtVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=+5O6lt97EwBEtqI1NRFO4o3pbV0Jp4dI981WeOJWHho=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=D4DRdTFQj9DtortKjWCySUy+8nOnpHCO8+CVAFuccR/K+Td8f/M0JxSYDEJN2jKHPv kpKxQCV2jGlOTPz8WvRpHNVcirOJwGCBlvZi/gactozvholJsAHaFU8Vh/yN4THWc486 8pKhNFoMYCKY4seFWKzUDr9zpJZSGTi06kndHaU8Dc49R+I7YDFB0M1+6l459IXPn8n8 yfyLrEoDFUDNcAZv4UiSwORvQYBX0RvPVHtLEURyH2mlQZ80IdDX+OiOfJWc8SIHLuAt wp7PrNSEI0kGY74rvFxCmSkO/3to0xEBgOyKOLcZpBrTQ0JkXluNkLFwBiDcjYuNSMB4 w5lA==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=bIaB4eRf; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.10]) by gmr-mx.google.com with ESMTPS id o19-20020a05600c4fd300b00412e5895f17si288704wmq.0.2024.03.09.07.12.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 07:12:05 -0800 (PST) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) client-ip=212.227.17.10; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1M42fG-1riyMn1Jui-0000bJ; Sat, 09 Mar 2024 16:12:05 +0100 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 5/5] doc: extend swuforward documentation Date: Sat, 9 Mar 2024 16:11:59 +0100 Message-Id: <20240309151159.8426-6-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240309151159.8426-1-stefano.babic@swupdate.org> References: <20240309151159.8426-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:BlrBb8U0WGiCzc+pr/pWy3zlQPfCO+COtuGxPj5KYJYRtFEc2Hx OnUxbSVzc09Yg01NkXMX4jNihffOYjQN9fv61LfoQrlk0U+xHL5fPSt9eyVza5QoY6cd2AO GCLRc8zbBv2tXoDv0TXwiNouiKtFIwHo+9sFNu3ib8vkCGUmUvIax1Mxof9o8OSLwgsA+KI b8pyi60ZJ73jccINglc9g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:CAn0zrSWCeg=;vup6q3V7tPBwTyCbKmY1hdPzFaR N2bIRKDJcmRe/p2S2j4yOvSFt+QEfpW51tU3ufKnfD5DifPaDtqVlib8TKvLxX6J3C2yPWJ6E JXmhG5vgwcJBHOvuKfamYW/v3PAFnrJ4hDXRtaLOEHKt9EUchtHb3XFWYScJk/j3SS6Qo9B0Y 0ACWvi9khMrD+/oAP3viS2iGDdgbTFqaDCjVbd+AYlnseRSpjxoEIBBuOlpOgkbwu2zm5CIX4 9f9l52+65OCg9+jsDZAoPGf/f3tWyXGHKXrQAMlfVWGmNe7LV4bMXBXdOG29Yi2Sg+GlBIKWX S2XR3bzglmm6Vp/vNZ++Sc1Lffup1h+VpulPHY1Tx3NXDEt9SEbI/OEZ0BkgY1T1IfLE5mf8x Gr0nRaC37+PKbDqSyOsfx/Wy/7J2D8ATPDu7shAYK+0CJgPgAwn2c8wi5FNjgwXwKR9tsGOKK zXhHEkjElTuEQhLhCOtCEQS/q3lUimHC6L/+fXd8DABZEf9CKkvP5OLtCi+3g5bXbLz8W4uCf fyMCiApSuV/y6WOE2zQSAxNWXp2blMZSqsgB2ERipfn07KzzZ11mCZfew7u2BsP+t5bmOtsy2 KY+zMiQ+IZgGlAudECSdEk4BDafdWDgQ0XQ7RqwMcnxmDsLK85wIhN0Yotn3WnKHoyqIvcaOa sX/a4sRT7Kggmzf4dDqJQwQYSgPteKmjNIyAmi9gP25euPHSd46Efw25sRNFWC0M6o8djsOm8 wp6LTJl0/bJhBv+M58V0aEvMw4raSRoa0z+teOev/mL+5rKkNKH77I= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=bIaB4eRf; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.10 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Describe hot to use the handler as generic uploader. Signed-off-by: Stefano Babic --- doc/source/handlers.rst | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) -- 2.34.1 diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst index da0bbeb8..9e09e420 100644 --- a/doc/source/handlers.rst +++ b/doc/source/handlers.rst @@ -627,6 +627,49 @@ the SWU forwarder: }; }); +The SWU forwarder can be used as generic uploader to an URL. This is requires to enable Lua support. +The back channel should still run via Websocket, if the connected server should communicate a progress status. +The handler allows to link an own Lua code that is able to parse the incoming data, and +report an error. The `properties field` should contain the name of the Lua function that +should be called to parse the answer from the remote system. Note that the data passed to Lua +is converted to a string (and null terminated). + +:: + + images: ( + { + filename = "image.swu"; + type = "swuforward"; + + properties: { + url = ["http://192.168.178.41", "http://192.168.178.42]; + parser-function = "parse_answer"; + }; + }); + +The parser function should be already loaded. The Lua function receives as input a string with the data +received via the Websocket back channel. The function will read the data and return a single scalar value +of swupdate_status, that is one of swupdate.RECOVERY_STATUS.*. +Example: + +:: + + function parse_answer(s) + if string.match (s, 'SUCCESS') then + return swupdate.RECOVERY_STATUS.SUCCESS + end + if string.match (s, 'FAILURE') then + return swupdate.RECOVERY_STATUS.FAILURE + end + + return swupdate.RECOVERY_STATUS.RUN + + end"; + +The handler evaluates the return value, and stops when one of SUCCESS or FAILURE is returned. + +If no parser-function is passed, the handler will run the internal parser used to connect +remote SWUpdate systems, and expects to see a JSON message sent by the Mongoose Webserver. rdiff handler -------------