-
Notifications
You must be signed in to change notification settings - Fork 1
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
Some more verbose/improved error logging for the bootstrap process. #49
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ import ( | |
"github.com/unity-sds/unity-management-console/backend/types" | ||
) | ||
|
||
func BootstrapEnv(appconf *config.AppConfig) { | ||
func BootstrapEnv(appconf *config.AppConfig) error { | ||
// Print out everything in appConfig | ||
log.Infof("AppConfig contents:") | ||
log.Infof("GithubToken: %s", appconf.GithubToken) | ||
|
@@ -36,94 +36,109 @@ func BootstrapEnv(appconf *config.AppConfig) { | |
for _, item := range appconf.MarketplaceItems { | ||
log.Infof(" - Name: %s, Version: %s", item.Name, item.Version) | ||
} | ||
|
||
log.Infof("Creating Local Database") | ||
store, err := database.NewGormDatastore() | ||
if err != nil { | ||
log.WithError(err).Error("Problem creating database") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Provisioning S3 Bucket") | ||
err = provisionS3(appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error provisioning S3 bucket") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Setting Up Default SSM Parameters") | ||
err = storeDefaultSSMParameters(appconf, store) | ||
if err != nil { | ||
log.WithError(err).Error("Error setting SSM Parameters") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Setting Up Terraform") | ||
err = initTerraform(store, appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error installing Terraform") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
//r := action.ActRunnerImpl{} | ||
//err = UpdateCoreConfig(appconf, store, nil, "") | ||
//if err != nil { | ||
// log.WithError(err).Error("Problem updating ssm config") | ||
//} | ||
|
||
log.Infof("Setting Up HTTPD Gateway from Marketplace") | ||
err = installGateway(store, appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error installing HTTPD Gateway") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Setting Up Health Status Lambda") | ||
err = installHealthStatusLambda(store, appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error installing Health Status") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Setting Up Basic API Gateway from Marketplace") | ||
err = installBasicAPIGateway(store, appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error installing API Gateway") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
log.Infof("Setting Up Unity UI from Marketplace") | ||
err = installUnityUi(store, appconf) | ||
if err != nil { | ||
log.WithError(err).Error("Error installing unity-ui") | ||
err = store.AddToAudit(application.Bootstrap_Unsuccessful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
} | ||
return | ||
return err | ||
} | ||
|
||
err = store.AddToAudit(application.Bootstrap_Successful, "test") | ||
if err != nil { | ||
log.WithError(err).Error("Problem writing to auditlog") | ||
return err | ||
} | ||
|
||
log.Infof("Bootstrap Process Completed Succesfully") | ||
return nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this return statement necessary? There wasn't a return here previously, and I just wasn't sure if this was a best practice, or it may change some behavior? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh never mind, I see why you are returning now |
||
} | ||
|
||
func provisionS3(appConfig *config.AppConfig) error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the err object be printed out, to see details of the error?