automate and improve change-tracking in deployers#869
Conversation
d252967 to
19249b8
Compare
7831333 to
c891c27
Compare
19249b8 to
821ae5b
Compare
c891c27 to
2e69a25
Compare
3f05a9a to
cf7e9fd
Compare
92a52b9 to
e21f2a0
Compare
2e69a25 to
36e8133
Compare
36e8133 to
4302126
Compare
fc8c8e3 to
486fb47
Compare
486fb47 to
d911e85
Compare
d911e85 to
dac6526
Compare
dac6526 to
72871d7
Compare
2fae992 to
dfa0315
Compare
1008981 to
76f00da
Compare
j4n
left a comment
There was a problem hiding this comment.
Looks good to me, a few minor suggestions.
Tested deploying, re-deploying, and redeploy with modified system units, all good.
It makes me wish to have a pyinfra_helpers.py we could use in other repos as well, with just the wrapper functions :)
| return self.put_template(src, dest, **kwargs) | ||
| return self.put_file(src, dest) | ||
|
|
||
| def put_file(self, src, dest, mode="644"): |
There was a problem hiding this comment.
| def put_file(self, src, dest, mode="644"): | |
| def put_file(self, src, dest, mode="644", reason=None): |
I think it would be valuable to preserve the ability to explain changes for put_file, put_template, remove_file, and embed it in braces into the name parameter.
| return self.put_template(src, dest, **kwargs) | ||
| return self.put_file(src, dest) | ||
|
|
||
| def put_file(self, src, dest, mode="644"): |
There was a problem hiding this comment.
also, this takes mode as an argument, but template doesnt, but takes owner - maybe this should be symmetrical to be less confusing.
There was a problem hiding this comment.
The new API is meant to only consists of things that map the previous usage, nothing more. If some other argument is needed, it is easy enough to add when it is actually needed.
| dest = f"/etc/systemd/system/{dest_name}" | ||
| if src.endswith(".j2"): | ||
| return self.put_template(src, dest, **kwargs) | ||
| return self.put_file(src, dest) |
There was a problem hiding this comment.
maybe we should pass kwargs to the non-template-case, to honor dest_name for example.
76f00da to
a1d5e3d
Compare
|
a more general API or |
Automate change tracking for added/remove files and systemd services. This removes a lot of boilerplate from the deployers and makes them more readable and less error-prone.