purpleidea / mgmt

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

Create resource for tar archiving #677

Open mattesko opened 2 years ago

mattesko commented 2 years ago

This is a work-in-progress

Notes

  1. Create a tar resource so that files and directories can be archived
  2. Features a compression parameter to choose whether to compress the resulting archive with gzip
  3. Create an mcl example for the tar resource
mattesko commented 2 years ago

I'm still implementing this. I'm trying to fix a bug where Watch keeps notifying mgmt about a state change, and CheckApply runs in an infinite loop:

...
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true): Return(true, <nil>)
13:54:45 engine: tar[/tmp/mytar.tar]: resource: Event(/tmp/mytar.tar): WRITE
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true)
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true): Return(true, <nil>)
13:54:45 engine: tar[/tmp/mytar.tar]: resource: Event(/tmp/mytar.tar): WRITE
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true)
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true): Return(true, <nil>)
13:54:45 engine: tar[/tmp/mytar.tar]: resource: Event(/tmp/mytar.tar): WRITE
13:54:45 engine: tar[/tmp/mytar.tar]: resource: Event(/tmp/mytar.tar): WRITE
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true)
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true): Return(true, <nil>)
13:54:45 engine: tar[/tmp/mytar.tar]: resource: Event(/tmp/mytar.tar): WRITE
13:54:45 engine: tar[/tmp/mytar.tar]: CheckApply(true)
...

I'm not sure if it's because CheckApply isn't implemented properly, and keeps writing to my resource, or if my Watch method isn't implemented properly. Can go over this on a call. Fixed.