Skip to content

Commit fd4a940

Browse files
authored
Fix leo read error for delete (#713)
* debug * clean up debugging
1 parent f84401c commit fd4a940

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

cmd/leo/create/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,5 @@ func (o *Options) Run(cmd *cobra.Command, args []string, cloud *common.Cloud) er
133133
}
134134
return err
135135
}
136-
137136
return nil
138137
}

cmd/leo/delete/delete.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import (
1010
)
1111

1212
type Options struct {
13-
Workdir string
14-
Output string
13+
Workdir string
14+
Output string
15+
ExcludeList []string
1516
}
1617

1718
func New(cloud *common.Cloud) *cobra.Command {
@@ -38,6 +39,7 @@ func (o *Options) Run(cmd *cobra.Command, args []string, cloud *common.Cloud) er
3839
Environment: common.Environment{
3940
Directory: o.Workdir,
4041
DirectoryOut: o.Output,
42+
ExcludeList: o.ExcludeList,
4143
},
4244
}
4345

@@ -53,6 +55,5 @@ func (o *Options) Run(cmd *cobra.Command, args []string, cloud *common.Cloud) er
5355
if err != nil {
5456
return err
5557
}
56-
5758
return tsk.Delete(ctx)
5859
}

task/aws/resources/data_source_image.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ type Image struct {
3131
}
3232

3333
func (i *Image) Read(ctx context.Context) error {
34+
// default image to ubuntu in not present
35+
if i.Identifier == "" {
36+
i.Identifier = "ubuntu"
37+
}
3438
image := i.Identifier
3539
images := map[string]string{
3640
"ubuntu": "ubuntu@099720109477:x86_64:*ubuntu/images/hvm-ssd/ubuntu-focal-20.04*",

task/az/resources/resource_virtual_machine_scale_set.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ func (v *VirtualMachineScaleSet) Create(ctx context.Context) error {
8282
if err != nil {
8383
return fmt.Errorf("failed to render machine script: %w", err)
8484
}
85-
85+
// default image to ubuntu in not present
86+
if v.Attributes.Environment.Image == "" {
87+
v.Attributes.Environment.Image = "ubuntu"
88+
}
8689
image := v.Attributes.Environment.Image
8790
images := map[string]string{
8891
"ubuntu": "ubuntu@Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest",

task/common/steps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func RunSteps(ctx context.Context, steps []Step) error {
1818
for i, step := range steps {
1919
logrus.Infof("[%d/%d] %s", i+1, total, step.Description)
2020
if err := step.Action(ctx); err != nil {
21+
logrus.Debug("step: ", step.Description, " error: ", err)
2122
return err
2223
}
2324
}

task/gcp/resources/data_source_image.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ type Image struct {
2929
}
3030

3131
func (i *Image) Read(ctx context.Context) error {
32+
// default image to ubuntu in not present
33+
if i.Identifier == "" {
34+
i.Identifier = "ubuntu"
35+
}
3236
image := i.Identifier
3337
images := map[string]string{
3438
"ubuntu": "ubuntu@ubuntu-os-cloud/ubuntu-2004-lts",

0 commit comments

Comments
 (0)