hassio-addons/addon-node-red

Add read access to backup folder #483

jmservera posted onGitHub

Problem/Motivation

I want to do regular backups and then copy them to the cloud, with node-red I can do the backups, I can even control how to name then but once done I cannot access the folder to copy them.

Expected behavior

Have read access to the backup folder so this flow gets a notification for a file change:

daily snapshot

Actual behavior

Backup folder is not permitted

Steps to reproduce

Use a watch node pointing to the backup folder, nothing ever happens. If you do a docker exec into the nodered container there's no access to the backup folder.

Proposed changes

I propose to add read only access to the backup folder by adding it into the "map" entry.


:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be useful.

posted by addons-assistant[bot] about 5 years ago

As a thought could you use the api to download the snapshot /snapshots/{slug}/download ?

https://github.com/home-assistant/supervisor/blob/dev/API.md

<blockquote><img src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicon.ico" height="14"> GitHub</div><div><strong><a href="https://github.com/home-assistant/supervisor">home-assistant/supervisor</a></strong></div><div>:house_with_garden: First private cloud supervisor for home automation - home-assistant/supervisor</div></blockquote>

posted by sinclairpaul about 5 years ago

Duplicate of #296

Closing it with the same reasoning.

posted by frenck about 5 years ago

Duplicate of #296

Closing it with the same reasoning.

How is read-only access different from using the API from a security standpoint? I think using the API you can get access to all the backups as well, but with the extra overhead of using an HTTP request, and, furthermore, I will have to poll for changes instead of getting an event when a backup is dropped in the folder.

posted by jmservera about 5 years ago

As a thought could you use the api to download the snapshot /snapshots/{slug}/download ?

https://github.com/home-assistant/supervisor/blob/dev/API.md

<img alt="" width="48" src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4"><img alt="" height="14" src="https://camo.githubusercontent.com/4908d9947135e4536ef61d61512ee575f869bf6f/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f66617669636f6e2e69636f"> GitHubhome-assistant/supervisor🏡 First private cloud supervisor for home automation - home-assistant/supervisor

Thanks for the tip, really useful as a workaround.

<blockquote><img src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicon.ico" height="14"> GitHub</div><div><strong><a href="https://github.com/home-assistant/supervisor">home-assistant/supervisor</a></strong></div><div>:house_with_garden: First private cloud supervisor for home automation - home-assistant/supervisor</div></blockquote>

posted by jmservera about 5 years ago

As a thought could you use the api to download the snapshot /snapshots/{slug}/download ? https://github.com/home-assistant/supervisor/blob/dev/API.md

<img alt="" width="48" src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4"><img alt="" height="14" src="https://camo.githubusercontent.com/4908d9947135e4536ef61d61512ee575f869bf6f/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f66617669636f6e2e69636f"> GitHubhome-assistant/supervisor🏡 First private cloud supervisor for home automation - home-assistant/supervisor

Thanks for the tip, really useful as a workaround.

<img alt="" width="48" src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4"><img alt="" height="14" src="https://camo.githubusercontent.com/4908d9947135e4536ef61d61512ee575f869bf6f/68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f66617669636f6e2e69636f"> GitHubhome-assistant/supervisor🏡 First private cloud supervisor for home automation - home-assistant/supervisor

I've done a flow to upload backups to a blob, but you still have to automate backups with automation, calling snapshot service from node-red fails from time to time:

[ { "id": "c334d0d7.0bb2f", "type": "tab", "label": "Upload snapshots", "disabled": false, "info": "" }, { "id": "e987d241.b66c28", "type": "http request", "z": "c334d0d7.0bb2f", "name": "List snapshots", "method": "GET", "ret": "obj", "paytoqs": false, "url": "supervisor/snapshots", "tls": "", "persist": false, "proxy": "", "authType": "", "x": 720, "y": 200, "wires": [ [ "d5b70ab6.2e4fe8" ] ] }, { "id": "77a1f8f2.a5ba48", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "set", "p": "headers", "pt": "msg", "to": "headers", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 200, "wires": [ [ "e987d241.b66c28" ] ] }, { "id": "6eebfb63.395cdc", "type": "inject", "z": "c334d0d7.0bb2f", "name": "Upload last snapshot every day", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "30 00 * * *", "once": false, "onceDelay": 0.1, "x": 260, "y": 80, "wires": [ [ "5dc6d74d.770068" ] ] }, { "id": "19e72d08.5df043", "type": "template", "z": "c334d0d7.0bb2f", "name": "", "field": "headers", "fieldType": "flow", "format": "handlebars", "syntax": "mustache", "template": "{ \"Authorization\": \"Bearer {{payload}}\"}", "output": "json", "x": 320, "y": 200, "wires": [ [ "77a1f8f2.a5ba48" ] ] }, { "id": "9e9d1b8d.725498", "type": "file", "z": "c334d0d7.0bb2f", "name": "", "filename": "", "appendNewline": false, "createDir": false, "overwriteFile": "true", "encoding": "none", "x": 850, "y": 380, "wires": [ [ "445de30f.92cc24" ] ] }, { "id": "5ce915cf.c1f5a4", "type": "sort", "z": "c334d0d7.0bb2f", "name": "", "order": "descending", "as_num": false, "target": "payload", "targetType": "msg", "msgKey": "date", "msgKeyType": "jsonata", "seqKey": "payload", "seqKeyType": "msg", "x": 470, "y": 300, "wires": [ [ "c5471d4f.816998" ] ] }, { "id": "d5b70ab6.2e4fe8", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "move", "p": "payload.data.snapshots", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 220, "y": 300, "wires": [ [ "5ce915cf.c1f5a4" ] ] }, { "id": "c5471d4f.816998", "type": "change", "z": "c334d0d7.0bb2f", "name": "Get first element", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload[0]", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 300, "wires": [ [ "206a2e22.5b1f12" ] ] }, { "id": "fc48cb60.985758", "type": "http request", "z": "c334d0d7.0bb2f", "name": "Download snapshot", "method": "GET", "ret": "bin", "paytoqs": false, "url": "", "tls": "", "persist": false, "proxy": "", "authType": "", "x": 640, "y": 380, "wires": [ [ "9e9d1b8d.725498" ] ] }, { "id": "206a2e22.5b1f12", "type": "template", "z": "c334d0d7.0bb2f", "name": "Format download url with slug", "field": "url", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "supervisor/snapshots/{{payload.slug}}/download", "output": "str", "x": 950, "y": 300, "wires": [ [ "6250f00.dc2dd9", "4709f940.c73178" ] ] }, { "id": "9b7956fd.ae7638", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "set", "p": "headers", "pt": "msg", "to": "headers", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 390, "y": 380, "wires": [ [ "fc48cb60.985758" ] ] }, { "id": "5dc6d74d.770068", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "SUPERVISOR_TOKEN", "tot": "env" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 140, "y": 200, "wires": [ [ "19e72d08.5df043" ] ] }, { "id": "6250f00.dc2dd9", "type": "change", "z": "c334d0d7.0bb2f", "name": "Get filename", "rules": [ { "t": "set", "p": "filename", "pt": "flow", "to": "\"/share/\"&payload.name", "tot": "jsonata" }, { "t": "set", "p": "filename", "pt": "msg", "to": "filename", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 150, "y": 380, "wires": [ [ "9b7956fd.ae7638" ] ] }, { "id": "e538495c.cd541", "type": "Save Blob", "z": "c334d0d7.0bb2f", "name": "Azure Save Blob Storage", "x": 550, "y": 480, "wires": [ [ "31ec824.e00027e", "6c965959.a273d8" ] ] }, { "id": "445de30f.92cc24", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "filename", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 260, "y": 480, "wires": [ [ "e538495c.cd541" ] ] }, { "id": "17864195.c93666", "type": "file", "z": "c334d0d7.0bb2f", "name": "", "filename": "", "appendNewline": true, "createDir": false, "overwriteFile": "delete", "encoding": "none", "x": 590, "y": 580, "wires": [ [ "6c965959.a273d8" ] ] }, { "id": "31ec824.e00027e", "type": "function", "z": "c334d0d7.0bb2f", "name": "Empty message", "func": "return {};", "outputs": 1, "noerr": 0, "x": 180, "y": 580, "wires": [ [ "cd43f1a7.0259c" ] ] }, { "id": "cd43f1a7.0259c", "type": "change", "z": "c334d0d7.0bb2f", "name": "", "rules": [ { "t": "set", "p": "filename", "pt": "msg", "to": "filename", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 410, "y": 580, "wires": [ [ "17864195.c93666" ] ] }, { "id": "6c965959.a273d8", "type": "debug", "z": "c334d0d7.0bb2f", "name": "", "active": true, "tosidebar": true, "console": true, "tostatus": false, "complete": "true", "targetType": "full", "x": 870, "y": 540, "wires": [] }, { "id": "4709f940.c73178", "type": "debug", "z": "c334d0d7.0bb2f", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 1030, "y": 380, "wires": [] } ]

<blockquote><img src="https://avatars1.githubusercontent.com/u/13844975?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicon.ico" height="14"> GitHub</div><div><strong><a href="https://github.com/home-assistant/supervisor">home-assistant/supervisor</a></strong></div><div>:house_with_garden: First private cloud supervisor for home automation - home-assistant/supervisor</div></blockquote>

posted by jmservera about 5 years ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

posted by addons-assistant[bot] about 5 years ago

Fund this Issue

$0.00
Funded

Pull requests