-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: coredump command for different runtimes (#24)
* feat(kubernetes): split ContainerInfo type to separate types Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * feat(dumper): add draft for coredump working implementation for different runtime Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * feat(flags): extract custom type for dotnet frameworks location Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * chore(dumper): extract method with fs actions Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * fix(dumper): add more logging & fix execution Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * chore(*): inline scripts Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * docs(*): update readme Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com> * chore(*): add default values for makefile Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com>
- Loading branch information
1 parent
fd12c59
commit 67b8e64
Showing
11 changed files
with
239 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package flags | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
const ( | ||
DotnetFrameworkApp = "Microsoft.NETCore.App" | ||
) | ||
|
||
type DotnetToolResolver struct { | ||
Root string | ||
Path string | ||
} | ||
|
||
type DotnetFramework struct { | ||
Root string | ||
Name string | ||
Version string | ||
} | ||
|
||
func NewDotnetToolResolver(root string) *DotnetToolResolver { | ||
return &DotnetToolResolver{ | ||
Root: root, | ||
Path: "/usr/share/dotnet/shared", | ||
} | ||
} | ||
|
||
func (r *DotnetToolResolver) LocateFrameworks() ([]DotnetFramework, error) { | ||
entries, err := os.ReadDir(r.FullPath()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var frameworks []DotnetFramework | ||
for _, entry := range entries { | ||
framework := entry.Name() | ||
frameworkPath := filepath.Join(r.FullPath(), framework) | ||
|
||
entries, err := os.ReadDir(frameworkPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, entry := range entries { | ||
frameworks = append(frameworks, | ||
DotnetFramework{ | ||
Name: framework, | ||
Root: r.FullPath(), | ||
Version: entry.Name(), | ||
}, | ||
) | ||
} | ||
} | ||
|
||
return frameworks, nil | ||
} | ||
|
||
func (r *DotnetToolResolver) FullPath() string { | ||
return filepath.Join(r.Root, r.Path) | ||
} | ||
|
||
func (f *DotnetFramework) FullPath() string { | ||
return filepath.Join(f.Root, f.Name, f.Version) | ||
} | ||
|
||
func (f *DotnetFramework) NameVersion() string { | ||
return filepath.Join(f.Name, f.Version) | ||
} |
Oops, something went wrong.