| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package agents | ||
|
|
||
| import ( | ||
| "log/slog" | ||
| "path" | ||
| "path/filepath" | ||
|
|
||
| "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/utils" | ||
| ) | ||
|
|
||
| const ( | ||
| ExtensionsDir = "/opt/extensions" | ||
| ) | ||
|
|
||
| func ListExternalAgentPaths(fileutils utils.FileUtil, dir string, root string) []string { | ||
| var agentPaths []string | ||
| if !isCanonical(dir) || !isCanonical(root) { | ||
| slog.Warn("Agents base paths are not absolute and in canonical form", "dir", dir, "root", root) | ||
| return agentPaths | ||
| } | ||
| fullDir := path.Join(root, dir) | ||
| files, err := fileutils.ReadDirectory(fullDir) | ||
| if err != nil { | ||
| if fileutils.IsNotExist(err) { | ||
| slog.Info("The extension's directory does not exist, assuming no extensions to be loaded", "fullDir", fullDir) | ||
| } else { | ||
|
|
||
| slog.Error("Cannot list external agents", "err", err) | ||
| } | ||
|
|
||
| return agentPaths | ||
| } | ||
|
|
||
| for _, file := range files { | ||
| if !file.IsDir() { | ||
|
|
||
| p := path.Join("/", dir, file.Name()) | ||
| agentPaths = append(agentPaths, p) | ||
| } | ||
| } | ||
| return agentPaths | ||
| } | ||
|
|
||
| func isCanonical(path string) bool { | ||
| absPath, err := filepath.Abs(path) | ||
| return err == nil && absPath == path | ||
| } |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityGood catch 👍
So we basically need to change the imports to our fork instead of using upstream via go.amzn.com. I guess these imports might be a frequent area of conflict, so it's worth documenting the rationale in our LocalStack readme.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.