|
72 | 72 | BAD_CFG = "invalid config; {}".format(SEE_LOG)
|
73 | 73 | SBADCFG = " ({})".format(BAD_CFG)
|
74 | 74 |
|
| 75 | +PTN_U_GRP = re.compile(r"\$\{u%([+-])([^}]+)\}") |
| 76 | + |
75 | 77 |
|
76 | 78 | class CfgEx(Exception):
|
77 | 79 | pass
|
@@ -953,12 +955,24 @@ def _map_volume_idp(
|
953 | 955 | un_gn = [("", "")]
|
954 | 956 |
|
955 | 957 | for un, gn in un_gn:
|
| 958 | + m = PTN_U_GRP.search(dst0) |
| 959 | + if m: |
| 960 | + req, gnc = m.groups() |
| 961 | + hit = gnc in (un_gns.get(un) or []) |
| 962 | + if req == "+": |
| 963 | + if not hit: |
| 964 | + continue |
| 965 | + elif hit: |
| 966 | + continue |
| 967 | + |
956 | 968 | # if ap/vp has a user/group placeholder, make sure to keep
|
957 | 969 | # track so the same user/group is mapped when setting perms;
|
958 | 970 | # otherwise clear un/gn to indicate it's a regular volume
|
959 | 971 |
|
960 | 972 | src1 = src0.replace("${u}", un or "\n")
|
961 | 973 | dst1 = dst0.replace("${u}", un or "\n")
|
| 974 | + src1 = PTN_U_GRP.sub(un or "\n", src1) |
| 975 | + dst1 = PTN_U_GRP.sub(un or "\n", dst1) |
962 | 976 | if src0 == src1 and dst0 == dst1:
|
963 | 977 | un = ""
|
964 | 978 |
|
@@ -2312,7 +2326,7 @@ def _reload(self, verbosity: int = 9) -> None:
|
2312 | 2326 | idp_vn, _ = vfs.get(idp_vp, "*", False, False)
|
2313 | 2327 | idp_vp0 = idp_vn.vpath0
|
2314 | 2328 |
|
2315 |
| - sigils = set(re.findall(r"(\${[ug]})", idp_vp0)) |
| 2329 | + sigils = set(re.findall(r"(\${[ug][}%])", idp_vp0)) |
2316 | 2330 | if len(sigils) > 1:
|
2317 | 2331 | t = '\nWARNING: IdP-volume "/%s" created by "/%s" has multiple IdP placeholders: %s'
|
2318 | 2332 | self.idp_warn.append(t % (idp_vp, idp_vp0, list(sigils)))
|
@@ -2344,7 +2358,7 @@ def _reload(self, verbosity: int = 9) -> None:
|
2344 | 2358 | elif oth_write:
|
2345 | 2359 | taxs = "WRITABLE BY %r" % (oth_write,)
|
2346 | 2360 | else:
|
2347 |
| - continue |
| 2361 | + break # no sigil; not idp; safe to stop |
2348 | 2362 |
|
2349 | 2363 | t = '\nWARNING: IdP-volume "/%s" created by "/%s" has parent/grandparent "/%s" and would be %s'
|
2350 | 2364 | self.idp_err.append(t % (idp_vp, idp_vp0, par_vn.vpath, taxs))
|
|
0 commit comments