Skip to content

Commit d4c34f8

Browse files
authored
Add “this may happen several times” notice on Read (#523)
1 parent 6dcb6ae commit d4c34f8

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

task/aws/task.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ type Task struct {
9393
}
9494

9595
func (t *Task) Create(ctx context.Context) error {
96+
logrus.Info("Creating resources...")
9697
logrus.Info("[1/11] Importing DefaultVPC...")
9798
if err := t.DataSources.DefaultVPC.Read(ctx); err != nil {
9899
return err
@@ -147,6 +148,7 @@ func (t *Task) Create(ctx context.Context) error {
147148
}
148149

149150
func (t *Task) Read(ctx context.Context) error {
151+
logrus.Info("Reading resources... (this may happen several times)")
150152
logrus.Info("[1/9] Reading DefaultVPC...")
151153
if err := t.DataSources.DefaultVPC.Read(ctx); err != nil {
152154
return err
@@ -191,6 +193,7 @@ func (t *Task) Read(ctx context.Context) error {
191193
}
192194

193195
func (t *Task) Delete(ctx context.Context) error {
196+
logrus.Info("Deleting resources...")
194197
logrus.Info("[1/8] Downloading Directory...")
195198
if t.Read(ctx) == nil {
196199
if t.Attributes.Environment.DirectoryOut != "" {

task/az/task.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ type Task struct {
9494
}
9595

9696
func (t *Task) Create(ctx context.Context) error {
97+
logrus.Info("Creating resources...")
9798
logrus.Info("[1/10] Creating ResourceGroup...")
9899
if err := t.Resources.ResourceGroup.Create(ctx); err != nil {
99100
return err
@@ -144,6 +145,7 @@ func (t *Task) Create(ctx context.Context) error {
144145
}
145146

146147
func (t *Task) Read(ctx context.Context) error {
148+
logrus.Info("Reading resources... (this may happen several times)")
147149
logrus.Info("[1/8] Reading ResourceGroup...")
148150
if err := t.Resources.ResourceGroup.Read(ctx); err != nil {
149151
return err
@@ -184,6 +186,7 @@ func (t *Task) Read(ctx context.Context) error {
184186
}
185187

186188
func (t *Task) Delete(ctx context.Context) error {
189+
logrus.Info("Deleting resources...")
187190
logrus.Info("[1/9] Downloading Directory...")
188191
if t.Read(ctx) == nil {
189192
if t.Attributes.Environment.DirectoryOut != "" {

task/gcp/task.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ type Task struct {
141141
}
142142

143143
func (t *Task) Create(ctx context.Context) error {
144+
logrus.Info("Creating resources...")
144145
logrus.Info("[1/14] Creating DefaultNetwork...")
145146
if err := t.DataSources.DefaultNetwork.Read(ctx); err != nil {
146147
return err
@@ -207,6 +208,7 @@ func (t *Task) Create(ctx context.Context) error {
207208
}
208209

209210
func (t *Task) Read(ctx context.Context) error {
211+
logrus.Info("Reading resources... (this may happen several times)")
210212
logrus.Info("[1/12] Reading DefaultNetwork...")
211213
if err := t.DataSources.DefaultNetwork.Read(ctx); err != nil {
212214
return err
@@ -263,6 +265,7 @@ func (t *Task) Read(ctx context.Context) error {
263265
}
264266

265267
func (t *Task) Delete(ctx context.Context) error {
268+
logrus.Info("Deleting resources...")
266269
logrus.Info("[1/11] Downloading Directory...")
267270
if t.Read(ctx) == nil {
268271
if t.Attributes.Environment.DirectoryOut != "" {

task/k8s/task.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ type Task struct {
9696
}
9797

9898
func (t *Task) Create(ctx context.Context) error {
99+
logrus.Info("Creating resources...")
99100
logrus.Info("[1/7] Creating ConfigMap...")
100101
if err := t.Resources.ConfigMap.Create(ctx); err != nil {
101102
return err
@@ -141,6 +142,7 @@ func (t *Task) Create(ctx context.Context) error {
141142
}
142143

143144
func (t *Task) Read(ctx context.Context) error {
145+
logrus.Info("Reading resources... (this may happen several times)")
144146
logrus.Info("[1/3] Reading ConfigMap...")
145147
if err := t.Resources.ConfigMap.Read(ctx); err != nil {
146148
return err
@@ -161,6 +163,7 @@ func (t *Task) Read(ctx context.Context) error {
161163
}
162164

163165
func (t *Task) Delete(ctx context.Context) error {
166+
logrus.Info("Deleting resources...")
164167
if t.Attributes.DirectoryOut != "" && t.Read(ctx) == nil {
165168
os.Setenv("TPI_TRANSFER_MODE", "true")
166169
os.Setenv("TPI_PULL_MODE", "true")

0 commit comments

Comments
 (0)