add update flag to package.install
given this action:
actions:
- action: package.install
name: git
running the module will install git as expected the first time. with a brew provider it will fail if git has a version bump on a subsequent apply.
ERROR manifest_run{manifest="git"}:package.install{provider="Homebrew"}: Error: git 2.30.2 is already installed
To upgrade to 2.31.0, run:
brew upgrade git
ERROR manifest_run{manifest="git"}: Failed to install git
ERROR manifest_run{manifest="git"}: Failed
comtrya should handle this gracefully in the default case, because git is installed.
it would be useful to have a flag or an alternative action to either install or update the package. if the package is installed and latest, no actions are taken. If the package is installed and outdated, the package is updated. if the package isn't installed, the package is installed.
options:
actions:
- action: package.latest
name: git
or
actions:
- action: package.install
update: true
name: git
@bketelsen Hmm. That's odd! The Homebrew provider checks in your paths for the Homebrew installation. When I -vv this, I see:
TRACE manifest_run{manifest="git"}:package.install{provider="Homebrew"}: git: found in Cellar
I'm curious why this isn't the case for you.
Can you run your Git module in isoloation with -m and show me the -vv output, please?
output here
OK. I'll keep this issue open for the update / latest request.
The Git problem was fixed by using the host machines brew --prefix. Closed by #28
Wouldn't be better to provide a generic action to run updates? It can trigger an update on homebrew, and the update/upgrade routine for other package managers. This seems like a bit too dependent on the specific behavior of homebrew. Apt, DNF, and many of the other package managers don't have this kind of behavior.
Now that we have subcommands, I'm curious if comtrya packages update would be useful?
It could scan manifests, discover packages, and attempt updates?