diff --git a/end-to-end/main_test.go b/end-to-end/main_test.go index ab9c5ada8..d21995b81 100644 --- a/end-to-end/main_test.go +++ b/end-to-end/main_test.go @@ -234,6 +234,7 @@ var filesToCleanUp = []struct { }{ {prefixEnv: "LocalAppData", path: "Ubuntu Pro"}, {prefixEnv: "UserProfile", path: ".ubuntupro"}, + {prefixEnv: "UserProfile", path: ".ubuntupro.log"}, } // assertCleanFilesystem returns error if directory '%LocalAppData%/Ubuntu Pro' exists. diff --git a/end-to-end/utils_test.go b/end-to-end/utils_test.go index 348cc03d2..365c242e6 100644 --- a/end-to-end/utils_test.go +++ b/end-to-end/utils_test.go @@ -15,7 +15,6 @@ import ( "testing" "time" - "github.com/canonical/ubuntu-pro-for-windows/common" "github.com/canonical/ubuntu-pro-for-windows/common/wsltestutils" "github.com/stretchr/testify/require" "github.com/ubuntu/gowsl" @@ -202,13 +201,13 @@ func logWindowsAgentJournal(t *testing.T, skipOnSuccess bool) { return } - localAppData := os.Getenv("LocalAppData") - if localAppData == "" { - t.Log("could not access Windows Agent's logs: $env:LocalAppData is not assigned") + home := os.Getenv("UserProfile") + if home == "" { + t.Log("could not access Windows Agent's logs: $env:UserProfile is not assigned") return } - out, err := os.ReadFile(filepath.Join(localAppData, common.LocalAppDataDir, "log")) + out, err := os.ReadFile(filepath.Join(home, ".ubuntupro.log")) if err != nil { t.Logf("could not read Windows Agent's logs: %v", err) return diff --git a/windows-agent/cmd/ubuntu-pro-agent/main.go b/windows-agent/cmd/ubuntu-pro-agent/main.go index 47d86048b..5037c6dd5 100644 --- a/windows-agent/cmd/ubuntu-pro-agent/main.go +++ b/windows-agent/cmd/ubuntu-pro-agent/main.go @@ -65,12 +65,12 @@ func run(a app) int { } func setLoggerOutput() (func(), error) { - lad := os.Getenv("LocalAppData") - if lad == "" { - return nil, errors.New("could not find LocalAppData") + home := os.Getenv("UserProfile") + if home == "" { + return nil, errors.New("environment variable %UserProfile% is empty") } - p := filepath.Join(lad, common.LocalAppDataDir, "log") + p := filepath.Join(home, ".ubuntupro.log") f, err := os.OpenFile(p, os.O_APPEND|os.O_CREATE, 0600) if err != nil {