Skip to content

Commit 238c5b8

Browse files
committed
fix: Update the path check
1 parent 5c3f357 commit 238c5b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ go build cmd/main.go
3131

3232
To Gather all resources
3333
```
34-
./main gather -provider=aws -region=us-east-1 --resource=vm
34+
./main gather -provider=aws -region=us-east-1
3535
```
3636
This will store all the meta data for AWS resource in `output/` directory
3737

services/awshandler/generatereport.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ func GenerateAWSReport(outFolder string) {
3434
if len(pathParts) < 4 {
3535
return fmt.Errorf("unexpected path format: %s", path)
3636
}
37-
serviceName := pathParts[3]
38-
regionName := pathParts[2]
37+
path_len := len(pathParts)
38+
serviceName := pathParts[path_len-2]
39+
regionName := pathParts[path_len-3]
3940

4041
// Print the entire data for debugging
4142
fmt.Printf("Service name %v, data is %v, \n", serviceName, data["stats"])
@@ -63,7 +64,7 @@ func GenerateAWSReport(outFolder string) {
6364
// Print and write the report
6465
utils.PrintNested(regionStats, "", 0)
6566

66-
err = utils.WriteJSONToFile("output/aws_report.json", regionStats)
67+
err = utils.WriteJSONToFile(outFolder+"/aws_report.json", regionStats)
6768
if err != nil {
6869
fmt.Println("Failed to Write the report file to json")
6970
fmt.Println(err)

0 commit comments

Comments
 (0)