purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.67k stars 315 forks source link

engine: resources: exec: AutoEdge to User/Group/File #660

Closed frebib closed 3 years ago

frebib commented 3 years ago

Fixes https://github.com/purpleidea/mgmt/issues/221

Signed-off-by: Joe Groocock me@frebib.net

This supersedes #270 and #536

=== RUN   TestExecAutoEdge1
    exec_test.go:308: test: adding autoedges...
    exec_test.go:308: test: no auto edges were found for: group[somegroup]
    exec_test.go:308: test: autoedge: UIDS:
    exec_test.go:308: test: autoedge: UID0: exec[true]
    exec_test.go:308: test: autoedge: Match: file[/somefile] with UID: exec[true]
    exec_test.go:308: test: autoedge: Match: user[someuser] with UID: exec[true]
    exec_test.go:308: test: autoedge: Match: group[somegroup] with UID: exec[true]
    exec_test.go:308: test: autoedge: UIDS:
    exec_test.go:308: test: autoedge: UID0: exec[true]
    exec_test.go:308: test: autoedge: Match: user[someuser] with UID: exec[true]
    exec_test.go:308: test: autoedge: Match: group[somegroup] with UID: exec[true]
    exec_test.go:308: test: autoedge: Match: file[/somefile] with UID: exec[true]
    exec_test.go:308: test: autoedge: adding: file[/somefile] -> exec[true] (autoedge)
    exec_test.go:308: test: autoedge: UIDS:
    exec_test.go:308: test: autoedge: UID0: exec[true]
    exec_test.go:308: test: autoedge: Match: user[someuser] with UID: exec[true]
    exec_test.go:308: test: autoedge: adding: user[someuser] -> exec[true] (autoedge)
    exec_test.go:308: test: autoedge: UIDS:
    exec_test.go:308: test: autoedge: UID0: exec[true]
    exec_test.go:308: test: autoedge: Match: group[somegroup] with UID: exec[true]
    exec_test.go:308: test: autoedge: adding: group[somegroup] -> exec[true] (autoedge)
    exec_test.go:308: test: autoedge: UIDS:
    exec_test.go:308: test: autoedge: UID0: file[/somefile]
    exec_test.go:308: test: autoedge: Match: exec[true] with UID: file[/somefile]
    exec_test.go:308: test: autoedge: Match: user[someuser] with UID: file[/somefile]
    exec_test.go:308: test: autoedge: Match: group[somegroup] with UID: file[/somefile]
    exec_test.go:308: test: the auto edge list is empty for: user[someuser]
--- PASS: TestExecAutoEdge1 (0.00s)
PASS
ok      github.com/purpleidea/mgmt/engine/resources 1.582s
purpleidea commented 3 years ago

FYI: I merged the first patch because I kept getting annoyed at failing tests and I wanted to push some tests tonight... So anything else you want to change, it's a delta on top of this now. Cheers

purpleidea commented 3 years ago

Rebased and merged! \o/ Thanks for the lovely tests!