comtrya icon indicating copy to clipboard operation
comtrya copied to clipboard

add update flag to package.install

Open bketelsen opened this issue 4 years ago • 6 comments

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 avatar Mar 16 '21 10:03 bketelsen

@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?

rawkode avatar Mar 16 '21 11:03 rawkode

output here

bketelsen avatar Mar 16 '21 11:03 bketelsen

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

rawkode avatar Mar 16 '21 11:03 rawkode

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.

martintc avatar Aug 04 '22 01:08 martintc

Now that we have subcommands, I'm curious if comtrya packages update would be useful?

It could scan manifests, discover packages, and attempt updates?

rawkode avatar Dec 29 '23 21:12 rawkode