Skip to content

Commit

Permalink
WIP: Can get the last container log and print the state of a docker i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
ToreMerkely committed Sep 25, 2023
1 parent fa45045 commit cbdd23f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/kosli/snapshotAzureFunctions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"fmt"
"io"

"github.com/kosli-dev/cli/internal/azure"
Expand Down Expand Up @@ -59,6 +60,7 @@ func (o *snapshotAzureFunctionsOptions) run(args []string) error {
return err
}
for _, webapp := range webAppInfo {
fmt.Println("webapp: ", *webapp.Properties.SiteConfig.LinuxFxVersion, " State: ", *webapp.Properties.State)
err := o.azureCredentials.GetDockerLogs(*webapp.Name)
if err != nil {
return err
Expand Down
14 changes: 12 additions & 2 deletions internal/azure/azure_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func (staticCreds *AzureStaticCredentials) GetDockerLogs(appServiceName string)

ctx := context.Background()
fmt.Println("Getting logs for app service: ", appServiceName)
response, err := webAppsClient.GetContainerLogsZip(ctx, staticCreds.ResourceGroupName, appServiceName, nil)
// response, err := webAppsClient.GetContainerLogsZip(ctx, staticCreds.ResourceGroupName, appServiceName, nil)
response, err := webAppsClient.GetWebSiteContainerLogs(ctx, staticCreds.ResourceGroupName, appServiceName, nil)
if err != nil {
return err
}
Expand All @@ -72,7 +73,16 @@ func (staticCreds *AzureStaticCredentials) GetDockerLogs(appServiceName string)
if err != nil {
return err
}
fmt.Println(len(body))
fmt.Println(string(body))

// out, err := os.Create("somelogs.zip")
// if err != nil {
// return err
// }
// defer out.Close()
// io.Copy(out, response.Body)

// fmt.Println(len(body))
// fmt.Println(string(body))
return nil
}

0 comments on commit cbdd23f

Please sign in to comment.