Open vexx32 opened 12 months ago
Do you need to make sense of the results? World checking the exit code not be enough to know if it succeeded or not.
What information would be needed and how would it be useful?
For cache remove
that's probably enough, but if folks want to do something with the results for cache list
it'll be difficult if we can't expose the data in a way that you can do things with it from a playbook.
For example, if folks want to build in some logic that retries on a task failure if and only if there's cached data that might need to be removed or skipped before retrying, they'd probably need that information. Choco exposes the current cache locations and states in its output for choco cache list
, so ideally we'd be able to surface the same info here in a way folks can interact with programmatically.
That output from choco cache list
does look relatively static (i.e. the format is the same whether items are in the cache or not), so it should be possible to grab the relevant info out via regex and format it as a dictionary if we don't want to wait on --limit-output
support.
Equally, the changes to win_chocolatey
don't rely on the changes to win_chocolatey_facts
so those can be done while waiting on chocolatey/choco#3254
The format is not guaranteed to stay the way it is, so I wouldn't rely on regex'ing the info.
The majority of the work here can be done without having --limit-output
available. If that is something that should be kept, we should break that out into a separate issue and focus this one on providing cache commands.
Checklist
Is Your Feature Request Related To A Problem? Please describe.
Currently, there is no way to interact with the
choco cache
command that was introduced in Chocolatey CLI v2.1.0.Describe The Solution. Why is it needed?
win_chocolatey
--skip-http-cache
global optionskip_http_cache
(or maybeskip_cache
/ignore_cache
) optionchoco cache remove
commandpurge_cache
which defaults tonone
/ nil and lets the user selectall
orexpired
win_chocolatey_facts
choco cache list
command and returning the cache information as part of the facts returnedAdditional Context
The
choco cache list
command currently doesn't support--limit-output
, so we will have a hard time making a lot of sense of the output until that is addressed:Related Issues
No response