@@ -17,7 +17,7 @@ import (
1717 "github.com/unity-sds/unity-management-console/backend/types"
1818)
1919
20- func BootstrapEnv (appconf * config.AppConfig ) {
20+ func BootstrapEnv (appconf * config.AppConfig ) error {
2121 // Print out everything in appConfig
2222 log .Infof ("AppConfig contents:" )
2323 log .Infof ("GithubToken: %s" , appconf .GithubToken )
@@ -36,94 +36,109 @@ func BootstrapEnv(appconf *config.AppConfig) {
3636 for _ , item := range appconf .MarketplaceItems {
3737 log .Infof (" - Name: %s, Version: %s" , item .Name , item .Version )
3838 }
39+
40+ log .Infof ("Creating Local Database" )
3941 store , err := database .NewGormDatastore ()
4042 if err != nil {
4143 log .WithError (err ).Error ("Problem creating database" )
4244 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
4345 if err != nil {
4446 log .WithError (err ).Error ("Problem writing to auditlog" )
4547 }
46- return
48+ return err
4749 }
4850
51+ log .Infof ("Provisioning S3 Bucket" )
4952 err = provisionS3 (appconf )
5053 if err != nil {
5154 log .WithError (err ).Error ("Error provisioning S3 bucket" )
5255 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
5356 if err != nil {
5457 log .WithError (err ).Error ("Problem writing to auditlog" )
5558 }
56- return
59+ return err
5760 }
61+
62+ log .Infof ("Setting Up Default SSM Parameters" )
5863 err = storeDefaultSSMParameters (appconf , store )
5964 if err != nil {
6065 log .WithError (err ).Error ("Error setting SSM Parameters" )
6166 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
6267 if err != nil {
6368 log .WithError (err ).Error ("Problem writing to auditlog" )
6469 }
65- return
70+ return err
6671 }
72+
73+ log .Infof ("Setting Up Terraform" )
6774 err = initTerraform (store , appconf )
6875 if err != nil {
6976 log .WithError (err ).Error ("Error installing Terraform" )
7077 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
7178 if err != nil {
7279 log .WithError (err ).Error ("Problem writing to auditlog" )
7380 }
74- return
81+ return err
7582 }
7683
7784 //r := action.ActRunnerImpl{}
7885 //err = UpdateCoreConfig(appconf, store, nil, "")
7986 //if err != nil {
8087 // log.WithError(err).Error("Problem updating ssm config")
8188 //}
89+
90+ log .Infof ("Setting Up HTTPD Gateway from Marketplace" )
8291 err = installGateway (store , appconf )
8392 if err != nil {
8493 log .WithError (err ).Error ("Error installing HTTPD Gateway" )
8594 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
8695 if err != nil {
8796 log .WithError (err ).Error ("Problem writing to auditlog" )
8897 }
89- return
98+ return err
9099 }
91100
101+ log .Infof ("Setting Up Health Status Lambda" )
92102 err = installHealthStatusLambda (store , appconf )
93103 if err != nil {
94104 log .WithError (err ).Error ("Error installing Health Status" )
95105 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
96106 if err != nil {
97107 log .WithError (err ).Error ("Problem writing to auditlog" )
98108 }
99- return
109+ return err
100110 }
101111
112+ log .Infof ("Setting Up Basic API Gateway from Marketplace" )
102113 err = installBasicAPIGateway (store , appconf )
103114 if err != nil {
104115 log .WithError (err ).Error ("Error installing API Gateway" )
105116 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
106117 if err != nil {
107118 log .WithError (err ).Error ("Problem writing to auditlog" )
108119 }
109- return
120+ return err
110121 }
111122
123+ log .Infof ("Setting Up Unity UI from Marketplace" )
112124 err = installUnityUi (store , appconf )
113125 if err != nil {
114126 log .WithError (err ).Error ("Error installing unity-ui" )
115127 err = store .AddToAudit (application .Bootstrap_Unsuccessful , "test" )
116128 if err != nil {
117129 log .WithError (err ).Error ("Problem writing to auditlog" )
118130 }
119- return
131+ return err
120132 }
121133
122134 err = store .AddToAudit (application .Bootstrap_Successful , "test" )
123135 if err != nil {
124136 log .WithError (err ).Error ("Problem writing to auditlog" )
137+ return err
125138 }
126139
140+ log .Infof ("Bootstrap Process Completed Succesfully" )
141+ return nil
127142}
128143
129144func provisionS3 (appConfig * config.AppConfig ) error {
0 commit comments