Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
Make more readable the processing error messages (issue #90)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Cantera authored and pbanos committed Mar 20, 2019
1 parent b8f8aaa commit b51bed7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bootstrapping/bootstrapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func applyPolicyfiles(bootstrappingSvc *blueprint.BootstrappingService, formatte
}
dir, err := generateWorkspaceDir()
if err != nil {
formatter.PrintError("couldn't generated workspace directory", err)
return err
}
bsProcess := &bootstrappingProcess{
Expand All @@ -216,25 +217,25 @@ func applyPolicyfiles(bootstrappingSvc *blueprint.BootstrappingService, formatte
// proto structures
err = initializePrototype(bsConfiguration, bsProcess)
if err != nil {
log.Debug(err)
formatter.PrintError("couldn't initialize prototype", err)
return err
}
// For every policyfile, ensure its tarball (downloadable through their download_url) has been downloaded to the server ...
err = downloadPolicyfiles(bootstrappingSvc, bsProcess)
if err != nil {
log.Debug(err)
formatter.PrintError("couldn't download policy files", err)
return err
}
//... and clean off any tarball that is no longer needed.
err = cleanObsoletePolicyfiles(bsProcess)
if err != nil {
log.Debug(err)
formatter.PrintError("couldn't clean obsolete policy files", err)
return err
}
// Store the attributes as JSON in a file with name `attrs-<attribute_revision_id>.json`
err = saveAttributes(bsProcess)
if err != nil {
log.Debug(err)
formatter.PrintError("couldn't save attributes for policy files", err)
return err
}
// Process tarballs policies
Expand All @@ -246,10 +247,11 @@ func applyPolicyfiles(bootstrappingSvc *blueprint.BootstrappingService, formatte
log.Debug("reporting applied policy files")
reportErr := reportAppliedConfiguration(bootstrappingSvc, bsProcess)
if reportErr != nil {
log.Debug(err)
formatter.PrintError("couldn't report applied status for policy files", err)
return err
}
if err != nil {
formatter.PrintError("couldn't process policy files", err)
return err
}
return completeBootstrappingSequence(bsProcess)
Expand Down

0 comments on commit b51bed7

Please sign in to comment.