Skip to content

Commit 4401310

Browse files
authored
Merge pull request #3496 from zeborg/nil-ami
Updated `clusterawsadm ami list` nil AMI output
2 parents 86cfb51 + e8039b2 commit 4401310

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/clusterawsadm/ami/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func getAllImages(ec2Client ec2iface.EC2API, ownerID string) (map[string][]*ec2.
210210
return nil, errors.Wrap(err, "failed to fetch AMIs")
211211
}
212212
if len(out.Images) == 0 {
213-
return nil, errors.Errorf("no AMIs in the account: %q", ownerID)
213+
return nil, nil
214214
}
215215

216216
imagesMap := make(map[string][]*ec2.Image)

cmd/clusterawsadm/cmd/ami/list/list.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ func ListAMICmd() *cobra.Command {
7373
if err != nil {
7474
return err
7575
}
76+
if len(listByVersion.Items) == 0 {
77+
fmt.Println("No AMIs found")
78+
return nil
79+
}
7680

7781
if outputPrinter == string(cmdout.PrinterTypeTable) {
7882
table := listByVersion.ToTable()
@@ -94,7 +98,7 @@ func ListAMICmd() *cobra.Command {
9498
}
9599

96100
func addOsFlag(c *cobra.Command) {
97-
c.Flags().StringVar(&opSystem, "os", "", "Operating system of the AMI to be copied")
101+
c.Flags().StringVar(&opSystem, "os", "", "Operating system of the AMI to be listed")
98102
}
99103

100104
func addKubernetesVersionFlag(c *cobra.Command) {

0 commit comments

Comments
 (0)