From cda9df9e13a05bffe2a5559fe804cccb41ea5f58 Mon Sep 17 00:00:00 2001 From: Linus Vogel Date: Sun, 31 May 2026 18:52:14 +0200 Subject: [PATCH] added states and hostgroup to pillar output --- pillar_tool/__pycache__/__init__.cpython-313.pyc | Bin 188 -> 0 bytes .../__pycache__/__init__.cpython-313.pyc | Bin 199 -> 0 bytes .../basicauth_backend.cpython-313.pyc | Bin 2018 -> 0 bytes pillar_tool/routers/pillar.py | 13 ++++++++++++- 4 files changed, 12 insertions(+), 1 deletion(-) delete mode 100644 pillar_tool/__pycache__/__init__.cpython-313.pyc delete mode 100644 pillar_tool/middleware/__pycache__/__init__.cpython-313.pyc delete mode 100644 pillar_tool/middleware/__pycache__/basicauth_backend.cpython-313.pyc diff --git a/pillar_tool/__pycache__/__init__.cpython-313.pyc b/pillar_tool/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 272a76d25a37f52abb2ed920a0e329d6f7558250..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmey&%ge<81Z%hXXM*U*AOZ#$p^VQgK*m&tbOudEzm*I{OhDdekkqYc{fzwFRQ;UH zywYNQm(=3ylKcXF51^1wVp2d+epYI72~a$-Br!QPuOzj|H!&|UJvA4|)(^ diff --git a/pillar_tool/middleware/__pycache__/__init__.cpython-313.pyc b/pillar_tool/middleware/__pycache__/__init__.cpython-313.pyc deleted file mode 100644 index 305b1e414b2f2959df536ee4b568c87a663e9f70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 199 zcmey&%ge<81U=jynIQTxh=2h`DC08=kTI1Zok5e)ZzV$!6Oi{ABy}rIKO;XkRX-;) zue4a-CAB!aB)>r411RK^m=sWypOuPO4oIE6`eyvx-5C NkIamWj77{q764vyHgo_0 diff --git a/pillar_tool/middleware/__pycache__/basicauth_backend.cpython-313.pyc b/pillar_tool/middleware/__pycache__/basicauth_backend.cpython-313.pyc deleted file mode 100644 index 7f9c04e86fd3ca55186645cfbec70c16bc1c8ecb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2018 zcmZt{O>Y}Tbk^QouN}La58?zjO}A+%aY=28oPg4XCT(bo(=XY$RC1-&dUtFuUGKWH z>qfOIgg`=x02L0ET5(7@0k0dqD)aRztYf=DmkmTLr6Th3Z5(?&L9 z1h@yT19}SN%QEB?z8FAk){nRn8|QHMX~ou6>ZTpYMi)_0eQg7Dqv`pC{F|eMdKgH= zVBT{;QZ>+raDs1|OLC%*6xMp@N6K$+U z{8dvqevEOd-GDlOm@d^5E?~GrSFZ(6zExP-ZX}RCnex;CX<|wXgQFXmopaO5hO4Z(;df zkDh%yy-78@!+L8??Bs;-oO!BS{BmlZn4(~ zE?LqJigX?-8bp{Y&^oO5y=&f53|(`Dq^w$o6EJ-wHESc%>i~0h)zBTx8P)=E#S?uvnZm)sWJ-gor9sTM_s~_vsKHk6_2x{S zGUr^87ELJVredqQj=2^gSXGdt(>_MDNQoy$aUk|-1KAD_OQGFlp#!%}&li`-Wpx zljjNPf>OAGtPh~-5W3Ac$jAAxltvRM9HT zV!ij3#*tIa-kC;t=84#M_s-It`)*7nUwAo?R3BslaC+ zJ{)L@W9!j)G-3=O=)sPIIt*ud2L;c-A^q~J(yaaelY#rSW}!{WS?}2ODElk&Nh3`HNxkf#D?#N zmO@{M|2*#pJ^TM0O8hANwC{&~4e`__U`TkK!q5Da@~=(%_2bF8ZszCN=$R4lt2o<7 zkl#jLn~V5=kN64vJsJKy7G#-Tuq@+{ELSY8W>7dR%QtI^(dLM JSONResponse: path.reverse() + # create 'virtual' pillar for states + stmt_states = select(State).join(TopFile, TopFile.state_id == State.id).where(TopFile.host_id == host.id) + states_list: list[str] = [ x[0].name for x in db.execute(stmt_states).fetchall() ] + + # create path name + hostgroup_name = '/'.join(x.name for x in path[:-1]) + print("[DEBUG] pillar_get: resolved host hierarchy with {} hosts: {}".format(len(path), [h.name for h in path])) out = merge([get_pillar_for_target(db, host.id) for host in path]) # type: ignore + out.update({ + "states": states_list, + "hostgroup": hostgroup_name + }) print("[DEBUG] pillar_get: merged pillar data contains {} top-level key(s)".format(len(out))) return JSONResponse(status_code=200, content=out)