Skip to content

Commit

Permalink
Merge pull request #94 from Cloud-Code-AI/93-bug-report-storage-path-…
Browse files Browse the repository at this point in the history
…is-relative-but-not-properly-calculated

fix: Update the path check
  • Loading branch information
sauravpanda authored Feb 1, 2024
2 parents 5c3f357 + 238c5b8 commit 2c83f90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ go build cmd/main.go

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

Expand Down
7 changes: 4 additions & 3 deletions services/awshandler/generatereport.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ func GenerateAWSReport(outFolder string) {
if len(pathParts) < 4 {
return fmt.Errorf("unexpected path format: %s", path)
}
serviceName := pathParts[3]
regionName := pathParts[2]
path_len := len(pathParts)
serviceName := pathParts[path_len-2]
regionName := pathParts[path_len-3]

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

err = utils.WriteJSONToFile("output/aws_report.json", regionStats)
err = utils.WriteJSONToFile(outFolder+"/aws_report.json", regionStats)
if err != nil {
fmt.Println("Failed to Write the report file to json")
fmt.Println(err)
Expand Down

0 comments on commit 2c83f90

Please sign in to comment.