Skip to content

Commit

Permalink
chore(dumper): add more logging
Browse files Browse the repository at this point in the history
Signed-off-by: ArtemTrofimushkin <artemtrofimushkin@gmail.com>
  • Loading branch information
ArtemTrofimushkin committed Mar 26, 2022
1 parent f1f91d7 commit 7137e4a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dumper/cmd/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
)

func (cb *CommandBuilder) prepareFS(container *kubernetes.ContainerConfigInfo) error {
events.NewStatusEvent("Looking for and mapping container /tmp")

// remove /tmp directory,
// because it will be mounted from container /tmp directory
if err := os.RemoveAll(globals.PathTmpFolder); err != nil {
Expand All @@ -34,24 +36,29 @@ func (cb *CommandBuilder) prepareFS(container *kubernetes.ContainerConfigInfo) e
}

// for privileged commands link framework runtime libs to root
events.NewStatusEvent("Looking for and mapping container runtime libs")
resolver := flags.NewDotnetToolResolver(container.RootFS)
frameworks, err := resolver.LocateFrameworks()
if err != nil {
return err
}

for _, framework := range frameworks {
events.NewStatusEvent(fmt.Sprintf("found: %s-%s", framework.Name, framework.Version))

if framework.Name != flags.DotnetFrameworkApp {
continue
}

source := framework.FullPath()
destination := filepath.Join(resolver.Path, framework.NameVersion())

events.NewStatusEvent(fmt.Sprintf("trying to map from: %s to: %s", source, destination))
if utils.FileExists(destination) {
continue
}

events.NewStatusEvent(fmt.Sprintf("map from: %s, to: %s", source, destination))
if err := os.Symlink(source, destination); err != nil {
return err
}
Expand All @@ -61,8 +68,6 @@ func (cb *CommandBuilder) prepareFS(container *kubernetes.ContainerConfigInfo) e
}

func (cb *CommandBuilder) launch() error {
events.NewStatusEvent("Looking for and mapping container fs")

container, err := kubernetes.NewContainerConfigInfo(cb.CommonOptions.ContainerRuntime, cb.CommonOptions.ContainerID)
if err != nil {
events.NewErrorEvent(err, "unable to locate container configuration")
Expand Down

0 comments on commit 7137e4a

Please sign in to comment.