Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boxstarter should report how many packages failed to install #401

Open
mwallner opened this issue Jul 22, 2019 · 7 comments
Open

Boxstarter should report how many packages failed to install #401

mwallner opened this issue Jul 22, 2019 · 7 comments
Assignees
Labels
1 - Ready Issue is accepted, milestone added and are ready to be worked on Bug Issues where something has happened which was not expected or intended Customer Bug reported or feature requested by a licensed customer of Chocolatey
Milestone

Comments

@mwallner
Copy link
Member

What You Are Seeing?

Invoke-ChocolateyBoxstarter doesn't provide any information if something failed along the way.

What is Expected?

(in case of 'no-reboots-required') either $lastexitcode or a try{ .. } catch { ...} should be sufficient to check if something went wrong.

How Did You Get This To Happen? (Steps to Reproduce)

using Boxstarter.bat

C:\myboxstarter\Boxstarter.bat pkg_does_not_exist
echo %errorlevel%

I'd suggest something like

if($chocoErrors -gt 0){
    $lastexitcode = $chocoErrors
    throw "got $chocoErrors Chocolatey errors"
}

here, right after the foreach($packageName in $packageNames){ ... }

@mwallner mwallner added Bug Issues where something has happened which was not expected or intended Discussion 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue Customer Bug reported or feature requested by a licensed customer of Chocolatey labels Jul 22, 2019
@mwallner mwallner added this to the v2.13.0 milestone Jul 22, 2019
@pauby
Copy link
Member

pauby commented Jul 22, 2019

If you used the throw statement it would stop the rest of Boxstarter. What we need to decide is if not being able to install packages is something that is a critical error or not. It may also come into the realms of #296 ?

What might be nice is if we have somewhere we can log issues / warnings / errors that the end user should know about and then, when everything is done, display them to the user? Something like a Add-BoxstarterIssue and then a Write-BoxstarterIssue (I'm just thinking out loud just now).

@mwallner
Copy link
Member Author

I was also thinking about #296, in contrast to the (initial) suggested change there, this would actually try to install all packages, before setting $lastexitcode to the number of failed choco installs.

@pauby
Copy link
Member

pauby commented Jul 22, 2019

Rather then the number of failed installs (does it matter how many?) you could just exit 1 or 0?

I'm not against the idea. I think that:

  1. Maybe we should turn it into a copy larger feature (such as recording the errors like I suggested above);

  2. Would be interested in seeing the detail on how it's done;

@pauby pauby changed the title cannot tell if Boxstarter failed to install 1 or more packages Boxstarter should report how many packages failed to install Jul 22, 2019
@mwallner mwallner self-assigned this Jul 22, 2019
@mwallner
Copy link
Member Author

I actually don't care how many installs failed, the thing is that, with a current version of Boxstarter, it is hard to get some useful return/exit code that tells you if something went wrong or not.

I do like your suggestion with the Add-BoxstarterIssue, followed by a final Get-BoxstarterIssues | % { Write-BoxstarterIssue $_ }, but also would need to put something like

if ((Get-BoxstarterIssues).Count -gt 0) { 
  exit 1 
}

somewhere at the end of the default Boxstarter procedure.

(it should not matter, if you call Invoke-ChocolateyBoxstarter pkg1,pkg2 or Boxstarter.bat pkg1,pkg2)

@mwallner
Copy link
Member Author

Just revisited this.
Note: when this is being implemented, take sure to note this:

If you used the throw statement it would stop the rest of Boxstarter.

meaning: reporting of the install error and setting of the return code must happen last, after Boxstarter cleanup-phase (UAC, Win-Update Settings etc. need to be restored!!)

@mwallner mwallner removed this from the v2.13.0 milestone Jan 29, 2020
@mwallner mwallner added 2 - Working A user or team member has started working on the issue Hacktoberfest and removed Up For Grabs labels Oct 13, 2020
@pauby
Copy link
Member

pauby commented Oct 19, 2020

@mwallner is this not fixed with PR #296 / #402 ?

@pauby pauby removed Hacktoberfest 0 - _Triaging Issue is accepted, but a milestone has yet to be added for the issue labels Oct 19, 2020
@mwallner
Copy link
Member Author

Short answer: no, this issue is something different as we're aiming to provide some feedback on which packages were installed successfully and which failed - after the Boxstarter procedure finished. (without the early-stopping bits)

@pauby pauby added 1 - Ready Issue is accepted, milestone added and are ready to be worked on and removed 2 - Working A user or team member has started working on the issue labels Oct 19, 2020
@mwallner mwallner added this to the 3.0.1 milestone Apr 12, 2022
@pauby pauby removed the Discussion label May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Ready Issue is accepted, milestone added and are ready to be worked on Bug Issues where something has happened which was not expected or intended Customer Bug reported or feature requested by a licensed customer of Chocolatey
Projects
None yet
Development

No branches or pull requests

2 participants