From d869f740f804e5005083122900b88dba178ac741 Mon Sep 17 00:00:00 2001
From: wachsylon <fabian.wachsmann90@gmx.de>
Date: Thu, 8 Dec 2022 10:10:37 +0100
Subject: [PATCH] Use container for toggling

---
 tzis/swifthandling.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tzis/swifthandling.py b/tzis/swifthandling.py
index 4a9ae2a..725fec9 100644
--- a/tzis/swifthandling.py
+++ b/tzis/swifthandling.py
@@ -171,15 +171,16 @@ def get_token(swift_base, account, username=None, **kwargs):
     env,expires =  _get_envtoken(**kwargs)
     return env
 
-def toggle_public(fsmap):
+def toggle_public(container):
     "toggle container public read_acl settings"
     getenv = os.environ.get
-    conn = Connection(preauthurl=getenv('OS_STORAGE_URL'),
+    osurl=getenv('OS_STORAGE_URL')
+    conn = Connection(preauthurl=osurl,
                       preauthtoken=getenv('OS_AUTH_TOKEN'))
-    acl = conn.head_container(fsmap.root).get("x-container-read", "")
+    acl = conn.head_container(container).get("x-container-read", "")
     if ".r:*" in acl:
         acl = acl.replace(".r:*", "")
     else:
         acl = ",".join([acl, ".r:*,.rlistings"])
     acl = ",".join(sorted(filter(None, set(acl.split(",")))))
-    conn.post_container(fsmap.root, headers={"X-Container-Read": acl})
+    conn.post_container(container, headers={"X-Container-Read": acl})
-- 
GitLab